VirtualBox

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


Ignore:
Timestamp:
Oct 26, 2020 4:59:39 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Adding an action to control visibility of tab widget

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r86697 r86715  
    6161    HelpBrowserTabs_Max
    6262};
     63Q_DECLARE_METATYPE(HelpBrowserTabs);
    6364
    6465class UIHelpBrowserViewer : public QTextBrowser
     
    123124    , m_pIndexWidget(0)
    124125    , m_pBookmarksWidget(0)
    125     , m_pShowHideContentsWidgetAction(0)
    126 {
     126    , m_pShowHideTabWidgetAction(0)
     127{
     128    qRegisterMetaType<HelpBrowserTabs>("HelpBrowserTabs");
    127129    prepare();
    128130}
     
    157159void UIHelpBrowserWidget::prepareActions()
    158160{
    159     m_pShowHideContentsWidgetAction = new QAction(this);
    160     m_pShowHideContentsWidgetAction->setData(HelpBrowserTabs_TOC);
     161    m_pShowHideTabWidgetAction = new QAction(this);
     162    m_pShowHideTabWidgetAction->setCheckable(true);
     163    m_pShowHideTabWidgetAction->setChecked(true);
     164    connect(m_pShowHideTabWidgetAction, &QAction::toggled, this, &UIHelpBrowserWidget::sltHandleTabVisibility);
    161165}
    162166
     
    175179    m_pTabWidget = new QITabWidget;
    176180    AssertReturnVoid(m_pTabWidget && m_pHelpEngine && m_pBookmarksWidget);
     181    //m_pTabWidget->setTabsClosable(true);
    177182
    178183    m_pContentWidget = m_pHelpEngine->contentWidget();
     
    181186    AssertReturnVoid(m_pContentWidget && m_pIndexWidget);
    182187    m_pSplitter->addWidget(m_pTabWidget);
     188
    183189    m_pTabWidget->insertTab(HelpBrowserTabs_TOC, m_pContentWidget, QString());
    184190    m_pTabWidget->insertTab(HelpBrowserTabs_Index, m_pIndexWidget, QString());
    185191    m_pTabWidget->insertTab(HelpBrowserTabs_Bookmarks, m_pBookmarksWidget, QString());
     192
     193    // insertTabWidgets(HelpBrowserTabs_TOC);
     194    // insertTabWidgets(HelpBrowserTabs_Index);
     195    // insertTabWidgets(HelpBrowserTabs_Bookmarks);
    186196
    187197    m_pContentViewer = new UIHelpBrowserViewer(m_pHelpEngine);
     
    240250    m_pMenu = new QMenu(tr("View"), this);
    241251    AssertReturnVoid(m_pMenu);
    242     m_pMenu->addAction(tr("View"));
     252
     253    m_pMenu->addAction(m_pShowHideTabWidgetAction);
    243254}
    244255
     
    275286        m_pTabWidget->setTabText(HelpBrowserTabs_Bookmarks, tr("Bookmarks"));
    276287    }
    277     if (m_pShowHideContentsWidgetAction)
    278         m_pShowHideContentsWidgetAction->setText("Show/Hide Contents");
     288    if (m_pShowHideTabWidgetAction)
     289        m_pShowHideTabWidgetAction->setText("Show/Hide Tabs Widget");
    279290}
    280291
     
    300311}
    301312
     313void UIHelpBrowserWidget::sltHandleTabVisibility(bool fToggled)
     314{
     315    if (!m_pTabWidget)
     316        return;
     317    m_pTabWidget->setVisible(fToggled);
     318}
    302319
    303320void UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished()
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86697 r86715  
    7979    void sltHandleHelpEngineSetupFinished();
    8080    void sltHandleContentWidgetItemClicked(const QModelIndex &index);
     81    void sltHandleTabVisibility(bool togggled);
    8182
    8283private:
     
    9192    void saveOptions();
    9293    void cleanup();
    93 
    9494    /** @name Event handling stuff.
    9595      * @{ */
     
    131131    QHelpIndexWidget    *m_pIndexWidget;
    132132    QWidget             *m_pBookmarksWidget;
    133     QAction             *m_pShowHideContentsWidgetAction;
     133    QAction             *m_pShowHideTabWidgetAction;
    134134};
    135135
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