VirtualBox

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


Ignore:
Timestamp:
Jun 10, 2021 4:04:00 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9930. Some more fixes about the tab closing stuff

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r89606 r89607  
    155155    :QTabBar(pParent)
    156156{
    157     setContextMenuPolicy(Qt::CustomContextMenu);
    158157}
    159158
     
    312311        {
    313312            pTabBar->setTabData(i, true);
    314             UIVMLogTab *pTab = logTab(i);
    315             if (pTab)
     313            /* Add close button only for manager UI. */
     314            if (uiCommon().uiType() == UICommon::UIType_SelectorUI)
    316315            {
    317                 UILogTabCloseButton *pCloseButton = new UILogTabCloseButton(0, pTab->machineId());
    318                 pCloseButton->setIcon(UIIconPool::iconSet(":/close_16px.png"));
    319                 pTabBar->setTabButton(i, QTabBar::RightSide, pCloseButton);
    320                 connect(pCloseButton, &UILogTabCloseButton::clicked, this, &UIVMLogViewerWidget::sltTabCloseButtonClick);
     316                UIVMLogTab *pTab = logTab(i);
     317                if (pTab)
     318                {
     319                    UILogTabCloseButton *pCloseButton = new UILogTabCloseButton(0, pTab->machineId());
     320                    pCloseButton->setIcon(UIIconPool::iconSet(":/close_16px.png"));
     321                    pTabBar->setTabButton(i, QTabBar::RightSide, pCloseButton);
     322                    connect(pCloseButton, &UILogTabCloseButton::clicked, this, &UIVMLogViewerWidget::sltTabCloseButtonClick);
     323                }
    321324            }
    322325        }
     
    650653    }
    651654    saveOptions();
    652 }
    653 
    654 void UIVMLogViewerWidget::sltShowTabBarContextMenu(const QPoint &pos)
    655 {
    656     if (m_pTabWidget && m_pTabWidget->tabBar())
    657     {
    658         int iIndex = m_pTabWidget->tabBar()->tabAt(pos);
    659         if (iIndex == -1)
    660             return;
    661         UIVMLogTab *pTab = qobject_cast<UIVMLogTab*>(m_pTabWidget->widget(iIndex));
    662         if (!pTab)
    663             return;
    664         QMenu menu;
    665 
    666         QAction *pCloseAction = menu.addAction(QString("%1 %2").arg(tr("Close Logs of")).arg(pTab->machineName()));
    667         pCloseAction->setData(pTab->machineId());
    668         connect(pCloseAction, &QAction::triggered, this, &UIVMLogViewerWidget::sltCloseMachineLogs);
    669         menu.exec(m_pTabWidget->tabBar()->mapToGlobal(pos));
    670     }
    671655}
    672656
     
    766750            m_pMainLayout->addWidget(m_pTabWidget);
    767751            connect(m_pTabWidget, &QITabWidget::currentChanged, this, &UIVMLogViewerWidget::sltCurrentTabChanged);
    768             connect(m_pTabWidget->tabBar(), &QTabBar::customContextMenuRequested,
    769                     this, &UIVMLogViewerWidget::sltShowTabBarContextMenu);
    770752        }
    771753
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r89605 r89607  
    142142        void sltResetOptionsToDefault();
    143143    /** @} */
    144     void sltShowTabBarContextMenu(const QPoint &pos);
    145144    void sltCloseMachineLogs();
    146145    void sltTabCloseButtonClick();
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