tags:

views:

53

answers:

2

Hello i have this code in QT and all i want to to catch the clicked event when some one clicking in one of the treeview rows without success

here is my code:

(parant is the qMmainwindow)
m_model = new QStandardItemModel(0, 5, parent);
// then later in the code i have 
proxyModel = new QSortFilterProxyModel;
proxyModel->setDynamicSortFilter(true);
setSourceModel(createMailModel(parent));
ui.treeView->setModel(proxyModel);
ui.treeView->setSortingEnabled(true);
ui.treeView->sortByColumn(4, Qt::DescendingOrder);
// and my signal/slot looks like this but its not working 
//and im not getting eny clicked event fired
connect(ui.treeView,SIGNAL(Clicked(const QModelIndex& ) ), 
        this,SLOT( treeViewSelectedRow(const QModelIndex& ) ) );

also how can i debug QT signal/slots so i can see some debug massages printing when something is wrong ?

+2  A: 

lowercase c for the clicked signal.

connect(ui.treeView,SIGNAL(clicked(const QModelIndex& ) ), 
    this,SLOT( treeViewSelectedRow(const QModelIndex& ) ) );
ianmac45
Thanks for the answer , do you know the answer to the second question
sorry, I missed that. if you run the program from visual studio or qt creator or something similar, the connection error will be sent to the debug window. otherwise, shadow's answer (checking the return value of QObject::connect) is the only other thing I can think of..
ianmac45
A: 

to debug the SIGNAL and SLOT, check the return value of connect.the return type of connect is of type BOOL, if it returns true then its connected else its not.

Shadow