PDA

View Full Version : Mouse Events for 2 different GUI applications running on same screen.



Meenakshi
8th October 2015, 07:24
Hello,

I have two different qt transparent applications having their own GUI running on the same screen.

I have a requirement for the mouse events(mouse move, left and right clicks) to be captured and processed by application 1 in some instance and the mouse events to be captured and processed by application 2 in some other instance.

How can this requirement be achieved.

Thanks in advance.

Regards,
Meenakshi.

Meenakshi
14th October 2015, 04:29
Hello,

I have two different qt transparent applications having their own GUI running on the same screen.

I have a requirement for the mouse events(mouse move, left and right clicks) to be captured and processed by application 1 in some instance and the mouse events to be captured and processed by application 2 in some other instance.

How can this requirement be achieved.

Thanks in advance.

Regards,
Meenakshi.

d_stranz
14th October 2015, 04:35
You asked this identical question (http://www.qtcentre.org/threads/63901-Mouse-Events-for-2-different-GUI-applications-running-on-same-screen) 6 days ago. If you don't get an answer to your original post, don't start another thread.

anda_skoa
14th October 2015, 11:53
Thread's merged.

Cheers,
_

d_stranz
14th October 2015, 18:10
two different qt transparent applications having their own GUI running on the same screen.

Both of these are Qt applications? And you have written both of them (or have the source code)?

If so, you may be able to use an event filter to capture the mouse events and emit signals from each app. The other app connects to these signals and provides slots to handle them.

But what you want to do makes little sense in practice. Mouse events are associated with GUI objects like widgets or graphics items, and have a position relative to that object. You can translate that to be relative to the application main window or to the screen, but if the user moves anything around, then all the coordinates change, too. Each app would have to know all the details about the other app's GUI objects to be able to understand which object was the target of the mouse activity.

It would make more sense to create a specific set of signals that you can use to send real information between your two apps, rather than just capture raw mouse events. If App 1 really wants to know that Button 2 was clicked in App 2, then you should devise a signal emitted by App 2 that says "Button2Clicked" instead of just mouse press event at (107, 42).