Changeset 90333 in vbox
- Timestamp:
- Jul 26, 2021 1:00:19 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.cpp
r88862 r90333 88 88 int totalHeight() const; 89 89 int titleHeight() const; 90 int pageWidgetHeight() const;90 QSize pageWidgetSize() const; 91 91 void setTitleIcon(const QIcon &icon, const QString &strToolTip); 92 92 … … 268 268 int UIToolBoxPage::totalHeight() const 269 269 { 270 return pageWidget Height() + titleHeight();270 return pageWidgetSize().height() + titleHeight(); 271 271 } 272 272 … … 292 292 } 293 293 294 int UIToolBoxPage::pageWidgetHeight() const295 { 296 if (m_pWidget && m_pWidget-> isVisible() && m_pWidget->sizeHint().isValid())297 return m_pWidget->sizeHint() .height();298 return 0;294 QSize UIToolBoxPage::pageWidgetSize() const 295 { 296 if (m_pWidget && m_pWidget->sizeHint().isValid()) 297 return m_pWidget->sizeHint(); 298 return QSize(); 299 299 } 300 300 … … 376 376 this, &UIToolBox::sltHandleShowPageWidget); 377 377 378 static int iMaxPageHeight = 0;379 int iTotalTitleHeight = 0;380 foreach(UIToolBoxPage *pPage, m_pages)381 {382 if (pWidget && pWidget->sizeHint().isValid())383 iMaxPageHeight = qMax(iMaxPageHeight, pWidget->sizeHint().height());384 iTotalTitleHeight += pPage->titleHeight();385 }386 setMinimumHeight(m_iPageCount * (qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin) +387 qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin)) +388 iTotalTitleHeight +389 iMaxPageHeight);390 378 /* Add stretch at the end: */ 391 379 m_pMainLayout->addStretch(); … … 393 381 } 394 382 383 QSize UIToolBox::minimumSizeHint() const 384 { 385 386 int iMaxPageHeight = 0; 387 int iTotalTitleHeight = 0; 388 int iWidth = 0; 389 foreach(UIToolBoxPage *pPage, m_pages) 390 { 391 QSize pageWidgetSize(pPage->pageWidgetSize()); 392 iMaxPageHeight = qMax(iMaxPageHeight, pageWidgetSize.height()); 393 iTotalTitleHeight += pPage->titleHeight(); 394 iWidth = qMax(pageWidgetSize.width(), iWidth); 395 } 396 int iHeight = m_iPageCount * (qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin) + 397 qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin)) + 398 iTotalTitleHeight + 399 iMaxPageHeight; 400 return QSize(iWidth, iHeight); 401 } 402 395 403 void UIToolBox::setPageEnabled(int iIndex, bool fEnabled) 396 404 { -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.h
r88271 r90333 52 52 void setPageTitleIcon(int iIndex, const QIcon &icon, const QString &strIconToolTip = QString()); 53 53 void setCurrentPage(int iIndex); 54 virtual QSize minimumSizeHint() const /* override */; 54 55 55 56 protected:
Note:
See TracChangeset
for help on using the changeset viewer.