VirtualBox

Changeset 8705 in vbox for trunk/src


Ignore:
Timestamp:
May 8, 2008 1:16:30 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
30643
Message:

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

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

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette