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. What happened to the QGraphicsSceneMouseEvent::button() function?
Qt 6.11 is out! See what's new in the release blog

What happened to the QGraphicsSceneMouseEvent::button() function?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 695 Views 2 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.
  • YosvanisY Offline
    YosvanisY Offline
    Yosvanis
    wrote on last edited by
    #1

    Hi!!
    I have next code;

    void Test::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
    {
        
        qDebug()<<"MouseMove"<<event->button();
        if (event->button() != Qt::LeftButton){
              //Always execute
                  return;
        }
    QGraphicsScene::mouseMoveEvent(event);
    }
    
    Output:
    MouseMove Qt::NoButton
    

    Why does the QGraphicsSceneMouseEvent :: button () function inside the mouseMoveEvent function return Qt :: Nobutton?
    However mousePressEvent and mouseReleaseEvent function work fine :(
    Output :
    MousePress Qt::LeftButton
    MouseMove Qt::NoButton
    MouseMove Qt::NoButton
    MouseRelease Qt::LeftButton

    Thanks!!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      That surprising indeed.

      What version of Qt are you using ?
      On what platform ?
      Can you provide a minimal compilable example that reproduces this ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • YosvanisY Offline
        YosvanisY Offline
        Yosvanis
        wrote on last edited by Yosvanis
        #3

        I have:
        Qt Creator 4.9.1
        Based on Qt 5.12.3 (MSVC 2017, 32 bit)
        Built on May 26 2019 21:17:08
        From revision 168e91b618
        Copyright 2008-2019 The Qt Company Ltd. All rights reserved.

        On Windows 10 Pro and you can run "Diagram Scene Example" and executed the same code just before after mousePressEvent, mouseMoveEvent and mouseReleaseEvent, in the DiagramScene class ... I'm sorry for my bad English ;)

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's the Qt Creator information. I would like to know which version of Qt you are using to build your application.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          YosvanisY 1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Looks like the buttons method return value could be fo interest.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • SGaistS SGaist

              That's the Qt Creator information. I would like to know which version of Qt you are using to build your application.

              YosvanisY Offline
              YosvanisY Offline
              Yosvanis
              wrote on last edited by
              #6

              @sgaist The version is Qt opensource-windows-x86-5.13.0.

              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