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. [Solved] Substitute of QWSMouseHandler class in QT5.x
QtWS25 Last Chance

[Solved] Substitute of QWSMouseHandler class in QT5.x

Scheduled Pinned Locked Moved General and Desktop
19 Posts 2 Posters 5.1k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    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
    0
    • S Offline
      S Offline
      Sidii
      wrote on last edited by
      #3

      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
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        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
        0
        • S Offline
          S Offline
          Sidii
          wrote on last edited by
          #5

          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
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            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
            0
            • S Offline
              S Offline
              Sidii
              wrote on last edited by
              #7

              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
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                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
                0
                • S Offline
                  S Offline
                  Sidii
                  wrote on last edited by
                  #9

                  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
                  0
                  • S Offline
                    S Offline
                    Sidii
                    wrote on last edited by
                    #10

                    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
                    0
                    • S Offline
                      S Offline
                      Sidii
                      wrote on last edited by
                      #11

                      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
                      0
                      • S Offline
                        S Offline
                        Sidii
                        wrote on last edited by
                        #12

                        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
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          /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
                          0
                          • S Offline
                            S Offline
                            Sidii
                            wrote on last edited by
                            #14

                            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
                            0
                            • S Offline
                              S Offline
                              Sidii
                              wrote on last edited by
                              #15

                              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
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                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
                                0
                                • S Offline
                                  S Offline
                                  Sidii
                                  wrote on last edited by
                                  #17

                                  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
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #18

                                    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
                                    0
                                    • S Offline
                                      S Offline
                                      Sidii
                                      wrote on last edited by
                                      #19

                                      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
                                      0

                                      • Login

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