Hi all,
I'm trying to create a reusable component for a button. Right now I'm
trying to figure out focus handling (the app is keyboard navigation
only).
I currently have the following structure (Button.qml):
Rectangle {
id: button
property alias text: text.text
property alias textPixelSize: text.font.pixelSize
width: text.implicitWidth
height: text.implicitHeight
Text {
id: text
...
}
}
Where I'm exposing the text and pixelSize properties of the text by
using property aliases, to be able to use it like:
Button {
text: "Foo bar"
textPixelSize: 42
}
This works fine. But now I'd like the component to be able to
participate in focus handling, so I wrap it in a FocusScope, e.g:
FocusScope {
Rectangle {
id: button
focus: true
property alias text: text.text
property alias textPixelSize: text.font.pixelSize
width: text.implicitWidth
height: text.implicitHeight
Text {
id: text
...
}
}
}
Which should allow me to use it in other nested focus scopes at a
higher level in the visual tree
The problem now is that I must expose the button.text and
button.textPixelSize in the FocusScope, to be able to use the
component as before. But I can't use property aliases again, since a
property alias may not refer to another property alias.
Anyone know how I can get around this?
Thanks in advance,
Elvis
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest