File indexing completed on 2025-03-09 05:02:41
0001 /* 0002 SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef CONFIGVIEW_H 0008 #define CONFIGVIEW_H 0009 0010 #include <QQuickView> 0011 #include <QScopedPointer> 0012 0013 #include <plasmaquick/plasmaquick_export.h> 0014 #include <qquickitem.h> 0015 0016 // 0017 // W A R N I N G 0018 // ------------- 0019 // 0020 // This file is not part of the public Plasma API. It exists purely as an 0021 // implementation detail. This header file may change from version to 0022 // version without notice, or even be removed. 0023 // 0024 // We mean it. 0025 // 0026 0027 namespace Plasma 0028 { 0029 class Applet; 0030 } 0031 0032 namespace PlasmaQuick 0033 { 0034 class ConfigViewPrivate; 0035 0036 class ConfigModel; 0037 0038 class PLASMAQUICK_EXPORT ConfigView : public QQuickWindow 0039 { 0040 Q_OBJECT 0041 Q_PROPERTY(PlasmaQuick::ConfigModel *configModel READ configModel CONSTANT) 0042 Q_PROPERTY(QString appletGlobalShortcut READ appletGlobalShortcut WRITE setAppletGlobalShortcut NOTIFY appletGlobalShortcutChanged) 0043 0044 public: 0045 /** 0046 * @param applet the applet of this ConfigView 0047 * @param parent the QWindow in which this ConfigView is parented to 0048 **/ 0049 ConfigView(Plasma::Applet *applet, QWindow *parent = nullptr); 0050 ~ConfigView() override; 0051 0052 QQmlEngine *engine(); 0053 QQmlContext *rootContext(); 0054 void setSource(const QUrl &src); 0055 QQuickItem *rootObject(); 0056 0057 virtual void init(); 0058 0059 Plasma::Applet *applet(); 0060 0061 QString appletGlobalShortcut() const; 0062 void setAppletGlobalShortcut(const QString &shortcut); 0063 0064 /** 0065 * @return the ConfigModel of the ConfigView 0066 **/ 0067 PlasmaQuick::ConfigModel *configModel() const; 0068 0069 Q_SIGNALS: 0070 void appletGlobalShortcutChanged(); 0071 0072 protected: 0073 void hideEvent(QHideEvent *ev) override; 0074 void resizeEvent(QResizeEvent *re) override; 0075 0076 private: 0077 QScopedPointer<ConfigViewPrivate> const d; 0078 0079 Q_PRIVATE_SLOT(d, void updateMinimumWidth()) 0080 Q_PRIVATE_SLOT(d, void updateMinimumHeight()) 0081 Q_PRIVATE_SLOT(d, void updateMaximumWidth()) 0082 Q_PRIVATE_SLOT(d, void updateMaximumHeight()) 0083 }; 0084 0085 } 0086 0087 #endif // multiple inclusion guard