File indexing completed on 2024-12-15 03:45:05

0001 /*
0002     SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_QMLPROPERTYRATIOSOURCE_H
0008 #define KUSERFEEDBACK_QMLPROPERTYRATIOSOURCE_H
0009 
0010 #include "qmlabstractdatasource.h"
0011 
0012 namespace KUserFeedback {
0013 
0014 class PropertyRatioSource;
0015 
0016 class QmlPropertyRatioSource : public QmlAbstractDataSource
0017 {
0018     Q_OBJECT
0019     Q_PROPERTY(QString sourceId READ sourceId WRITE setSourceId NOTIFY changed)
0020     Q_PROPERTY(QString name READ name WRITE setName NOTIFY changed)
0021     Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY changed)
0022     Q_PROPERTY(QObject* object READ object WRITE setObject NOTIFY changed)
0023     Q_PROPERTY(QString propertyName READ propertyName WRITE setPropertyName NOTIFY changed)
0024 public:
0025     explicit QmlPropertyRatioSource(QObject *parent = nullptr);
0026     ~QmlPropertyRatioSource() override;
0027 
0028     QString sourceId() const;
0029     void setSourceId(const QString &id);
0030 
0031     QString name() const;
0032     void setName(const QString &name);
0033 
0034     QString description() const;
0035     void setDescription(const QString &desc);
0036 
0037     QObject* object() const;
0038     void setObject(QObject *object);
0039 
0040     QString propertyName() const;
0041     void setPropertyName(const QString &name);
0042 
0043     Q_INVOKABLE void addValueMapping(const QVariant &value, const QString &name);
0044 
0045 Q_SIGNALS:
0046     void changed();
0047 
0048 private:
0049     PropertyRatioSource* prSrc() const;
0050 };
0051 
0052 }
0053 
0054 #endif // KUSERFEEDBACK_QMLPROPERTYRATIOSOURCE_H