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
qquickapplicationwindow_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 QQUICKAPPLICATIONWINDOW_P_H
6#define QQUICKAPPLICATIONWINDOW_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 <QtQuick/private/qquickwindowmodule_p.h>
20#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
21#include <QtQuickTemplates2/private/qquickcontentitem_p.h>
22#include <QtGui/qfont.h>
23#include <QtGui/qpalette.h>
24#include <QtCore/qlocale.h>
25
26QT_BEGIN_NAMESPACE
27
28class QQuickApplicationWindowPrivate;
29class QQuickApplicationWindowAttached;
31class QQuickControl;
32
33class Q_QUICKTEMPLATES2_EXPORT QQuickApplicationWindow : public QQuickWindowQmlImpl
34{
35 Q_OBJECT
36 Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
37 Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT FINAL)
38 Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func(), QQmlListProperty<QObject> contentData READ contentData FINAL)
39 Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
40 Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
41 Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
42 Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
43 Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
44 // 2.3 (Qt 5.10)
45 Q_PROPERTY(QQuickItem *menuBar READ menuBar WRITE setMenuBar NOTIFY menuBarChanged FINAL REVISION(2, 3))
46 // 2.14 (Qt 6)
47 Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func(), QQuickPalette *palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged REVISION(2, 3))
48
49 Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func()->control,
50 qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL REVISION(6, 9))
51 Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func()->control,
52 qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL REVISION(6, 9))
53 Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func()->control,
54 qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL REVISION(6, 9))
55 Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func()->control,
56 qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL REVISION(6, 9))
57
58 Q_CLASSINFO("DeferredPropertyNames", "background")
59 Q_CLASSINFO("DefaultProperty", "contentData")
60 QML_NAMED_ELEMENT(ApplicationWindow)
61 QML_ADDED_IN_VERSION(2, 0)
62 QML_ATTACHED(QQuickApplicationWindowAttached)
63
64public:
65 explicit QQuickApplicationWindow(QWindow *parent = nullptr);
66 ~QQuickApplicationWindow();
67
68 static QQuickApplicationWindowAttached *qmlAttachedProperties(QObject *object);
69
70 QQuickItem *background() const;
71 void setBackground(QQuickItem *background);
72
73 QQuickItem *contentItem() const;
74
75 QQuickItem *activeFocusControl() const;
76
77 QQuickItem *header() const;
78 void setHeader(QQuickItem *header);
79
80 QQuickItem *footer() const;
81 void setFooter(QQuickItem *footer);
82
83 QFont font() const;
84 void setFont(const QFont &font);
85 void resetFont();
86
87 QLocale locale() const;
88 void setLocale(const QLocale &locale);
89 void resetLocale();
90
91 QQuickItem *menuBar() const;
92 void setMenuBar(QQuickItem *menuBar);
93
94Q_SIGNALS:
95 void backgroundChanged();
96 void activeFocusControlChanged();
97 void headerChanged();
98 void footerChanged();
99 void fontChanged();
100 void localeChanged();
101 Q_REVISION(2, 3) void menuBarChanged();
102
103 Q_REVISION(6, 9) void topPaddingChanged();
104 Q_REVISION(6, 9) void leftPaddingChanged();
105 Q_REVISION(6, 9) void rightPaddingChanged();
106 Q_REVISION(6, 9) void bottomPaddingChanged();
107
108protected:
109 bool isComponentComplete() const;
110 void classBegin() override;
111 void componentComplete() override;
112 void resizeEvent(QResizeEvent *event) override;
113
114private:
115 Q_DISABLE_COPY(QQuickApplicationWindow)
116 Q_DECLARE_PRIVATE(QQuickApplicationWindow)
117
118 Q_PRIVATE_SLOT(d_func(), void _q_updateActiveFocus())
119};
120
121class Q_QUICKTEMPLATES2_EXPORT QQuickApplicationWindowAttached : public QObject
122{
123 Q_OBJECT
124 Q_PROPERTY(QQuickApplicationWindow *window READ window NOTIFY windowChanged FINAL)
125 Q_PROPERTY(QQuickItem *contentItem READ contentItem NOTIFY contentItemChanged FINAL)
126 Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
127 Q_PROPERTY(QQuickItem *header READ header NOTIFY headerChanged FINAL)
128 Q_PROPERTY(QQuickItem *footer READ footer NOTIFY footerChanged FINAL)
129 Q_PROPERTY(QQuickItem *menuBar READ menuBar NOTIFY menuBarChanged FINAL) // REVISION(2, 3)
130
131public:
132 explicit QQuickApplicationWindowAttached(QObject *parent = nullptr);
133
134 QQuickApplicationWindow *window() const;
135 QQuickItem *contentItem() const;
136 QQuickItem *activeFocusControl() const;
137 QQuickItem *header() const;
138 QQuickItem *footer() const;
139 QQuickItem *menuBar() const;
140
141Q_SIGNALS:
142 void windowChanged();
143 void contentItemChanged();
144 void activeFocusControlChanged();
145 void headerChanged();
146 void footerChanged();
147 // 2.3 (Qt 5.10)
148 /*Q_REVISION(2, 3)*/ void menuBarChanged();
149
150private:
151 Q_DISABLE_COPY(QQuickApplicationWindowAttached)
152 Q_DECLARE_PRIVATE(QQuickApplicationWindowAttached)
153};
154
155QT_END_NAMESPACE
156
157#endif // QQUICKAPPLICATIONWINDOW_P_H
bool isInteractiveControlType(const QQuickItem *item)
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)