osx - QML Mac fullscreen mode lose mouse focus -
i'm using qml build osx application fullscreen mode support. intention toggle fullscreen/normal mode double-clicking main area of window, here minimal code:
import qtquick 2.4 import qtquick.window 2.2 window { id: main visible: true width: 800; height: 480 flags: qt.window | qt.windowfullscreenbuttonhint // osx native behavior support mousearea { anchors.fill: parent ondoubleclicked: { if (main.visibility === window.fullscreen) { main.visibility = window.automaticvisibility; } else { main.visibility = window.fullscreen; } } } }
it's simple, behavior weird:
whenever visibility state of application changes(enter or leave), user must click in window 1 more time before window mode can change again, the application loses mouse focus.
to validate i'm thinking, test more, add 1 more mousearea
(let's mouseareatest
) in window, split window side side , can receive onentered
, onexited
event. right after application enter or exit fullscreen mode, mouseareatest
never receive enter or exit event, unless click on window one more time, not want.
i know nothing how osx implement own fullscreen mode, nor why qml on osx has such buggy problem. expect tell me it.
update
later doubted if qml related window system of qml, tried using traditional qtwidgets
, , found same result there.
update
i tracked mouse event of traditional widget, , found problem: double click event consisted of 2 click event(press-release-press-release), when window state changd(fullscreen normal or normal fullscreen), the last release event never received unless click 1 more time.
i did more test: use button control window state, , problem gone, may consider bug of mouse event handle.
by way, post system info note:
osx 10.10.1
qt 5.4.1
Comments
Post a Comment