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)
prSrc()->setPropertyName(name);
emit changed();
}
void QmlPropertyRatioSource::addValueMapping(const QVariant& value, const QString& name)
{
prSrc()->addValueMapping(value, name);
}
......@@ -47,6 +47,8 @@ public:
QString propertyName() const;
void setPropertyName(const QString &name);
Q_INVOKABLE void addValueMapping(const QVariant &value, const QString &name);
Q_SIGNALS:
void changed();
......
......@@ -68,6 +68,11 @@ ApplicationWindow {
name: "dialRatio"
propertyName: "intValue"
description: qsTr("The dial position.")
Component.onCompleted: {
dialRatioSource.addValueMapping(0, "off");
dialRatioSource.addValueMapping(11, "max");
}
}
}
......@@ -111,12 +116,12 @@ ApplicationWindow {
id: dial
Layout.fillWidth: true
from: 0
to: 10
to: 11
stepSize: 1
Component.onCompleted: dialRatioSource.object = dial
}
Settings {
property alias sliderValue: dial.value
property alias dialValue: dial.value
}
Button {
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