VirtualBox

Changeset 89606 in vbox


Ignore:
Timestamp:
Jun 10, 2021 3:37:31 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9930. Coonecting close button to slot

File:
1 edited

Legend:

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

    r89605 r89606  
    6767
    6868    //UILogTabCloseButton(QWidget *pParent, const QUuid &uMachineId, const QString &strMachineName);
    69     UILogTabCloseButton(QWidget *pParent = 0)
     69    UILogTabCloseButton(QWidget *pParent, const QUuid &uMachineId)
    7070        : QIToolButton(pParent)
     71        , m_uMachineId(uMachineId)
    7172    {
    7273        setAutoRaise(true);
     
    7475    }
    7576
     77    const QUuid &machineId() const
     78    {
     79        return m_uMachineId;
     80    }
     81
    7682protected:
    7783
     84    QUuid m_uMachineId;
    7885};
    7986/*********************************************************************************************************************************
     
    305312        {
    306313            pTabBar->setTabData(i, true);
    307             UILogTabCloseButton *pCloseButton = new UILogTabCloseButton;
    308             pCloseButton->setIcon(UIIconPool::iconSet(":/close_16px.png"));
    309 
    310             pTabBar->setTabButton(i, QTabBar::RightSide, pCloseButton);
    311             connect(pCloseButton, &UILogTabCloseButton::clicked, this, &UIVMLogViewerWidget::sltTabCloseButtonClick);
     314            UIVMLogTab *pTab = logTab(i);
     315            if (pTab)
     316            {
     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);
     321            }
    312322        }
    313323        else
     
    676686void UIVMLogViewerWidget::sltTabCloseButtonClick()
    677687{
    678     printf("UIVMLogViewerWidget::sltTabCloseButtonClick\n");
     688    UILogTabCloseButton *pButton = qobject_cast<UILogTabCloseButton*>(sender());
     689    if (!pButton)
     690        return;
     691    if (pButton->machineId().isNull())
     692        return;
     693    QVector<QUuid> list;
     694    list << pButton->machineId();
     695    removeLogViewerPages(list);
    679696}
    680697
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