For example, I have two different QML elements with a common property, for example:
import QtQuick 2.0 Rectangle { width: 360 height: 360 Text { id: t color: "red" text: qsTr("Hello World") anchors.top: parent.top } TextInput { text: qsTr("Hello all!") color: "red" anchors.top: t.bottom } }
You can see that Text and TextInput have an equal property called "color" with equal value.
In QSS, I can use the general value of a property, for example:
QWidget { background: "red" }
and all QWidgets belonging to the qss widget will also have a red background.
Is it possible to set a common property in QML?
source share