[Solved] Substitute of QWSMouseHandler class in QT5.x
-
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
-
Thanks SGaist,
I checked inside:
/qtbase/src/platformsupport/input
There are following folders:
- evdevkeyboard
- evdevmouse
- evdevtablet
- evdevtouch
I read somewhere that evdev* works for eglfs platform.
Can i use it for LinuxFB also?
I am using QT_QPA_PLATFORM=linuxfbWill evdevmouse will work for linux framebuffer also?
Kindly clarify this doubt also. Thanks a lot
-
AFAIK, yes, linuxfb like eglfs has nothing to do with input devices
-
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
-
Since you are trying to play with a Qt plugin, put it in your target Qt's installation plugin path
-
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 :( -
set QT_DEBUG_PLUGINS=1 to see what happens with your plugins
-
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 :)
-
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
-
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=1I 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?
-
/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
-
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
-
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 :)
-
How are you doing it ?
-
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
-
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