diff options
authorJan-Marek Glogowski <>2019-11-25 14:08:44 +0000
committerJan-Marek Glogowski <>2019-11-26 23:20:58 +0100
commitec554ac30236fa7949e9866d01319d4e3e88c983 (patch)
parent97ad402d58b52a1f2636905137c21298531c2935 (diff)
tdf#126607 Qt5 activate window before setFocus
.., and prevent Qt5MainWindow to take any focus. Our top level Qt5MainWindow shouldn't handle focus directly, as it's always completely drawn by the child Qt5Widget, which also handles input. So prevent any direct focus handling by setting the Qt5Widget as the focus proxy of the Qt5MainWindow. Also setting the focus of the child widget on its own seems to do nothing at all. At least I didn't see any difference after commenting the code block. But it at least has some effect, if you call setFocus on the real window, but that breaks Impress full screen mode, which somehow gets scroll bars?! Not that I understand why this is needed. At least the original X11 code just calls XSetInputFocus in this case. Change-Id: I591c031a17a7ae0b5486760cd1802522d4088678 Reviewed-on: Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <>
1 files changed, 5 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 47bfb357c2a5..2ca319ee515c 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -153,6 +153,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
m_pTopLevel = new Qt5MainWindow(*this, pParentWidget, aWinFlags);
m_pQWidget = new Qt5Widget(*this, aWinFlags);
+ m_pTopLevel->setFocusProxy(m_pQWidget);
m_pQWidget = new Qt5Widget(*this, aWinFlags);
@@ -684,7 +685,10 @@ void Qt5Frame::ToTop(SalFrameToTop nFlags)
if ((nFlags & SalFrameToTop::RestoreWhenMin) || (nFlags & SalFrameToTop::ForegroundTask))
else if ((nFlags & SalFrameToTop::GrabFocus) || (nFlags & SalFrameToTop::GrabFocusOnly))
- m_pQWidget->setFocus();
+ {
+ pWidget->activateWindow();
+ pWidget->setFocus();
+ }
void Qt5Frame::SetPointer(PointerStyle ePointerStyle)