diff options
| author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-01 12:47:18 +0200 |
|---|---|---|
| committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-01 12:47:18 +0200 |
| commit | 37d3ecfd3d1ddaff4b12e97926b2c94260164e4c (patch) | |
| tree | 02d7e17187491b4fad4f049304aa5b77cd4c61ca /src/controls | |
| parent | f8b75642343123ce355aa33ee8ef6697ff2075f5 (diff) | |
| parent | 1bd60bec33458136efceac6c16abf2bc3976d984 (diff) | |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: I7d6be51a5601fb90ed5e102b63173ccc01b39f36
Diffstat (limited to 'src/controls')
| -rw-r--r-- | src/controls/controls.pro | 2 | ||||
| -rw-r--r-- | src/controls/plugins.qmltypes | 195 | ||||
| -rw-r--r-- | src/controls/qquickmenupopupwindow.cpp | 7 | ||||
| -rw-r--r-- | src/controls/qquickpopupwindow.cpp | 24 |
4 files changed, 222 insertions, 6 deletions
diff --git a/src/controls/controls.pro b/src/controls/controls.pro index e7cd6adaf..fd4aac0d0 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -2,7 +2,7 @@ TARGET = qtquickcontrolsplugin TARGETPATH = QtQuick/Controls IMPORT_VERSION = 1.2 -QT += qml quick gui-private core-private +QT += qml quick quick-private gui-private core-private QMAKE_DOCS = $$PWD/doc/qtquickcontrols.qdocconf diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes index 72cb8c2df..a9d6e5278 100644 --- a/src/controls/plugins.qmltypes +++ b/src/controls/plugins.qmltypes @@ -779,7 +779,202 @@ Module { } } Component { + name: "QQuickWindow" + defaultProperty: "data" + prototype: "QWindow" + exports: ["QtQuick.Window/Window 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Method { name: "update" } + Method { name: "releaseResources" } + } + Component { + name: "QQuickWindowQmlImpl" + defaultProperty: "data" + prototype: "QQuickWindow" + exports: ["QtQuick.Window/Window 2.1"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QWindow" prototype: "QObject" + Enum { + name: "Visibility" + values: { + "Hidden": 0, + "AutomaticVisibility": 1, + "Windowed": 2, + "Minimized": 3, + "Maximized": 4, + "FullScreen": 5 + } + } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; type: "int" } + Property { name: "minimumHeight"; type: "int" } + Property { name: "maximumWidth"; type: "int" } + Property { name: "maximumHeight"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setMinimumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + revision: 1 + Parameter { name: "msec"; type: "int" } + } + } + Component { + prototype: "QQuickWindow" name: "QtQuick.Controls/ApplicationWindow" exports: ["QtQuick.Controls/ApplicationWindow 1.0"] exportMetaObjectRevisions: [0] diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp index ec33b0c14..6a2a03bc1 100644 --- a/src/controls/qquickmenupopupwindow.cpp +++ b/src/controls/qquickmenupopupwindow.cpp @@ -45,6 +45,7 @@ #include <qpa/qwindowsysteminterface.h> #include <qquickitem.h> #include <QtGui/QScreen> +#include <QtQuick/private/qquickrendercontrol_p.h> QT_BEGIN_NAMESPACE @@ -84,8 +85,10 @@ void QQuickMenuPopupWindow::setItemAt(QQuickItem *menuItem) void QQuickMenuPopupWindow::setParentWindow(QQuickWindow *parentWindow) { - if (transientParent() != parentWindow) - setTransientParent(parentWindow); + QWindow *proxyWindow = QQuickRenderControl::renderWindowFor(parentWindow); + QWindow *renderWindow = proxyWindow ? proxyWindow : parentWindow; + if (transientParent() != renderWindow) + setTransientParent(renderWindow); if (parentWindow) { connect(parentWindow, SIGNAL(destroyed()), this, SLOT(dismissPopup())); if (QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(parentWindow)) diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp index a9e85ff30..56f4c351a 100644 --- a/src/controls/qquickpopupwindow.cpp +++ b/src/controls/qquickpopupwindow.cpp @@ -44,6 +44,7 @@ #include <qguiapplication.h> #include <qpa/qwindowsysteminterface.h> #include <QtQuick/qquickitem.h> +#include <QtQuick/private/qquickrendercontrol_p.h> QT_BEGIN_NAMESPACE @@ -84,6 +85,19 @@ void QQuickPopupWindow::show() posx += parentWindow->geometry().left(); posy += parentWindow->geometry().top(); } + } else if (m_parentItem && m_parentItem->window()) { + QPoint offset; + QQuickWindow *quickWindow = m_parentItem->window(); + QWindow *renderWindow = QQuickRenderControl::renderWindowFor(quickWindow, &offset); + + QPointF pos = m_parentItem->mapToItem(quickWindow->contentItem(), QPointF(posx, posy)); + posx = pos.x(); + posy = pos.y(); + if (renderWindow) { + QPoint parentWindowOffset = renderWindow->mapToGlobal(QPoint()); + posx += offset.x() + parentWindowOffset.x(); + posy += offset.y() + parentWindowOffset.y(); + } } if (m_contentItem) { @@ -95,11 +109,15 @@ void QQuickPopupWindow::show() } emit geometryChanged(); - if (!qobject_cast<QQuickPopupWindow *>(transientParent())) // No need for parent menu windows - if (QQuickWindow *w = qobject_cast<QQuickWindow *>(transientParent())) + if (!qobject_cast<QQuickPopupWindow *>(transientParent())) { // No need for parent menu windows + if (QQuickWindow *w = qobject_cast<QQuickWindow *>(transientParent())) { if (QQuickItem *mg = w->mouseGrabberItem()) mg->ungrabMouse(); - + } else if (m_parentItem && m_parentItem->window()) { + if (QQuickItem *mg = m_parentItem->window()->mouseGrabberItem()) + mg->ungrabMouse(); + } + } QQuickWindow::show(); setMouseGrabEnabled(true); // Needs to be done after calling show() setKeyboardGrabEnabled(true); |
