Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mouse double click event confueses with key event
Qt 6.11 is out! See what's new in the release blog

Mouse double click event confueses with key event

Scheduled Pinned Locked Moved General and Desktop
windows
3 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Heero
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alex_malyu
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Heero
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved