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



  • 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]



  • sorry it is

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




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.