1/*
2 SPDX-FileCopyrightText: 2020-2023 Alexander Lohnau <alexander.lohnau@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef KNEWSTUFF_QTQUICKDIALOGWRAPPER_H
8#define KNEWSTUFF_QTQUICKDIALOGWRAPPER_H
9
10#include <KNSCore/Entry>
11#include <KNSCore/ErrorCode>
12#include <QDialog>
13
14#include "knewstuffwidgets_export.h"
15
16namespace KNSCore
17{
18class EngineBase;
19};
20
21namespace KNSWidgets
22{
23class DialogPrivate;
24/**
25 * @class Dialog dialog.h <KNSWidgets/Dialog>
26 *
27 * This class is a wrapper around the QtQuick QML dialog. This dialog content is loaded QQuickWidget.
28 * It is recommended to reuse an instance of this class if it is expected that the user reopens the dialog.
29 * For most usecases, you should use KNSWidgets::Button or KNSWidgets::Action directly.
30 *
31 * @since 6.0
32 */
33class KNEWSTUFFWIDGETS_EXPORT Dialog : public QDialog
34{
35 Q_OBJECT
36
37public:
38 /**
39 * Constructs a new Dialog for the given config file and parent widget
40 */
41 explicit Dialog(const QString &configFile, QWidget *parent = nullptr);
42 ~Dialog() override;
43
44 /**
45 * Engine that is used by the dialog, might be null if the engine failed to initialize.
46 * @return KNSCore::EngineBase used by the dialog
47 */
48 KNSCore::EngineBase *engine();
49
50 /**
51 * Entries that were changed while the user interacted with the dialog
52 * @since 5.94
53 */
54 QList<KNSCore::Entry> changedEntries() const;
55
56 void open() override;
57
58private:
59 Q_PRIVATE_SLOT(d, void onEntryEvent(const KNSCore::Entry &entry, KNSCore::Entry::EntryEvent event))
60 const std::unique_ptr<DialogPrivate> d;
61
62 Q_DISABLE_COPY(Dialog)
63};
64}
65
66#endif // KNEWSTUFF_QTQUICKDIALOGWRAPPER_H
67

source code of knewstuff/src/widgets/dialog.h