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. Subclassed QStandardItem does not receive any signal when it is checked in tree view

Subclassed QStandardItem does not receive any signal when it is checked in tree view

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 1 Posters 2.0k 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
    sweety
    wrote on last edited by
    #1

    Hey I have a QTreeView in which I have a tree that stores a list of vector an d raster files.I m using QStandardItem model and I have subclasse QStandardItem as "myQStandardItem" because I wanted each myQStandardItem to have a list of corresponding QGraphicLineItems..Whenever an item(myQStandardItem) is clicked in treeView i want corresponding QgraphicLineItems to be displayed.

    I m using
    @
    connect(ui.treeView,SIGNAL(clicked(QModelIndex)),
    this,SLOT(on_treeView_clicked(QModelIndex)));@

    and
    @
    void Visualizer::on_treeView_clicked(QModelIndex index)
    {
    myQStandardItem *item1 =standardModel->itemFromIndex(index);
    ----
    }@

    the problem is that 'standardModel->itemFromIndex(index)' returns pointer to QStandardItem and not myQStandaradItem...When item in treeview is clicked i want to get that myQStandardItem and display corresponding QGraphicsItems....
    plz help me to fix this!

    [edit: please use @-code tags for code, Eddy]

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sweety
      wrote on last edited by
      #2

      sorry it is

      connect(ui.treeView,SIGNAL(clicked(QModelIndex)),this,SLOT(on_treeView_clicked(QModelIndex)));

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sweety
        wrote on last edited by
        #3

        I found the solution at
        http://www.qtforum.org/article/34069/store-user-data-void-with-qstandarditem-in-qstandarditemmodel.html

        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