Hi Matthias,
Could you be more specific about what you are trying to create? I was
unable to understand the hierarchy of your elements i.e.:
> [BaseScreen] <----- [SomePartScreen] <----- [MainScreen]
> <----- [AboutScreen]
>
> <----- [OtherPartScreen] <----- [...Screen]
Do you mean that AboutScreen should "inherit" MainScreen? Without any
additional information, this design sounds a bit weird. What
properties of BaseScreen should SomePartScreen, MainScreen etc. use?
> If I want to put a rectangle between rectOne and rectTwo in a further
> "derived"
> screen (e.g. AboutScreen), I need access to at least one of their anchor
> properties.
> Unfortunately due to the way QML is designed, I cannot access the childs of
> my parent
> class.
The base (or parent) class (or element) when "inherited" does not have
children per se (afaik, if someone has more accurate info on this,
please let me know :). If you "inherit" a element in qml like you
explaned in your message, the children of the base element are same as
the children of the derived element. E.g. consider the following:
BaseScreen.qml:
Item {
Rectangle {
id: childRect
}
}
SomePartScreen.qml:
BaseScreen {
// children[0] here should point to childRect
}
If you define other children in SomePartScreen.qml inside the
BaseScreen, the children of the BaseScreen will be replaced with that
content.
This might be a long shot, but from what I understood from your
message, you might be trying to create a container component. If this
is the case, you might want to take a look at this thread:
http://www.developer.nokia.com/Community/Discussion/showthread.php?234457-How-to-create-container-in-qml&p=889467#post889467
Using the method described in the post you can add a Item between the
two rectangles you have in SomePartScreen.qml, anchor that Item to the
Rectangles and add a property to the root element (BaseScreen):
SomePartScreen.qml:
BaseScreen {
property alias content: contentItem.children
Rectangle {
id: rectOne
anchors.left: parent.left
}
Item {
id: contentItem
anchors.left: rectOne.right
anchors.right: rectTwo.left
}
Rectangle {
id: rectTwo
anchors.right: parent.right
}
}
Please notice also the use of the anchors in the example.
Hope this helps to solve your problem. If not, please send some
additional info describing the issue in further detail.
BR,
Miko Kiiski
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml