connect(ui.treewidget, SIGNAL(itemClicked(QTreeWidgetItem * , int )), this,SLOT(wc_fun_treewidgetTest(QTreeWidgetItem * , int ))); void Mainwidget::wc_fun_treewidgetTest(QTreeWidgetItem* item, int column) { QString _datt = item->data(0, Qt::UserRole).toString(); QStringList _data = _datt.split("-"); qDebug() << QString::fromLocal8Bit("当前点击的项的索引是:") << _data[0] << endl; }
标签:控件,QT,int,treewidgetTest,QTreeWidgetItem,QTreeWidget,节点 From: https://www.cnblogs.com/RedWetPlace/p/16789726.html