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