Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Add another Component.onCompleted signal
Forum Updated to NodeBB v4.3 + New Features

Add another Component.onCompleted signal

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    devel
    wrote on last edited by
    #1

    Is it hard to add another stage of initialization like Component.onPreCompleted that runs entirely before the Component.onCompleted?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What would you do in that "preCompleted" stage ? What would you consider as "pre completed" ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What would you do in that "preCompleted" stage ? What would you consider as "pre completed" ?

        D Offline
        D Offline
        devel
        wrote on last edited by devel
        #3

        @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 by LiveReloader.preserve on the first GUI load. Unloading the GUI destroys all QObject shells but the LiveReloader is keeping the implementations. On the subsequent GUI reloads the LiveReloader.preserve installs the implementations into shells using the tags like "my01" in that example.

        The problem is if you have LiveReloader.preserve in Component.onCompleted, there is no way to execute anything else in the Component.onCompleted because the order is not specified and some implementation objects may be not yet created/installed.

        I'm investigating now the QQmlComponent::beginCreate and QQmlParserStatus::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 the Component.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?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved