summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-09-23 16:43:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-09-23 16:43:33 +0200
commit26db5c724540449ef1e19178427081bff084e4ad (patch)
tree612c0666edfd92a3832b868ddaf018d81b18ef52
parent215ca36081044f5124cc183a2e2ca188bd6aeaf8 (diff)
parent0276bda8914f94081d844ed671a215906fd1ae70 (diff)
downloadqtquickcontrols-26db5c724540449ef1e19178427081bff084e4ad.tar.gz
Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4
-rw-r--r--src/controls/TextArea.qml2
-rw-r--r--src/controls/TextField.qml2
-rw-r--r--src/controls/qquickmenupopupwindow.cpp13
-rw-r--r--src/controls/qquickmenupopupwindow_p.h1
-rw-r--r--src/controls/qquickpopupwindow.cpp28
-rw-r--r--src/dialogs/qquickdialog.cpp2
-rw-r--r--src/dialogs/qquickdialog_p.h2
7 files changed, 26 insertions, 24 deletions
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index 6db196b6..1f06569c 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -255,7 +255,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 4ae4d64d..797c3fc2 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -301,7 +301,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 c3231fd4..52ce7219 100644
--- a/src/controls/qquickmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -42,8 +42,10 @@
QT_BEGIN_NAMESPACE
QQuickMenuPopupWindow::QQuickMenuPopupWindow() :
- QQuickPopupWindow(), m_itemAt(0)
-{ }
+ m_itemAt(0),
+ m_logicalParentWindow(0)
+{
+}
void QQuickMenuPopupWindow::setParentItem(QQuickItem *item)
{
@@ -72,8 +74,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))
@@ -129,6 +134,10 @@ void QQuickMenuPopupWindow::exposeEvent(QExposeEvent *e)
// the popup will reposition at the last moment, so its
// initial position must be captured for updateSize().
m_initialPos = position();
+ if (m_logicalParentWindow && m_logicalParentWindow->parent()) {
+ // This must be a QQuickWindow embedded via createWindowContainer.
+ m_initialPos += m_logicalParentWindow->geometry().topLeft();
+ }
QQuickPopupWindow::exposeEvent(e);
}
diff --git a/src/controls/qquickmenupopupwindow_p.h b/src/controls/qquickmenupopupwindow_p.h
index 0d07f687..83216373 100644
--- a/src/controls/qquickmenupopupwindow_p.h
+++ b/src/controls/qquickmenupopupwindow_p.h
@@ -61,6 +61,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 066624d4..e10e6ae0 100644
--- a/src/controls/qquickpopupwindow.cpp
+++ b/src/controls/qquickpopupwindow.cpp
@@ -60,23 +60,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();
@@ -85,11 +78,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 76f278ae..ebe2c7b0 100644
--- a/src/dialogs/qquickdialog.cpp
+++ b/src/dialogs/qquickdialog.cpp
@@ -230,7 +230,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 087f677d..3ae055f7 100644
--- a/src/dialogs/qquickdialog_p.h
+++ b/src/dialogs/qquickdialog_p.h
@@ -104,8 +104,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)