Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › [Feedback] Documentation of lazy-loaded components

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12343

    Nathan

    The documentation does not seem to state that the v-play navigation infrastructure will lazy-load pages. This is rather surprising for someone who’s used to standard QML, which will construct all components defined in the QML source at startup, unless they are wrapped in a Component{}. This leads to unexpected behavior such as getting a “ReferenceError: listPage is not defined” error from something like this:

    App {
      Component.onCompleted: console.log(listPage.x)
      Navigation {
        NavigationItem {
          id: widgetsItem
          title: "Widgets"
          icon: IconType.calculator
    
          WidgetsPage { title: widgetsItem.title }
        }
    
        NavigationItem {
          title: "Simple List"
          icon: IconType.list
    
          NavigationStack { //this tab/navigation item uses stack-based sub-navigation
            SimpleListPage { id: listPage }
          }
        }
      }
    }

     

    This behavior should be documented in the Navigation and NavigationItem detailed description sections.

    #12344

    Günther
    Felgo Team

    Hi Nathan,
    thank you for your feedback!
    We will add it to the documentation. 😉

    Our current implementation uses the Qt Quick TabView internally, which automatically comes with this lazy-loading mechanism.
    Besides the Navigation, this also affects the TabControl component.

     

    Cheers,
    Günther

    #12386

    Nathan

    Ahh, that makes sense. I also note that NavigationItem inherits Tab, which could have been a hint (since Qt’s Tab documentation emphasizes that Tabs are lazy-loaded), but I didn’t follow that link. It’s probably worth emphasizing on NavigationItem that it is lazy-loaded, and referencing the Tab docs for more info.

    It appears that NavigationStack also lazy-loads its children, though, since in my original example (which was just a tweak from the example on the Navigation doc) I still can’t access listPage from an onSelected handler on its containing NavigationItem. I believe this is also the behavior of Qt Quick Controls’ StackView, if that’s what’s being used behind the scenes.

    #12394

    Günther
    Felgo Team

    You guessed right, we use the StackView internally.
    Besides the Navigation/TabControl and the NavigationStack there aren’t any more items that lazy-load their content. So if you keep in mind that these types do you should be good to go.

    Best,
    Günther

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded