diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-09-16 12:35:28 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-09-16 12:38:06 +0200 |
commit | 1aecda36d1d12bcd24a5ee87dd82ed04f85c41e2 (patch) | |
tree | af84a7911c2d6a2c1d54582810cb95665ae534f1 | |
parent | 6a7a824b970d12471f9219c84a57eb91231c59fe (diff) | |
parent | d70e5ebe11a8eb22fe5e71945982d81991dc9f09 (diff) | |
download | qtquickcontrols-1aecda36d1d12bcd24a5ee87dd82ed04f85c41e2.tar.gz |
Merge remote-tracking branch 'origin/5.3.2' into 5.3
Change-Id: I91d1886e6081e39a1b5ea17b6c44d73b539889b1
-rw-r--r-- | src/controls/TextArea.qml | 2 | ||||
-rw-r--r-- | src/controls/TextField.qml | 2 | ||||
-rw-r--r-- | src/controls/qquickmenupopupwindow.cpp | 13 | ||||
-rw-r--r-- | src/controls/qquickmenupopupwindow_p.h | 1 | ||||
-rw-r--r-- | src/controls/qquickpopupwindow.cpp | 28 | ||||
-rw-r--r-- | src/dialogs/qquickdialog.cpp | 2 | ||||
-rw-r--r-- | src/dialogs/qquickdialog_p.h | 2 |
7 files changed, 26 insertions, 24 deletions
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 83d42aaf..74ed716e 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -235,7 +235,7 @@ ScrollView { \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. \endlist */ - property int inputMethodHints: edit.inputMethodHints || Qt.ImhNone + property alias inputMethodHints: edit.inputMethodHints /*! \qmlproperty int TextArea::length diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index 89e23ed2..58498f13 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -281,7 +281,7 @@ Control { \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. \endlist */ - property int inputMethodHints: textInput.inputMethodHints || Qt.ImhNone + property alias inputMethodHints: textInput.inputMethodHints /*! \qmlproperty int TextField::length diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp index 508b6b27..bdd1cd6b 100644 --- a/src/controls/qquickmenupopupwindow.cpp +++ b/src/controls/qquickmenupopupwindow.cpp @@ -50,8 +50,10 @@ QT_BEGIN_NAMESPACE QQuickMenuPopupWindow::QQuickMenuPopupWindow() : - QQuickPopupWindow(), m_itemAt(0) -{ } + m_itemAt(0), + m_logicalParentWindow(0) +{ +} void QQuickMenuPopupWindow::show() { @@ -59,6 +61,10 @@ void QQuickMenuPopupWindow::show() // show() will reposition the popup at the last moment, // so its initial position must be captured after the call. m_initialPos = position(); + if (m_logicalParentWindow && m_logicalParentWindow->parent()) { + // This must be a QQuickWindow embedded via createWindowContainer. + m_initialPos += m_logicalParentWindow->geometry().topLeft(); + } } void QQuickMenuPopupWindow::setParentItem(QQuickItem *item) @@ -88,8 +94,11 @@ void QQuickMenuPopupWindow::setItemAt(QQuickItem *menuItem) void QQuickMenuPopupWindow::setParentWindow(QWindow *effectiveParentWindow, QQuickWindow *parentWindow) { + while (effectiveParentWindow && effectiveParentWindow->parent()) + effectiveParentWindow = effectiveParentWindow->parent(); if (transientParent() != effectiveParentWindow) setTransientParent(effectiveParentWindow); + m_logicalParentWindow = parentWindow; if (parentWindow) { connect(parentWindow, SIGNAL(destroyed()), this, SLOT(dismissPopup())); if (QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(parentWindow)) diff --git a/src/controls/qquickmenupopupwindow_p.h b/src/controls/qquickmenupopupwindow_p.h index a550daa2..7da861d9 100644 --- a/src/controls/qquickmenupopupwindow_p.h +++ b/src/controls/qquickmenupopupwindow_p.h @@ -69,6 +69,7 @@ private: QQuickItem *m_itemAt; QPointF m_oldItemPos; QPointF m_initialPos; + QQuickWindow *m_logicalParentWindow; }; QT_END_NAMESPACE diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp index bcd2837f..fe697d31 100644 --- a/src/controls/qquickpopupwindow.cpp +++ b/src/controls/qquickpopupwindow.cpp @@ -68,23 +68,16 @@ void QQuickPopupWindow::show() { qreal posx = x(); qreal posy = y(); - if (QQuickWindow *parentWindow = qobject_cast<QQuickWindow *>(transientParent())) { + // transientParent may not be a QQuickWindow when embedding into widgets + if (QWindow *tp = transientParent()) { if (m_parentItem) { - QPointF pos = m_parentItem->mapToItem(parentWindow->contentItem(), QPointF(posx, posy)); + QPointF pos = m_parentItem->mapToItem(m_parentItem->window()->contentItem(), QPointF(posx, posy)); posx = pos.x(); posy = pos.y(); } - - if (parentWindow->parent()) { - // If the parent window is embedded in another window, the offset needs to be relative to - // its top-level window container, or to global coordinates, which is the same in the end. - QPoint parentWindowOffset = parentWindow->mapToGlobal(QPoint()); - posx += parentWindowOffset.x(); - posy += parentWindowOffset.y(); - } else { - posx += parentWindow->geometry().left(); - posy += parentWindow->geometry().top(); - } + QPoint tlwOffset = tp->mapToGlobal(QPoint()); + posx += tlwOffset.x(); + posy += tlwOffset.y(); } else if (m_parentItem && m_parentItem->window()) { QPoint offset; QQuickWindow *quickWindow = m_parentItem->window(); @@ -93,11 +86,10 @@ void QQuickPopupWindow::show() 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(); - } + + QPoint parentWindowOffset = (renderWindow ? renderWindow : quickWindow)->mapToGlobal(QPoint()); + posx += offset.x() + parentWindowOffset.x(); + posy += offset.y() + parentWindowOffset.y(); } if (m_contentItem) { diff --git a/src/dialogs/qquickdialog.cpp b/src/dialogs/qquickdialog.cpp index 060512d0..4f23dcb4 100644 --- a/src/dialogs/qquickdialog.cpp +++ b/src/dialogs/qquickdialog.cpp @@ -238,7 +238,7 @@ QJSValue QQuickDialog::__standardButtonsRightModel() void QQuickDialog::setVisible(bool v) { if (v) - m_clickedButton == NoButton; + m_clickedButton = NoButton; QQuickAbstractDialog::setVisible(v); } diff --git a/src/dialogs/qquickdialog_p.h b/src/dialogs/qquickdialog_p.h index 565859f3..fbf0ce0b 100644 --- a/src/dialogs/qquickdialog_p.h +++ b/src/dialogs/qquickdialog_p.h @@ -112,8 +112,8 @@ private: private: QString m_title; - StandardButton m_clickedButton; StandardButtons m_enabledButtons; + StandardButton m_clickedButton; QJSValue m_standardButtonsLeftModel; QJSValue m_standardButtonsRightModel; Q_DISABLE_COPY(QQuickDialog) |