Kirigami-addons

kwindowstatesaverquick.h
1// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
2// SPDX-License-Identifier: LGPL-2.0-or-later
3
4#ifndef KWINDOWSTATESAVER_QUICK_H
5#define KWINDOWSTATESAVER_QUICK_H
6
7#include <QQmlEngine>
8
9/**
10 * @brief Creates a @c KWindowStateSaver in QML, and assigns it to the window it's parented to.
11 *
12 * Functions exactly as KWindowStateSaver in C++, as it's a small wrapper around it.
13 *
14 * @code
15 * import org.kde.config as KConfig
16 *
17 * Kirigami.ApplicationWindow {
18 * id: root
19 *
20 * title: i18n("My Window")
21 *
22 * KConfig.WindowStateSaver {
23 * configGroupName: "Main"
24 * }
25 * }
26 * @endcode
27 * @since 6.5
28 *
29 * @sa KWindowStateSaver
30 *
31 * @internal Copy from KConfig, to remove when KConfig 6.5 is released
32 */
34{
36 QML_ELEMENT
37 QML_NAMED_ELEMENT(WindowStateSaver)
39
40 Q_PROPERTY(QString configGroupName READ configGroupName WRITE setConfigGroupName NOTIFY configGroupNameChanged REQUIRED)
41
42public:
43 void classBegin() override;
44 void componentComplete() override;
45
46 void setConfigGroupName(const QString &name);
47 QString configGroupName() const;
48
50 void configGroupNameChanged();
51
52private:
53 QString m_configGroupName;
54};
55
56#endif
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:54:39 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.