Changeset 73072 in vbox
- Timestamp:
- Jul 11, 2018 4:15:10 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp
r73068 r73072 25 25 # include <QDir> 26 26 # include <QGridLayout> 27 # include <QHeaderView> 27 28 # include <QLabel> 28 29 # include <QLineEdit> 29 30 # include <QStackedWidget> 31 # include <QTableWidget> 30 32 # include <QVBoxLayout> 31 33 … … 57 59 , m_pProfileComboBoxLabel(0) 58 60 , m_pProfileComboBox(0) 61 , m_pProfileSettingsTable(0) 59 62 { 60 63 } … … 120 123 } 121 124 125 void UIWizardExportAppPage3::populateProfileSettings() 126 { 127 /* Acquire current profile table: */ 128 // Here goes the experiamental lists with 129 // arbitrary contents for testing purposes. 130 QStringList keys; 131 QStringList values; 132 keys << "Key 1"; 133 keys << "Key 2"; 134 keys << "Key 3"; 135 keys << "Key 4"; 136 values << "Value 1"; 137 values << "Value 2"; 138 values << "Value 3"; 139 values << "Value 4"; 140 m_pProfileSettingsTable->clear(); 141 m_pProfileSettingsTable->setRowCount(4); 142 m_pProfileSettingsTable->setColumnCount(2); 143 144 /* Push acquired keys/values to data fields: */ 145 for (int i = 0; i < m_pProfileSettingsTable->rowCount(); ++i) 146 { 147 QTableWidgetItem *pItem1 = new QTableWidgetItem(keys.at(i)); 148 pItem1->setFlags(pItem1->flags() & ~Qt::ItemIsEditable); 149 QTableWidgetItem *pItem2 = new QTableWidgetItem(values.at(i)); 150 pItem2->setFlags(pItem2->flags() & ~Qt::ItemIsEditable); 151 m_pProfileSettingsTable->setItem(i, 0, pItem1); 152 m_pProfileSettingsTable->setItem(i, 1, pItem2); 153 } 154 155 /* Adjust the table: */ 156 adjustProfileSettingsTable(); 157 } 158 122 159 void UIWizardExportAppPage3::updatePageAppearance() 123 160 { … … 209 246 AssertMsg(!strCurrentToolTip.isEmpty(), ("Data not found!")); 210 247 m_pProviderComboBox->setToolTip(strCurrentToolTip); 248 } 249 250 void UIWizardExportAppPage3::adjustProfileSettingsTable() 251 { 252 /* Disable last column stretching temporary: */ 253 m_pProfileSettingsTable->horizontalHeader()->setStretchLastSection(false); 254 255 /* Resize both columns to contents: */ 256 m_pProfileSettingsTable->resizeColumnsToContents(); 257 /* Then acquire full available width: */ 258 const int iFullWidth = m_pProfileSettingsTable->viewport()->width(); 259 /* First column should not be less than it's minimum size, last gets the rest: */ 260 const int iMinimumWidth0 = qMin(m_pProfileSettingsTable->horizontalHeader()->sectionSize(0), iFullWidth / 2); 261 m_pProfileSettingsTable->horizontalHeader()->resizeSection(0, iMinimumWidth0); 262 263 /* Enable last column stretching again: */ 264 m_pProfileSettingsTable->horizontalHeader()->setStretchLastSection(true); 211 265 } 212 266 … … 423 477 pSettingsLayout2->addWidget(m_pProfileComboBoxLabel, 1, 0); 424 478 } 425 426 /* Create placeholder: */ 427 QWidget *pPlaceholder = new QWidget; 428 if (pPlaceholder) 429 { 430 /* Add into layout: */ 431 pSettingsLayout2->addWidget(pPlaceholder, 2, 0, 1, 2); 479 /* Create profile settings table: */ 480 m_pProfileSettingsTable = new QTableWidget; 481 if (m_pProfileSettingsTable) 482 { 483 const QFontMetrics fm(m_pProfileSettingsTable->font()); 484 const int iFontWidth = fm.width('x'); 485 const int iTotalWidth = 50 * iFontWidth; 486 const int iFontHeight = fm.height(); 487 const int iTotalHeight = 4 * iFontHeight; 488 m_pProfileSettingsTable->setMinimumSize(QSize(iTotalWidth, iTotalHeight)); 489 m_pProfileSettingsTable->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 490 m_pProfileSettingsTable->setAlternatingRowColors(true); 491 m_pProfileSettingsTable->horizontalHeader()->setVisible(false); 492 m_pProfileSettingsTable->verticalHeader()->setVisible(false); 493 m_pProfileSettingsTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); 494 495 /* Add into layout: */ 496 pSettingsLayout2->addWidget(m_pProfileSettingsTable, 2, 1); 432 497 } 433 498 } … … 448 513 /* Populate profiles: */ 449 514 populateProfiles(); 515 /* Populate profile settings: */ 516 populateProfileSettings(); 450 517 451 518 /* Setup connections: */ … … 462 529 registerField("format", this, "format"); 463 530 registerField("manifestSelected", this, "manifestSelected"); 531 } 532 533 bool UIWizardExportAppPageBasic3::event(QEvent *pEvent) 534 { 535 /* Handle known event types: */ 536 switch (pEvent->type()) 537 { 538 case QEvent::Show: 539 case QEvent::Resize: 540 { 541 /* Adjust profile settings table: */ 542 adjustProfileSettingsTable(); 543 break; 544 } 545 default: 546 break; 547 } 548 549 /* Call to base-class: */ 550 return UIWizardPage::event(pEvent); 464 551 } 465 552 … … 624 711 void UIWizardExportAppPageBasic3::sltHandleProfileComboChange() 625 712 { 626 } 713 /* Refresh required settings: */ 714 populateProfileSettings(); 715 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h
r73033 r73072 31 31 class QLineEdit; 32 32 class QStackedWidget; 33 class QTableWidget; 33 34 class QIRichTextLabel; 34 35 class UIEmptyFilePathSelector; … … 49 50 /** Populates profiles. */ 50 51 void populateProfiles(); 52 /** Populates profile settings. */ 53 void populateProfileSettings(); 51 54 52 55 /** Updates page appearance. */ … … 66 69 /** Updates provider combo tool-tips. */ 67 70 void updateProviderComboToolTip(); 71 72 /** Adjusts profile settings table. */ 73 void adjustProfileSettingsTable(); 68 74 69 75 /** Returns path. */ … … 124 130 125 131 /** Holds the profile combo-box label instance. */ 126 QLabel *m_pProfileComboBoxLabel;132 QLabel *m_pProfileComboBoxLabel; 127 133 /** Holds the profile combo-box instance. */ 128 QComboBox *m_pProfileComboBox; 134 QComboBox *m_pProfileComboBox; 135 /** Holds the profile settings table-widget instance. */ 136 QTableWidget *m_pProfileSettingsTable; 129 137 }; 130 138 … … 145 153 146 154 protected: 155 156 /** Handle any Qt @a pEvent. */ 157 virtual bool event(QEvent *pEvent) /* override */; 147 158 148 159 /** Allows access wizard-field from base part. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
r73033 r73072 24 24 # include <QGridLayout> 25 25 # include <QGroupBox> 26 # include <QHeaderView> 26 27 # include <QLabel> 27 28 # include <QLineEdit> … … 29 30 # include <QRadioButton> 30 31 # include <QStackedWidget> 32 # include <QTableWidget> 31 33 # include <QVBoxLayout> 32 34 … … 285 287 pSettingsLayout2->addWidget(m_pProfileComboBoxLabel, 1, 0); 286 288 } 287 288 /* Create placeholder: */ 289 QWidget *pPlaceholder = new QWidget; 290 if (pPlaceholder) 291 { 292 /* Add into layout: */ 293 pSettingsLayout2->addWidget(pPlaceholder, 2, 0, 1, 2); 289 /* Create profile settings table: */ 290 m_pProfileSettingsTable = new QTableWidget; 291 if (m_pProfileSettingsTable) 292 { 293 const QFontMetrics fm(m_pProfileSettingsTable->font()); 294 const int iFontWidth = fm.width('x'); 295 const int iTotalWidth = 50 * iFontWidth; 296 const int iFontHeight = fm.height(); 297 const int iTotalHeight = 4 * iFontHeight; 298 m_pProfileSettingsTable->setMinimumSize(QSize(iTotalWidth, iTotalHeight)); 299 m_pProfileSettingsTable->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 300 m_pProfileSettingsTable->setAlternatingRowColors(true); 301 m_pProfileSettingsTable->horizontalHeader()->setVisible(false); 302 m_pProfileSettingsTable->verticalHeader()->setVisible(false); 303 m_pProfileSettingsTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); 304 305 /* Add into layout: */ 306 pSettingsLayout2->addWidget(m_pProfileSettingsTable, 2, 1); 294 307 } 295 308 } … … 319 332 /* Populate profiles: */ 320 333 populateProfiles(); 334 /* Populate profile settings: */ 335 populateProfileSettings(); 321 336 322 337 /* Setup connections: */ … … 344 359 registerField("manifestSelected", this, "manifestSelected"); 345 360 registerField("applianceWidget", this, "applianceWidget"); 361 } 362 363 bool UIWizardExportAppPageExpert::event(QEvent *pEvent) 364 { 365 /* Handle known event types: */ 366 switch (pEvent->type()) 367 { 368 case QEvent::Show: 369 case QEvent::Resize: 370 { 371 /* Adjust profile settings table: */ 372 adjustProfileSettingsTable(); 373 break; 374 } 375 default: 376 break; 377 } 378 379 /* Call to base-class: */ 380 return UIWizardPage::event(pEvent); 346 381 } 347 382 … … 521 556 void UIWizardExportAppPageExpert::sltHandleProfileComboChange() 522 557 { 523 } 558 /* Refresh required settings: */ 559 populateProfileSettings(); 560 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h
r73033 r73072 54 54 protected: 55 55 56 /** Handle any Qt @a pEvent. */ 57 virtual bool event(QEvent *pEvent) /* override */; 58 56 59 /** Allows access wizard from base part. */ 57 60 UIWizard* wizardImp() { return UIWizardPage::wizard(); }
Note:
See TracChangeset
for help on using the changeset viewer.