5,7 → 5,9 |
QItemDelegate(parent) |
{ |
items.append(tr("CHAR(10)")); |
items.append(tr("CHAR(30)")); |
items.append(tr("INT(10)")); |
items.append(tr("DATA")); |
} |
QWidget *DelegateForClassesTable::createEditor(QWidget *parent, |
const QStyleOptionViewItem &/* option */, |
47,6 → 49,9 |
QComboBox *comboBox = static_cast<QComboBox*>(editor); |
int curr_index = items.indexOf(value); |
if (curr_index!= -1) comboBox->setCurrentIndex(curr_index); |
else { |
|
} |
/* |
if (value == "0") comboBox->setCurrentIndex(0); |
if (value == "1") comboBox->setCurrentIndex(1); |
59,7 → 64,7 |
if (value == "8") comboBox->setCurrentIndex(8); |
if (value == "9") comboBox->setCurrentIndex(9); |
*/ |
comboBox->setEditable(true); |
comboBox->setEditable(false); |
|
|
//comboBox->setItemText(0, value); |
92,3 → 97,10 |
editor->setGeometry(option.rect); |
} |
//! [4] |
|
|
void DelegateForClassesTable::setItems(QStringList new_items){ |
|
DelegateForClassesTable::items = new_items; |
|
} |