VirtualBox

Changeset 77935 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 28, 2019 12:54:19 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Using stack widget for navigation widgets.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r77932 r77935  
    2323#include <QItemDelegate>
    2424#include <QGridLayout>
     25#include <QStackedWidget>
    2526#include <QTextEdit>
    2627
     
    475476    , m_pLocationComboBox(0)
    476477    , m_pWarningLabel(0)
     478    , m_pNavigationWidgetWidget(0)
    477479    , m_pBreadCrumbsWidget(0)
    478480{
     
    525527    }
    526528
    527     m_pLocationComboBox = new QComboBox;
    528     if (m_pLocationComboBox)
    529     {
    530         m_pMainLayout->addWidget(m_pLocationComboBox, 1, 1, 1, 4);
    531         m_pLocationComboBox->setEditable(false);
    532         connect(m_pLocationComboBox, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
    533                 this, &UIFileManagerTable::sltLocationComboCurrentChange);
    534     }
    535 
    536     m_pBreadCrumbsWidget = new UIFileManagerBreadCrumbs;
    537     if (m_pBreadCrumbsWidget)
    538     {
    539         m_pMainLayout->addWidget(m_pBreadCrumbsWidget, 1, 1, 1, 4);
    540         m_pBreadCrumbsWidget->setReadOnly(true);
    541         QSizePolicy sizePolicy;
    542         sizePolicy.setControlType(QSizePolicy::ComboBox);
    543         m_pBreadCrumbsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    544         connect(m_pBreadCrumbsWidget, &UIFileManagerBreadCrumbs::sigNavitatePath,
    545                 this, &UIFileManagerTable::sltHandleBreadCrumbsClick);
    546     }
    547 
     529    m_pNavigationWidgetWidget = new QStackedWidget;
     530    if (m_pNavigationWidgetWidget)
     531    {
     532        m_pNavigationWidgetWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     533
     534        m_pLocationComboBox = new QComboBox;
     535        if (m_pLocationComboBox)
     536        {
     537            m_pNavigationWidgetWidget->addWidget(m_pLocationComboBox);
     538            m_pLocationComboBox->setEditable(false);
     539            connect(m_pLocationComboBox, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
     540                    this, &UIFileManagerTable::sltLocationComboCurrentChange);
     541        }
     542
     543        m_pBreadCrumbsWidget = new UIFileManagerBreadCrumbs;
     544        if (m_pBreadCrumbsWidget)
     545        {
     546            m_pNavigationWidgetWidget->addWidget(m_pBreadCrumbsWidget);
     547            m_pBreadCrumbsWidget->setReadOnly(true);
     548            connect(m_pBreadCrumbsWidget, &UIFileManagerBreadCrumbs::sigNavitatePath,
     549                    this, &UIFileManagerTable::sltHandleBreadCrumbsClick);
     550        }
     551        m_pMainLayout->addWidget(m_pNavigationWidgetWidget, 1, 1, 1, 4);
     552    }
    548553    UIFileManagerOptions *pOptions = UIFileManagerOptions::instance();
    549554    if (pOptions)
     
    13821387void UIFileManagerTable::showHideBreadCrumbs(bool fShow)
    13831388{
    1384     if (m_pLocationComboBox)
    1385         m_pLocationComboBox->setVisible(!fShow);
    1386     if (m_pBreadCrumbsWidget)
    1387         m_pBreadCrumbsWidget->setVisible(fShow);
     1389    if (!m_pNavigationWidgetWidget)
     1390        return;
     1391    if (fShow)
     1392        m_pNavigationWidgetWidget->setCurrentIndex(0);
     1393    else
     1394        m_pNavigationWidgetWidget->setCurrentIndex(1);
    13881395}
    13891396
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h

    r77932 r77935  
    4646class QGridLayout;
    4747class QSortFilterProxyModel;
     48class QStackedWidget;
    4849class QTextEdit;
    4950class QVBoxLayout;
     
    295296    QILabel         *m_pWarningLabel;
    296297
     298    /** Contains m_pBreadCrumbsWidget and m_pLocationComboBox. */
     299    QStackedWidget           *m_pNavigationWidgetWidget;
    297300    UIFileManagerBreadCrumbs *m_pBreadCrumbsWidget;
    298301
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