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. A word about Qt internals: mapping input to interface
Forum Updated to NodeBB v4.3 + New Features

A word about Qt internals: mapping input to interface

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.4k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kriu
    wrote on last edited by
    #1

    Hi,

    my problem is the following and I'm not interested in any piece code, just the theory and the data structures behind this : I have a piece of software that when an input is triggered for a device ( a mouse click or a touch ) it gives me the coordinates where the event occurred, and I have to map this event to my GUI.

    the question is what is the data structure used by Qt, or other GUI frameworks in general, to perform the mapping between the input ( for example the input given by Xlib under X11 ) and what I see on the screen ?

    I would like to read something about data structures that can solve this problem and what is the one choosed by the Qt team, but I suspect that is something like a graph or a tree.

    Thanks.

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

      Hi,

      There's not one answer, it all depends on the underlying platforms. Generally you will have your framework using a defined system and abstraction for inputs and then backends that translate the various platforms inputs in your framework's system.

      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
      • K Offline
        K Offline
        kriu
        wrote on last edited by
        #3

        [quote author="SGaist" date="1387665204"]Hi,

        There's not one answer, it all depends on the underlying platforms. Generally you will have your framework using a defined system and abstraction for inputs and then backends that translate the various platforms inputs in your framework's system.

        Hope it helps[/quote]

        Qt uses multiple data structures depending on the target platform ? Are you sure you are not referring to the API/design of the underlying system specific implementation ?

        My focus is just the data structure for this, nothing more, nothing less.

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          Hi,

          I'm not 100% what you mean by "data structure", but all GUI input events in Qt are represented by objects derived from the QEvent class (e.g. QMouseEvent, QTouchEvent).

          What SGaist means is: The underlying windowing system, which generates these events, are different for each platform. Thus, the internal Qt code that interfaces with the windowing system and create these QEvent objects are platform-dependent.

          You could start by studying the documentation and source code for the various subclasses of QEvent:

          • http://qt-project.org/doc/qt-5/qevent.html
          • https://qt.gitorious.org/qt/qtbase/source/src/gui/kernel/qevent.h

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kriu
            wrote on last edited by
            #5

            [quote author="JKSH" date="1387687353"]Hi,

            I'm not 100% what you mean by "data structure", but all GUI input events in Qt are represented by objects derived from the QEvent class (e.g. QMouseEvent, QTouchEvent).

            What SGaist means is: The underlying windowing system, which generates these events, are different for each platform. Thus, the internal Qt code that interfaces with the windowing system and create these QEvent objects are platform-dependent.

            You could start by studying the documentation and source code for the various subclasses of QEvent:

            • http://qt-project.org/doc/qt-5/qevent.html
            • https://qt.gitorious.org/qt/qtbase/source/src/gui/kernel/qevent.h[/quote]

            I'm talking about Qt internals, something that is probably not exposed in any public class.

            Usually a server like X under Linux gives you a pair of coordinates when an even happens, when you click or move your mouse the server fires an event.

            Now the problem is how to map that event with your layout/widget/window ? How to handle the rescaling of windows and the rescaling of the layout ? I don't know how this works under Qt but you probably need a data structure of some kind just to do the mapping between your input / pair of coordinates and your graphical layout .

            EDIT: to clarify further, a similar task is usually handled by libXt under X11, but as far as I know libXt handles input and does this kind of mapping for a widget, not for a window, also I'm interested in the nitty gritty details of this.

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

              Then have a look at the various platform 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
              • K Offline
                K Offline
                kriu
                wrote on last edited by
                #7

                I think that I'll wait for an answer from some Qt developer from the "core" team, if they still are here on this forum.

                1 Reply Last reply
                0
                • JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  The devs from the core team do not visit this forum. They are on the Interest mailing list or IRC (see http://qt-project.org/wiki/OnlineCommunities ). Note that they are currently on holiday; their offices are closed for Christmas and New Year.

                  The best way to get into the nitty gritty details is to have a look at the source code. You want the "Qt Platform Abstraction":http://qt-project.org/doc/qt-5/qpa.html (QPA) API. As one "Digia writer said":https://blog.qt.digia.com/blog/2013/07/23/anatomy-of-a-qt-5-for-android-application/,
                  [quote]Qt abstracts away the windowing system in an API called "QPA", so that platform-dependent code can be isolated to a plugin. This plugin will handle everything from putting graphics on the screen to propagating events from the windowing system and into your Qt event loop.[/quote]

                  [quote author="kriu" date="1387693075"]as far as I know libXt handles input and does this kind of mapping for a widget, not for a window[/quote]Both QWindow and QWidget are built on top of QPA.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  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