MouseArea pressedButtons



  • Hello.

    @import QtQuick 1.1

    Text {
    text: mouseArea.pressed

    MouseArea {
    id: mouseArea
    anchors.fill: parent
    }
    }@

    First I press left mouse button and I see true.
    Then I press right mouse button still holding left button and I see true.
    Then I release right mouse button still holding left button and I see false.

    Anybody knows why?

    It is Qt 4.8.2 QtQuick 1.1 on windows with mingw.

    Using pressedButtons property also give strange results with multiple buttons pressed.



  • it seems that both mouse buttons pressed simultaneously are taken to be another button(because pressedButtons consists of bitwise combination of buttons)if considered together... right and left pressed together amount to a value of '3'... if you want to check if a button is pressed or not, you should use something like:
    @
    if(pressedButtons & Qt.LeftButton)
    //... code here
    @



  • Well the problem is, that you get a release event for the right mouse button, but no pressed event. Instead of the pressed event there is a context menu event.
    What happens is, the left button is pressed, then you press the right button and release it again. The release of the right button sets the internal state to not pressed.
    I think this can be considered as bug...



  • I agree that sounds like a bug -- could you add a new bug via http://bugreports.qt-project.org please?



  • pressedButtons & Qt.LeftButton don't work too but in a different way.
    It stay true after releasing right mouse button but then releasing left button it is not reset.

    Bugreport here https://bugreports.qt-project.org/browse/QTBUG-26458


Log in to reply
 

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