Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to handle click event on node of Treeview

How to handle click event on node of Treeview

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.8k Views
  • 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.
  • I Offline
    I Offline
    Indrajeet
    wrote on 22 May 2012, 13:46 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on 22 May 2012, 13:59 last edited by
      #2

      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.

      --
      Vasiliy

      1 Reply Last reply
      0

      1/2

      22 May 2012, 13:46

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved