How to install a eventFilter to a WinOS window in Qt? - qt

I have got the handle of a WinOS window,eg. Internet Explorer window, in Qt.I did it in this way:m_hwndUnderCursor= WindowFromPoint(curPoint);
How can I install a eventFilter to m_hwndUnderCursor by QWidget::find(m_hwndUnderCursor)->installEventFilter(this); successfully,so that I can watch m_hwndUnderCursor in Qt without HOOK technology.
I know because m_hwndUnderCursor a pointer to a WinOS window so QWidget::find(m_hwndUnderCursor) always return NULL.Is there a way to make it?

A quick answer is: you cannot do this.
A more detailed answer:
The QObject::installEventFilter() works basing on Qt's events engine (the event loop, events propagation, etc). This is Qt's internal stuff and this is not available to other windows, outside the Qt application. It will only work with windows that are part of the same application that you're calling installEventFilter() from.
For similar reason the QWidget::find() will never give you an existing QWidget in result if you try to find non-Qt window. It works only with windows created within your Qt application. Also see this: Can QWidget::find find widgets from a different process?
You will have to deal with it using native Windows API.

Related

Define input type for Windows 10 touch keyboard from a JavaFX application

I have a working JavaFX app running on windows 10.
I would like to use the touch-keyboard in a similar to MSDN user input scope to change the touch keyboard
HOWEVER there is no way to interact with it. All textfieeds open the Default keyboard.
I would like to find the closest to JavaFX as possible solution.
Things I have tries so far:
Tried to use the WM_MESSAGE to trick the OS, see Here. This is a messy workaround that does not work on windows 10.
Encapsulating the WM_MESSAGE or InputScope object in an executable, and calling it from JNI only creates a one-way transition from app to keyboard. it will not suffice.
Using a custom keyboard or the JAvaFX touch keyboard (see here is not a valid solution as these keyboards look a bit messy, and they require some twirking we already know exist.
set-numeric-layout-for-windows-onscreen-keyboard-programmatically not working.
activating-touch-enabled-controls-in-javafx is irrelevant.

Automated functional testing qt apps in windows

I'm trying to create scripts that test if some GUI components exist inside a window (combo boxes, check boxes, the state of check boxes, etc.) The app I want to tests is written in QT and running on Windows 7. Its content is created dynamically.
I've tried with swapy/pywinauto, AutoHotkey and AutoIt. But as they rely on standard Windows API calls they are useless for this (need a solution that involves QT).
Any recommendation will be appreciated.
You can try QtTestLib for integrated solution, or, if you want (and can afford) commercial solutions, I am aware of squish and kdexecutor.
Are you aware that AutoHotKey Windows Spy allows you to see if certain GUI objects exist inside a window. In the example image you see that I held the mouse over a combo box named ComboBox5. Are you trying to test at this level?
The rest can be found here already:Check if a certain button is existing or not using autohotkey

masking QT widget while capturing the screen

I have a Qt 4.8 application for both Win and Mac that captures the screen.
I have a QT widget on my desktop (always on top) that shouldn't be captured during my capture. Instead of the QT widget, the application/desktop running behind the QWidget should be captured. My QT application's UI should be masked from capturing.
Is there any way i can do this?
The main question is: are you in control of taking the screenshot or not? If you're taking the screenshot, it'd be doable but platform specific. You'd need to get the contents of all of the windows on the screen except the one you don't want to see, and build up a screenshot from those.
If it's a third party screen grabber, like Ctrl-PrtSc on Windows or Grab on OS-X, then you're out of luck unless the OS provides some APIs that would enable you to hide the widget.
The functionality you desire isn't exactly commonplace so I'm doubtful there's any portable, or even sane, way of achieving what you want.

Embedding Qt GUI into existing OpenGL program

I'm currently trying to get Qt working with my existing program.
I'm using SFML for creating my OpenGL rendering context and creating the window. The things I tried out so far however always create a separate window by Qt instead of just rendering into the existing context.
Is there any way I can force Qt to render to an already existing OpenGL context?
I've not looked into the specifics, but this has been done for openage.
I think looking at the documentation for QQuickRenderControl might be a good place to start.
Qt wants full control over the windows and the event loop, so this will not work (unless you put a lot of effort into it). Your best bet is using a QGLWidget and emulate the event management of SFML with that, so that your application effectively runs on Qt. It is very well possible to render Qt widgets into a OpenGL window (Qt has a OpenGL widget backend) but this must be still managed by Qt itself.

Qt+OpenGl+SimpleGl

I have enabled qt+OpenGl+SimpleGl on one of the ARM platform and was able to run opengl example programs.
I also has a qt+Webkit, which is working with a graphic plugin.
I wanted to use simpleGl context for every thing, instead of using the normal graphic screen. So, when I try to run Qt+Webkit with simpleGl, I just get a blank screen.
Does QT support this? If so how can we make it?
Yes, this is correct. OpenGL draws directly to the framebuffer. The simplegl driver doesn't handle what is drawn using the raster paint engine of the QWS, so you may see only black.
Using simplegl for "everything" means you want everything to be drawn using OpenGL in your EGL full-screen window? This is possible under some assumptions. You have to write all your applications to be rendered using the Qt OpenGL paint engine (using the opengl graphics system is not supported under Qt/E). This is possible also for QtWebKit, I'm doing it now. Note that this does not mean that everything is rendered using hardware acceleration. You'll have to write your applications "the right way" to get all actually hardware accelerated. Consider that you'll have to handle the mouse pointer some other way in this case.
The other way is to just modify the simplegl driver to allow for the use of Qt applications using the raster paint engine. This is possible as well with some limitations. Qt can use blit to place its own windows over OpenGL. Look for the framebuffer driver inside the Qt source tree to know how to do this. You can then have common Qt applications and OpenGL Qt applications some way. I'm doing this as well. Not everything can be done anyway.
EDIT: I'm sure you already did, but in case, give this http://doc.qt.io/qt-4.8/qt-embeddedlinux-opengl.html much attention.
Unfortunately I don't know anything about SimpleGL, but I do know that there is a way to render a standard Qt widget in a QGLWidget. Maybe have a look at this Qt Quarterly which I think is somewhat related to your question:
http://doc.qt.nokia.com/qq/qq26-openglcanvas.html

Resources