Solved Any way to know the column clicked in a row QTreeWidget?
-
Welcome everybody, searching help for this issue.
Once built a QTreeWidget and ready to select several items to clicking with CTRL or SHIFT . Just want to know the way of take the specific column item in selected row by the click after changed its value, the main reason of this is at the moment of change the value of the column the other elements selected change their value too in the corresponding column like an excel table, It's hard to begin for something.
My code are here:
void StudyHours::on_mainTreeWidget_itemChanged(QTreeWidgetItem *item, int column) { QList<QTreeWidgetItem *> itemsListSelected; itemsListSelected = ui->mainTreeWidget->selectedItems(); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); foreach (QTreeWidgetItem *item, itemsListSelected) { } QApplication::restoreOverrideCursor(); }
In resume:
- Just know the value of column selected after changed
- Change every values at the same column in the rows that had been.
Thanks boys.
-
@Ripley
I don't understand much about your question, or what the relevance of "after changed its value" is, but in answer to your title:Any way to know the column clicked in a row QTreeWidget?
there is signal
void QTreeWidget::itemClicked(QTreeWidgetItem *item, int column)
, https://doc.qt.io/qt-5/qtreewidget.html#itemClicked. -
@JonB Thanks bro.