avh
5th June 2008, 21:38
I am attempting to control a QStackedWidget with a QTreeWidget.
Both are initialized in the constructor of my class.
To do so, I use the following code:
//optionLabels is a QTreeWidget*
//optionControls is a QStackedWidget*
void EditOptionsDialog::makeConnections() {
connect(optionLabels, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(changeCollectionPane(QTreeWidgetItem*, int)));
}
//This is defined as a slot in the header file
void EditOptionsDialog::changeCollectionPane(QTreeWidge tItem* selection, int col) {
QMessageBox::information(this, tr("Is this slot called?"), tr("Index of Clicked Widget: %1").arg(selection->data(col, Qt::UserRole).toInt()));
if(selection && col == 0) {
optionControls->setCurrentIndex(selection->data(col, Qt::UserRole).toInt());
}
}
When I click around on the tree, I don't get a message box, so the slot is not being called. Any ideas as to why?
Both are initialized in the constructor of my class.
To do so, I use the following code:
//optionLabels is a QTreeWidget*
//optionControls is a QStackedWidget*
void EditOptionsDialog::makeConnections() {
connect(optionLabels, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(changeCollectionPane(QTreeWidgetItem*, int)));
}
//This is defined as a slot in the header file
void EditOptionsDialog::changeCollectionPane(QTreeWidge tItem* selection, int col) {
QMessageBox::information(this, tr("Is this slot called?"), tr("Index of Clicked Widget: %1").arg(selection->data(col, Qt::UserRole).toInt()));
if(selection && col == 0) {
optionControls->setCurrentIndex(selection->data(col, Qt::UserRole).toInt());
}
}
When I click around on the tree, I don't get a message box, so the slot is not being called. Any ideas as to why?