Changeset 59727 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 18, 2016 6:40:57 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r59094 r59727 185 185 int index = m_pages[cId]; 186 186 #ifdef Q_WS_MAC 187 # if QT_VERSION < 0x050000 187 188 QSize cs = size(); 188 189 if (index < m_sizeList.count()) … … 199 200 } 200 201 ::darwinSetShowsResizeIndicator(this, false); 202 # else /* QT_VERSION >= 0x050000 */ 203 /* If index is within the stored size list bounds: */ 204 if (index < m_sizeList.count()) 205 { 206 /* Get current/stored size: */ 207 const QSize cs = size(); 208 const QSize ss = m_sizeList.at(index); 209 210 /* Switch to the new page first if we are shrinking: */ 211 if (cs.height() > ss.height()) 212 m_pStack->setCurrentIndex(index); 213 214 /* Do the animation: */ 215 ::darwinWindowAnimateResize(this, QRect (x(), y(), ss.width(), ss.height())); 216 217 /* Switch to the new page last if we are zooming: */ 218 if (cs.height() <= ss.height()) 219 m_pStack->setCurrentIndex(index); 220 221 /* Unlock all page policies but lock the current one: */ 222 for (int i = 0; i < m_pStack->count(); ++i) 223 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Minimum, i == index ? QSizePolicy::Minimum : QSizePolicy::Ignored); 224 /* And make sure layouts are freshly calculated: */ 225 foreach (QLayout *pLayout, findChildren<QLayout*>()) 226 { 227 pLayout->update(); 228 pLayout->activate(); 229 } 230 } 231 # endif /* QT_VERSION >= 0x050000 */ 201 232 #else 202 233 m_pLbTitle->setText(m_pSelector->itemText(cId)); … … 592 623 ::darwinSetHidesAllTitleButtons(this); 593 624 625 # if QT_VERSION < 0x050000 594 626 /* Set all size policies to ignored: */ 595 627 for (int i = 0; i < m_pStack->count(); ++i) … … 618 650 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); 619 651 } 652 # else /* QT_VERSION >= 0x050000 */ 653 /* Unlock all page policies initially: */ 654 for (int i = 0; i < m_pStack->count(); ++i) 655 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored); 656 657 /* Activate every single page to get the optimal size: */ 658 for (int i = m_pStack->count() - 1; i >= 0; --i) 659 { 660 /* Activate current page: */ 661 m_pStack->setCurrentIndex(i); 662 663 /* Lock current page policy temporary: */ 664 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); 665 /* And make sure layouts are freshly calculated: */ 666 foreach (QLayout *pLayout, findChildren<QLayout*>()) 667 { 668 pLayout->update(); 669 pLayout->activate(); 670 } 671 672 /* Acquire minimum size-hint: */ 673 QSize s = minimumSizeHint(); 674 /* HACK ALERT! 675 * Take into account the height of native tool-bar title. 676 * It will be applied only after widget is really shown. 677 * The height is 11pix * 2 (possible HiDPI support). */ 678 s.setHeight(s.height() + 11 * 2); 679 /* Also make sure that width is no less than tool-bar: */ 680 if (iMinWidth > s.width()) 681 s.setWidth(iMinWidth); 682 /* And remember the size finally: */ 683 m_sizeList.insert(0, s); 684 685 /* Unlock the policy for current page again: */ 686 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored); 687 } 688 # endif /* QT_VERSION >= 0x050000 */ 620 689 621 690 sltCategoryChanged(m_pSelector->currentId());
Note:
See TracChangeset
for help on using the changeset viewer.