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

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