diff options
author | Doris Verria <doris.verria@qt.io> | 2022-09-14 15:14:35 +0200 |
---|---|---|
committer | Doris Verria <doris.verria@qt.io> | 2022-09-14 19:01:11 +0000 |
commit | 6430d1db636962ed25dd1c14a2d7ae548bafb948 (patch) | |
tree | 3d714dc0724db1a4a4d394ca363286a40a378959 /src/tools/uic/cpp/cppwriteinitialization.cpp | |
parent | b31d90291314c0664ef5aae72225c213fc560b06 (diff) |
QCocoaColor(/Font)Dialog: Call makeKeyAndOrderFront asynchronously
We are calling makeKeyAndOrderFront on the NSColorPanel once when
show()-ing it and then we call runModalForWindow when calling exec(),
which also internally makes the panel key window.
The call to makeKeyAndOrderFront changes the window to key window
immediately so by the time the next event loop is run, the window is
already key. This causes problem when running the modal loop in
runModalForWindow as now the [NSApp _previousKeyWindow] already points
to the color dialog (NSColorPanel), so the application looses the
reference to any other window that was key before the color dialog,
thus, choosing the wrong window as key when the color dialog is closed.
So ideally we would avoid the first call to makeKeyAndOrderFront, but
since we don't know if exec() will be called on the dialog, or just
show() (which would need the call to makeKeyAndOrderFront in order
to set the dialog visible), we need to make the call to
makeKeyAndOrderFront in an asynchronous way, so by the time the
next event loop is run (the modal session loop in the case of
exec()), the app still has the correct reference to _previousKeyWindow
and can choose the right window after the color dialog is closed.
Fixes: QTBUG-42661
Pick-to: 6.2 6.4
Change-Id: I1b5c429c90847c48d7aa1d61b2462122c5b587f8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteinitialization.cpp')
0 files changed, 0 insertions, 0 deletions