Хранилища Subversion OpenInventory

Редакция

Редакция 66 | Редакция 77 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 66 Редакция 67
Строка 3... Строка 3...
3
3
4
DelegateForClassesTable::DelegateForClassesTable(QObject *parent) :
4
DelegateForClassesTable::DelegateForClassesTable(QObject *parent) :
5
    QItemDelegate(parent)
5
    QItemDelegate(parent)
6
{
6
{
7
    items.append(tr("CHAR(10)"));
7
    items.append(tr("CHAR(10)"));
-
 
8
    items.append(tr("CHAR(30)"));
8
    items.append(tr("INT(10)"));
9
    items.append(tr("INT(10)"));
-
 
10
    items.append(tr("DATA"));
9
}
11
}
10
QWidget *DelegateForClassesTable::createEditor(QWidget *parent,
12
QWidget *DelegateForClassesTable::createEditor(QWidget *parent,
11
    const QStyleOptionViewItem &/* option */,
13
    const QStyleOptionViewItem &/* option */,
12
    const QModelIndex &/* index */) const
14
    const QModelIndex &/* index */) const
13
{
15
{
Строка 45... Строка 47...
45
 //   spinBox->setValue(value);
47
 //   spinBox->setValue(value);
46
QString value = index.model()->data(index, Qt::EditRole).toString();
48
QString value = index.model()->data(index, Qt::EditRole).toString();
47
QComboBox *comboBox = static_cast<QComboBox*>(editor);
49
QComboBox *comboBox = static_cast<QComboBox*>(editor);
48
int curr_index = items.indexOf(value);
50
int curr_index = items.indexOf(value);
49
if (curr_index!= -1) comboBox->setCurrentIndex(curr_index);
51
if (curr_index!= -1) comboBox->setCurrentIndex(curr_index);
-
 
52
else {
-
 
53
-
 
54
}
50
/*
55
/*
51
if (value == "0") comboBox->setCurrentIndex(0);
56
if (value == "0") comboBox->setCurrentIndex(0);
52
if (value == "1") comboBox->setCurrentIndex(1);
57
if (value == "1") comboBox->setCurrentIndex(1);
53
if (value == "2") comboBox->setCurrentIndex(2);
58
if (value == "2") comboBox->setCurrentIndex(2);
54
if (value == "3") comboBox->setCurrentIndex(3);
59
if (value == "3") comboBox->setCurrentIndex(3);
Строка 57... Строка 62...
57
if (value == "6") comboBox->setCurrentIndex(6);
62
if (value == "6") comboBox->setCurrentIndex(6);
58
if (value == "7") comboBox->setCurrentIndex(7);
63
if (value == "7") comboBox->setCurrentIndex(7);
59
if (value == "8") comboBox->setCurrentIndex(8);
64
if (value == "8") comboBox->setCurrentIndex(8);
60
if (value == "9") comboBox->setCurrentIndex(9);
65
if (value == "9") comboBox->setCurrentIndex(9);
61
*/
66
*/
62
comboBox->setEditable(true);
67
comboBox->setEditable(false);
63
68
64
69
65
//comboBox->setItemText(0, value);
70
//comboBox->setItemText(0, value);
66
71
67
}
72
}
Строка 90... Строка 95...
90
    const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
95
    const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
91
{
96
{
92
    editor->setGeometry(option.rect);
97
    editor->setGeometry(option.rect);
93
}
98
}
94
//! [4]
99
//! [4]
-
 
100
-
 
101
-
 
102
void DelegateForClassesTable::setItems(QStringList new_items){
-
 
103
-
 
104
    DelegateForClassesTable::items =  new_items;
-
 
105
-
 
106
}