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. How to add dynamically created QQuickItem to VisualItemModel?
Forum Updated to NodeBB v4.3 + New Features

How to add dynamically created QQuickItem to VisualItemModel?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 780 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.
  • S Offline
    S Offline
    sibislaw2
    wrote on last edited by
    #1

    Here's the code:

    @

        QQuickItem *miniWindowParent = aMainWindow.rootGui()->rootObject()->findChild<QQuickItem*>("samplersMiniListModel");
    
        Q_ASSERT(miniWindowParent != 0);
    
        mDummyMiniItem->setParentItem(miniWindowParent);
    

    @

    samplersMiniListModel is VisualItemModel in QML.

    And this not works (program crashes on the Q_ASSERT). Reason is that the VisualItemModel isnt QQuickItem*.


    This code works good:

    @
    QObject miniWindowParent = aMainWindow.rootGui()->rootObject()->findChild<QObject>("samplersMiniListModel");

        Q_ASSERT(miniWindowParent != 0);
    
        mDummyMiniItem->setParent(miniWindowParent);
    

    @

    but has no effect (Window dont adds to List). Anyone know how to add QQuickItem* to VisualItemModel ?

    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