Add another Component.onCompleted signal
-
Hi,
What would you do in that "preCompleted" stage ? What would you consider as "pre completed" ?
-
@SGaist, preCompleted handlers should run before any of onCompleted are run, but obviously after the time when "full QML environment has been established".
Haven't mentioned the goal (live reload): https://forum.qt.io/topic/62013/livereload-after-file-save-but-keep-some-objects because people are seemingly avoiding that topic.
MyCppItem { id: my Component.onPreCompleted: LiveReloader.preserve(my, "my01") }
MyCppItem
consists of QObject shell and a pointer to the implementation object. The implementation is created byLiveReloader.preserve
on the first GUI load. Unloading the GUI destroys all QObject shells but theLiveReloader
is keeping the implementations. On the subsequent GUI reloads theLiveReloader.preserve
installs the implementations into shells using the tags like "my01" in that example.The problem is if you have
LiveReloader.preserve
inComponent.onCompleted
, there is no way to execute anything else in theComponent.onCompleted
because the order is not specified and some implementation objects may be not yet created/installed.I'm investigating now the
QQmlComponent::beginCreate
andQQmlParserStatus::classBegin
methods but they don't break the creation process in the right place. And overall the thing probably won't work as intended because other properties are evaluated initially at the same time as theComponent.onCompleted
properties.update
Ok, now I see that it'll closer to the solution with this simpler syntax:
MyCppItem { id: my liveReloadTag: "my01" }
because the constant bindings are evaluated before everything else. Now there are conflicts with the static bindings. Is it hard to get a list of all static bindings before they are actually executed to be able to preliminary execute a part of them?
-
It's not that people are avoiding that topic, but this forum is more user oriented and that question (as well as this one) is pretty low level. You should maybe try the interest mailing list, you'll find there Qt's developers/maintainers.