VirtualBox

Changeset 8705

Show
Ignore:
Timestamp:
05/08/08 15:16:30 (2 months ago)
Author:
vboxsync
Message:

FE/Qt-OSX: Fixed a bug where the context menu event could be triggered twice.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Frontends/VirtualBox/src/QIStateIndicator.cpp

    r8170 r8705  
    158158void QIStateIndicator::mousePressEvent (QMouseEvent *aEv) 
    159159{ 
    160     QContextMenuEvent qme (QContextMenuEvent::Mouse, aEv->pos(), aEv->globalPos(), 0); 
    161     emit contextMenuRequested (this, &qme); 
    162     if (qme.isAccepted()) 
    163         aEv->accept(); 
    164     else 
     160    /* Do this for the left mouse button event only, cause in the case of the 
     161     * right mouse button it could happen that the context menu event is 
     162     * triggered twice. Also this isn't necessary for the middle mouse button 
     163     * which would be some kind of overstated. */ 
     164    if (aEv->button() == Qt::LeftButton) 
     165    { 
     166        QContextMenuEvent qme (QContextMenuEvent::Mouse, aEv->pos(), aEv->globalPos(), 0); 
     167        emit contextMenuRequested (this, &qme); 
     168        if (qme.isAccepted()) 
     169            aEv->accept(); 
     170        else 
     171            QFrame::mousePressEvent (aEv); 
     172    }else 
    165173        QFrame::mousePressEvent (aEv); 
    166174} 
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIStateIndicator.cpp

    r8170 r8705  
    171171void QIStateIndicator::mousePressEvent (QMouseEvent *aEv) 
    172172{ 
    173     QContextMenuEvent qme (QContextMenuEvent::Mouse, aEv->pos(), aEv->globalPos(), 0); 
    174     emit contextMenuRequested (this, &qme); 
    175     if (qme.isAccepted()) 
    176         aEv->accept(); 
    177     else 
     173    /* Do this for the left mouse button event only, cause in the case of the 
     174     * right mouse button it could happen that the context menu event is 
     175     * triggered twice. Also this isn't necessary for the middle mouse button 
     176     * which would be some kind of overstated. */ 
     177    if (aEv->button() == Qt::LeftButton) 
     178    { 
     179        QContextMenuEvent qme (QContextMenuEvent::Mouse, aEv->pos(), aEv->globalPos(), 0); 
     180        emit contextMenuRequested (this, &qme); 
     181        if (qme.isAccepted()) 
     182            aEv->accept(); 
     183        else 
     184            QFrame::mousePressEvent (aEv); 
     185    }else 
    178186        QFrame::mousePressEvent (aEv); 
    179187} 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy