Scenerio:
I have a 2 column QTreeWidget in my MainWindow. I add a row with text in the first column and a QComboBox in the second using the following code:
QTreeWidgetItem *rowItem = new QTreeWidgetItem(mainTree);
QComboBox *comboBox = GenerateComboBox(mainTree);
comboBox->setCurrentIndex(someIndexValue);
rowItem->setText(0,someText);
mainTree->setItemWidget(rowItem,1,comboBox);
My intention is to have a slot that does some work when the index of a combobox has changed. I need to know the row number of the TreeItem the changed comboBox resides in, in-addition to the index of the comboBox that value has changed to.
Current Understanding:
With my limited knowledge of QT:
1. It doesn't seem the TreeItem and comboBox are aware of each other as the TreeWidget is used as the parent for both.
2. I don't see a way to connect comboBox's indexChanged signal to a TreeItem itemChanged slot using what's already there to propagate the change notification up.
Question:
Is there a way to achieve this without writing a wrapper class that implements a slots and signal with the needed parameters or adding that implementation to the QTreeItem/QComboBox classes?