Important: Please read the Qt Code of Conduct -

mouse mid button up down scroll

  • How to recive mouse scrolling events?
    So far have been using this concept but in documentation no Qt::button for scroll.

    This enum type describes the different mouse buttons.

    Constant Value Description
    Qt::NoButton 0x00000000 The button state does not refer to any button (see QMouseEvent::button()).
    Qt::AllButtons 0x07ffffff This value corresponds to a mask of all possible mouse buttons. Use to set the 'acceptedButtons' property of a MouseArea to accept ALL mouse buttons.
    Qt::LeftButton 0x00000001 The left button is pressed, or an event refers to the left button. (The left button may be the right button on left-handed mice.)
    Qt::RightButton 0x00000002 The right button.
    Qt::MidButton 0x00000004 The middle button.
    Qt::MiddleButton MidButton The middle button.
    Qt::BackButton 0x00000008 The 'Back' button. (Typically present on the 'thumb' side of a mouse with extra buttons. This is NOT the tilt wheel.)
    Qt::XButton1 BackButton The 'Back' Button.
    Qt::ExtraButton1 XButton1 The 'Back' Button.
    Qt::ForwardButton 0x00000010 The 'Forward' Button. (Typically present beside the 'Back' button, and also pressed by the thumb.)
    Qt::XButton2 ForwardButton The 'Forward Button.
    Qt::ExtraButton2 ForwardButton The 'Forward' Button.
    Qt::TaskButton 0x00000020 The 'Task' Button.
    Qt::ExtraButton3 TaskButton The 'Task' Button.
    Qt::ExtraButton4 0x00000040 The 7th non-wheel Mouse Button.
    Qt::ExtraButton5 0x00000080 The 8th non-wheel Mouse Button.
    Qt::ExtraButton6 0x00000100 The 9th non-wheel Mouse Button.
    Qt::ExtraButton7 0x00000200 The 10th non-wheel Mouse Button.
    Qt::ExtraButton8 0x00000400 The 11th non-wheel Mouse Button.
    Qt::ExtraButton9 0x00000800 The 12th non-wheel Mouse Button.
    Qt::ExtraButton10 0x00001000 The 13th non-wheel Mouse Button.
    Qt::ExtraButton11 0x00002000 The 14th non-wheel Mouse Button.
    Qt::ExtraButton12 0x00004000 The 15th non-wheel Mouse Button.
    Qt::ExtraButton13 0x00008000 The 16th non-wheel Mouse Button.
    Qt::ExtraButton14 0x00010000 The 17th non-wheel Mouse Button.
    Qt::ExtraButton15 0x00020000 The 18th non-wheel Mouse Button.
    Qt::ExtraButton16 0x00040000 The 19th non-wheel Mouse Button.
    Qt::ExtraButton17 0x00080000 The 20th non-wheel Mouse Button.
    Qt::ExtraButton18 0x00100000 The 21st non-wheel Mouse Button.
    Qt::ExtraButton19 0x00200000 The 22nd non-wheel Mouse Button.
    Qt::ExtraButton20 0x00400000 The 23rd non-wheel Mouse Button.
    Qt::ExtraButton21 0x00800000 The 24th non-wheel Mouse Button.
    Qt::ExtraButton22 0x01000000 The 25th non-wheel Mouse Button.
    Qt::ExtraButton23 0x02000000 The 26th non-wheel Mouse Button.
    Qt::ExtraButton24 0x04000000 The 27th non-wheel Mouse Button.

    This way for rest of buttons working good.
    if (m->button() == Qt::MidButton){
    start_zoom_move = m->globalY();

    if (m->button() == Qt::RightButton){
    allowmousemoveSizing = 1;
    start_mouse_move_shift = m->globalX();


  • QWheelEvent

  • More precisely, the wheelEvent method

  • Thank you, solved

Log in to reply