Редакция 129 | Редакция 138 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 129 | Редакция 136 | ||
---|---|---|---|
Строка 170... | Строка 170... | ||
170 | // int value = index.model()->data(index, Qt::EditRole).toInt();
|
170 | // int value = index.model()->data(index, Qt::EditRole).toInt();
|
171 | 171 | ||
172 | // QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
|
172 | // QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
|
173 | // spinBox->setValue(value);
|
173 | // spinBox->setValue(value);
|
174 | QString value = index.model()->data(index, Qt::EditRole).toString(); |
174 | QString value = index.model()->data(index, Qt::EditRole).toString(); |
- | 175 | ||
175 | QComboBox *comboBox = static_cast<QComboBox*>(editor); |
176 | QComboBox *comboBox = static_cast<QComboBox*>(editor); |
176 | 177 | ||
177 | QStringList ID_list;
|
178 | QStringList ID_list;
|
178 | QStringList Name_list;
|
179 | QStringList Name_list;
|
179 | int curr_index; |
180 | int curr_index; |
180 | 181 | ||
181 | ID_list = items.keys(); |
182 | ID_list = items.keys(); |
182 | Name_list = items.values(); |
183 | Name_list = items.values(); |
183 | 184 | ||
184 | curr_index = ID_list.indexOf(value); |
185 | curr_index = ID_list.indexOf(value); |
- | 186 | if (curr_index==-1) return; |
|
185 | comboBox->setCurrentIndex(curr_index); |
187 | comboBox->setCurrentIndex(curr_index); |
186 | /****************************************************
|
188 | /****************************************************
|
187 | if (value == "0") comboBox->setCurrentIndex(0);
|
189 | if (value == "0") comboBox->setCurrentIndex(0);
|
188 | if (value == "1") comboBox->setCurrentIndex(1);
|
190 | if (value == "1") comboBox->setCurrentIndex(1);
|
189 | if (value == "2") comboBox->setCurrentIndex(2);
|
191 | if (value == "2") comboBox->setCurrentIndex(2);
|
Строка 216... | Строка 218... | ||
216 | QStringList Name_list;
|
218 | QStringList Name_list;
|
217 | 219 | ||
218 | QComboBox *comboBox = static_cast<QComboBox*>(editor); |
220 | QComboBox *comboBox = static_cast<QComboBox*>(editor); |
219 | int currIndex; |
221 | int currIndex; |
220 | currIndex = comboBox->currentIndex(); |
222 | currIndex = comboBox->currentIndex(); |
- | 223 | if (currIndex==-1) return; |
|
221 | // QString value = comboBox->itemText(currIndex);
|
224 | // QString value = comboBox->itemText(currIndex);
|
222 | 225 | ||
223 | ID_list = items.keys(); |
226 | ID_list = items.keys(); |
224 | Name_list = items.values(); |
227 | Name_list = items.values(); |
225 | 228 |