Thanks,
I am writing the
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
To copy to clipboard, switch view to plain text mode
function of the delegate.
Column 0 is a non editable QComboBox where the user selects between a list of application objects represented by QStrings.
Columm 1 is an editable QWidget with (QLabels and QLineEdits). This cell depends on what is selected in the QComboBox.
There can be a different selection in the QComboBox for each row, of course.
This is the start of the implementation of createEditor:
{
switch(index.column()) {
case 0: {
systems_widget->setEditable(false);
for (....) /// pseudo code here
systems_widget
->addItem
( QString(someStdString.
c_str()) );
}
return systems_widget;
}
case 1:
return .... /// How do I pick up the selected item from the QComboBox in column 0 ?
case 2:
/// to implement
default:
return 0;
};
}
{
switch(index.column()) {
case 0: {
QComboBox* systems_widget = new QComboBox(this); /// check parenting is ok
systems_widget->setEditable(false);
for (....) /// pseudo code here
systems_widget->addItem( QString(someStdString.c_str()) );
}
return systems_widget;
}
case 1:
return .... /// How do I pick up the selected item from the QComboBox in column 0 ?
case 2:
/// to implement
default:
return 0;
};
}
To copy to clipboard, switch view to plain text mode
Bookmarks