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 * \qmltype WindowStateSaver
11 * \inqmlmodule org.kde.config
12 *
13 * \brief Creates a KWindowStateSaver in QML, and assigns it to the window it's parented to.
14 *
15 * Functions exactly as KWindowStateSaver in C++, as it's a small wrapper around it.
16 *
17 * \code
18 * import org.kde.config as KConfig
19 *
20 * Kirigami.ApplicationWindow {
21 * id: root
22 *
23 * title: i18n("My Window")
24 *
25 * KConfig.WindowStateSaver {
26 * configGroupName: "Main"
27 * }
28 * }
29 * \endcode
30 * \since 6.5
31 *
32 * \sa KWindowStateSaver
33 */
34class KWindowStateSaverQuick : public QObject, public QQmlParserStatus
35{
36 Q_OBJECT
37 QML_ELEMENT
38 QML_NAMED_ELEMENT(WindowStateSaver)
39 Q_INTERFACES(QQmlParserStatus)
40
41 /*!
42 * \qmlproperty string WindowStateSaver::configGroupName
43 */
44 Q_PROPERTY(QString configGroupName READ configGroupName WRITE setConfigGroupName NOTIFY configGroupNameChanged REQUIRED)
45
46public:
47 void classBegin() override;
48 void componentComplete() override;
49
50 void setConfigGroupName(const QString &name);
51 QString configGroupName() const;
52
53Q_SIGNALS:
54 void configGroupNameChanged();
55
56private:
57 QString m_configGroupName;
58};
59
60#endif
61

source code of kconfig/src/qml/kwindowstatesaverquick.h