PDA

View Full Version : QTableView::doubleClicked(const QModelIndex &) isn't emitted



hasmik
9th December 2009, 13:52
Hi,

I am using QTableView class. I want when user double clicks on the item (e.g. row = 1, column = 1) dialog appears on the screen.

I wrote the following:


MainWindow::MainWindow(/* PARAMS */)
{
...
connect(tableView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(showDialog(const QModelIndex &)));
...
}


but the slot isn't called :(.

Why double click signal isn't emitted?

thanks,
Hasmik.

vieraci
9th December 2009, 14:36
Maybe you have a missing slot or incompatible sender/receiver arguments.
Do you see a warning message in the output window ? it's a good clue.

hasmik
9th December 2009, 14:58
Thanks for the reply.

There is no warnings. The slot is defined correct. I read in the Internet that QTableView doesn't emit signals. Is it correct?
I surprised because I use QTreeWidget and I haven't met any problem.

vieraci
9th December 2009, 22:43
QTableView DOES emit signal.
Is your slot defined in the same file/class ?

hasmik
10th December 2009, 15:54
My slot is defined in the MainWindow class which is derived from MainWindow. This slot has the same argumnts as doubleclick signal has. I want to mention that I have defined a new model and this model is used in QTableView.