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 #include "qmlpropertyratiosource.h" 0008 0009 #include <KUserFeedback/PropertyRatioSource> 0010 0011 using namespace KUserFeedback; 0012 0013 QmlPropertyRatioSource::QmlPropertyRatioSource(QObject* parent) 0014 : QmlAbstractDataSource(new PropertyRatioSource(nullptr, nullptr, QString()), parent) 0015 { 0016 } 0017 0018 QmlPropertyRatioSource::~QmlPropertyRatioSource() 0019 { 0020 } 0021 0022 PropertyRatioSource* QmlPropertyRatioSource::prSrc() const 0023 { 0024 return static_cast<PropertyRatioSource*>(source()); 0025 } 0026 0027 QString QmlPropertyRatioSource::sourceId() const 0028 { 0029 return source()->id(); 0030 } 0031 0032 void QmlPropertyRatioSource::setSourceId(const QString& id) 0033 { 0034 if (source()->id() == id) 0035 return; 0036 prSrc()->setId(id); 0037 Q_EMIT changed(); 0038 } 0039 0040 QString QmlPropertyRatioSource::name() const 0041 { 0042 return prSrc()->name(); 0043 } 0044 0045 void QmlPropertyRatioSource::setName(const QString& name) 0046 { 0047 if (prSrc()->name() == name) { 0048 return; 0049 } 0050 prSrc()->setName(name); 0051 Q_EMIT changed(); 0052 } 0053 0054 QString QmlPropertyRatioSource::description() const 0055 { 0056 return prSrc()->description(); 0057 } 0058 0059 void QmlPropertyRatioSource::setDescription(const QString& desc) 0060 { 0061 if (description() == desc) 0062 return; 0063 prSrc()->setDescription(desc); 0064 Q_EMIT changed(); 0065 } 0066 0067 QObject* QmlPropertyRatioSource::object() const 0068 { 0069 return prSrc()->object(); 0070 } 0071 0072 void QmlPropertyRatioSource::setObject(QObject* object) 0073 { 0074 if (prSrc()->object() == object) 0075 return; 0076 prSrc()->setObject(object); 0077 Q_EMIT changed(); 0078 } 0079 0080 QString QmlPropertyRatioSource::propertyName() const 0081 { 0082 return prSrc()->propertyName(); 0083 } 0084 0085 void QmlPropertyRatioSource::setPropertyName(const QString& name) 0086 { 0087 if (propertyName() == name) 0088 return; 0089 prSrc()->setPropertyName(name); 0090 Q_EMIT changed(); 0091 } 0092 0093 void QmlPropertyRatioSource::addValueMapping(const QVariant& value, const QString& name) 0094 { 0095 prSrc()->addValueMapping(value, name); 0096 } 0097 0098 #include "moc_qmlpropertyratiosource.cpp"