| 1 | // Copyright (C) 2025 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_P_H |
| 5 | #define QQUICKAPPLICATIONWINDOW_P_P_H |
| 6 | |
| 7 | #include <QtQuick/private/qquickitemchangelistener_p.h> |
| 8 | #include <QtQuick/private/qquickwindowmodule_p_p.h> |
| 9 | #include <QtQuickTemplates2/private/qquickapplicationwindow_p.h> |
| 10 | #include <QtQuickTemplates2/private/qquickcontrol_p.h> |
| 11 | #include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h> |
| 12 | #include <QtQuickTemplates2/private/qquickpopup_p_p.h> |
| 13 | #include <QtQuickTemplates2/private/qquicktheme_p.h> |
| 14 | #include <QtQuickTemplates2/private/qquicktooltip_p.h> |
| 15 | |
| 16 | // |
| 17 | // W A R N I N G |
| 18 | // ------------- |
| 19 | // |
| 20 | // This file is not part of the Qt API. It exists purely as an |
| 21 | // implementation detail. This header file may change from version to |
| 22 | // version without notice, or even be removed. |
| 23 | // |
| 24 | // We mean it. |
| 25 | // |
| 26 | |
| 27 | QT_BEGIN_NAMESPACE |
| 28 | |
| 29 | class Q_QUICKTEMPLATES2_EXPORT QQuickApplicationWindowPrivate |
| 30 | : public QQuickWindowQmlImplPrivate |
| 31 | , public QSafeQuickItemChangeListener<QQuickApplicationWindowPrivate> |
| 32 | { |
| 33 | Q_DECLARE_PUBLIC(QQuickApplicationWindow) |
| 34 | |
| 35 | public: |
| 36 | static QQuickApplicationWindowPrivate *get(QQuickApplicationWindow *window) |
| 37 | { |
| 38 | return window->d_func(); |
| 39 | } |
| 40 | |
| 41 | QQmlListProperty<QObject> contentData(); |
| 42 | |
| 43 | void updateHasBackgroundFlags(); |
| 44 | void relayout(); |
| 45 | |
| 46 | void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override; |
| 47 | void itemVisibilityChanged(QQuickItem *item) override; |
| 48 | void itemImplicitWidthChanged(QQuickItem *item) override; |
| 49 | void itemImplicitHeightChanged(QQuickItem *item) override; |
| 50 | QPalette windowPalette() const override { return defaultPalette(); } |
| 51 | |
| 52 | void updateFont(const QFont &f); |
| 53 | inline void setFont_helper(const QFont &f) { |
| 54 | if (font.resolveMask() == f.resolveMask() && font == f) |
| 55 | return; |
| 56 | updateFont(f); |
| 57 | } |
| 58 | void resolveFont(); |
| 59 | |
| 60 | void _q_updateActiveFocus(); |
| 61 | void setActiveFocusControl(QQuickItem *item); |
| 62 | |
| 63 | static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj); |
| 64 | |
| 65 | void cancelBackground(); |
| 66 | void executeBackground(bool complete = false); |
| 67 | |
| 68 | QPalette defaultPalette() const override { return QQuickTheme::palette(scope: QQuickTheme::System); } |
| 69 | void updateChildrenPalettes(const QPalette &parentPalette) override |
| 70 | { |
| 71 | // Update regular children |
| 72 | QQuickWindowPrivate::updateChildrenPalettes(parentPalette); |
| 73 | |
| 74 | // And cover special cases |
| 75 | for (auto &&child : q_func()->findChildren<QObject *>()) { |
| 76 | if (auto *popup = qobject_cast<QQuickPopup *>(object: child)) |
| 77 | QQuickPopupPrivate::get(popup)->updateContentPalettes(parentPalette); |
| 78 | else if (auto *toolTipAttached = qobject_cast<QQuickToolTipAttached *>(object: child)) { |
| 79 | if (auto *toolTip = toolTipAttached->toolTip()) |
| 80 | QQuickPopupPrivate::get(popup: toolTip)->updateContentPalettes(parentPalette); |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | QQuickDeferredPointer<QQuickItem> background; |
| 86 | QQuickControl *control = nullptr; |
| 87 | QQuickItem *menuBar = nullptr; |
| 88 | QQuickItem *header = nullptr; |
| 89 | QQuickItem *footer = nullptr; |
| 90 | QFont font; |
| 91 | QLocale locale; |
| 92 | QQuickItem *activeFocusControl = nullptr; |
| 93 | bool insideRelayout = false; |
| 94 | bool hasBackgroundWidth = false; |
| 95 | bool hasBackgroundHeight = false; |
| 96 | }; |
| 97 | |
| 98 | QT_END_NAMESPACE |
| 99 | |
| 100 | #endif // QQUICKAPPLICATIONWINDOW_P_P_H |
| 101 |
