1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2017 The Qt Company Ltd. 4 ** Contact: http://www.qt.io/licensing/ 5 ** 6 ** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL3$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see http://www.qt.io/terms-conditions. For further 15 ** information use the contact form at http://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 ** packaging of this file. Please review the following information to 22 ** ensure the GNU Lesser General Public License version 3 requirements 23 ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 ** 25 ** GNU General Public License Usage 26 ** Alternatively, this file may be used under the terms of the GNU 27 ** General Public License version 2.0 or later as published by the Free 28 ** Software Foundation and appearing in the file LICENSE.GPL included in 29 ** the packaging of this file. Please review the following information to 30 ** ensure the GNU General Public License version 2.0 requirements will be 31 ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 ** 33 ** $QT_END_LICENSE$ 34 ** 35 ****************************************************************************/ 36 37 #ifndef QQUICKAPPLICATIONWINDOW_P_H 38 #define QQUICKAPPLICATIONWINDOW_P_H 39 40 // 41 // W A R N I N G 42 // ------------- 43 // 44 // This file is not part of the Qt API. It exists purely as an 45 // implementation detail. This header file may change from version to 46 // version without notice, or even be removed. 47 // 48 // We mean it. 49 // 50 51 #include <QtQuick/private/qquickwindowmodule_p.h> 52 #include <QtQuickTemplates2/private/qtquicktemplates2global_p.h> 53 #include <QtGui/qfont.h> 54 #include <QtGui/qpalette.h> 55 #include <QtCore/qlocale.h> 56 57 QT_BEGIN_NAMESPACE 58 59 class QQuickOverlay; 60 class QQuickApplicationWindowPrivate; 61 class QQuickApplicationWindowAttached; 62 class QQuickApplicationWindowAttachedPrivate; 63 64 class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickApplicationWindow : public QQuickWindowQmlImpl 65 { 66 Q_OBJECT 67 Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL) 68 Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT FINAL) 69 Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func(), QQmlListProperty<QObject> contentData READ contentData FINAL) 70 Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL) 71 Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL) 72 Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL) 73 Q_PROPERTY(QQuickOverlay *overlay READ overlay CONSTANT FINAL) 74 Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL) 75 Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL) 76 // 2.3 (Qt 5.10) 77 Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3) 78 Q_PROPERTY(QQuickItem *menuBar READ menuBar WRITE setMenuBar NOTIFY menuBarChanged FINAL REVISION 3) 79 Q_CLASSINFO("DeferredPropertyNames", "background") 80 Q_CLASSINFO("DefaultProperty", "contentData") 81 82 public: 83 explicit QQuickApplicationWindow(QWindow *parent = nullptr); 84 ~QQuickApplicationWindow(); 85 86 static QQuickApplicationWindowAttached *qmlAttachedProperties(QObject *object); 87 88 QQuickItem *background() const; 89 void setBackground(QQuickItem *background); 90 91 QQuickItem *contentItem() const; 92 93 QQuickItem *activeFocusControl() const; 94 95 QQuickItem *header() const; 96 void setHeader(QQuickItem *header); 97 98 QQuickItem *footer() const; 99 void setFooter(QQuickItem *footer); 100 101 QQuickOverlay *overlay() const; 102 103 QFont font() const; 104 void setFont(const QFont &font); 105 void resetFont(); 106 107 QLocale locale() const; 108 void setLocale(const QLocale &locale); 109 void resetLocale(); 110 111 // 2.3 (Qt 5.10) 112 QPalette palette() const; 113 void setPalette(const QPalette &palette); 114 void resetPalette(); 115 116 QQuickItem *menuBar() const; 117 void setMenuBar(QQuickItem *menuBar); 118 119 Q_SIGNALS: 120 void backgroundChanged(); 121 void activeFocusControlChanged(); 122 void headerChanged(); 123 void footerChanged(); 124 void fontChanged(); 125 void localeChanged(); 126 Q_REVISION(3) void paletteChanged(); 127 Q_REVISION(3) void menuBarChanged(); 128 129 protected: 130 bool isComponentComplete() const; 131 void classBegin() override; 132 void componentComplete() override; 133 void resizeEvent(QResizeEvent *event) override; 134 135 private: 136 Q_DISABLE_COPY(QQuickApplicationWindow) 137 Q_DECLARE_PRIVATE(QQuickApplicationWindow) 138 Q_PRIVATE_SLOT(d_func(), void _q_updateActiveFocus()) 139 QScopedPointer<QQuickApplicationWindowPrivate> d_ptr; 140 }; 141 142 class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickApplicationWindowAttached : public QObject 143 { 144 Q_OBJECT 145 Q_PROPERTY(QQuickApplicationWindow *window READ window NOTIFY windowChanged FINAL) 146 Q_PROPERTY(QQuickItem *contentItem READ contentItem NOTIFY contentItemChanged FINAL) 147 Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL) 148 Q_PROPERTY(QQuickItem *header READ header NOTIFY headerChanged FINAL) 149 Q_PROPERTY(QQuickItem *footer READ footer NOTIFY footerChanged FINAL) 150 Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL) 151 Q_PROPERTY(QQuickItem *menuBar READ menuBar NOTIFY menuBarChanged FINAL) // REVISION 3 152 153 public: 154 explicit QQuickApplicationWindowAttached(QObject *parent = nullptr); 155 156 QQuickApplicationWindow *window() const; 157 QQuickItem *contentItem() const; 158 QQuickItem *activeFocusControl() const; 159 QQuickItem *header() const; 160 QQuickItem *footer() const; 161 QQuickOverlay *overlay() const; 162 QQuickItem *menuBar() const; 163 164 Q_SIGNALS: 165 void windowChanged(); 166 void contentItemChanged(); 167 void activeFocusControlChanged(); 168 void headerChanged(); 169 void footerChanged(); 170 void overlayChanged(); 171 // 2.3 (Qt 5.10) 172 /*Q_REVISION(3)*/ void menuBarChanged(); 173 174 private: 175 Q_DISABLE_COPY(QQuickApplicationWindowAttached) 176 Q_DECLARE_PRIVATE(QQuickApplicationWindowAttached) 177 }; 178 179 QT_END_NAMESPACE 180 181 QML_DECLARE_TYPE(QQuickApplicationWindow) 182 QML_DECLARE_TYPEINFO(QQuickApplicationWindow, QML_HAS_ATTACHED_PROPERTIES) 183 184 #endif // QQUICKAPPLICATIONWINDOW_P_H 185