How to handle click event on node of Treeview



  • Hi

    I want to call a slot on the click event of a treeview node i tried something like this

    @QObject::connect(view, SIGNAL(clicked(const QModelIndex &)),view, SLOT(expandtest(const QModelIndex &)));@

    My slot loks like this
    @void MainWindow::expandtest(const QModelIndex &index)
    {
    QMessageBox::information(this, "Popup", "Item clicked");
    }@

    but the slot is not getting called.
    Can anybody help me out.



  • Third parameter of connect must be pointer to object which contain slot,
    so for you it must be pointer for MainWindow object,
    if you doing connect in MainWindow object you can use this.


Log in to reply
 

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