aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-03-15 09:53:48 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2018-03-22 20:41:35 +0000
commit1abc7fcbabcc5a89ceaaf69173d077e22ed2d658 (patch)
treebd8709695ede60b257adac02aa9c3f835b0d73af /src
parentffc64f07ade1d3c80e7d20e4f73210cca2b1181a (diff)
Add anchors property to Popup to allow centering in parent/window
Currently, users must manually position their Popup using x and y bindings: Popup { x: (parent.width - width) / 2 y: (parent.height - height) / 2 } This patch adds an anchors property so that you can do this instead: Popup { anchors.centerIn: parent } It's also possible to conveniently center within the window from anywhere within the scene (106e7b63 also documents an alternative way of doing this using Overlay): Window { id: window Pane { Popup { anchors.centerIn: window } } } QQuickAnchors were never used with Popup, because we cannot use the QQuickAnchors implementation as-is, as the visual QQuickItem parent is not the actual parent item of QQuickPopupItem. Currently just centerIn is supported, as that's the most common use case. [ChangeLog][Controls][Popup] Added anchors.centerIn to Popup to allow a covenient way of centering a popup. Task-number: QTBUG-60354 Change-Id: Ia030f812df9da646fea8f373ef6199a21205ffbd Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml46
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp2
-rw-r--r--src/quicktemplates2/qquickpopup.cpp53
-rw-r--r--src/quicktemplates2/qquickpopup_p.h2
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h4
-rw-r--r--src/quicktemplates2/qquickpopupanchors.cpp90
-rw-r--r--src/quicktemplates2/qquickpopupanchors_p.h89
-rw-r--r--src/quicktemplates2/qquickpopupanchors_p_p.h77
-rw-r--r--src/quicktemplates2/qquickpopuppositioner.cpp34
-rw-r--r--src/quicktemplates2/quicktemplates2.pri3
10 files changed, 395 insertions, 5 deletions
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml
new file mode 100644
index 00000000..593058c6
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+
+Item {
+//! [centerIn]
+ApplicationWindow {
+ id: window
+ // ...
+
+ Pane {
+ // ...
+
+ Popup {
+ anchors.centerIn: Overlay.overlay
+ }
+ }
+}
+//! [centerIn]
+}
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index d8496558..f565dafb 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -70,6 +70,7 @@
#include <QtQuickTemplates2/private/qquickpaletteprovider_p.h>
#include <QtQuickTemplates2/private/qquickpane_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
+#include <QtQuickTemplates2/private/qquickpopupanchors_p.h>
#include <QtQuickTemplates2/private/qquickprogressbar_p.h>
#include <QtQuickTemplates2/private/qquickradiobutton_p.h>
#include <QtQuickTemplates2/private/qquickradiodelegate_p.h>
@@ -333,6 +334,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickDialogButtonBox, 5>(uri, 2, 5, "DialogButtonBox");
qmlRegisterType<QQuickControl, 5>(uri, 2, 5, "Control");
qmlRegisterType<QQuickPopup, 5>(uri, 2, 5, "Popup");
+ qmlRegisterType<QQuickPopupAnchors>();
qmlRegisterType<QQuickRangeSlider, 5>(uri, 2, 5, "RangeSlider");
qmlRegisterType<QQuickSlider, 5>(uri, 2, 5, "Slider");
qmlRegisterType<QQuickTextArea, 5>(uri, 2, 5, "TextArea");
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 84b17d65..03dd3dd0 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -36,6 +36,7 @@
#include "qquickpopup_p.h"
#include "qquickpopup_p_p.h"
+#include "qquickpopupanchors_p.h"
#include "qquickpopupitem_p_p.h"
#include "qquickpopuppositioner_p_p.h"
#include "qquickapplicationwindow_p.h"
@@ -178,6 +179,11 @@ QT_BEGIN_NAMESPACE
\include qquickoverlay-popup-parent.qdocinc
+ Another way to center a popup in the window regardless of its parent item
+ is to use \l {anchors.centerIn}:
+
+ \snippet qtquickcontrols2-popup.qml centerIn
+
\sa {Popup Controls}, {Customizing Popup}, ApplicationWindow
*/
@@ -259,7 +265,8 @@ QQuickPopupPrivate::QQuickPopupPrivate()
exit(nullptr),
popupItem(nullptr),
positioner(nullptr),
- transitionManager(this)
+ transitionManager(this),
+ anchors(nullptr)
{
}
@@ -572,6 +579,48 @@ void QQuickPopupPrivate::setBottomMargin(qreal value, bool reset)
}
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlpropertygroup QtQuick.Controls::Popup::anchors
+ \qmlproperty Object QtQuick.Controls::Popup::anchors.centerIn
+
+ Anchors provide a way to position an item by specifying its
+ relationship with other items.
+
+ A common use case is to center a popup within its parent. One way to do
+ this is with the \l {Item::}{x} and \l {Item::}{y} properties. Anchors offer
+ a more convenient approach:
+
+ \qml
+ Pane {
+ // ...
+
+ Popup {
+ anchors.centerIn: parent
+ }
+ }
+ \endqml
+
+ It is also possible to center the popup in the window by using \l Overlay:
+
+ \snippet qtquickcontrols2-popup.qml centerIn
+
+ This makes it easy to center a popup in the window from any component.
+
+ \note Popups can only be centered within their immediate parent or
+ the window overlay; trying to center in other items will produce a warning.
+
+ \sa {Popup Positioning}, {Item::anchors}
+*/
+QQuickPopupAnchors *QQuickPopupPrivate::getAnchors()
+{
+ if (!anchors) {
+ Q_Q(QQuickPopup);
+ anchors = new QQuickPopupAnchors(positioner, q);
+ }
+ return anchors;
+}
+
void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow)
{
Q_Q(QQuickPopup);
@@ -2470,3 +2519,5 @@ bool QQuickPopup::setAccessibleProperty(const char *propertyName, const QVariant
}
QT_END_NAMESPACE
+
+#include "moc_qquickpopup_p.cpp"
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index 9e2f3649..07ac664e 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -67,6 +67,7 @@
QT_BEGIN_NAMESPACE
class QQuickWindow;
+class QQuickPopupAnchors;
class QQuickPopupPrivate;
class QQuickTransition;
@@ -124,6 +125,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
// 2.5 (Qt 5.12)
Q_PROPERTY(qreal horizontalPadding READ horizontalPadding WRITE setHorizontalPadding RESET resetHorizontalPadding NOTIFY horizontalPaddingChanged FINAL)
Q_PROPERTY(qreal verticalPadding READ verticalPadding WRITE setVerticalPadding RESET resetVerticalPadding NOTIFY verticalPaddingChanged FINAL)
+ Q_PRIVATE_PROPERTY(QQuickPopup::d_func(), QQuickPopupAnchors *anchors READ getAnchors DESIGNABLE false CONSTANT FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,contentItem")
Q_CLASSINFO("DefaultProperty", "contentData")
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
index 6890fdac..64362ada 100644
--- a/src/quicktemplates2/qquickpopup_p_p.h
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
class QQuickTransition;
class QQuickTransitionManager;
class QQuickPopup;
+class QQuickPopupAnchors;
class QQuickPopupItem;
class QQuickPopupPrivate;
class QQuickPopupPositioner;
@@ -135,6 +136,8 @@ public:
void setRightMargin(qreal value, bool reset = false);
void setBottomMargin(qreal value, bool reset = false);
+ QQuickPopupAnchors *getAnchors();
+
void setWindow(QQuickWindow *window);
void itemDestroyed(QQuickItem *item) override;
@@ -189,6 +192,7 @@ public:
QList<QQuickStateAction> enterActions;
QList<QQuickStateAction> exitActions;
QQuickPopupTransitionManager transitionManager;
+ QQuickPopupAnchors *anchors;
friend class QQuickPopupTransitionManager;
};
diff --git a/src/quicktemplates2/qquickpopupanchors.cpp b/src/quicktemplates2/qquickpopupanchors.cpp
new file mode 100644
index 00000000..1311a322
--- /dev/null
+++ b/src/quicktemplates2/qquickpopupanchors.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpopupanchors_p.h"
+#include "qquickpopupanchors_p_p.h"
+#include "qquickpopuppositioner_p_p.h"
+
+#include <QtQuick/qquickwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickPopupAnchorsPrivate::QQuickPopupAnchorsPrivate(QQuickPopupPositioner *positioner)
+ : positioner(positioner)
+{
+}
+
+QQuickPopupAnchorsPrivate::~QQuickPopupAnchorsPrivate()
+{
+}
+
+QQuickPopupAnchors::QQuickPopupAnchors(QQuickPopupPositioner *positioner, QObject *parent)
+ : QObject(*(new QQuickPopupAnchorsPrivate(positioner)), parent)
+{
+}
+
+QQuickPopupAnchors::QQuickPopupAnchors(QQuickPopupAnchorsPrivate &dd, QObject *parent)
+ : QObject(dd, parent)
+{
+}
+
+QQuickPopupAnchors::~QQuickPopupAnchors()
+{
+}
+
+QQuickItem *QQuickPopupAnchors::centerIn() const
+{
+ Q_D(const QQuickPopupAnchors);
+ return d->centerIn;
+}
+
+void QQuickPopupAnchors::setCenterIn(QQuickItem *item)
+{
+ Q_D(QQuickPopupAnchors);
+ if (item == d->centerIn)
+ return;
+
+ d->centerIn = item;
+ d->positioner->reposition();
+ emit centerInChanged();
+}
+
+void QQuickPopupAnchors::resetCenterIn()
+{
+ setCenterIn(nullptr);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpopupanchors_p.h b/src/quicktemplates2/qquickpopupanchors_p.h
new file mode 100644
index 00000000..490a4867
--- /dev/null
+++ b/src/quicktemplates2/qquickpopupanchors_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPOPUPANCHORS_P_H
+#define QQUICKPOPUPANCHORS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtQml/qqml.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QQuickPopupAnchorsPrivate;
+class QQuickPopupPositioner;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopupAnchors : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
+
+public:
+ explicit QQuickPopupAnchors(QQuickPopupPositioner *positioner, QObject *parent);
+ ~QQuickPopupAnchors();
+
+ QQuickItem *centerIn() const;
+ void setCenterIn(QQuickItem *item);
+ void resetCenterIn();
+
+Q_SIGNALS:
+ void centerInChanged();
+
+protected:
+ QQuickPopupAnchors(QQuickPopupAnchorsPrivate &dd, QObject *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickPopupAnchors)
+ Q_DECLARE_PRIVATE(QQuickPopupAnchors)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPopupAnchors)
+
+#endif // QQUICKPOPUPANCHORS_P_H
diff --git a/src/quicktemplates2/qquickpopupanchors_p_p.h b/src/quicktemplates2/qquickpopupanchors_p_p.h
new file mode 100644
index 00000000..c2f577bf
--- /dev/null
+++ b/src/quicktemplates2/qquickpopupanchors_p_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPOPUPANCHORS_P_P_H
+#define QQUICKPOPUPANCHORS_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPopupAnchors;
+class QQuickPopupPositioner;
+
+class QQuickPopupAnchorsPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickPopupAnchors)
+
+public:
+ QQuickPopupAnchorsPrivate(QQuickPopupPositioner *positioner);
+ ~QQuickPopupAnchorsPrivate();
+
+ static QQuickPopupAnchorsPrivate *get(QQuickPopupAnchors *popupAnchors)
+ {
+ return popupAnchors->d_func();
+ }
+
+ QQuickPopupPositioner *positioner = nullptr;
+ QQuickItem *centerIn = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPOPUPANCHORS_P_P_H
diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp
index 2b67c85e..60a989da 100644
--- a/src/quicktemplates2/qquickpopuppositioner.cpp
+++ b/src/quicktemplates2/qquickpopuppositioner.cpp
@@ -34,10 +34,13 @@
**
****************************************************************************/
+#include "qquickoverlay_p.h"
#include "qquickpopuppositioner_p_p.h"
+#include "qquickpopupanchors_p.h"
#include "qquickpopupitem_p_p.h"
#include "qquickpopup_p_p.h"
+#include <QtQml/qqmlinfo.h>
#include <QtQuick/private/qquickitem_p.h>
QT_BEGIN_NAMESPACE
@@ -111,12 +114,31 @@ void QQuickPopupPositioner::reposition()
bool heightAdjusted = false;
QQuickPopupPrivate *p = QQuickPopupPrivate::get(m_popup);
- QRectF rect(p->allowHorizontalMove ? p->x : popupItem->x(),
- p->allowVerticalMove ? p->y : popupItem->y(),
+ const QQuickItem *centerInParent = p->anchors ? p->getAnchors()->centerIn() : nullptr;
+ const QQuickOverlay *centerInOverlay = qobject_cast<const QQuickOverlay*>(centerInParent);
+ QRectF rect(!centerInParent ? p->allowHorizontalMove ? p->x : popupItem->x() : 0,
+ !centerInParent ? p->allowVerticalMove ? p->y : popupItem->y() : 0,
!p->hasWidth && iw > 0 ? iw : w,
!p->hasHeight && ih > 0 ? ih : h);
if (m_parentItem) {
- rect.moveTopLeft(m_parentItem->mapToItem(popupItem->parentItem(), rect.topLeft()));
+ // m_parentItem is the parent that the popup should open in,
+ // and popupItem()->parentItem() is the overlay, so the mapToItem() calls below
+ // effectively map the rect to scene coordinates.
+ if (centerInParent) {
+ if (centerInParent != parentItem() && !centerInOverlay) {
+ qmlWarning(m_popup) << "Popup can only be centered within its immediate parent or Overlay.overlay";
+ return;
+ }
+
+ if (centerInOverlay) {
+ rect.moveCenter(QPointF(qRound(centerInOverlay->width() / 2.0), qRound(centerInOverlay->height() / 2.0)));
+ } else {
+ const QPointF parentItemCenter = QPointF(qRound(m_parentItem->width() / 2), qRound(m_parentItem->height() / 2));
+ rect.moveCenter(m_parentItem->mapToItem(popupItem->parentItem(), parentItemCenter));
+ }
+ } else {
+ rect.moveTopLeft(m_parentItem->mapToItem(popupItem->parentItem(), rect.topLeft()));
+ }
if (p->window) {
const QMarginsF margins = p->getMargins();
@@ -217,7 +239,11 @@ void QQuickPopupPositioner::reposition()
popupItem->setPosition(rect.topLeft());
- const QPointF effectivePos = m_parentItem ? m_parentItem->mapFromScene(rect.topLeft()) : rect.topLeft();
+ // If the popup was assigned a parent, rect will be in scene coordinates,
+ // so we need to map its top left back to item coordinates.
+ // However, if centering within the overlay, the coordinates will be relative
+ // to the window, so we don't need to do anything.
+ const QPointF effectivePos = m_parentItem && !centerInOverlay ? m_parentItem->mapFromScene(rect.topLeft()) : rect.topLeft();
if (!qFuzzyCompare(p->effectiveX, effectivePos.x())) {
p->effectiveX = effectivePos.x();
emit m_popup->xChanged();
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index c37526d4..425b3c8f 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -55,6 +55,8 @@ HEADERS += \
$$PWD/qquickpane_p_p.h \
$$PWD/qquickpopup_p.h \
$$PWD/qquickpopup_p_p.h \
+ $$PWD/qquickpopupanchors_p.h \
+ $$PWD/qquickpopupanchors_p_p.h \
$$PWD/qquickpopupitem_p_p.h \
$$PWD/qquickpopuppositioner_p_p.h \
$$PWD/qquickpresshandler_p_p.h \
@@ -131,6 +133,7 @@ SOURCES += \
$$PWD/qquickpaletteprovider.cpp \
$$PWD/qquickpane.cpp \
$$PWD/qquickpopup.cpp \
+ $$PWD/qquickpopupanchors.cpp \
$$PWD/qquickpopupitem.cpp \
$$PWD/qquickpopuppositioner.cpp \
$$PWD/qquickpresshandler.cpp \