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. getting no response from QWheelEvent
Qt 6.11 is out! See what's new in the release blog

getting no response from QWheelEvent

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 1.6k 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.
  • M Offline
    M Offline
    Md Saif Khan
    wrote on last edited by
    #3

    I am using this function in qtopenglwidget. I have drawn linestrip. Now i want to add zoom in and out functionalities by using mouse wheel. I am new in qt . May be I am wrong. But i found in internet that to use mouse wheel, I have to use this function. Thats why first i was trying to print something by scrolling the mouse wheel. But it does not print anything.

    1 Reply Last reply
    0
    • M Md Saif Khan

      I am trying to use the mouse wheel but it does not give any response.
      i tried with the function below:
      void wheelEvent(QWheelEvent *ev)
      {
      if(ev->angleDelta().y() > 0) // up Wheel
      cout<< " increasing" << endl;
      else if(ev->angleDelta().y() < 0) //down Wheel
      cout<< " decreasing" << endl;
      }
      how to solve this problem?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Md-Saif-Khan said in getting no response from QWheelEvent:

      void wheelEvent(QWheelEvent *ev)

      You don't use this function in your qtopenglwidget here ...

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @Md-Saif-Khan said in getting no response from QWheelEvent:

        void wheelEvent(QWheelEvent *ev)

        You don't use this function in your qtopenglwidget here ...

        M Offline
        M Offline
        Md Saif Khan
        wrote on last edited by
        #5

        @Christian-Ehrlicher could you please tell me how i can use mouse wheel while i am working on qtopenglwidget?

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

          Hi,

          You start by creating a subclass of QOpenGLWidget.

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

          M 1 Reply Last reply
          2
          • SGaistS SGaist

            Hi,

            You start by creating a subclass of QOpenGLWidget.

            M Offline
            M Offline
            Md Saif Khan
            wrote on last edited by
            #7

            @SGaist what did you mean by "creating a subclass of QOpenGLWidget". Could you please provide me some link or example which i can follow.?

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

              Then I recommend with starting from the basics: C++ inheritance.

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

              M 1 Reply Last reply
              1
              • SGaistS SGaist

                Then I recommend with starting from the basics: C++ inheritance.

                M Offline
                M Offline
                Md Saif Khan
                wrote on last edited by
                #9

                @SGaist Sorry. I meant that it would be helpful if you can provide me some website link where i can understand how they are using mouse wheel in qt for qtopenglwidget.

                Christian EhrlicherC 1 Reply Last reply
                0
                • M Md Saif Khan

                  @SGaist Sorry. I meant that it would be helpful if you can provide me some website link where i can understand how they are using mouse wheel in qt for qtopenglwidget.

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  @Md-Saif-Khan said in getting no response from QWheelEvent:

                  me some website link where i can understand how they are using mouse wheel in qt for qtopenglwidget.

                  This will not help until you learn basic ++ stuff like inheritance as @SGaist already pointed out.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

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

                    You know that your current free function just misses one thing to be properly used ?

                    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
                    • M Offline
                      M Offline
                      Md Saif Khan
                      wrote on last edited by
                      #12

                      I understood the problem. Thank you for your help. :)

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

                        Great !

                        Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three doted menu beside the answer you deem correct so that other forum users may know a solution was found :-)

                        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

                        • Login

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