Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2011

    Getting widget from coordinates

    I'm trying to get the widget of the foreground application at given location as below but all I get is 0. Also if I try to iterate children there is none. The foreground application can be anything the user is running e.g. Messages. On some other platforms like Mac OS X, one needs to use accessibility APIs to access UI elements of other applications but I see no such limitation documented nor I couldn't make much sense how to access QDesktopWidget as QAccessibleWidget in order to iterate through the children. Any ideas how to access arbitatary data represented by the widgets on screen?

    QDesktopWidget* desktop = QApplication::desktop();
    QWidget* childElement = desktop->childAt(300,300);

  2. #2
    Super Contributor
    Join Date
    Mar 2009

    Re: Getting widget from coordinates

    Hi likanen,
    As you have understood it's not possible to use that code to access to widgets which belongs to separate applications.
    QDesktopWidget is not a real widget; it's a kind of fictitious widget which provides you some informations about the desktop process, but you cannot really iterate through the its children.
    It's anyway important to understand that applications running on a desktop are not actually children of the Desktop.
    Application runs in windows. Windows are managed by a Window manager.

    So to be short to access to the children you need to use platform APIs. I don't know which one to use on MacOS X but for Linux/Unix/Maemo/MeeGo you can use X11 ones.
    Some widget and all windows widgets have a WinID. WinID are used to dispatch an event to the right widget of one app.
    Think about clicking (Mouse Events) or entering some text (key events). The system sends those events to the application which provide to dispatch to one of its widgets.
    In case you are interested in XEvents, you can read more at the current page: http://www.manpagez.com/man/3/XEvent/

Similar Threads

  1. Finding paths between two GPS coordinates on Google maps, embedded in a Qt widget
    By Anisha Kaul in forum [Archived] Qt Mobility Project
    Replies: 25
    Last Post: 2011-06-10, 05:11
  2. converting coordinates in pixel -> m3g coordinates
    By Kayron in forum Mobile Java General
    Replies: 0
    Last Post: 2011-02-27, 21:33
  3. Homescreen widget: Error occured. Widget removed
    By _yarik_ in forum Symbian User Interface
    Replies: 2
    Last Post: 2011-02-12, 22:17
  4. Replies: 1
    Last Post: 2009-12-20, 05:28
  5. Replies: 1
    Last Post: 2009-08-06, 04:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts