VirtualBox

Changeset 41250 in vbox


Ignore:
Timestamp:
May 10, 2012 11:59:26 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: 5590: Reworking UIPopupBox to use local event-filters instead global event-filter for mouse-processing.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp

    r39261 r41250  
    6060    connect(m_pTitleLabel, SIGNAL(linkActivated(const QString)), this, SIGNAL(titleClicked(const QString)));
    6161
    62     /* Install event-filter: */
    63     qApp->installEventFilter(this);
     62    /* Install local event-filters: */
     63    installEventFilter(this);
     64    m_pTitleIcon->installEventFilter(this);
     65    m_pWarningIcon->installEventFilter(this);
     66    m_pTitleLabel->installEventFilter(this);
    6467}
    6568
     
    131134    if (m_pContentWidget)
    132135    {
     136        m_pContentWidget->removeEventFilter(this);
    133137        layout()->removeWidget(m_pContentWidget);
    134 //        m_pContentWidget->removeEventFilter(this);
    135138    }
    136139    m_pContentWidget = pWidget;
    137 //    m_pContentWidget->installEventFilter(this);
    138 //    m_pContentWidget->setMouseTracking(true);
    139     layout()->addWidget(pWidget);
     140    layout()->addWidget(m_pContentWidget);
     141    m_pContentWidget->installEventFilter(this);
    140142    recalc();
    141143}
     
    183185{
    184186    QEvent::Type type = pEvent->type();
    185     if (   type == QEvent::MouseMove
    186         || type == QEvent::Wheel
    187         || type == QEvent::Resize
    188         || type == QEvent::Enter
    189         || type == QEvent::Leave)
     187    if (type == QEvent::Enter ||
     188        type == QEvent::Leave ||
     189        type == QEvent::MouseMove ||
     190        type == QEvent::Wheel)
    190191        updateHover();
    191192    return false;
     
    202203{
    203204    toggleOpen();
    204 }
    205 
    206 void UIPopupBox::mouseMoveEvent(QMouseEvent *pEvent)
    207 {
    208     updateHover();
    209     QWidget::mouseMoveEvent(pEvent);
    210 }
    211 
    212 void UIPopupBox::wheelEvent(QWheelEvent *pEvent)
    213 {
    214     updateHover();
    215     QWidget::wheelEvent(pEvent);
    216 }
    217 
    218 void UIPopupBox::enterEvent(QEvent *pEvent)
    219 {
    220     updateHover();
    221     QWidget::enterEvent(pEvent);
    222 }
    223 
    224 void UIPopupBox::leaveEvent(QEvent *pEvent)
    225 {
    226     updateHover();
    227     QWidget::leaveEvent(pEvent);
    228205}
    229206
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h

    r39261 r41250  
    7272    void resizeEvent(QResizeEvent *pEvent);
    7373    void mouseDoubleClickEvent(QMouseEvent *pEvent);
    74     void mouseMoveEvent(QMouseEvent *pEvent);
    75     void wheelEvent(QWheelEvent *pEvent);
    76     void enterEvent(QEvent *pEvent);
    77     void leaveEvent(QEvent *pEvent);
    7874    void paintEvent(QPaintEvent *pEvent);
    7975
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