Commit 539c023b authored by Volker Krause's avatar Volker Krause
Browse files

Also make PropertyRatioSource::addValueMapping usable via QML

parent e88f0d21
...@@ -86,3 +86,8 @@ void QmlPropertyRatioSource::setPropertyName(const QString& name) ...@@ -86,3 +86,8 @@ void QmlPropertyRatioSource::setPropertyName(const QString& name)
prSrc()->setPropertyName(name); prSrc()->setPropertyName(name);
emit changed(); emit changed();
} }
void QmlPropertyRatioSource::addValueMapping(const QVariant& value, const QString& name)
{
prSrc()->addValueMapping(value, name);
}
...@@ -47,6 +47,8 @@ public: ...@@ -47,6 +47,8 @@ public:
QString propertyName() const; QString propertyName() const;
void setPropertyName(const QString &name); void setPropertyName(const QString &name);
Q_INVOKABLE void addValueMapping(const QVariant &value, const QString &name);
Q_SIGNALS: Q_SIGNALS:
void changed(); void changed();
......
...@@ -68,6 +68,11 @@ ApplicationWindow { ...@@ -68,6 +68,11 @@ ApplicationWindow {
name: "dialRatio" name: "dialRatio"
propertyName: "intValue" propertyName: "intValue"
description: qsTr("The dial position.") description: qsTr("The dial position.")
Component.onCompleted: {
dialRatioSource.addValueMapping(0, "off");
dialRatioSource.addValueMapping(11, "max");
}
} }
} }
...@@ -111,12 +116,12 @@ ApplicationWindow { ...@@ -111,12 +116,12 @@ ApplicationWindow {
id: dial id: dial
Layout.fillWidth: true Layout.fillWidth: true
from: 0 from: 0
to: 10 to: 11
stepSize: 1 stepSize: 1
Component.onCompleted: dialRatioSource.object = dial Component.onCompleted: dialRatioSource.object = dial
} }
Settings { Settings {
property alias sliderValue: dial.value property alias dialValue: dial.value
} }
Button { Button {
id: submitButton id: submitButton
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment