//! [6]
AnalogClockWindow::AnalogClockWindow()
{
- setWindowTitle("Analog Clock");
+ setTitle("Analog Clock");
resize(200, 200);
m_timerId = startTimer(1000);
: m_colorIndex(0), m_renderer(renderer), m_timer(0)
{
setSurfaceType(QWindow::OpenGLSurface);
- setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
setGeometry(QRect(10, 10, 640, 480));
HelloWindow *windowA = new HelloWindow(rendererA);
windowA->setGeometry(QRect(center, windowSize).translated(-windowSize.width() - delta / 2, 0));
- windowA->setWindowTitle(QLatin1String("Thread A - Context A"));
+ windowA->setTitle(QLatin1String("Thread A - Context A"));
windowA->setVisible(true);
windows.prepend(windowA);
HelloWindow *windowB = new HelloWindow(rendererA);
windowB->setGeometry(QRect(center, windowSize).translated(delta / 2, 0));
- windowB->setWindowTitle(QLatin1String("Thread A - Context A"));
+ windowB->setTitle(QLatin1String("Thread A - Context A"));
windowB->setVisible(true);
windows.prepend(windowB);
HelloWindow *windowC = new HelloWindow(rendererB);
windowC->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, windowSize.height() + delta));
- windowC->setWindowTitle(QLatin1String("Thread B - Context B"));
+ windowC->setTitle(QLatin1String("Thread B - Context B"));
windowC->setVisible(true);
windows.prepend(windowC);
window->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, -windowSize.height() / 2));
QChar id = QChar('B' + i);
- window->setWindowTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id);
+ window->setTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id);
window->setVisible(true);
windows.prepend(window);
}
format.setSamples(4);
setSurfaceType(QWindow::OpenGLSurface);
- setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
setFormat(format);
create();
m_animation->setEndValue(qreal(1));
m_animation->setDuration(500);
- requestWindowOrientation(Qt::PortraitOrientation);
+ requestOrientation(Qt::PortraitOrientation);
QRect screenGeometry = screen()->availableGeometry();
QPoint center = screenGeometry.center();
- QRect windowRect = screen()->isLandscape(windowOrientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640);
+ QRect windowRect = screen()->isLandscape(orientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640);
setGeometry(QRect(center - windowRect.center(), windowRect.size()));
m_rotation = 0;
QPainter p;
p.begin(&m_prevImage);
- p.setTransform(screen()->transformBetween(contentOrientation(), windowOrientation(), rect));
- paint(&p, screen()->mapBetween(contentOrientation(), windowOrientation(), rect));
+ p.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect));
+ paint(&p, screen()->mapBetween(contentOrientation(), orientation(), rect));
p.end();
p.begin(&m_nextImage);
- p.setTransform(screen()->transformBetween(newOrientation, windowOrientation(), rect));
- paint(&p, screen()->mapBetween(newOrientation, windowOrientation(), rect));
+ p.setTransform(screen()->transformBetween(newOrientation, orientation(), rect));
+ paint(&p, screen()->mapBetween(newOrientation, orientation(), rect));
p.end();
m_deltaRotation = screen()->angleBetween(newOrientation, contentOrientation());
painter.setOpacity(m_rotation);
painter.drawImage(0, 0, m_nextImage);
} else {
- QRect mapped = screen()->mapBetween(contentOrientation(), windowOrientation(), rect);
+ QRect mapped = screen()->mapBetween(contentOrientation(), orientation(), rect);
- painter.setTransform(screen()->transformBetween(contentOrientation(), windowOrientation(), rect));
+ painter.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect));
paint(&painter, mapped);
painter.end();
}
Window a;
a.setFramePos(QPoint(10, 10));
- a.setWindowTitle(QStringLiteral("Window A"));
- a.setObjectName(a.windowTitle());
+ a.setTitle(QStringLiteral("Window A"));
+ a.setObjectName(a.title());
a.setVisible(true);
Window b;
b.setFramePos(QPoint(100, 100));
- b.setWindowTitle(QStringLiteral("Window B"));
- b.setObjectName(b.windowTitle());
+ b.setTitle(QStringLiteral("Window B"));
+ b.setObjectName(b.title());
b.setVisible(true);
Window child(&b);
geometry.moveCenter(screen->availableGeometry().center());
window->setGeometry(geometry);
window->setVisible(true);
- window->setWindowTitle(screen->name());
- window->setObjectName(window->windowTitle());
+ window->setTitle(screen->name());
+ window->setObjectName(window->title());
windows.push_back(window);
}
return app.exec();
if (parent())
setGeometry(QRect(160, 120, 320, 240));
else {
- setWindowFlags(windowFlags() | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
+ setFlags(flags() | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
| Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
const QSize baseSize = QSize(640, 480);
setGeometry(QRect(geometry().topLeft(), baseSize));
const QWindowList tlw(QGuiApplication::topLevelWindows());
for (int i = 0; i < tlw.count(); ++i) {
QWindow *w = tlw.at(i);
- if (w->windowType() != Qt::Popup && w->windowType() != Qt::Desktop) {
+ if (w->type() != Qt::Popup && w->type() != Qt::Desktop) {
if (QAccessibleInterface *root = w->accessibleRoot()) {
if (root->object())
list.append(root->object());
visible, this function returns zero.
A modal window is a window which has its
- \l{QWindow::windowModality}{windowModality} property set to Qt::WindowModal
+ \l{QWindow::modality}{modality} property set to Qt::WindowModal
or Qt::ApplicationModal. A modal window must be closed before the user can
continue with other parts of the program.
Modal window are organized in a stack. This function returns the modal
window at the top of the stack.
- \sa Qt::WindowModality, QWindow::setWindowModality()
+ \sa Qt::WindowModality, QWindow::setModality()
*/
QWindow *QGuiApplication::modalWindow()
{
void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
{
bool shouldBeBlocked = false;
- if ((window->windowType() & Qt::Popup) != Qt::Popup && !self->modalWindowList.isEmpty())
+ if ((window->type() & Qt::Popup) != Qt::Popup && !self->modalWindowList.isEmpty())
shouldBeBlocked = self->isWindowBlocked(window);
if (shouldBeBlocked != window->d_func()->blockedByModalWindow) {
self->modalWindowList.prepend(modal);
// Send leave for currently entered window if it should be blocked
- if (currentMouseWindow && (currentMouseWindow->windowType() & Qt::Popup) != Qt::Popup) {
+ if (currentMouseWindow && (currentMouseWindow->type() & Qt::Popup) != Qt::Popup) {
bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow);
if (shouldBeBlocked) {
// Remove the new window from modalWindowList temporarily so leave can go through
}
}
- Qt::WindowModality windowModality = modalWindow->windowModality();
+ Qt::WindowModality windowModality = modalWindow->modality();
switch (windowModality) {
case Qt::ApplicationModal:
{
{
for (int i = 0; i < l.size(); ++i) {
QWindow *w = l.at(i);
- if (w->handle() && w->windowType() != Qt::Desktop)
+ if (w->handle() && w->type() != Qt::Desktop)
applyCursor(w, c);
}
}
{
for (int i = 0; i < l.size(); ++i) {
QWindow *w = l.at(i);
- if (w->handle() && w->windowType() != Qt::Desktop)
+ if (w->handle() && w->type() != Qt::Desktop)
applyCursor(w, w->cursor());
}
}
A modal window prevents other windows from getting any input.
- \sa QWindow::windowModality
+ \sa QWindow::modality
*/
bool QWindow::isModal() const
{
return d->modality != Qt::NonModal;
}
-/*! \property QWindow::windowModality
+/*! \property QWindow::modality
\brief the modality of the window
A modal window prevents other windows from receiving input events. Qt
\sa Qt::WindowModality
*/
-Qt::WindowModality QWindow::windowModality() const
+Qt::WindowModality QWindow::modality() const
{
Q_D(const QWindow);
return d->modality;
}
-void QWindow::setWindowModality(Qt::WindowModality modality)
+void QWindow::setModality(Qt::WindowModality modality)
{
Q_D(QWindow);
if (d->modality == modality)
return;
d->modality = modality;
- emit windowModalityChanged(modality);
+ emit modalityChanged(modality);
}
-/*! \fn void QWindow::windowModalityChanged(Qt::WindowModality windowModality)
+/*! \fn void QWindow::modalityChanged(Qt::WindowModality modality)
- This signal is emitted when the Qwindow::windowModality property changes to \a windowModality.
+ This signal is emitted when the Qwindow::modality property changes to \a modality.
*/
/*!
}
/*!
- Sets the window flags of the window to \a flags.
+ \property QWindow::flags
+ \brief the window flags of the window
The window flags control the window's appearance in the windowing system,
whether it's a dialog, popup, or a regular window, and whether it should
have a title bar, etc.
- \sa windowFlags()
+ The actual window flags might differ from the flags set with setFlags()
+ if the requested flags could not be fulfilled.
*/
-void QWindow::setWindowFlags(Qt::WindowFlags flags)
+void QWindow::setFlags(Qt::WindowFlags flags)
{
Q_D(QWindow);
if (d->platformWindow)
d->windowFlags = flags;
}
-/*!
- Returns the window flags of the window.
-
- This might differ from the flags set with setWindowFlags() if the
- requested flags could not be fulfilled.
-
- \sa setWindowFlags()
-*/
-Qt::WindowFlags QWindow::windowFlags() const
+Qt::WindowFlags QWindow::flags() const
{
Q_D(const QWindow);
return d->windowFlags;
This returns the part of the window flags that represents
whether the window is a dialog, tooltip, popup, regular window, etc.
- \sa windowFlags(), setWindowFlags()
+ \sa flags(), setFlags()
*/
-Qt::WindowType QWindow::windowType() const
+Qt::WindowType QWindow::type() const
{
Q_D(const QWindow);
return static_cast<Qt::WindowType>(int(d->windowFlags & Qt::WindowType_Mask));
}
/*!
- \property QWindow::windowTitle
+ \property QWindow::title
\brief the window's title in the windowing system
The window title might appear in the title area of the window decorations,
be used by the windowing system to identify the window in other contexts,
such as in the task switcher.
- \sa windowFlags()
+ \sa flags()
*/
-void QWindow::setWindowTitle(const QString &title)
+void QWindow::setTitle(const QString &title)
{
Q_D(QWindow);
d->windowTitle = title;
d->platformWindow->setWindowTitle(title);
}
-QString QWindow::windowTitle() const
+QString QWindow::title() const
{
Q_D(const QWindow);
return d->windowTitle;
}
/*!
- \property QWindow::windowFilePath
- \brief the file name this window is representing.
+ \brief set the file name this window is representing.
- This property might be used by the windowing system to display the file
+ The windowing system might use \a filePath to display the
path of the document this window is representing in the tile bar.
+
*/
-void QWindow::setWindowFilePath(const QString &filePath)
+void QWindow::setFilePath(const QString &filePath)
{
Q_D(QWindow);
d->windowFilePath = filePath;
d->platformWindow->setWindowFilePath(filePath);
}
-QString QWindow::windowFilePath() const
+/*!
+ \brief the file name this window is representing.
+
+ \sa setFilePath()
+*/
+QString QWindow::filePath() const
{
Q_D(const QWindow);
return d->windowFilePath;
}
/*!
- \property QWindow::windowIcon
- \brief the window's icon in the windowing system
+ \brief set the window's \a icon in the windowing system
The window icon might be used by the windowing system for example to
decorate the window, and/or in the task switcher.
*/
-void QWindow::setWindowIcon(const QIcon &icon)
+void QWindow::setIcon(const QIcon &icon)
{
Q_D(QWindow);
d->windowIcon = icon;
d->platformWindow->setWindowIcon(icon);
}
-QIcon QWindow::windowIcon() const
+/*!
+ \brief set the window's icon in the windowing system
+
+ \sa setIcon()
+*/
+QIcon QWindow::icon() const
{
Q_D(const QWindow);
return d->windowIcon;
\sa isActive(), QGuiApplication::focusWindow()
*/
-void QWindow::requestActivateWindow()
+void QWindow::requestActivate()
{
Q_D(QWindow);
if (d->platformWindow)
The default value is Qt::PrimaryOrientation
- \sa requestWindowOrientation(), QScreen::orientation()
+ \sa requestOrientation(), QScreen::orientation()
*/
void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
{
on a device that only handles landscape buffers, typically a desktop
system).
- If the return value is false, call windowOrientation() to get the actual
+ If the return value is false, call \l orientation() to get the actual
supported orientation.
- \sa windowOrientation(), reportContentOrientationChange(), QScreen::orientation()
+ \sa orientation(), reportContentOrientationChange(), QScreen::orientation()
*/
-bool QWindow::requestWindowOrientation(Qt::ScreenOrientation orientation)
+bool QWindow::requestOrientation(Qt::ScreenOrientation orientation)
{
Q_D(QWindow);
if (!d->platformWindow)
The default value is Qt::PrimaryOrientation.
- \sa requestWindowOrientation()
+ \sa requestOrientation()
*/
-Qt::ScreenOrientation QWindow::windowOrientation() const
+Qt::ScreenOrientation QWindow::orientation() const
{
Q_D(const QWindow);
return d->windowOrientation;
}
/*!
- Returns the window state.
+ \brief set the screen-occupation state of the window
- \sa setWindowState()
-*/
-Qt::WindowState QWindow::windowState() const
-{
- Q_D(const QWindow);
- return d->windowState;
-}
-
-/*!
- Sets the desired window \a state.
-
- The window state represents whether the window appears in the
+ The window \a state represents whether the window appears in the
windowing system as maximized, minimized, fullscreen, or normal.
The enum value Qt::WindowActive is not an accepted parameter.
- \sa windowState(), showNormal(), showFullScreen(), showMinimized(), showMaximized()
+ \sa showNormal(), showFullScreen(), showMinimized(), showMaximized()
*/
void QWindow::setWindowState(Qt::WindowState state)
{
if (d->platformWindow)
d->platformWindow->setWindowState(state);
d->windowState = state;
+ emit windowStateChanged(d->windowState);
}
/*!
+ \brief the screen-occupation state of the window
+
+ \sa setWindowState()
+*/
+Qt::WindowState QWindow::windowState() const
+{
+ Q_D(const QWindow);
+ return d->windowState;
+}
+
+/*!
+ \fn QWindow::windowStateChanged(Qt::WindowState windowState)
+
+ This signal is emitted when the \a windowState changes, either
+ by being set explicitly with setWindowState(), or automatically when
+ the user clicks one of the titlebar buttons or by other means.
+*/
+
+/*!
Sets the transient \a parent
This is a hint to the window manager that this window is a dialog or pop-up
{
setWindowState(Qt::WindowFullScreen);
setVisible(true);
- requestActivateWindow();
+ requestActivate();
}
/*!
hideEvent(static_cast<QHideEvent *>(ev));
break;
+ case QEvent::WindowStateChange: {
+ Q_D(QWindow);
+ emit windowStateChanged(d->windowState);
+ }
+
#ifndef QT_NO_TABLETEVENT
case QEvent::TabletPress:
case QEvent::TabletMove:
}
+#ifndef QT_NO_CURSOR
/*!
- \property QWindow::cursor
- \brief the cursor shape for this window
+ \brief set the cursor shape for this window
- The mouse cursor will assume this shape when it is over this
+ The mouse \a cursor will assume this shape when it is over this
window, unless an override cursor is set.
See the \l{Qt::CursorShape}{list of predefined cursor objects} for a
range of useful shapes.
- By default, this property contains a cursor with the Qt::ArrowCursor
- shape.
+ By default, the cursor has the Qt::ArrowCursor shape.
Some underlying window implementations will reset the cursor if it
leaves a window even if the mouse is grabbed. If you want to have
\sa QGuiApplication::setOverrideCursor()
*/
-
-#ifndef QT_NO_CURSOR
-QCursor QWindow::cursor() const
-{
- Q_D(const QWindow);
- return d->cursor;
-}
-
void QWindow::setCursor(const QCursor &cursor)
{
Q_D(QWindow);
setCursor(Qt::ArrowCursor);
}
+/*!
+ \brief the cursor shape for this window
+
+ \sa setCursor(), unsetCursor()
+*/
+QCursor QWindow::cursor() const
+{
+ Q_D(const QWindow);
+ return d->cursor;
+}
+
void QWindowPrivate::applyCursor()
{
Q_Q(QWindow);
}
}
}
-#endif
+#endif // QT_NO_CURSOR
QT_END_NAMESPACE
Q_OBJECT
Q_DECLARE_PRIVATE(QWindow)
- Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
- Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath)
- Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
- Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged)
+ // All properties which are declared here are inherited by QQuickWindow and therefore available in QML.
+ // So please think carefully about what it does to the QML namespace if you add any new ones,
+ // particularly the possible meanings these names might have in any specializations of Window.
+ // For example "state" (meaning windowState) is not a good property to declare, because it has
+ // a different meaning in QQuickItem, and users will tend to assume it is the same for Window.
+
+ Q_PROPERTY(QString title READ title WRITE setTitle)
+ Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged)
+ Q_PROPERTY(Qt::WindowFlags flags READ flags WRITE setFlags)
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
-#ifndef QT_NO_CURSOR
- Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor)
-#endif
public:
bool isTopLevel() const;
bool isModal() const;
- Qt::WindowModality windowModality() const;
- void setWindowModality(Qt::WindowModality windowModality);
+ Qt::WindowModality modality() const;
+ void setModality(Qt::WindowModality modality);
void setFormat(const QSurfaceFormat &format);
QSurfaceFormat format() const;
QSurfaceFormat requestedFormat() const;
- void setWindowFlags(Qt::WindowFlags flags);
- Qt::WindowFlags windowFlags() const;
- Qt::WindowType windowType() const;
+ void setFlags(Qt::WindowFlags flags);
+ Qt::WindowFlags flags() const;
+ Qt::WindowType type() const;
- QString windowTitle() const;
+ QString title() const;
void setOpacity(qreal level);
- void requestActivateWindow();
+ void requestActivate();
bool isActive() const;
void reportContentOrientationChange(Qt::ScreenOrientation orientation);
Qt::ScreenOrientation contentOrientation() const;
- bool requestWindowOrientation(Qt::ScreenOrientation orientation);
- Qt::ScreenOrientation windowOrientation() const;
+ bool requestOrientation(Qt::ScreenOrientation orientation);
+ Qt::ScreenOrientation orientation() const;
Qt::WindowState windowState() const;
void setWindowState(Qt::WindowState state);
void resize(const QSize &newSize);
inline void resize(int w, int h) { resize(QSize(w, h)); }
- void setWindowFilePath(const QString &filePath);
- QString windowFilePath() const;
+ void setFilePath(const QString &filePath);
+ QString filePath() const;
- void setWindowIcon(const QIcon &icon);
- QIcon windowIcon() const;
+ void setIcon(const QIcon &icon);
+ QIcon icon() const;
void destroy();
void raise();
void lower();
- void setWindowTitle(const QString &);
+ void setTitle(const QString &);
void setX(int arg)
{
Q_SIGNALS:
void screenChanged(QScreen *screen);
- void windowModalityChanged(Qt::WindowModality windowModality);
+ void modalityChanged(Qt::WindowModality modality);
+ void windowStateChanged(Qt::WindowState windowState);
void xChanged(int arg);
void yChanged(int arg);
format.setAlphaBufferSize(8);
setFormat(format);
setSurfaceType(RasterSurface);
- setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint |
+ setFlags(Qt::ToolTip | Qt::FramelessWindowHint |
Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput);
create();
m_backingStore = new QBackingStore(this);
bool QCocoaMenuBar::shouldDisable(QCocoaWindow *active) const
{
- if (active && (active->window()->windowModality() == Qt::NonModal))
+ if (active && (active->window()->modality() == Qt::NonModal))
return false;
if (m_window == active) {
// the menubar should be disabled. The exception in Qt is that if the
// modal window is the only window on screen, then we enable the menu bar.
foreach (QWindow *w, topWindows) {
- if (w->isVisible() && w->windowModality() == Qt::ApplicationModal) {
+ if (w->isVisible() && w->modality() == Qt::ApplicationModal) {
// check for other visible windows
foreach (QWindow *other, topWindows) {
if ((w != other) && (other->isVisible())) {
- (BOOL)canBecomeKeyWindow
{
// Most panels can be come the key window. Exceptions are:
- if (m_cocoaPlatformWindow->window()->windowType() == Qt::ToolTip)
+ if (m_cocoaPlatformWindow->window()->type() == Qt::ToolTip)
return NO;
- if (m_cocoaPlatformWindow->window()->windowType() == Qt::SplashScreen)
+ if (m_cocoaPlatformWindow->window()->type() == Qt::SplashScreen)
return NO;
return YES;
}
#endif
if (visible) {
// We need to recreate if the modality has changed as the style mask will need updating
- if (m_windowModality != window()->windowModality())
+ if (m_windowModality != window()->modality())
recreateWindow(parent());
QCocoaWindow *parentCocoaWindow = 0;
if (window()->transientParent()) {
// Register popup windows so that the parent window can
// close them when needed.
- if (window()->windowType() == Qt::Popup) {
- // qDebug() << "transientParent and popup" << window()->windowType() << Qt::Popup << (window()->windowType() & Qt::Popup);
+ if (window()->type() == Qt::Popup) {
+ // qDebug() << "transientParent and popup" << window()->type() << Qt::Popup << (window()->type() & Qt::Popup);
parentCocoaWindow->m_activePopupWindow = window();
}
syncWindowState(window()->windowState());
if (window()->windowState() != Qt::WindowMinimized) {
- if ((window()->windowModality() == Qt::WindowModal
- || window()->windowType() == Qt::Sheet)
+ if ((window()->modality() == Qt::WindowModal
+ || window()->type() == Qt::Sheet)
&& parentCocoaWindow) {
// show the window as a sheet
[NSApp beginSheet:m_nsWindow modalForWindow:parentCocoaWindow->m_nsWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
- } else if (window()->windowModality() != Qt::NonModal) {
+ } else if (window()->modality() != Qt::NonModal) {
// show the window as application modal
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
Q_ASSERT(cocoaEventDispatcher != 0);
}
// We want the events to properly reach the popup
- if (window()->windowType() == Qt::Popup)
+ if (window()->type() == Qt::Popup)
[(NSPanel *)m_nsWindow setWorksWhenModal:YES];
}
}
Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint;
if (flags == Qt::Window) {
styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);
- } else if ((flags & Qt::Dialog) && (window()->windowModality() != Qt::NonModal)) {
+ } else if ((flags & Qt::Dialog) && (window()->modality() != Qt::NonModal)) {
styleMask = NSTitledWindowMask;
} else if (!(flags & Qt::FramelessWindowHint)) {
if (flags & Qt::WindowMaximizeButtonHint)
NSButton *iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
if (iconButton == nil) {
- NSString *title = QCFString::toNSString(window()->windowTitle());
+ NSString *title = QCFString::toNSString(window()->title());
[m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]];
iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
}
bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const
{
if (type == Qt::Widget)
- type = window()->windowType();
+ type = window()->type();
if (type == Qt::Tool)
return false; // Qt::Tool has the Popup bit set but isn't, at least on Mac.
// QPlatformWindow subclasses must sync up with QWindow on creation:
propagateSizeHints();
- setWindowFlags(window()->windowFlags());
- setWindowTitle(window()->windowTitle());
+ setWindowFlags(window()->flags());
+ setWindowTitle(window()->title());
setWindowState(window()->windowState());
} else {
// Child windows have no NSWindow, link the NSViews instead.
NSRect frame = qt_mac_flipRect(window()->geometry(), window());
- Qt::WindowType type = window()->windowType();
- Qt::WindowFlags flags = window()->windowFlags();
+ Qt::WindowType type = window()->type();
+ Qt::WindowFlags flags = window()->flags();
NSUInteger styleMask = windowStyleMask(flags);
NSWindow *createdWindow = 0;
NSInteger level = windowLevel(flags);
[createdWindow setLevel:level];
- m_windowModality = window()->windowModality();
+ m_windowModality = window()->modality();
return createdWindow;
}
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
#ifndef Q_OS_WINCE
- if (rw->format().hasAlpha() && (window->windowFlags() & Qt::FramelessWindowHint)) {
+ if (rw->format().hasAlpha() && (window->flags() & Qt::FramelessWindowHint)) {
const long wl = GetWindowLong(rw->handle(), GWL_EXSTYLE);
if ((wl & WS_EX_LAYERED) == 0)
SetWindowLong(rw->handle(), GWL_EXSTYLE, wl | WS_EX_LAYERED);
QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
{
- const Qt::WindowFlags flags = w ? w->windowFlags() : (Qt::WindowFlags)0;
+ const Qt::WindowFlags flags = w ? w->flags() : (Qt::WindowFlags)0;
const Qt::WindowFlags type = flags & Qt::WindowType_Mask;
uint style = 0;
QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const
{
QWindowsWindow::WindowData requested;
- requested.flags = window->windowFlags();
+ requested.flags = window->flags();
requested.geometry = window->geometry();
const QWindowsWindow::WindowData obtained
- = QWindowsWindow::WindowData::create(window, requested, window->windowTitle());
+ = QWindowsWindow::WindowData::create(window, requested, window->title());
if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows)
qDebug().nospace()
<< __FUNCTION__ << '<' << window << '\n'
if (!obtained.hwnd)
return 0;
if (requested.flags != obtained.flags)
- window->setWindowFlags(obtained.flags);
+ window->setFlags(obtained.flags);
return new QWindowsWindow(window, obtained);
}
#define enabled (MF_BYCOMMAND | MF_ENABLED)
#define disabled (MF_BYCOMMAND | MF_GRAYED)
- EnableMenuItem(menu, SC_MINIMIZE, (topLevel->windowFlags() & Qt::WindowMinimizeButtonHint)?enabled:disabled);
+ EnableMenuItem(menu, SC_MINIMIZE, (topLevel->flags() & Qt::WindowMinimizeButtonHint)?enabled:disabled);
bool maximized = IsZoomed(topLevelHwnd);
- EnableMenuItem(menu, SC_MAXIMIZE, ! (topLevel->windowFlags() & Qt::WindowMaximizeButtonHint) || maximized?disabled:enabled);
+ EnableMenuItem(menu, SC_MAXIMIZE, ! (topLevel->flags() & Qt::WindowMaximizeButtonHint) || maximized?disabled:enabled);
EnableMenuItem(menu, SC_RESTORE, maximized?enabled:disabled);
// We should _not_ check with the setFixedSize(x,y) case here, since Windows is not able to check
// this and our menu here would be out-of-sync with the menu produced by mouse-click on the
// System Menu, or right-click on the title bar.
- EnableMenuItem(menu, SC_SIZE, (topLevel->windowFlags() & Qt::MSWindowsFixedSizeDialogHint) || maximized?disabled:enabled);
+ EnableMenuItem(menu, SC_SIZE, (topLevel->flags() & Qt::MSWindowsFixedSizeDialogHint) || maximized?disabled:enabled);
EnableMenuItem(menu, SC_MOVE, maximized?disabled:enabled);
EnableMenuItem(menu, SC_CLOSE, enabled);
// Set bold on close menu item
setFlag(OpenGLSurface);
QWindowsContext::instance()->addWindow(m_data.hwnd, this);
if (aWindow->isTopLevel()) {
- switch (aWindow->windowType()) {
+ switch (aWindow->type()) {
case Qt::Window:
case Qt::Dialog:
case Qt::Sheet:
int sm = SW_SHOWNORMAL;
bool fakedMaximize = false;
const QWindow *w = window();
- const Qt::WindowFlags flags = w->windowFlags();
- const Qt::WindowType type = w->windowType();
+ const Qt::WindowFlags flags = w->flags();
+ const Qt::WindowType type = w->type();
if (w->isTopLevel()) {
const Qt::WindowState state = w->windowState();
if (state & Qt::WindowMinimized) {
// partially from QWidgetPrivate::hide_sys()
void QWindowsWindow::hide_sys() const
{
- const Qt::WindowFlags flags = window()->windowFlags();
+ const Qt::WindowFlags flags = window()->flags();
if (flags != Qt::Desktop) {
if (flags & Qt::Popup)
ShowWindow(m_data.hwnd, SW_HIDE);
// to dialog frames, etc (see SetParent() ) if the top level state changes.
if (wasTopLevel != isTopLevel) {
const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild);
- setWindowFlags_sys(window()->windowFlags(), flags);
+ setWindowFlags_sys(window()->flags(), flags);
}
}
}
QXcbWindow *w = 0;
if (target) {
w = connection()->platformWindowFromId(target);
- if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/)
+ if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/)
w = 0;
} else {
w = 0;
QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target);
- if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/)
+ if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/)
w = 0;
Transaction t = {
p -= geometry.topLeft();
- if (!w || (w->windowType() == Qt::Desktop))
+ if (!w || (w->type() == Qt::Desktop))
return;
if (e->data.data32[0] != xdnd_dragsource) {
QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target);
- if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/)
+ if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/)
w = 0;
if (w)
DNDDEBUG << "xdndEnable" << w << on;
if (on) {
QXcbWindow *xdnd_widget = 0;
- if ((w->window()->windowType() == Qt::Desktop)) {
+ if ((w->window()->type() == Qt::Desktop)) {
if (desktop_proxy) // *WE* already have one.
return false;
return false;
}
} else {
- if ((w->window()->windowType() == Qt::Desktop)) {
+ if ((w->window()->type() == Qt::Desktop)) {
xcb_delete_property(xcb_connection(), w->xcb_window(), atom(QXcbAtom::XdndProxy));
delete desktop_proxy;
desktop_proxy = 0;
QXcbConnection *c = drag->connection();
QXcbWindow *xcb_window = c->platformWindowFromId(drag->xdnd_dragsource);
- if (xcb_window && drag->currentDrag() && xcb_window->window()->windowType() != Qt::Desktop) {
+ if (xcb_window && drag->currentDrag() && xcb_window->window()->type() != Qt::Desktop) {
QMimeData *data = drag->currentDrag()->mimeData();
if (data->hasFormat(QLatin1String(format)))
result = data->data(QLatin1String(format));
// Returns true if we should set WM_TRANSIENT_FOR on \a w
static inline bool isTransient(const QWindow *w)
{
- return w->windowType() == Qt::Dialog
- || w->windowType() == Qt::Sheet
- || w->windowType() == Qt::Tool
- || w->windowType() == Qt::SplashScreen
- || w->windowType() == Qt::ToolTip
- || w->windowType() == Qt::Drawer
- || w->windowType() == Qt::Popup;
+ return w->type() == Qt::Dialog
+ || w->type() == Qt::Sheet
+ || w->type() == Qt::Tool
+ || w->type() == Qt::SplashScreen
+ || w->type() == Qt::ToolTip
+ || w->type() == Qt::Drawer
+ || w->type() == Qt::Popup;
}
static inline QImage::Format imageFormatForDepth(int depth)
m_configureNotifyPending = true;
m_windowState = Qt::WindowNoState;
- Qt::WindowType type = window()->windowType();
+ Qt::WindowType type = window()->type();
if (type == Qt::Desktop) {
m_window = m_screen->root();
if (m_screen->syncRequestSupported())
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
- if (window()->windowFlags() & Qt::WindowContextHelpButtonHint)
+ if (window()->flags() & Qt::WindowContextHelpButtonHint)
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP);
Q_XCB_CALL(xcb_change_property(xcb_connection(),
memset(&hints, 0, sizeof(hints));
xcb_wm_hints_set_normal(&hints);
- xcb_wm_hints_set_input(&hints, !(window()->windowFlags() & Qt::WindowDoesNotAcceptFocus));
+ xcb_wm_hints_set_input(&hints, !(window()->flags() & Qt::WindowDoesNotAcceptFocus));
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
connection()->xi2Select(m_window);
#endif
- setWindowFlags(window()->windowFlags());
- setWindowTitle(window()->windowTitle());
setWindowState(window()->windowState());
+ setWindowFlags(window()->flags());
+ setWindowTitle(window()->title());
- if (window()->windowFlags() & Qt::WindowTransparentForInput)
+ if (window()->flags() & Qt::WindowTransparentForInput)
setTransparentForMouseEvents(true);
#ifndef QT_NO_DRAGANDDROP
else
xcb_wm_hints_set_normal(&hints);
- xcb_wm_hints_set_input(&hints, !(window()->windowFlags() & Qt::WindowDoesNotAcceptFocus));
+ xcb_wm_hints_set_input(&hints, !(window()->flags() & Qt::WindowDoesNotAcceptFocus));
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
{
QtMotifWmHints mwmhints = getMotifWmHints(connection(), m_window);
- if (window()->windowModality() != Qt::NonModal) {
- switch (window()->windowModality()) {
+ if (window()->modality() != Qt::NonModal) {
+ switch (window()->modality()) {
case Qt::WindowModal:
mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL;
break;
}
}
- if (window()->windowFlags() & Qt::WindowMinimizeButtonHint) {
+ if (window()->flags() & Qt::WindowMinimizeButtonHint) {
mwmhints.flags |= MWM_HINTS_DECORATIONS;
mwmhints.decorations |= MWM_DECOR_MINIMIZE;
mwmhints.functions |= MWM_FUNC_MINIMIZE;
}
- if (window()->windowFlags() & Qt::WindowMaximizeButtonHint) {
+ if (window()->flags() & Qt::WindowMaximizeButtonHint) {
mwmhints.flags |= MWM_HINTS_DECORATIONS;
mwmhints.decorations |= MWM_DECOR_MAXIMIZE;
mwmhints.functions |= MWM_FUNC_MAXIMIZE;
}
- if (window()->windowFlags() & Qt::WindowCloseButtonHint)
+ if (window()->flags() & Qt::WindowCloseButtonHint)
mwmhints.functions |= MWM_FUNC_CLOSE;
setMotifWmHints(connection(), m_window, mwmhints);
{
NetWmStates states(0);
- const Qt::WindowFlags flags = window()->windowFlags();
+ const Qt::WindowFlags flags = window()->flags();
if (flags & Qt::WindowStaysOnTopHint) {
states |= NetWmStateAbove;
states |= NetWmStateStaysOnTop;
states |= NetWmStateMaximizedVert;
}
- if (window()->windowModality() != Qt::NonModal)
+ if (window()->modality() != Qt::NonModal)
states |= NetWmStateModal;
setNetWmStates(states);
return false;
}
- Qt::WindowModality windowModality = modalWindow->windowModality();
+ Qt::WindowModality windowModality = modalWindow->modality();
QWidgetWindow *modalWidgetWindow = qobject_cast<QWidgetWindow *>(modalWindow);
if (windowModality == Qt::NonModal) {
// determine the modality type if it hasn't been set on the
win = topData()->window;
}
- win->setWindowFlags(data.window_flags);
+ win->setFlags(data.window_flags);
fixPosIncludesFrame();
win->setGeometry(q->geometry());
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
QWindowPrivate::WindowFrameInclusive : QWindowPrivate::WindowFrameExclusive;
win->create();
- data.window_flags = win->windowFlags();
+ data.window_flags = win->flags();
QBackingStore *store = q->backingStore();
if (parent != newparent) {
QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function???
if (q->windowHandle()) {
- q->windowHandle()->setWindowFlags(f);
+ q->windowHandle()->setFlags(f);
QWidget *parentWithWindow =
newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0;
if (parentWithWindow) {
return;
if (QWindow *window = q->windowHandle())
- window->setWindowTitle(caption);
+ window->setTitle(caption);
}
return;
if (QWindow *window = q->windowHandle())
- window->setWindowFilePath(filePath);
+ window->setFilePath(filePath);
}
void QWidgetPrivate::setWindowIcon_sys()
{
Q_Q(QWidget);
if (QWindow *window = q->windowHandle())
- window->setWindowIcon(q->windowIcon());
+ window->setIcon(q->windowIcon());
}
void QWidgetPrivate::setWindowIconText_sys(const QString &iconText)
QWindow *const wnd = window()->windowHandle();
if (wnd)
- wnd->requestActivateWindow();
+ wnd->requestActivate();
}
// Position top level windows at the center, avoid showing
if (QWindow *nativeWindow = q->window()->windowHandle()) {
if (nativeWindow != QGuiApplication::focusWindow()
&& q->testAttribute(Qt::WA_WState_Created)) {
- nativeWindow->requestActivateWindow();
+ nativeWindow->requestActivate();
}
}
}
{
Q_Q(QWidget);
if (q->windowHandle())
- q->windowHandle()->setWindowModality(q->windowModality());
+ q->windowHandle()->setModality(q->windowModality());
}
#ifndef QT_NO_CURSOR
// verify active window focus propagates to qguiapplication
- window1.requestActivateWindow();
+ window1.requestActivate();
QVERIFY(QTest::qWaitForWindowActive(&window1));
QCOMPARE(app.focusWindow(), &window1);
window2.show();
QVERIFY(QTest::qWaitForWindowExposed(&window1));
QVERIFY(QTest::qWaitForWindowExposed(&window2));
- window1.requestActivateWindow();
+ window1.requestActivate();
QTRY_COMPARE(app.focusWindow(), &window1);
- window2.requestActivateWindow();
+ window2.requestActivate();
QTRY_COMPARE(app.focusWindow(), &window2);
QCOMPARE(window1.windowDuringFocusAboutToChange, &window1);
QCOMPARE(window1.windowDuringFocusOut, &window2);
BlockableWindow *windowModalWindow1 = new BlockableWindow;
windowModalWindow1->setTransientParent(window1);
- windowModalWindow1->setWindowModality(Qt::WindowModal);
+ windowModalWindow1->setModality(Qt::WindowModal);
BlockableWindow *windowModalWindow2 = new BlockableWindow;
windowModalWindow2->setTransientParent(windowModalWindow1);
- windowModalWindow2->setWindowModality(Qt::WindowModal);
+ windowModalWindow2->setModality(Qt::WindowModal);
BlockableWindow *applicationModalWindow1 = new BlockableWindow;
- applicationModalWindow1->setWindowModality(Qt::ApplicationModal);
+ applicationModalWindow1->setModality(Qt::ApplicationModal);
// show the 2 windows, nothing is blocked
window1->show();
DummyWindow window;
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
- window.requestActivateWindow();
+ window.requestActivate();
QTRY_COMPARE(qApp->focusWindow(), &window);
window.setFocusObject(&m_inputItem);
DummyWindow window;
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
- window.requestActivateWindow();
+ window.requestActivate();
QTRY_COMPARE(qApp->focusWindow(), &window);
window.setFocusObject(&disabledItem);
Window()
{
reset();
- setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
}
void reset()
QTRY_VERIFY(child.isExposed());
- child.requestActivateWindow();
+ child.requestActivate();
QTRY_VERIFY(QGuiApplication::focusWindow() == &child);
QVERIFY(child.isActive());
dialog.setGeometry(110, 110, 300, 30);
dialog.show();
- dialog.requestActivateWindow();
+ dialog.requestActivate();
QTRY_VERIFY(dialog.isExposed());
QCoreApplication::processEvents();
// parent is active
QVERIFY(child.isActive());
- window.requestActivateWindow();
+ window.requestActivate();
QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
QCoreApplication::processEvents();
window.reportContentOrientationChange(Qt::PrimaryOrientation);
QCOMPARE(window.contentOrientation(), Qt::PrimaryOrientation);
- QVERIFY(!window.requestWindowOrientation(Qt::LandscapeOrientation) || window.windowOrientation() == Qt::LandscapeOrientation);
- QVERIFY(!window.requestWindowOrientation(Qt::PortraitOrientation) || window.windowOrientation() == Qt::PortraitOrientation);
- QVERIFY(!window.requestWindowOrientation(Qt::PrimaryOrientation) || window.windowOrientation() == Qt::PrimaryOrientation);
+ QVERIFY(!window.requestOrientation(Qt::LandscapeOrientation) || window.orientation() == Qt::LandscapeOrientation);
+ QVERIFY(!window.requestOrientation(Qt::PortraitOrientation) || window.orientation() == Qt::PortraitOrientation);
+ QVERIFY(!window.requestOrientation(Qt::PrimaryOrientation) || window.orientation() == Qt::PrimaryOrientation);
QSignalSpy spy(&window, SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)));
window.reportContentOrientationChange(Qt::LandscapeOrientation);
for (int i = 0; i < 10; ++i) {
QWindow window;
window.show();
- window.requestActivateWindow();
+ window.requestActivate();
QVERIFY(QTest::qWaitForWindowActive(&window));
QCOMPARE(qGuiApp->focusWindow(), &window);
}
qRegisterMetaType<Qt::WindowModality>("Qt::WindowModality");
QWindow window;
- QSignalSpy spy(&window, SIGNAL(windowModalityChanged(Qt::WindowModality)));
+ QSignalSpy spy(&window, SIGNAL(modalityChanged(Qt::WindowModality)));
- QCOMPARE(window.windowModality(), Qt::NonModal);
- window.setWindowModality(Qt::NonModal);
- QCOMPARE(window.windowModality(), Qt::NonModal);
+ QCOMPARE(window.modality(), Qt::NonModal);
+ window.setModality(Qt::NonModal);
+ QCOMPARE(window.modality(), Qt::NonModal);
QCOMPARE(spy.count(), 0);
- window.setWindowModality(Qt::WindowModal);
- QCOMPARE(window.windowModality(), Qt::WindowModal);
+ window.setModality(Qt::WindowModal);
+ QCOMPARE(window.modality(), Qt::WindowModal);
QCOMPARE(spy.count(), 1);
- window.setWindowModality(Qt::WindowModal);
- QCOMPARE(window.windowModality(), Qt::WindowModal);
+ window.setModality(Qt::WindowModal);
+ QCOMPARE(window.modality(), Qt::WindowModal);
QCOMPARE(spy.count(), 1);
- window.setWindowModality(Qt::ApplicationModal);
- QCOMPARE(window.windowModality(), Qt::ApplicationModal);
+ window.setModality(Qt::ApplicationModal);
+ QCOMPARE(window.modality(), Qt::ApplicationModal);
QCOMPARE(spy.count(), 2);
- window.setWindowModality(Qt::ApplicationModal);
- QCOMPARE(window.windowModality(), Qt::ApplicationModal);
+ window.setModality(Qt::ApplicationModal);
+ QCOMPARE(window.modality(), Qt::ApplicationModal);
QCOMPARE(spy.count(), 2);
- window.setWindowModality(Qt::NonModal);
- QCOMPARE(window.windowModality(), Qt::NonModal);
+ window.setModality(Qt::NonModal);
+ QCOMPARE(window.modality(), Qt::NonModal);
QCOMPARE(spy.count(), 3);
}
InputTestWindow modalA;
modalA.setTransientParent(&parent);
modalA.setGeometry(10, 10, 20, 20);
- modalA.setWindowModality(Qt::ApplicationModal);
+ modalA.setModality(Qt::ApplicationModal);
modalA.show();
InputTestWindow modalB;
modalB.setTransientParent(&parent);
modalB.setGeometry(30, 10, 20, 20);
- modalB.setWindowModality(Qt::ApplicationModal);
+ modalB.setModality(Qt::ApplicationModal);
modalB.show();
QPointF local(5, 5);
child.setGeometry(10, 10, 20, 20);
child.show();
- child.requestActivateWindow();
+ child.requestActivate();
QTRY_VERIFY(QGuiApplication::focusWindow() == &child);
QAccessibleStateChangeEvent deactivate(&window, activeState);