简体   繁体   中英

QQuickItem not receiving mouse events after using grabMouse() when mouse is outside app window

I have an QtGuiApplication with single QQuickItem. and I want quickitem to receive mouse events when mouse pointer is outside the Main Window. mouse pointer can be anywhere in screen. So at the end QQuickItem should receive mouse events(eg mouse move) when the mouse pointer is outside application window.

I used grabMouse [void QQuickItem::grabMouse()] to do this. but I see no effect as desired. QuickItem receives event only when mouse pointer is inside App window. It stopped getting any mouse event as soon as mouse pointer leaves the QGuiApplication boundary.

As I read grabMouse should solve my problem but somehow it doesn't. Can anyone point me that is there is any extras need to be done or anything wrong here.

Note : after using grabmouse Quickitem starts getting mousemove event when mouse is passed over application

I believe you can not receive mouse events when mouse it outside your application window. That is how OS usually works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM