File indexing completed on 2024-04-21 05:30:53

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 
0012 //
0013 //  W A R N I N G
0014 //  -------------
0015 //
0016 // This file is not part of the public Plasma API.  It exists purely as an
0017 // implementation detail.  This header file may change from version to
0018 // version without notice, or even be removed.
0019 //
0020 // We mean it.
0021 //
0022 
0023 namespace Plasma {
0024 class Applet;
0025 }
0026 
0027 namespace PlasmaQuick {
0028 
0029 class ConfigViewPrivate;
0030 
0031 class ConfigModel;
0032 
0033 class ConfigView : public QQuickView
0034 {
0035     Q_OBJECT
0036     Q_PROPERTY(PlasmaQuick::ConfigModel *configModel READ configModel CONSTANT)
0037     Q_PROPERTY(QString appletGlobalShortcut READ appletGlobalShortcut WRITE setAppletGlobalShortcut NOTIFY appletGlobalShortcutChanged)
0038 
0039 public:
0040     /**
0041      * @param applet the applet of this ConfigView
0042      * @param parent the QWindow in which this ConfigView is parented to
0043      **/
0044     ConfigView(Plasma::Applet *applet, QWindow *parent = 0);
0045     ~ConfigView() override;
0046 
0047     virtual void init();
0048 
0049     Plasma::Applet *applet();
0050 
0051     QString appletGlobalShortcut() const;
0052     void setAppletGlobalShortcut(const QString &shortcut);
0053 
0054     /**
0055      * @return the ConfigModel of the ConfigView
0056      **/
0057     PlasmaQuick::ConfigModel *configModel() const;
0058 
0059 Q_SIGNALS:
0060     void appletGlobalShortcutChanged();
0061 
0062 protected:
0063     void hideEvent(QHideEvent *ev) override;
0064     void resizeEvent(QResizeEvent *re) override;
0065 
0066 private:
0067     ConfigViewPrivate *const d;
0068 
0069     Q_PRIVATE_SLOT(d, void updateMinimumWidth())
0070     Q_PRIVATE_SLOT(d, void updateMinimumHeight())
0071     Q_PRIVATE_SLOT(d, void updateMaximumWidth())
0072     Q_PRIVATE_SLOT(d, void updateMaximumHeight())
0073 };
0074 
0075 }
0076 
0077 #endif // multiple inclusion guard