VirtualBox

Changeset 72154 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 8, 2018 7:52:06 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9072 Refactor UIVMFilterLineEdit take 2

File:
1 edited

Legend:

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

    r72153 r72154  
    105105    :QLineEdit(parent)
    106106    , m_pRemoveTermButton(0)
     107    , m_pClearAllButton(0)
    107108    , m_iRemoveTermButtonSize(16)
    108109    , m_iTrailingSpaceCount(1)
     
    146147{
    147148    QLineEdit::paintEvent(event);
     149
     150    if (!m_pClearAllButton || !m_pRemoveTermButton)
     151        createButtons();
    148152    int clearButtonSize = height();
    149153    m_pClearAllButton->setGeometry(width() - clearButtonSize, 0, clearButtonSize, clearButtonSize);
     
    191195void UIVMFilterLineEdit::createButtons()
    192196{
    193     m_pRemoveTermButton = new QToolButton(this);
    194     if (m_pRemoveTermButton)
    195     {
    196         m_pRemoveTermButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton));
    197         m_pRemoveTermButton->hide();
    198         connect(m_pRemoveTermButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltRemoveFilterTerm);
    199     }
    200 
    201     m_pClearAllButton = new QToolButton(this);
    202     if (m_pClearAllButton)
    203     {
    204         m_pClearAllButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_LineEditClearButton));
    205         connect(m_pClearAllButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltClearAll);
     197    if (!m_pRemoveTermButton)
     198    {
     199        m_pRemoveTermButton = new QToolButton(this);
     200        if (m_pRemoveTermButton)
     201        {
     202            m_pRemoveTermButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton));
     203            m_pRemoveTermButton->hide();
     204            connect(m_pRemoveTermButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltRemoveFilterTerm);
     205        }
     206    }
     207
     208    if (!m_pClearAllButton)
     209    {
     210        m_pClearAllButton = new QToolButton(this);
     211        if (m_pClearAllButton)
     212        {
     213            m_pClearAllButton->setIcon(m_pClearAllButton->style()->standardIcon(QStyle::SP_LineEditClearButton));
     214            connect(m_pClearAllButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltClearAll);
     215        }
    206216    }
    207217}
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