开发者

QT clicked signal dosnt work on QStandardItemModel with tree view

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 开发者_JAVA百科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 ?


lowercase c for the clicked signal.

connect(ui.treeView,SIGNAL(clicked(const QModelIndex& ) ), 
    this,SLOT( treeViewSelectedRow(const QModelIndex& ) ) );


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜