Changeset 78249 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 22, 2019 2:43:59 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIFormEditorWidget.cpp
r78247 r78249 201 201 int m_iGeneration; 202 202 203 /** Holds cached bool value. */ 204 bool m_fBool; 205 /** Holds cached string value. */ 206 QString m_strString; 207 /** Holds cached choice value. */ 208 ChoiceData m_choice; 209 203 210 /** Holds the cell instances. */ 204 211 QVector<UIFormEditorCell*> m_cells; … … 314 321 , m_enmValueType(KFormValueType_Max) 315 322 , m_iGeneration(0) 323 , m_fBool(false) 324 , m_strString(QString()) 325 , m_choice(ChoiceData()) 316 326 { 317 327 prepare(); … … 341 351 { 342 352 AssertReturn(valueType() == KFormValueType_Boolean, false); 343 CBooleanFormValue comValue(m_comValue); 344 return comValue.GetSelected(); 353 return m_fBool; 345 354 } 346 355 … … 371 380 { 372 381 AssertReturn(valueType() == KFormValueType_String, QString()); 373 CStringFormValue comValue(m_comValue); 374 return comValue.GetString(); 382 return m_strString; 375 383 } 376 384 … … 401 409 { 402 410 AssertReturn(valueType() == KFormValueType_Choice, ChoiceData()); 403 CChoiceFormValue comValue(m_comValue); 404 return ChoiceData(comValue.GetValues(), comValue.GetSelectedIndex()); 411 return m_choice; 405 412 } 406 413 … … 442 449 { 443 450 CBooleanFormValue comValue(m_comValue); 444 m_cells[UIFormEditorDataType_Value]->setText(comValue.GetSelected() ? "True" : "False"); 451 m_fBool = comValue.GetSelected(); 452 m_cells[UIFormEditorDataType_Value]->setText(m_fBool ? "True" : "False"); 445 453 /// @todo check for errors 446 454 break; … … 449 457 { 450 458 CStringFormValue comValue(m_comValue); 451 m_cells[UIFormEditorDataType_Value]->setText(comValue.GetString()); 459 m_strString = comValue.GetString(); 460 m_cells[UIFormEditorDataType_Value]->setText(m_strString); 452 461 /// @todo check for errors 453 462 break; … … 457 466 CChoiceFormValue comValue(m_comValue); 458 467 const QVector<QString> values = comValue.GetValues(); 459 m_cells[UIFormEditorDataType_Value]->setText(values.isEmpty() ? QString() : values.at(comValue.GetSelectedIndex())); 468 const int iSelectedIndex = comValue.GetSelectedIndex(); 469 m_choice = ChoiceData(values, iSelectedIndex); 470 m_cells[UIFormEditorDataType_Value]->setText( !m_choice.choices().isEmpty() 471 ? m_choice.choices().at(m_choice.selectedChoice()) 472 : QString()); 460 473 /// @todo check for errors 461 474 break;
Note:
See TracChangeset
for help on using the changeset viewer.