Unsolved Get touch device info
-
Hello everyone.
I need to get a resolution of plugged touch display.
I know that QtouchEvent contains member 'window()' from which this event was sent. And the pointer to this window contains info about width and height of the window. But I do not see the same (or similar) information in QMouseEvent.
And the question: how can I get a resolution of plugged touch display in scope of mousePressEvent, mouseMoveEvent and mouseReleaseEvent?
Thanks.
-
Hi,
You could get the widget from which the event was generated and then QDesktopWidget to get the info you want.
-
Hi
https://doc.qt.io/qt-5/qscreen.html
can be used to find such information.
You can use the widget as context.
As far as I know you cant get the information via the mouse Events as such.QScreen* pScreen = QGuiApplication::screenAt(widget->mapToGlobal({widget->width()/2,0})); QRect availableScreenSize = pScreen->availableGeometry();
-
@SGaist, @mrjj I have found out the following info https://doc.qt.io/qt-5/qmouseevent-members.html
@SGaist I cannot see how can I get the widget from which the event was generated. Could you please explain how exactly to do the action from your post?
@mrjj I cannot see how can I link your example
QScreen* pScreen = QGuiApplication::screenAt(widget->mapToGlobal({widget->width()/2,0})); QRect availableScreenSize = pScreen->availableGeometry();
and QMouseEvent data. Could you please explain how exactly I can get QScreen info using QMouseEvent?
-
Well, dont you get the mouse event in a class?
So the "widget" in the code can be replaced with "this" and it should work.