[SOLVED] Shift + Mouseclick
I got a question.
I have button that has to do 2 things.
Go to a function
When shift + clicked:
Go to somewhere else
I have tried it with a keypressEvent, catching the shift key and changing the connect(SIGNAL, SLOT), but it doesn't seem to catch that.
Then I tried to install an eventfilter, which results in nothing either. Anyone got any idea for me?
You would be of great help! Thanks
the event filter should work if you do it correctly :-) How did you do it? Could you share some code?
The other option would be, subclass the button, overwrite mouse events and emit additional signals when shift click the button.
I think it is working. I don't know what I was doing wrong, but now it works fine.
@bool EventWidget::eventFilter(QObject *obj, QEvent *event)
//qDebug() << event->key();
if (event->type() == QEvent::MouseButtonPress)
if(Qt::ShiftModifier == QApplication::keyboardModifiers())
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton)
//I do the other thing here.
return QWidget::eventFilter(obj, event);
And this, apparently, works just fine. So its [SOLVED]