简体   繁体   中英

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 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& ) ) );

要调试SIGNAL和SLOT,请检查connect的返回值.connect的返回类型为BOOL类型,如果返回true,则表示其连接,否则返回。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM