From e71c921ad27dbb72f454951ffe22345f61a68d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 13 Sep 2013 10:13:21 +0200 Subject: [PATCH] Add Qt::WindowDoesNotAcceptFocus to our initial window flags on deco Qt requests focus on a mouse press event on the QWindow of a QWidget. This results in our active window losing focus when a mouse press on the window decoration happens. Of course we don't need Qt to request focus on the window decoration. If it's the inactive window we will activate it by ourself. If it's the active window, well it's already active. Adding Qt::WindowDoesNotAcceptFocus to the initial window flags ensures that this behavior in Qt gets disables with the result that the window no longer loses focus on mouse click on decoration. I declare this to be the most difficult one line change in my life. --- bridge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge.cpp b/bridge.cpp index e86d878df4..f00734ba5d 100644 --- a/bridge.cpp +++ b/bridge.cpp @@ -186,7 +186,7 @@ QWidget* Bridge::initialParentWidget() const Qt::WindowFlags Bridge::initialWFlags() const { - return 0; + return Qt::WindowDoesNotAcceptFocus; } QRegion Bridge::unobscuredRegion(const QRegion& r) const