Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QPointerEvent throws error
QtWS25 Last Chance

QPointerEvent throws error

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
56 Posts 5 Posters 13.7k Views
  • 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.
  • C Offline
    C Offline
    curiosity
    wrote on last edited by
    #1

    Hi,
    QPointerEvent is not identified in the program. i am using Qt 5.12.12. Any suggestions?

    2a03daf8-8326-4835-99d9-7d77bc6c8a9f-image.png

    jsulmJ 1 Reply Last reply
    0
    • Pl45m4P Pl45m4

      @curiosity said in QPointerEvent throws error:

      Now it is working as expected

      Great, then mark the topic as solved.

      Beside the discussion about syntax and other stuff and I believe it was mentioned here before....
      your lambda is not needed and the content does not make too much sense.

      Window::onCurrentTextChanged(text);

      In what scope this is called? If you are in Window and you pass this to your labda, you don't need the fully qualified function name.

      echoLineEdit->show();

      Calling show() after the text has changed is not needed unless you never insert text manully but always set text programmatically with setText(...).
      But even then, connecting to slot onCurrentTextChanged(text) in Window would be way easier.

      C Offline
      C Offline
      curiosity
      wrote on last edited by
      #55

      @Pl45m4

      if you say that lambda is not needed, in which context do we use lambda for connect statements

      jsulmJ 1 Reply Last reply
      0
      • C curiosity

        Hi,
        QPointerEvent is not identified in the program. i am using Qt 5.12.12. Any suggestions?

        2a03daf8-8326-4835-99d9-7d77bc6c8a9f-image.png

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @curiosity Please read https://doc.qt.io/qt-6/qeventpoint.html
        Especially the "Since:" part.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        C 1 Reply Last reply
        2
        • jsulmJ jsulm

          @curiosity Please read https://doc.qt.io/qt-6/qeventpoint.html
          Especially the "Since:" part.

          C Offline
          C Offline
          curiosity
          wrote on last edited by
          #3

          @jsulm

          what is the alternate for qeventpoint in 5.12

          jsulmJ 1 Reply Last reply
          0
          • C curiosity

            @jsulm

            what is the alternate for qeventpoint in 5.12

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @curiosity What do you actually want to do?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            C 1 Reply Last reply
            0
            • jsulmJ jsulm

              @curiosity What do you actually want to do?

              C Offline
              C Offline
              curiosity
              wrote on last edited by
              #5

              @jsulm

                  if (touchEvent->touchPoints().count() == 2) {
                      const QEventPoint &touchPoint1 = touchEvent->touchPoints().first();
                      const QEventPoint &touchPoint2 = touchEvent->touchPoints().last();
              
                      QLineF line1(touchPoint1.sceneLastPosition(), touchPoint2.sceneLastPosition());
                      QLineF line2(touchPoint1.scenePosition(), touchPoint2.scenePosition());
              
                      setTransform(QTransform().rotate(line2.angleTo(line1)), true);
                  }
              

              this is the code .. i need 2 point on the screen

              Christian EhrlicherC 1 Reply Last reply
              0
              • C curiosity

                @jsulm

                    if (touchEvent->touchPoints().count() == 2) {
                        const QEventPoint &touchPoint1 = touchEvent->touchPoints().first();
                        const QEventPoint &touchPoint2 = touchEvent->touchPoints().last();
                
                        QLineF line1(touchPoint1.sceneLastPosition(), touchPoint2.sceneLastPosition());
                        QLineF line2(touchPoint1.scenePosition(), touchPoint2.scenePosition());
                
                        setTransform(QTransform().rotate(line2.angleTo(line1)), true);
                    }
                

                this is the code .. i need 2 point on the screen

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

                When you use Qt5 then you should look at the Qt5 documentation of QTouchEvent and use the correct return type: https://doc.qt.io/qt-5/qtouchevent.html#touchPoints

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

                C 1 Reply Last reply
                2
                • Christian EhrlicherC Christian Ehrlicher

                  When you use Qt5 then you should look at the Qt5 documentation of QTouchEvent and use the correct return type: https://doc.qt.io/qt-5/qtouchevent.html#touchPoints

                  C Offline
                  C Offline
                  curiosity
                  wrote on last edited by
                  #7

                  @Christian-Ehrlicher

                  I am getting a lot of linker errors. probably QApplication is not resolved while compiling. or what is the possible reason

                  Severity Code Description Project File Line Suppression State
                  Error LNK2001 unresolved external symbol "protected: virtual void __cdecl QGraphicsItem::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QGraphicsItem@@MEAAXPEAVQKeyEvent@@@Z) TouchPadProj C:\Users\source\repos\TouchProj\TouchProj\Touchpad.obj 1

                  Christian EhrlicherC C 2 Replies Last reply
                  0
                  • C curiosity

                    @Christian-Ehrlicher

                    I am getting a lot of linker errors. probably QApplication is not resolved while compiling. or what is the possible reason

                    Severity Code Description Project File Line Suppression State
                    Error LNK2001 unresolved external symbol "protected: virtual void __cdecl QGraphicsItem::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QGraphicsItem@@MEAAXPEAVQKeyEvent@@@Z) TouchPadProj C:\Users\source\repos\TouchProj\TouchProj\Touchpad.obj 1

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

                    @curiosity Then you should link against QtGui as shown in the documentation.

                    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
                    0
                    • C curiosity

                      @Christian-Ehrlicher

                      I am getting a lot of linker errors. probably QApplication is not resolved while compiling. or what is the possible reason

                      Severity Code Description Project File Line Suppression State
                      Error LNK2001 unresolved external symbol "protected: virtual void __cdecl QGraphicsItem::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QGraphicsItem@@MEAAXPEAVQKeyEvent@@@Z) TouchPadProj C:\Users\source\repos\TouchProj\TouchProj\Touchpad.obj 1

                      C Offline
                      C Offline
                      curiosity
                      wrote on last edited by
                      #9

                      @Christian-Ehrlicher

                      6b092e55-5ef9-43ab-b345-97af9c01bc22-image.png

                      there are so many such errors

                      Christian EhrlicherC 1 Reply Last reply
                      0
                      • C curiosity

                        @Christian-Ehrlicher

                        6b092e55-5ef9-43ab-b345-97af9c01bc22-image.png

                        there are so many such errors

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

                        @curiosity And why don't you do what I told you then? When you want to use a library then you have to link against this library...

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

                        C 1 Reply Last reply
                        0
                        • Christian EhrlicherC Christian Ehrlicher

                          @curiosity And why don't you do what I told you then? When you want to use a library then you have to link against this library...

                          C Offline
                          C Offline
                          curiosity
                          wrote on last edited by
                          #11

                          @Christian-Ehrlicher

                          this is my .pro file

                          QT += gui // I guess this is how you suggested
                          QT += widgets

                          -lQtGui

                          HEADERS = knob.h
                          SOURCES = main.cpp knob.cpp

                          install

                          target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/knobs
                          INSTALLS += target

                          this didnt work

                          jsulmJ 1 Reply Last reply
                          0
                          • C curiosity

                            @Christian-Ehrlicher

                            this is my .pro file

                            QT += gui // I guess this is how you suggested
                            QT += widgets

                            -lQtGui

                            HEADERS = knob.h
                            SOURCES = main.cpp knob.cpp

                            install

                            target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/knobs
                            INSTALLS += target

                            this didnt work

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #12

                            @curiosity said in QPointerEvent throws error:

                            -lQtGui

                            What is this?!

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            C 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @curiosity said in QPointerEvent throws error:

                              -lQtGui

                              What is this?!

                              C Offline
                              C Offline
                              curiosity
                              wrote on last edited by
                              #13

                              @jsulm
                              linker flag... even with/ without this it isnt working

                              JonBJ jsulmJ 2 Replies Last reply
                              0
                              • C curiosity

                                @jsulm
                                linker flag... even with/ without this it isnt working

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by JonB
                                #14

                                @curiosity But what is it doing as you show in the middle of your .pro file? It will likely make it incorrect.

                                C 1 Reply Last reply
                                0
                                • C curiosity

                                  @jsulm
                                  linker flag... even with/ without this it isnt working

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #15

                                  @curiosity First: this linker flag is not needed. Second: the way you added it is wrong and makes no sense.

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  C 1 Reply Last reply
                                  0
                                  • JonBJ JonB

                                    @curiosity But what is it doing as you show in the middle of your .pro file? It will likely make it incorrect.

                                    C Offline
                                    C Offline
                                    curiosity
                                    wrote on last edited by
                                    #16

                                    @JonB

                                    I removed it. also #include <QApplication> is not resolved by the compiler. i have to include the entire path/absolute path something like this

                                    #include <C:\Qt\Qt5.12.12\5.12.12\winrt_x64_msvc2017\include\QtWidgets\QApplication> which is not the right way

                                    jsulmJ 1 Reply Last reply
                                    0
                                    • C curiosity

                                      @JonB

                                      I removed it. also #include <QApplication> is not resolved by the compiler. i have to include the entire path/absolute path something like this

                                      #include <C:\Qt\Qt5.12.12\5.12.12\winrt_x64_msvc2017\include\QtWidgets\QApplication> which is not the right way

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #17

                                      @curiosity said in QPointerEvent throws error:

                                      also #include <QApplication> is not resolved by the compiler

                                      Then something is wrong with your project configuration.
                                      Did you rerun qmake after editing the pro file?
                                      It also looks like you're using Visual Studio - I never used it with Qt, but maybe you need to recreate project files after changing pro file?

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      C 1 Reply Last reply
                                      0
                                      • jsulmJ jsulm

                                        @curiosity said in QPointerEvent throws error:

                                        also #include <QApplication> is not resolved by the compiler

                                        Then something is wrong with your project configuration.
                                        Did you rerun qmake after editing the pro file?
                                        It also looks like you're using Visual Studio - I never used it with Qt, but maybe you need to recreate project files after changing pro file?

                                        C Offline
                                        C Offline
                                        curiosity
                                        wrote on last edited by
                                        #18

                                        @jsulm

                                        I am not sure from where should i run qmake in visual studio. i rebuilt the solution after deleting the build folder.

                                        1 Reply Last reply
                                        0
                                        • jsulmJ jsulm

                                          @curiosity First: this linker flag is not needed. Second: the way you added it is wrong and makes no sense.

                                          C Offline
                                          C Offline
                                          curiosity
                                          wrote on last edited by
                                          #19

                                          @jsulm @JonB

                                          i switched to qt creator.

                                          i have an error here with signals and slots

                                          c4385b22-d686-4bc7-aa90-9d05909b0579-image.png

                                          looks like i have right signals and slots. but not getting about this errorgetting about

                                          JonBJ jsulmJ 2 Replies Last reply
                                          0
                                          • C curiosity

                                            @jsulm @JonB

                                            i switched to qt creator.

                                            i have an error here with signals and slots

                                            c4385b22-d686-4bc7-aa90-9d05909b0579-image.png

                                            looks like i have right signals and slots. but not getting about this errorgetting about

                                            JonBJ Offline
                                            JonBJ Offline
                                            JonB
                                            wrote on last edited by
                                            #20

                                            @curiosity
                                            Start by showing definition of the two slot functions you use.
                                            Is this an error only in the code completion inside Qt Creator, or do you get these errors when you actually compile?

                                            C 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