Changeset 90032 in vbox
- Timestamp:
- Jul 5, 2021 3:34:39 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.cpp
r89995 r90032 97 97 , m_iLastIndex(-1) 98 98 , m_pLabelPixmap(0) 99 #ifdef VBOX_WS_MAC 99 , m_pLayoutRight(0) 100 100 , m_pLabelPageTitle(0) 101 #endif102 101 , m_pWidgetStack(0) 103 102 { … … 233 232 UINativeWizardPage *pPage = qobject_cast<UINativeWizardPage*>(m_pWidgetStack->widget(iIndex)); 234 233 AssertPtrReturnVoid(pPage); 235 #ifdef VBOX_WS_MAC236 234 m_pLabelPageTitle->setText(pPage->title()); 237 #endif238 235 if (iIndex > m_iLastIndex) 239 236 pPage->initializePage(); … … 345 342 } 346 343 347 #ifdef VBOX_WS_MAC 348 /* Prepare right layout on macOS for nativity purposes: */ 349 QVBoxLayout *pLayoutRight = new QVBoxLayout; 350 if (pLayoutRight) 344 /* Prepare right layout: */ 345 m_pLayoutRight = new QVBoxLayout; 346 if (m_pLayoutRight) 351 347 { 352 348 /* Prepare page title label: */ … … 360 356 m_pLabelPageTitle->setFont(labelFont); 361 357 362 pLayoutRight->addWidget(m_pLabelPageTitle);358 m_pLayoutRight->addWidget(m_pLabelPageTitle); 363 359 } 364 360 361 #ifdef VBOX_WS_MAC 365 362 /* Prepare frame around widget-stack on macOS for nativity purposes: */ 366 363 UIFrame *pFrame = new UIFrame(this); … … 381 378 382 379 /* Add to layout: */ 383 pLayoutRight->addWidget(pFrame);380 m_pLayoutRight->addWidget(pFrame); 384 381 } 382 #else /* !VBOX_WS_MAC */ 383 /* Prepare widget-stack directly on other platforms: */ 384 m_pWidgetStack = new QStackedWidget(this); 385 if (m_pWidgetStack) 386 { 387 connect(m_pWidgetStack, &QStackedWidget::currentChanged, this, &UINativeWizard::sltCurrentIndexChanged); 388 m_pLayoutRight->addWidget(m_pWidgetStack); 389 } 390 #endif /* !VBOX_WS_MAC */ 385 391 386 392 /* Add to layout: */ 387 pLayoutUpper->addLayout( pLayoutRight);393 pLayoutUpper->addLayout(m_pLayoutRight); 388 394 } 389 #else /* !VBOX_WS_MAC */390 /* Prepare widget-stack directly on other platforms: */391 m_pWidgetStack = new QStackedWidget(this);392 if (m_pWidgetStack)393 {394 connect(m_pWidgetStack, &QStackedWidget::currentChanged, this, &UINativeWizard::sltCurrentIndexChanged);395 pLayoutUpper->addWidget(m_pWidgetStack);396 }397 #endif /* !VBOX_WS_MAC */398 395 399 396 /* Add to layout: */ … … 504 501 void UINativeWizard::resizeToGoldenRatio() 505 502 { 506 #ifdef VBOX_WS_MAC 507 /* Hide/show title label on macOS only, on Windows/X11 there is no title label. */ 503 /* Standard top margin for Basic mode case: */ 504 const int iT = m_enmMode == WizardMode_Basic 505 ? qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin) 506 : 0; 507 m_pLayoutRight->setContentsMargins(0, iT, 0, 0); 508 /* Show title label for Basic mode case: */ 508 509 m_pLabelPageTitle->setVisible(m_enmMode == WizardMode_Basic); 509 # else510 #ifndef VBOX_WS_MAC 510 511 /* Hide/show pixmap label on Windows/X11 only, on macOS it's in the background: */ 511 512 m_pLabelPixmap->setVisible(!m_strPixmapName.isEmpty() && m_enmMode == WizardMode_Basic); … … 542 543 if (!m_strPixmapName.isEmpty()) 543 544 iWidth += 145; 545 /* Advance height for spacing & title height: */ 546 if (m_pLayoutRight) 547 { 548 int iL, iT, iR, iB; 549 m_pLayoutRight->getContentsMargins(&iL, &iT, &iR, &iB); 550 iHeight += iT + m_pLayoutRight->spacing() + iB; 551 } 552 if (m_pLabelPageTitle) 553 iHeight += m_pLabelPageTitle->minimumSizeHint().height(); 544 554 #endif /* !VBOX_WS_MAC */ 545 555 const double dRatio = (double)iWidth / iHeight; … … 607 617 const QRgb rgbFrame = imageOld.pixel(imageOld.width() - 1, 0); 608 618 609 /* Upscale desired height up to pixmap device pixel ratio: */ 610 const int iDesiredHeight = m_pWidgetStack->minimumSizeHint().height() * pixmapOld.devicePixelRatio(); 619 /* Compose desired height up to pixmap device pixel ratio: */ 620 int iL, iT, iR, iB; 621 m_pLayoutRight->getContentsMargins(&iL, &iT, &iR, &iB); 622 const int iSpacing = iT + m_pLayoutRight->spacing() + iB; 623 const int iTitleHeight = m_pLabelPageTitle->minimumSizeHint().height(); 624 const int iStackHeight = m_pWidgetStack->minimumSizeHint().height(); 625 const int iDesiredHeight = (iTitleHeight + iSpacing + iStackHeight) * pixmapOld.devicePixelRatio(); 611 626 /* Create final image on the basis of incoming, applying the rules: */ 612 627 QImage imageNew(imageOld.width(), qMax(imageOld.height(), iDesiredHeight), imageOld.format()); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.h
r89967 r90032 35 35 class QPushButton; 36 36 class QStackedWidget; 37 class QVBoxLayout; 37 38 class UINativeWizardPage; 38 39 … … 164 165 /** Holds the pixmap label instance. */ 165 166 QLabel *m_pLabelPixmap; 166 #ifdef VBOX_WS_MAC 167 /** Holds the right layout instance. */ 168 QVBoxLayout *m_pLayoutRight; 169 /** Holds the title label instance. */ 167 170 QLabel *m_pLabelPageTitle; 168 #endif169 171 /** Holds the widget-stack instance. */ 170 172 QStackedWidget *m_pWidgetStack;
Note:
See TracChangeset
for help on using the changeset viewer.