- Timestamp:
- Apr 18, 2019 4:16:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIFormEditorWidget.cpp
r78210 r78211 171 171 void updateValueCells(); 172 172 173 /** Check whether generation value is changed. */ 174 bool isGenerationChanged() const; 175 173 176 protected: 174 177 … … 191 194 KFormValueType m_enmValueType; 192 195 196 /** Holds current generation value. */ 197 int m_iGeneration; 198 193 199 /** Holds the cell instances. */ 194 200 QVector<UIFormEditorCell*> m_cells; … … 237 243 /** Return the parent table-view reference. */ 238 244 QITableView *parentTable() const; 245 246 /** Updates row generation values. */ 247 void updateGeneration(); 239 248 240 249 /** Holds the Form Editor row list. */ … … 281 290 , m_comValue(comValue) 282 291 , m_enmValueType(KFormValueType_Max) 292 , m_iGeneration(0) 283 293 { 284 294 prepare(); … … 396 406 void UIFormEditorRow::updateValueCells() 397 407 { 408 m_iGeneration = m_comValue.GetGeneration(); 409 /// @todo check for errors 410 398 411 switch (m_enmValueType) 399 412 { … … 416 429 CChoiceFormValue comValue(m_comValue); 417 430 const QVector<QString> values = comValue.GetValues(); 418 m_cells[UIFormEditorDataType_Value]->setText(values. at(comValue.GetSelectedIndex()));431 m_cells[UIFormEditorDataType_Value]->setText(values.isEmpty() ? QString() : values.at(comValue.GetSelectedIndex())); 419 432 /// @todo check for errors 420 433 break; … … 423 436 break; 424 437 } 438 } 439 440 bool UIFormEditorRow::isGenerationChanged() const 441 { 442 const int iGeneration = m_comValue.GetGeneration(); 443 /// @todo check for errors 444 return m_iGeneration != iGeneration; 425 445 } 426 446 … … 573 593 m_dataList[index.row()]->setBool(enmCheckState == Qt::Checked); 574 594 emit dataChanged(index, index); 595 updateGeneration(); 575 596 return true; 576 597 } … … 595 616 m_dataList[index.row()]->setString(value.toString()); 596 617 emit dataChanged(index, index); 618 updateGeneration(); 597 619 return true; 598 620 case KFormValueType_Choice: 599 621 m_dataList[index.row()]->setChoice(value.value<ChoiceData>()); 600 622 emit dataChanged(index, index); 623 updateGeneration(); 601 624 return true; 602 625 default: … … 701 724 } 702 725 726 void UIFormEditorModel::updateGeneration() 727 { 728 foreach (UIFormEditorRow *pRow, m_dataList) 729 if (pRow->isGenerationChanged()) 730 pRow->updateValueCells(); 731 } 732 703 733 704 734 /*********************************************************************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.