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. Get touch device info
Forum Update on Monday, May 27th 2025

Get touch device info

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 287 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.
  • R Offline
    R Offline
    rrr_rrr_rrr1
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You could get the widget from which the event was generated and then QDesktopWidget to get the info you want.

      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
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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();
        
        1 Reply Last reply
        1
        • R Offline
          R Offline
          rrr_rrr_rrr1
          wrote on last edited by
          #4

          @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?

          mrjjM 1 Reply Last reply
          0
          • R rrr_rrr_rrr1

            @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?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @rrr_rrr_rrr1

            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.

            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