Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Solved] Substitute of QWSMouseHandler class in QT5.x

    General and Desktop
    2
    19
    4175
    Loading More Posts
    • 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.
    • S
      Sidii last edited by

      Dear all,
      i want to port my QT4.8 application to QT5.3 and one class is derived from QWSMouseHandler, any idea how to implement the same functionality in QT5?

      Please let me know.
      Thanks

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        I think it will depend on what plugin you use now. Have a look at the input folder in qtbase/src/platformsupport.

        Hope it helps

        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 Reply Quote 0
        • S
          Sidii last edited by

          Thanks SGaist,

          I checked inside:

          /qtbase/src/platformsupport/input

          There are following folders:

          1. evdevkeyboard
          2. evdevmouse
          3. evdevtablet
          4. evdevtouch

          I read somewhere that evdev* works for eglfs platform.

          Can i use it for LinuxFB also?
          I am using QT_QPA_PLATFORM=linuxfb

          Will evdevmouse will work for linux framebuffer also?

          Kindly clarify this doubt also. Thanks a lot

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            AFAIK, yes, linuxfb like eglfs has nothing to do with input devices

            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 Reply Quote 0
            • S
              Sidii last edited by

              Dear SGaist, thanks a lot for clarifying my doubt.

              Now suppose my QT application which contains One main window and inside that only one button is present. This app is kept inside:

              @/home/Sid/./ButtonApp@

              Now where should i keep the evdevmouse plugin?

              Should i place it under:

              @/home/Sid/plugins/libqevdevmouseplugin.so@

              OR

              @/home/Sid/plugins/generic/libqevdevmouseplugin.so@

              I am also setting the environment variable like this:

              @export QT_QPA_GENERIC_PLUGINS=evdevmouse:/dev/ttyS1@

              I also modified the main.cpp file which is kept inside:

              qtbase/src/plugins/generic/evdevmouse

              by adding a qDebug statement:

              @
              QObject* QEvdevMousePlugin::create(const QString &key,
              const QString &specification)
              {
              qDebug()<<"QEvdevMousePlugin::create";
              if (!key.compare(QLatin1String("EvdevMouse"), Qt::CaseInsensitive))
              return new QEvdevMouseManager(key, specification);
              return 0;
              }

              @

              But still when i run my QT application (./ButtonApp) i did not get any qDebug output.

              Kindly point out what i am doing wrong :(

              Thanks

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                Since you are trying to play with a Qt plugin, put it in your target Qt's installation plugin path

                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 Reply Quote 0
                • S
                  Sidii last edited by

                  Dear SGaist,
                  Thanks for your reply.
                  Now i have set the plugins directory by doing:
                  @export QT_PLUGIN_PATH=/home/Sid/plugins/generic@

                  and QT's mouse plugin: libqevdevmouseplugin.so
                  is located in the same directory, but still no qDebug lines are printed. I think control is not reaching to the evdevmouse plugin :(

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    set QT_DEBUG_PLUGINS=1 to see what happens with your plugins

                    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 Reply Quote 0
                    • S
                      Sidii last edited by

                      Dear SGaist,
                      Thanks for highlighting my mistake actually i did this:

                      @export QT_DEBUG_PLUGIN=1@

                      instead of this:

                      @export QT_DEBUG_PLUGINS=1@

                      So i made PLUGIN to PLUGINS now i am getting lot of thins on screen. Let me check in detail. I will get back to you.

                      Thanks a lot :)

                      1 Reply Last reply Reply Quote 0
                      • S
                        Sidii last edited by

                        Dear SGaist,

                        I gave following command to run my application:

                        @./buttonApp -plugin evdevmouse:/dev/ttyS1@

                        And i got following output:

                        @
                        QFactoryLoader::QFactoryLoader() checking directory path "/home/Sid/platforms" ...
                        QFactoryLoader::QFactoryLoader() looking at "/home/Sid/platforms/libqlinuxfb.so"
                        Found metadata in lib /home/Sid/platforms/libqlinuxfb.so, metadata=
                        {
                        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
                        "MetaData": {
                        "Keys": [
                        "linuxfb"
                        ]
                        },
                        "className": "QLinuxFbIntegrationPlugin",
                        "debug": false,
                        "version": 328193
                        }

                        Got keys from plugin meta data ("linuxfb")
                        QFactoryLoader::QFactoryLoader() looking at "/home/Sid/platforms/libqminimal.so"
                        Found metadata in lib /home/Sid/platforms/libqminimal.so, metadata=
                        {
                        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
                        "MetaData": {
                        "Keys": [
                        "minimal"
                        ]
                        },
                        "className": "QMinimalIntegrationPlugin",
                        "debug": false,
                        "version": 328193
                        }

                        Got keys from plugin meta data ("minimal")
                        QFactoryLoader::QFactoryLoader() looking at "/home/Sid/platforms/libqoffscreen.so"
                        Found metadata in lib /home/Sid/platforms/libqoffscreen.so, metadata=
                        {
                        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
                        "MetaData": {
                        "Keys": [
                        "offscreen"
                        ]
                        },
                        "className": "QOffscreenIntegrationPlugin",
                        "debug": false,
                        "version": 328193
                        }

                        Got keys from plugin meta data ("offscreen")
                        QFactoryLoader::QFactoryLoader() checking directory path "/home/Sid/plugins/generic/platforms" ...
                        loaded library "/home/Sid/platforms/libqlinuxfb.so"

                        QFactoryLoader::QFactoryLoader() checking directory path "/home/Sid/generic" ...
                        QFactoryLoader::QFactoryLoader() checking directory path "/home/Sid/plugins/generic/generic" ...
                        QFactoryLoader::QFactoryLoader() checking directory path "/home/Sid/styles" ...
                        QFactoryLoader::QFactoryLoader() checking directory path "/home/Sid/plugins/generic/styles" ...

                        @

                        Nothing is shown related to evdevmouse.
                        Required (.so) file is kept here:
                        @/home/Sid/plugins/generic/libqevdevmouseplugin.so@

                        Can you please guide me why it is not loading :(
                        What extra i need to do or some other setting i need to do.

                        Kindly help

                        Thanks

                        1 Reply Last reply Reply Quote 0
                        • S
                          Sidii last edited by

                          Also i have removed -DQT_NO_DEBUG
                          from the makefile of evdevmouse. So now it is debug enabled.
                          But still i no output i am getting from qDebug statements.

                          It is not getting loaded :(

                          1 Reply Last reply Reply Quote 0
                          • S
                            Sidii last edited by

                            Dear SGaist,
                            I am able to load the plugin. There was problem in the path. Thanks a lot :) for pointing to the QT_DEBUG_PLUGINS=1

                            I am getting qDebugs getting printed. But again i have one more doubt:

                            What is the difference between:

                            /qtbase/src/plugins/generic/evdevmouse

                            AND

                            /qtbase/src/platformsupport/input/evdevmouse

                            Actually to get the touch coordinates i want to add debug points to the code located in :

                            /qtbase/src/platformsupport/input/evdevmouse

                            But to my surprise, both the above locations are not interlinked.

                            Do i need to merge the code?

                            1 Reply Last reply Reply Quote 0
                            • SGaist
                              SGaist Lifetime Qt Champion last edited by

                              /qtbase/src/plugins/generic/evdevmouse is only the plugin stuff

                              /qtbase/src/platformsupport/input/evdevmouse is the actual code

                              AFAIK, the input code is builtin, so if you play with it, you have to deploy the libraries

                              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 Reply Quote 0
                              • S
                                Sidii last edited by

                                Dear SGaist, Thanks for your reply.

                                I am now using serial port to read the touch screen values. Actually our touch screen is working as a mouse. I am able to get the exact touch coordinates. But now what should i do with those coordinates?
                                I saw that in my old QT4x code one slot was called after getting the coordinates:

                                @QWSMouseHandler::mouseChanged(position, state, wheel);@

                                But now i want to port it to the QT 5. Can u please tell me how to proceed. i have seached evdevmouse plugin but there is no such slot.

                                My question is that i am able to get the x and y. but how should i pass to the QT so that button can be seen as pressed. Kindly guide me.

                                Thanks

                                1 Reply Last reply Reply Quote 0
                                • S
                                  Sidii last edited by

                                  Dear SGaist, i am able to detect the touch by just directly passing the touch coordinates to:
                                  @
                                  QWindowSystemInterface::handleMouseEvent(0, position, position, Qt::LeftButton);
                                  @

                                  But i dont know is this a correct way or not. Also in the header file of QWindowSystemInterface some warning is given:

                                  @
                                  //
                                  // W A R N I N G
                                  // -------------
                                  //
                                  // This file is part of the QPA API and is not meant to be used
                                  // in applications. Usage of this API may make your code
                                  // source and binary incompatible with future versions of Qt.
                                  //

                                  @

                                  Kindly guide me to the correct way.

                                  Thanks :)

                                  1 Reply Last reply Reply Quote 0
                                  • SGaist
                                    SGaist Lifetime Qt Champion last edited by

                                    How are you doing it ?

                                    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 Reply Quote 0
                                    • S
                                      Sidii last edited by

                                      Dear SGaist,

                                      Actually since tslib was not working with serial port touch screen, i wrote one program to get open the serial port and then get the coordinates. Once i get the coordinates, i immediately emit one custom signal(defined by me) and then i call my slot. Inside that slot i have written:

                                      @
                                      QWindowSystemInterface::handleMouseEvent(0, position, position, Qt::LeftButton);
                                      @

                                      So i am able to see the button getting pressed. So i am able to get the touch event. But i am not sure whether this approach is correct or not.

                                      Kindly give your inputs.

                                      Thanks

                                      1 Reply Last reply Reply Quote 0
                                      • SGaist
                                        SGaist Lifetime Qt Champion last edited by

                                        AFAIK there's nothing wrong with that. However, you should create a new generic plugin (you can get some ideas from the tslib one) so you have a reusable component

                                        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 Reply Quote 0
                                        • S
                                          Sidii last edited by

                                          Ok thanks a lot for your guidance. At my end also finally touch screen is working and push buttons are taking the events. Marking the thread as [solved]
                                          :)
                                          Cheers

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post