diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 11 | ||||
-rw-r--r-- | src/gui/kernel/qplatformmenu.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 54 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 19 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 1 |
8 files changed, 104 insertions, 7 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 64d2f8001f..efb34ffe9f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -105,6 +105,7 @@ QPointF QGuiApplicationPrivate::lastCursorPosition(0.0, 0.0); bool QGuiApplicationPrivate::tabletState = false; QWindow *QGuiApplicationPrivate::tabletPressTarget = 0; +QWindow *QGuiApplicationPrivate::currentMouseWindow = 0; QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0; @@ -455,7 +456,19 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal) { self->modalWindowList.prepend(modal); - QEvent e(QEvent::WindowBlocked); + // Send leave for currently entered window if it should be blocked + if (currentMouseWindow && (currentMouseWindow->windowType() & Qt::Popup) != Qt::Popup) { + bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow); + if (shouldBeBlocked) { + // Remove the new window from modalWindowList temporarily so leave can go through + self->modalWindowList.removeFirst(); + QEvent e(QEvent::Leave); + QGuiApplication::sendEvent(currentMouseWindow, &e); + currentMouseWindow = 0; + self->modalWindowList.prepend(modal); + } + } + QWindowList windows = QGuiApplication::topLevelWindows(); for (int i = 0; i < windows.count(); ++i) { QWindow *window = windows.at(i); @@ -470,7 +483,6 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window) { self->modalWindowList.removeAll(window); - QEvent e(QEvent::WindowUnblocked); QWindowList windows = QGuiApplication::topLevelWindows(); for (int i = 0; i < windows.count(); ++i) { QWindow *window = windows.at(i); @@ -1410,6 +1422,8 @@ void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::En return; } + currentMouseWindow = e->enter; + QEvent event(QEvent::Enter); QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event); } @@ -1423,6 +1437,8 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le return; } + currentMouseWindow = 0; + QEvent event(QEvent::Leave); QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event); } diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 44a9275688..c9eb672220 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -189,6 +189,7 @@ public: static QPointF lastCursorPosition; static bool tabletState; static QWindow *tabletPressTarget; + static QWindow *currentMouseWindow; #ifndef QT_NO_CLIPBOARD static QClipboard *qt_clipboard; diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index cf55c59bab..5259ed9164 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -195,6 +195,10 @@ QPlatformServices *QPlatformIntegration::services() const \value BufferQueueingOpenGL The OpenGL implementation on the platform will queue up buffers when swapBuffers() is called and block only when its buffer pipeline is full, rather than block immediately. + + \value MultipleWindows The platform supports multiple QWindows, i.e. does some kind + of compositing either client or server side. Some platforms might only support a + single fullscreen window. */ diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 7e8888407c..b4c8ebff5a 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -83,11 +83,12 @@ class Q_GUI_EXPORT QPlatformIntegration public: enum Capability { ThreadedPixmaps = 1, - OpenGL = 2, - ThreadedOpenGL = 3, - SharedGraphicsCache = 4, - BufferQueueingOpenGL = 5, - WindowMasks = 6 + OpenGL, + ThreadedOpenGL, + SharedGraphicsCache, + BufferQueueingOpenGL, + WindowMasks, + MultipleWindows }; virtual ~QPlatformIntegration() { } diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index 64f738b331..7e7ccdb294 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -102,6 +102,7 @@ public: virtual void setText(const QString &text) = 0; virtual void setEnabled(bool enabled) = 0; + virtual void setVisible(bool visible) = 0; virtual QPlatformMenuItem *menuItemAt(int position) const = 0; virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0; diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 4f1610cb21..d845be3d01 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -214,6 +214,8 @@ QWindow::~QWindow() { if (QGuiApplicationPrivate::focus_window == this) QGuiApplicationPrivate::focus_window = 0; + if (QGuiApplicationPrivate::currentMouseWindow == this) + QGuiApplicationPrivate::currentMouseWindow = 0; QGuiApplicationPrivate::window_list.removeAll(this); destroy(); } @@ -939,9 +941,24 @@ void QWindow::setMinimumSize(const QSize &size) QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); if (d->minimumSize == adjustedSize) return; + QSize oldSize = d->minimumSize; d->minimumSize = adjustedSize; if (d->platformWindow && isTopLevel()) d->platformWindow->propagateSizeHints(); + if (d->minimumSize.width() != oldSize.width()) + emit minimumWidthChanged(d->minimumSize.width()); + if (d->minimumSize.height() != oldSize.height()) + emit minimumHeightChanged(d->minimumSize.height()); +} + +void QWindow::setMinimumWidth(int w) +{ + setMinimumSize(QSize(w, minimumHeight())); +} + +void QWindow::setMinimumHeight(int h) +{ + setMinimumSize(QSize(minimumWidth(), h)); } /*! @@ -957,9 +974,24 @@ void QWindow::setMaximumSize(const QSize &size) QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); if (d->maximumSize == adjustedSize) return; + QSize oldSize = d->maximumSize; d->maximumSize = adjustedSize; if (d->platformWindow && isTopLevel()) d->platformWindow->propagateSizeHints(); + if (d->maximumSize.width() != oldSize.width()) + emit maximumWidthChanged(d->maximumSize.width()); + if (d->maximumSize.height() != oldSize.height()) + emit maximumHeightChanged(d->maximumSize.height()); +} + +void QWindow::setMaximumWidth(int w) +{ + setMaximumSize(QSize(w, maximumHeight())); +} + +void QWindow::setMaximumHeight(int h) +{ + setMaximumSize(QSize(maximumWidth(), h)); } /*! @@ -1058,6 +1090,26 @@ void QWindow::setGeometry(const QRect &rect) */ /*! + \property QWindow::minimumWidth + \brief the minimum width of the window's geometry +*/ + +/*! + \property QWindow::minimumHeight + \brief the minimum height of the window's geometry +*/ + +/*! + \property QWindow::maximumWidth + \brief the maximum width of the window's geometry +*/ + +/*! + \property QWindow::maximumHeight + \brief the maximum height of the window's geometry +*/ + +/*! Returns the geometry of the window, excluding its window frame. \sa frameMargins(), frameGeometry() @@ -1445,6 +1497,8 @@ bool QWindow::close() if (QGuiApplicationPrivate::focus_window == this) QGuiApplicationPrivate::focus_window = 0; + if (QGuiApplicationPrivate::currentMouseWindow == this) + QGuiApplicationPrivate::currentMouseWindow = 0; QGuiApplicationPrivate::window_list.removeAll(this); destroy(); diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 62268cd88a..4832adfb63 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -104,6 +104,10 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_PROPERTY(QPoint pos READ pos WRITE setPos) Q_PROPERTY(QSize size READ size WRITE resize) Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry) + Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged) + Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged) + Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged) + 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 @@ -170,6 +174,11 @@ public: bool isExposed() const; + int minimumWidth() const { return minimumSize().width(); } + int minimumHeight() const { return minimumSize().height(); } + int maximumWidth() const { return maximumSize().width(); } + int maximumHeight() const { return maximumSize().height(); } + QSize minimumSize() const; QSize maximumSize() const; QSize baseSize() const; @@ -273,6 +282,11 @@ public Q_SLOTS: setGeometry(QRect(x(), y(), width(), arg)); } + void setMinimumWidth(int w); + void setMinimumHeight(int h); + void setMaximumWidth(int w); + void setMaximumHeight(int h); + Q_SIGNALS: void screenChanged(QScreen *screen); void windowModalityChanged(Qt::WindowModality windowModality); @@ -283,6 +297,11 @@ Q_SIGNALS: void widthChanged(int arg); void heightChanged(int arg); + void minimumWidthChanged(int arg); + void minimumHeightChanged(int arg); + void maximumWidthChanged(int arg); + void maximumHeightChanged(int arg); + void visibleChanged(bool arg); void contentOrientationChanged(Qt::ScreenOrientation orientation); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 159f05d1a5..bce6a4ff04 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -80,6 +80,7 @@ public: , positionPolicy(WindowFrameExclusive) , contentOrientation(Qt::PrimaryOrientation) , windowOrientation(Qt::PrimaryOrientation) + , minimumSize(0, 0) , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) , modality(Qt::NonModal) , blockedByModalWindow(false) |