property aus QtObject neu initialisieren (QML)
Solved
German
-
Hallo Zusammen,
folgende Datei habe ich:
QtObject { property QtObject darkBg: QtObject { readonly property color backgroundNormalColor: "green" readonly property color textNormalColor: "red" readonly property url normalImage: "" .... readonly property color backgroundSelectedColor: "yellow" readonly property color textSelectedColor: ... readonly property url selectedImage: "" readonly property int width: 50 readonly property int normalHeight: 45 readonly property int depressedHeight: 48 readonly property int contentDisplay: contentDisplayType.textOnly readonly property font font: ... } property QtObject lightBg: QtObject { ...... } property QtObject blueBg: QtObject { readonly property color textGhostedColor: "green" readonly property color focusFrameGhostedColor: "blue" } readonly property QtObject contentDisplayType: QtObject { property int textOnly : 0 // Display the text only property int imageOnly : 1 // Display the image only property int textAndImage : 2 // Display the text and the image } }
in diesen datei werde alle möglische Farben, was einen Button haben kann, definiert.
meine Frage: Wie kann ich z.b auf den font oder normalHeight um einen neue Value zuzuweisen?Danke
-
@J-Hilk
danke für die Antwort.
Wenn ich den readonly weglasse, wie greife ich den auf einzelne Property?folgende habe ich versucht: wenn die Buttons einen lightBg haben sollen, dann habe ich folgende gemacht:
property QtObject buttonStyle: QQtButtonStyle.lightBg
aber wenn ich z.b nur den normalHeight neue Value zuweisen möchte: Wie tue ich das?
Danke
-
wenn ich so was habe:
property QtObject buttonStyle: QQtButtonStyle.lightBg
dann versuche ich auf die Property in der QObject zugreifen (einfach auslesen) --> Das geht nicht Warum?
Ich bekomme die Fehlermeldung: Es sei:
Unable to assign [undefined] to QColor
Das verstehe ich nicht!!!