Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickpopup_p_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKPOPUP_P_P_H
6#define QQUICKPOPUP_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickpopup_p.h>
20#include <QtQuickTemplates2/private/qquickcontrol_p.h>
21#include <QtQuickTemplates2/private/qquicktheme_p.h>
22
23#include <QtCore/private/qobject_p.h>
24#include <QtQuick/qquickitem.h>
25#include <QtQuick/private/qquickitemchangelistener_p.h>
26#include <QtQuick/private/qquicktransitionmanager_p_p.h>
27#include <QtQuick/private/qquickitem_p.h>
28
29#include <QtCore/qpointer.h>
30
32
33class QQuickTransition;
34class QQuickTransitionManager;
35class QQuickPopup;
36class QQuickPopupAnchors;
37class QQuickPopupItem;
38class QQuickPopupWindow;
39class QQuickPopupPrivate;
40class QQuickPopupPositioner;
41
42class Q_QUICKTEMPLATES2_EXPORT QQuickPopupTransitionManager : public QQuickTransitionManager
43{
44public:
45 QQuickPopupTransitionManager(QQuickPopupPrivate *popup);
46
47 void transitionEnter();
48 void transitionExit();
49
50protected:
51 void finished() override;
52
53private:
54 QQuickPopupPrivate *popup = nullptr;
55};
56
57class Q_QUICKTEMPLATES2_EXPORT QQuickPopupPrivate
58 : public QObjectPrivate
59 , public QSafeQuickItemChangeListener<QQuickPopupPrivate>
60 , public QQuickPaletteProviderPrivateBase<QQuickPopup, QQuickPopupPrivate>
61{
62public:
63 Q_DECLARE_PUBLIC(QQuickPopup)
64
65 QQuickPopupPrivate();
66
67 static QQuickPopupPrivate *get(QQuickPopup *popup)
68 {
69 return popup->d_func();
70 }
71
72 QQmlListProperty<QObject> contentData();
73 QQmlListProperty<QQuickItem> contentChildren();
74
75 void init();
76 void closeOrReject();
77 bool tryClose(const QPointF &pos, QQuickPopup::ClosePolicy flags);
78
79 bool contains(const QPointF &scenePos) const;
80
81#if QT_CONFIG(quicktemplates2_multitouch)
82 virtual bool acceptTouch(const QTouchEvent::TouchPoint &point);
83#endif
84 virtual bool blockInput(QQuickItem *item, const QPointF &point) const;
85
86 virtual bool handlePress(QQuickItem* item, const QPointF &point, ulong timestamp);
87 virtual bool handleMove(QQuickItem* item, const QPointF &point, ulong timestamp);
88 virtual bool handleRelease(QQuickItem* item, const QPointF &point, ulong timestamp);
89 virtual bool handleReleaseWithoutGrab(const QEventPoint &) { return false; }
90 virtual void handleUngrab();
91
92 bool handleMouseEvent(QQuickItem *item, QMouseEvent *event);
93 bool handleHoverEvent(QQuickItem *item, QHoverEvent *event);
94#if QT_CONFIG(quicktemplates2_multitouch)
95 bool handleTouchEvent(QQuickItem *item, QTouchEvent *event);
96#endif
97
98 QMarginsF windowInsets() const;
99 QPointF windowInsetsTopLeft() const;
100 void setEffectivePosFromWindowPos(const QPointF &windowPos);
101 void reposition();
102
103 bool usePopupWindow() const;
104 void adjustPopupItemParentAndWindow();
105 void createOverlay();
106 QQuickItem *createDimmer(QQmlComponent *component, QQuickPopup *popup, QQuickItem *parent) const;
107 void destroyDimmer();
108 void toggleOverlay();
109 void updateContentPalettes(const QPalette& parentPalette);
110
111 virtual QQuickPopup::PopupType resolvedPopupType() const;
112
113 virtual void showDimmer();
114 virtual void hideDimmer();
115 virtual void resizeDimmer();
116
117 virtual bool prepareEnterTransition();
118 virtual bool prepareExitTransition();
119 virtual void finalizeEnterTransition();
120 virtual void finalizeExitTransition();
121
122 virtual void opened();
123
124 Qt::WindowFlags popupWindowFlags() const;
125 void setPopupWindowFlags(Qt::WindowFlags flags);
126
127 QMarginsF getMargins() const;
128
129 void setTopMargin(qreal value, bool reset = false);
130 void setLeftMargin(qreal value, bool reset = false);
131 void setRightMargin(qreal value, bool reset = false);
132 void setBottomMargin(qreal value, bool reset = false);
133
134 QQuickPopupAnchors *getAnchors();
135 virtual QQuickPopupPositioner *getPositioner();
136
137 void setWindow(QQuickWindow *window);
138 void itemDestroyed(QQuickItem *item) override;
139
140 QPalette defaultPalette() const override;
141
142 void updateChildrenPalettes(const QPalette &parentPalette) override;
143
144 enum TransitionState {
145 NoTransition, EnterTransition, ExitTransition
146 };
147
148 static const QQuickPopup::ClosePolicy DefaultClosePolicy;
149
150 bool focus = false;
151 bool modal = false;
152 bool dim = false;
153 bool hasDim = false;
154 bool visible = false;
155 bool complete = true;
156 bool positioning = false;
157 bool hasWidth = false;
158 bool hasHeight = false;
159 bool hasTopMargin = false;
160 bool hasLeftMargin = false;
161 bool hasRightMargin = false;
162 bool hasBottomMargin = false;
163 bool hasZ = false;
164 bool allowVerticalFlip = false;
165 bool allowHorizontalFlip = false;
166 bool allowVerticalMove = true;
167 bool allowHorizontalMove = true;
168 bool allowVerticalResize = true;
169 bool allowHorizontalResize = true;
170 bool hadActiveFocusBeforeExitTransition = false;
171 bool interactive = true;
172 bool hasClosePolicy = false;
173 bool outsidePressed = false;
174 bool outsideParentPressed = false;
175 bool inDestructor = false;
176 bool relaxEdgeConstraint = false;
177 bool popupWindowDirty = false;
178 QPointer<QQuickItem> lastActiveFocusItem;
179 int touchId = -1;
180 qreal x = 0;
181 qreal y = 0;
182 QPointF effectivePos;
183 qreal margins = -1;
184 qreal topMargin = 0;
185 qreal leftMargin = 0;
186 qreal rightMargin = 0;
187 qreal bottomMargin = 0;
188 QPointF pressPoint;
189 TransitionState transitionState = NoTransition;
190 QQuickPopup::ClosePolicy closePolicy = DefaultClosePolicy;
191 QQuickItem *parentItem = nullptr;
192 QQuickItem *dimmer = nullptr;
193 QPointer<QQuickWindow> window;
194 QQuickTransition *enter = nullptr;
195 QQuickTransition *exit = nullptr;
196 QQuickPopupItem *popupItem = nullptr;
197 QQuickPopupWindow *popupWindow = nullptr;
198 QQuickPopupPositioner *positioner = nullptr;
199 QList<QQuickStateAction> enterActions;
200 QList<QQuickStateAction> exitActions;
201 QQuickPopupTransitionManager transitionManager;
202 QQuickPopupAnchors *anchors = nullptr;
203 qreal explicitDimmerOpacity = 0;
204 qreal prevOpacity = 0;
205 qreal prevScale = 0;
206 QString title;
207 QQuickPopup::PopupType popupType = QQuickPopup::Item;
208 Qt::WindowModality popupWndModality = Qt::NonModal;
209 Qt::WindowFlags windowFlags = Qt::Popup | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint;
210
211 friend class QQuickPopupTransitionManager;
212};
213
214QT_END_NAMESPACE
215
216#endif // QQUICKPOPUP_P_P_H
bool isInteractiveControlType(const QQuickItem *item)
Combined button and popup list for selecting options.
static void layoutItem(QQuickItem *item, qreal y, qreal width)
static const QQuickItemPrivate::ChangeTypes ItemChanges
Styled top-level window with support for a header and footer.
static QQuickItem * findActiveFocusControl(QQuickWindow *window)