KGuiAddons

kwindowinsetscontroller.h
1// SPDX-FileCopyrightText: 2024 Mathis BrĂ¼chert <mbb@kaidan.im>
2// SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
3// SPDX-License-Identifier: LGPL-2.0-or-later
4
5#ifndef KWINDOWINSETSCONTROLLER_H
6#define KWINDOWINSETSCONTROLLER_H
7
8#include "kguiaddons_export.h"
9
10#include <QColor>
11#include <QObject>
12
13#include <memory>
14
15class KWindowInsetsControllerPrivate;
16
17/** Access to window insets colors.
18 *
19 * On most platforms this does nothing, on Android it allows
20 * to customize the (top) status bar and (botton) navigation bar
21 * background colors, e.g. to match the current window or application
22 * colors.
23 *
24 * Note that the foreground colors on Android are automatically
25 * chosen based on the background color.
26 *
27 * @code
28 * Component.onComplete: {
29 * WindowInsetsController.statusBarBackgroundColor = Kirigami.Theme.backgroundColor;
30 * WindowInsetsController.navigationBarBackgroundColor = Kirigami.Theme.backgroundColor;
31 * }
32 * @endcode
33 *
34 * @since 6.7
35 */
36class KGUIADDONS_EXPORT KWindowInsetsController : public QObject
37{
38 Q_OBJECT
39 /** Background color of the status bar. */
40 Q_PROPERTY(QColor statusBarBackgroundColor READ statusBarBackgroundColor WRITE setStatusBarBackgroundColor NOTIFY statusBarBackgroundColorChanged)
41 /** Background color of the navigation bar. */
42 Q_PROPERTY(
43 QColor navigationBarBackgroundColor READ navigationBarBackgroundColor WRITE setNavigationBarBackgroundColor NOTIFY navigationBarBackgroundColorChanged)
44
45public:
46 explicit KWindowInsetsController(QObject *parent = nullptr);
48
49 [[nodiscard]] QColor statusBarBackgroundColor() const;
50 void setStatusBarBackgroundColor(const QColor &color);
51
52 [[nodiscard]] QColor navigationBarBackgroundColor() const;
53 void setNavigationBarBackgroundColor(const QColor &color);
54
55Q_SIGNALS:
56 void statusBarBackgroundColorChanged();
57 void navigationBarBackgroundColorChanged();
58
59private:
60 std::unique_ptr<KWindowInsetsControllerPrivate> d;
61};
62
63#endif // KWINDOWINSETSCONTROLLER_H
Access to window insets colors.
Q_PROPERTY(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:05:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.