Mouse double click event confueses with key event



  • Hello,
    I encounter a very strange issue when I am developing a desktop application with Qt5.5.0_mingw32 on Windows. I create a GUI application simply based on QWidget by QtCreator wizard. And I just add the following lines:

    void Widget::keyPressEvent(QKeyEvent *event)
    {
    qDebug() << event->modifiers() << "," << event->key();
    }

    void Widget::mouseDoubleClickEvent(QMouseEvent *event)
    {
    qDebug() << "mouse double click";
    }

    Then I run the demo and double click left mouse button. The result output is:
    mouse double click
    QFlagsQt::KeyboardModifiers(ControlModifier) , 16777249
    QFlagsQt::KeyboardModifiers(ControlModifier) , 67

    It should not generate key press event, right?
    So how can I to avoid this? Or is there anything wrong I have done?

    Thank you!



  • It looks like one of the key it determined as pressed is Qt::Key_End
    Are you sure you do not have it pressed?



  • Hello alex_malyu,
    Thanks for your quick reply.
    I'm sure I don't have it pressed. Only when I double click mouse button, it does these output.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.