Changeset 88795 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 30, 2021 12:20:49 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r87498 r88795 727 727 void UISettingsDialog::prepareWidgets() 728 728 { 729 if (objectName().isEmpty()) 730 setObjectName(QStringLiteral("UISettingsDialog")); 731 resize(550, 450); 732 QWidget *pCentralWidget = new QWidget(this); 733 pCentralWidget->setObjectName(QStringLiteral("pCentralWidget")); 734 QGridLayout *pMainLayout = new QGridLayout(pCentralWidget); 735 pMainLayout->setObjectName(QStringLiteral("pMainLayout")); 736 m_pLabelTitle = new QLabel(pCentralWidget); 737 m_pLabelTitle->setObjectName(QStringLiteral("m_pLabelTitle")); 738 QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 739 sizePolicy.setHorizontalStretch(0); 740 sizePolicy.setVerticalStretch(0); 741 sizePolicy.setHeightForWidth(m_pLabelTitle->sizePolicy().hasHeightForWidth()); 742 m_pLabelTitle->setSizePolicy(sizePolicy); 743 QPalette palette; 744 QBrush brush(QColor(255, 255, 255, 255)); 745 brush.setStyle(Qt::SolidPattern); 746 palette.setBrush(QPalette::Active, QPalette::Window, brush); 747 palette.setBrush(QPalette::Inactive, QPalette::Window, brush); 748 palette.setBrush(QPalette::Disabled, QPalette::Window, brush); 749 m_pLabelTitle->setPalette(palette); 750 QFont font; 751 font.setFamily(QStringLiteral("Sans Serif")); 752 font.setPointSize(11); 753 font.setBold(true); 754 font.setWeight(75); 755 m_pLabelTitle->setFont(font); 756 m_pLabelTitle->setAutoFillBackground(true); 757 m_pLabelTitle->setFrameShape(QFrame::Box); 758 m_pLabelTitle->setFrameShadow(QFrame::Sunken); 759 m_pLabelTitle->setMargin(7); 760 pMainLayout->addWidget(m_pLabelTitle, 0, 1, 1, 1); 761 762 m_pWidgetStackHandler = new QWidget(pCentralWidget); 763 m_pWidgetStackHandler->setObjectName(QStringLiteral("m_pWidgetStackHandler")); 764 QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Expanding); 765 sizePolicy1.setHorizontalStretch(0); 766 sizePolicy1.setVerticalStretch(0); 767 sizePolicy1.setHeightForWidth(m_pWidgetStackHandler->sizePolicy().hasHeightForWidth()); 768 m_pWidgetStackHandler->setSizePolicy(sizePolicy1); 769 pMainLayout->addWidget(m_pWidgetStackHandler, 1, 1, 1, 1); 770 771 m_pButtonBox = new QIDialogButtonBox(pCentralWidget); 772 m_pButtonBox->setObjectName(QStringLiteral("m_pButtonBox")); 729 /* Prepare central-widget: */ 730 setCentralWidget(new QWidget); 731 if (centralWidget()) 732 { 733 /* Prepare main layout: */ 734 QGridLayout *pLayoutMain = new QGridLayout(centralWidget()); 735 if (pLayoutMain) 736 { 737 /* Prepare title label: */ 738 m_pLabelTitle = new QLabel(centralWidget()); 739 if (m_pLabelTitle) 740 { 741 m_pLabelTitle->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); 742 QPalette pal = QApplication::palette(); 743 pal.setColor(QPalette::Active, QPalette::Window, pal.color(QPalette::Active, QPalette::Base)); 744 m_pLabelTitle->setPalette(pal); 745 QFont fnt; 746 fnt.setFamily(QStringLiteral("Sans Serif")); 747 fnt.setPointSize(11); 748 fnt.setBold(true); 749 fnt.setWeight(75); 750 m_pLabelTitle->setFont(fnt); 751 m_pLabelTitle->setAutoFillBackground(true); 752 m_pLabelTitle->setFrameShadow(QFrame::Sunken); 753 m_pLabelTitle->setMargin(9); 754 755 pLayoutMain->addWidget(m_pLabelTitle, 0, 1); 756 } 757 758 /* Prepare widget stack handler: */ 759 m_pWidgetStackHandler = new QWidget(centralWidget()); 760 if (m_pWidgetStackHandler) 761 { 762 m_pWidgetStackHandler->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 763 pLayoutMain->addWidget(m_pWidgetStackHandler, 1, 1); 764 } 765 766 /* Prepare button-box: */ 767 m_pButtonBox = new QIDialogButtonBox(centralWidget()); 768 if (m_pButtonBox) 769 { 773 770 #ifndef VBOX_WS_MAC 774 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|775 QDialogButtonBox::Ok| QDialogButtonBox::Help);776 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents);771 m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | 772 QDialogButtonBox::NoButton | QDialogButtonBox::Help); 773 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); 777 774 #else 778 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton| 779 QDialogButtonBox::Ok); 775 // WORKAROUND: 776 // No Help button on macOS for now, conflict with old Qt. 777 m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | 778 QDialogButtonBox::NoButton); 780 779 #endif 781 pMainLayout->addWidget(m_pButtonBox, 2, 0, 1, 2); 782 783 setCentralWidget(pCentralWidget); 784 785 QObject::connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UISettingsDialog::reject); 786 QObject::connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UISettingsDialog::accept); 780 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UISettingsDialog::reject); 781 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UISettingsDialog::accept); 787 782 #ifndef VBOX_WS_MAC 788 connect(m_pButtonBox->button(QDialogButtonBox::Help), &QAbstractButton::pressed,789 &(msgCenter()), &UIMessageCenter::sltHandleHelpRequest);783 connect(m_pButtonBox->button(QDialogButtonBox::Help), &QAbstractButton::pressed, 784 &msgCenter(), &UIMessageCenter::sltHandleHelpRequest); 790 785 #endif 786 787 pLayoutMain->addWidget(m_pButtonBox, 2, 0, 1, 2); 788 } 789 } 790 } 791 791 } 792 792
Note:
See TracChangeset
for help on using the changeset viewer.