On Tuesday 05 November 2013 06:48:11 Alan Alpert wrote:
> I'm surprised this works. There's implicit QObject parenting built
> into the language, for example:
> QtObject {
> id: foo
> property Widget bar: Widget{}
> }
>
> Will automatically make foo the qobject parent of bar.
Correct, this example aborts. But not where you expect: it is caught in the
DeclarativeWidgets lib itself.
$ ./declarativewidgets test.qml
Root Element is neither an AbstractDeclarativeObject nor a widget
Aborted
> I'm not certain, but I think this happens before it gets assigned to
> the property which might make any declarative widgets example using
> layouts crash in debug builds...
There is a lot of code handling layouts specially.
If I reformat your example thusly:
import QtWidgets 1.0
Widget {
HBoxLayout {
id: foo
property Widget bar: Label{ text: "hello" }
Label { text: "world" }
}
}
The "world" label shows up, while the "hello" widget is ignored by the layout
(the outer Widget is necessary because layouts cannot be shown on their own).
Konrad
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
