VirtualBox

Changeset 88065 in vbox


Ignore:
Timestamp:
Mar 10, 2021 11:05:15 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950: New VM Wizard: Layout fix for QIRichTextLabel stuff; Wrappable labels should be a members of Basic page and should be inserted into a root layout; Besides that, I'd prefer to have no layout margins where possible.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r87941 r88065  
    180180UIWizardNewVMPage1::UIWizardNewVMPage1(const QString &strGroup)
    181181    : m_pNameAndSystemEditor(0)
    182     , m_pNameOSTypeLabel(0)
    183182    , m_pISOFilePathSelector(0)
    184     , m_pUnattendedLabel(0)
    185183    , m_pISOPathSelectorLabel(0)
    186184    , m_strGroup(strGroup)
     
    235233}
    236234
    237 QWidget *UIWizardNewVMPage1::createNameOSTypeWidgets(bool fCreateLabels)
    238 {
    239     QWidget *pContainer = new QWidget;
    240     QGridLayout *pLayout = new QGridLayout(pContainer);
    241 
    242     int iRow = 0;
    243     if (fCreateLabels)
    244     {
    245         m_pNameOSTypeLabel = new QIRichTextLabel;
    246         if (m_pNameOSTypeLabel)
    247             pLayout->addWidget(m_pNameOSTypeLabel, iRow++, 0, 1, 6);
    248     }
    249 
    250     m_pNameAndSystemEditor = new UINameAndSystemEditor(0, true, true, true);
    251     if (m_pNameAndSystemEditor)
    252         pLayout->addWidget(m_pNameAndSystemEditor, iRow++, 0, 1, 6);
    253 
    254     return pContainer;
     235QWidget *UIWizardNewVMPage1::createNameOSTypeWidgets()
     236{
     237    /* Prepare Name and OS Type editor: */
     238    m_pNameAndSystemEditor = new UINameAndSystemEditor(0,
     239                                                       true /* fChooseName? */,
     240                                                       true /* fChoosePath? */,
     241                                                       true /* fChooseType? */);
     242    return m_pNameAndSystemEditor;
    255243}
    256244
     
    420408}
    421409
     410
    422411UIWizardNewVMPageBasic1::UIWizardNewVMPageBasic1(const QString &strGroup)
    423412    : UIWizardNewVMPage1(strGroup)
     413    , m_pNameOSTypeLabel(0)
     414    , m_pUnattendedLabel(0)
    424415{
    425416    prepare();
     
    428419void UIWizardNewVMPageBasic1::prepare()
    429420{
     421    /* Prepare page layout: */
    430422    QVBoxLayout *pPageLayout = new QVBoxLayout(this);
    431     pPageLayout->addWidget(createNameOSTypeWidgets(/* fCreateLabels */ true));
    432 
    433     m_pUnattendedLabel = new QIRichTextLabel;
    434     if (m_pUnattendedLabel)
    435         pPageLayout->addWidget(m_pUnattendedLabel);
    436 
    437     QHBoxLayout *pISOSelectorLayout = new QHBoxLayout;
    438 
    439     m_pISOPathSelectorLabel = new QLabel;
    440     pISOSelectorLayout->addWidget(m_pISOPathSelectorLabel);
    441     m_pISOPathSelectorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
    442 
    443     m_pISOFilePathSelector = new UIFilePathSelector;
    444     if (m_pISOFilePathSelector)
    445     {
    446         m_pISOFilePathSelector->setResetEnabled(false);
    447         m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);
    448         m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
    449         m_pISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    450         m_pISOFilePathSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
    451         m_pISOPathSelectorLabel->setBuddy(m_pISOFilePathSelector);
    452         pISOSelectorLayout->addWidget(m_pISOFilePathSelector);
    453     }
    454 
    455     pPageLayout->addLayout(pISOSelectorLayout);
    456     pPageLayout->addStretch();
    457 
    458 
    459 
     423    if (pPageLayout)
     424    {
     425        /* Prepare Name and OS Type label: */
     426        m_pNameOSTypeLabel = new QIRichTextLabel(this);
     427        if (m_pNameOSTypeLabel)
     428            pPageLayout->addWidget(m_pNameOSTypeLabel);
     429
     430        /* Prepare Name and OS Type editor: */
     431        pPageLayout->addWidget(createNameOSTypeWidgets());
     432
     433        /* Prepare Unattended description label: */
     434        m_pUnattendedLabel = new QIRichTextLabel(this);
     435        if (m_pUnattendedLabel)
     436            pPageLayout->addWidget(m_pUnattendedLabel);
     437
     438        /* Prepare ISO Selector layout: */
     439        QHBoxLayout *pISOSelectorLayout = new QHBoxLayout;
     440        if (pISOSelectorLayout)
     441        {
     442            /* Prepare ISO Selector label: */
     443            m_pISOPathSelectorLabel = new QLabel(this);
     444            if (m_pISOPathSelectorLabel)
     445            {
     446                m_pISOPathSelectorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
     447                pISOSelectorLayout->addWidget(m_pISOPathSelectorLabel);
     448            }
     449            /* Prepare ISO Selector editor: */
     450            m_pISOFilePathSelector = new UIFilePathSelector(this);
     451            if (m_pISOFilePathSelector)
     452            {
     453                m_pISOFilePathSelector->setResetEnabled(false);
     454                m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);
     455                m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
     456                m_pISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     457                m_pISOFilePathSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
     458                m_pISOPathSelectorLabel->setBuddy(m_pISOFilePathSelector);
     459
     460                pISOSelectorLayout->addWidget(m_pISOFilePathSelector);
     461            }
     462
     463            pPageLayout->addLayout(pISOSelectorLayout);
     464        }
     465
     466        pPageLayout->addStretch();
     467    }
    460468
    461469    createConnections();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r87892 r88065  
    4040class UIWizardNewVMPage1 : public UIWizardPageBase
    4141{
    42 
    4342protected:
    4443
     
    7675    void composeMachineFilePath();
    7776
    78     QWidget *createNameOSTypeWidgets(bool fCreateLabels);
    79     int createNameOSTypeWidgets(QGridLayout *pLayout, bool fCreateLabels = true);
     77    QWidget *createNameOSTypeWidgets();
    8078    /** Colors the widgets red if they cause isComplete to fail. */
    8179    void markWidgets() const;
     
    9189    /** @name Widgets
    9290     * @{ */
    93        UINameAndSystemEditor *m_pNameAndSystemEditor;
    94        QIRichTextLabel *m_pNameOSTypeLabel;
    95        mutable UIFilePathSelector *m_pISOFilePathSelector;
    96        QIRichTextLabel *m_pUnattendedLabel;
    97        QLabel *m_pISOPathSelectorLabel;
     91        UINameAndSystemEditor *m_pNameAndSystemEditor;
     92        UIFilePathSelector    *m_pISOFilePathSelector;
     93        QLabel                *m_pISOPathSelectorLabel;
    9894    /** @} */
    9995
     
    166162    /** Validation stuff. */
    167163    virtual bool validatePage() /* override */;
     164
     165
     166    /** @name Widgets
     167     * @{ */
     168        QIRichTextLabel *m_pNameOSTypeLabel;
     169        QIRichTextLabel *m_pUnattendedLabel;
     170    /** @} */
    168171};
    169172
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp

    r88038 r88065  
    7777    QWidget *pHardwareContainer = new QWidget;
    7878    QGridLayout *pHardwareLayout = new QGridLayout(pHardwareContainer);
     79    pHardwareLayout->setContentsMargins(0, 0, 0, 0);
    7980
    8081    m_pBaseMemoryEditor = new UIBaseMemoryEditor(0, true);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.cpp

    r88038 r88065  
    109109    QWidget *pDiskContainer = new QWidget;
    110110    QGridLayout *pDiskLayout = new QGridLayout(pDiskContainer);
     111    pDiskLayout->setContentsMargins(0, 0, 0, 0);
    111112    m_pDiskSourceButtonGroup = new QButtonGroup;
    112113    m_pDiskEmpty = new QRadioButton;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r88046 r88065  
    5959    {
    6060        m_pToolBox = new UIToolBox;
    61         m_pToolBox->insertPage(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(/* fCreateLabels */ false), "");
     61        m_pToolBox->insertPage(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(), "");
    6262        m_pToolBox->insertPage(ExpertToolboxItems_Unattended, createUnattendedWidgets(), "", false);
    6363        m_pToolBox->insertPage(ExpertToolboxItems_Hardware, createHardwareWidgets(), "");
     
    345345    QWidget *pContainerWidget = new QWidget;
    346346    QGridLayout *pLayout = new QGridLayout(pContainerWidget);
     347    pLayout->setContentsMargins(0, 0, 0, 0);
    347348    int iRow = 0;
    348349
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette