View Full Version : Finding a QWidget from a screen XY
andyp
12th August 2009, 14:14
Is there the equivalent in Qt of the WindowFromPoint (win32) or XTranslateCoordinates (X-windows) method, which returns a window (preferably a QWidget) given a screen(global) x,y ? I have trawled the doc, but can't find one.
yogeshgokul
12th August 2009, 14:18
Try:
QWidget * QApplication::widgetAt ( const QPoint & point ) [static]
andyp
12th August 2009, 14:30
Many thanks. Got it. Must get new glasses.
Suppaman
26th August 2012, 03:23
Try:
QWidget * QApplication::widgetAt ( const QPoint & point ) [static]
Hi
I have the same need but this call doesn't seem to work for me. I need to know if QT have a call able to get the handle of a child control (like, for example, a text box) present at specified xy coordinates (like WindowFromPoint API do). Reading the documentation of this call it said:
Returns the widget at global screen position point, or 0 if there is no Qt widget there.
Than it seem it can detect only qt widget and not standard widget.
Do you know if using qt is possible to hqve a call act like WindowFromPoint but working for all child controls in windows, linux and mac?
Thank you
ChrisW67
26th August 2012, 07:05
QApplication::widgetAt() works for all the widgets in the Qt application itself, top-level or child, thinly wrapped native or fully Qt. A Qt application cannot return a QWidget* for a non-Qt widget, or for an arbitrary widget in another application for obvious reasons. Use the Windows API if you want a Windows API handle to the window at the specified location. Do whatever the equivalent is for the Mac OS X and X11 environments. Just wanting to do this sort of thing means your application is almost certainly going to be platform-dependent anyway.
Suppaman
26th August 2012, 09:15
Hi
Thank you for reply. I could develop different code based to the running platform. I know how to do under windows, just found an example seem working in the same way for mac but I still miss the linux side. Do you know if linux have some api similar to WindowFromPoint()?
Thank you
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.