1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKPOPUPPOSITIONER_P_P_H
5#define QQUICKPOPUPPOSITIONER_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qquickitemchangelistener_p.h>
19#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQuickItem;
24class QQuickPopup;
25
26class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopupPositioner : public QQuickItemChangeListener
27{
28public:
29 explicit QQuickPopupPositioner(QQuickPopup *popup);
30 ~QQuickPopupPositioner();
31
32 QQuickPopup *popup() const;
33
34 QQuickItem *parentItem() const;
35 void setParentItem(QQuickItem *parent);
36
37 virtual void reposition();
38
39protected:
40 void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override;
41 void itemParentChanged(QQuickItem *, QQuickItem *parent) override;
42 void itemChildRemoved(QQuickItem *, QQuickItem *child) override;
43
44 void removeAncestorListeners(QQuickItem *item);
45 void addAncestorListeners(QQuickItem *item);
46
47 bool m_positioning = false;
48 QQuickItem *m_parentItem = nullptr;
49 QQuickPopup *m_popup = nullptr;
50 qreal m_popupScale = 1.0;
51};
52
53QT_END_NAMESPACE
54
55#endif // QQUICKPOPUPPOSITIONER_P_P_H
56

source code of qtdeclarative/src/quicktemplates/qquickpopuppositioner_p_p.h