Actually, an interesting idea is to remove the keyboard’s specific implementation of their keyboard delegate and place it into a different file, then the properties will be correctly inherited:
// library land
// Bluekey.qml
KeyboardButton
{
text: value;
value: key
shiftValue: key
style: keyboard.style; width: buttonWidth; height: buttonHeight;
onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton;
shiftTextFontSize: keyboard.shiftTextFontSize;
shiftTextFontFamily: keyboard.shiftTextFontFamily;
shiftTextFontWeight: keyboard.shiftTextFontWeight;
shiftTextColor: keyboard.shiftTextColor
}
// bluekeyboard.qml
Rectangle
{
id: keyboard
// bunch of properties
....
property Component keyboardDelegate: Bluekey { }
Repeater {
model: myModel
Loader {
property string key: myModel.get(index).key
sourceComponent: keyboardDelegate
}
}
}
// user land
//main.qml
Rectangle
{
property Component buttonDelegate:
Bluekey
{
color: key == "E" ? "red" : "blue"
}
Keyboard
{
keyboardDelegate: buttonDelegate
}
}
Any feedback on this?
Thanks for the suggestions Jens!
↧