VirtualBox

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


Ignore:
Timestamp:
Oct 27, 2020 2:39:16 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Adding a toolbar.

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

Legend:

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

    r86723 r86724  
    3131#include <QSplitter>
    3232#include <QTextBrowser>
     33#include <QVBoxLayout>
    3334#ifdef RT_OS_SOLARIS
    3435# include <QFontDatabase>
     
    4546#include "QIToolBar.h"
    4647#include "UICommon.h"
     48#include "UIIconPool.h"
    4749
    4850/* COM includes: */
     
    121123    , m_pBookmarksWidget(0)
    122124    , m_pShowHideTabWidgetAction(0)
     125    , m_pGoHomeAction(0)
    123126    , m_fModelContentCreated(false)
    124127{
     
    147150void UIHelpBrowserWidget::prepare()
    148151{
     152    /* Create main layout: */
     153    m_pMainLayout = new QVBoxLayout(this);
     154    AssertReturnVoid(m_pMainLayout);
     155
    149156    prepareActions();
     157    prepareToolBar();
    150158    prepareWidgets();
    151159    prepareMenu();
     
    159167    m_pShowHideTabWidgetAction->setChecked(true);
    160168    connect(m_pShowHideTabWidgetAction, &QAction::toggled, this, &UIHelpBrowserWidget::sltHandleTabVisibility);
     169    m_pGoHomeAction = new QAction(UIIconPool::iconSet(":/file_manager_go_home_16px.png"), "", this);
     170    connect(m_pGoHomeAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleGoHomeAction);
    161171}
    162172
    163173void UIHelpBrowserWidget::prepareWidgets()
    164174{
    165     /* Create main layout: */
    166     m_pMainLayout = new QHBoxLayout(this);
    167175    m_pSplitter = new QSplitter;
    168 
    169     AssertReturnVoid(m_pMainLayout && m_pSplitter);
     176    AssertReturnVoid(m_pSplitter);
    170177
    171178    m_pMainLayout->addWidget(m_pSplitter);
     
    226233        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    227234        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    228 
     235        m_pToolBar->addAction(m_pGoHomeAction);
    229236
    230237#ifdef VBOX_WS_MAC
     
    388395}
    389396
     397void sltHandleGoHomeAction();
     398
    390399void UIHelpBrowserWidget::sltHandleContentWidgetItemClicked(const QModelIndex &index)
    391400{
     
    435444        sltHandleHelpBrowserViewerSourceChange(m_pContentViewer->source());
    436445}
     446
     447void UIHelpBrowserWidget::sltHandleGoHomeAction()
     448{
     449    if (!m_pContentViewer)
     450        return;
     451
     452    QUrl homeUrl = findIndexHtml();
     453    if (!homeUrl.isValid())
     454        return;
     455    m_pContentViewer->setSource(homeUrl);
     456}
     457
    437458#include "UIHelpBrowserWidget.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86723 r86724  
    3737
    3838/* Forward declarations: */
    39 class QHBoxLayout;
     39class QVBoxLayout;
    4040class QHelpEngine;
    4141class QHelpContentModel;
     
    8383    void sltHandleHelpBrowserViewerSourceChange(const QUrl &source);
    8484    void sltHandleContentsCreated();
     85    void sltHandleGoHomeAction();
    8586
    8687private:
     
    119120
    120121    /** Holds container for log-pages. */
    121     QHBoxLayout         *m_pMainLayout;
     122    QVBoxLayout         *m_pMainLayout;
    122123    QITabWidget *m_pTabWidget;
    123124    /** @name Toolbar and menu variables.
     
    138139    QWidget             *m_pBookmarksWidget;
    139140    QAction             *m_pShowHideTabWidgetAction;
     141    QAction             *m_pGoHomeAction;
    140142    QString              m_strPageNotFoundText;
    141143    /* This is set t true when handling QHelpContentModel::contentsCreated signal. */
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