Qt World Summit: Register Today!

How to open a Dialog when an Item is clicked in QTableView?

  • I am using a QTableView with 3 rows & 3 columns. If i click on any rows/columns, i want to open a Dialog. How to open a Dialog when an item is clicked?

  • Moderators

    connect to the clicked() signal of your QTableView

  • If i connect the clicked signal to my QTableView, then even if i click on the TableView Header then the Dialog will pop up. I want the Dialog to pop up only when the cell Item is clicked.

  • Hi,

    may be you can filter out in slot the signals by the senders, but I think this will be helpful:

    SIGNAL(currentChanged(QModelIndex, QModelIndex)),


  • Hi.. Already I tried using the selectionModel with the SIGNAL (selectionChanged(QItemSelection,QItemSelection), even after using the selectionModel, the dialog opens when QTableview header is clicked. How can i filter the Header section in the SLOT?

Log in to reply