[vlc-commits] [Git][videolan/vlc][master] qt: fix focus item is not restored when window is re-activated in CompositorOffscreenWindow
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Sep 22 14:46:31 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e5d0b63c by Fatih Uzunoglu at 2024-09-22T14:14:13+00:00
qt: fix focus item is not restored when window is re-activated in CompositorOffscreenWindow
- QQuickWindow should not clear focus when it loses focus (QTBUG-125309).
- Qt 6.5 is able to re-focus the previously focused item, when the window is
re-activated.
- Qt 6.2 does not set the focus item when the window is re-activated. This causes
issues with key event delivery, and therefore key navigation.
- - - - -
2 changed files:
- modules/gui/qt/maininterface/compositor_common.cpp
- modules/gui/qt/maininterface/compositor_common.hpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor_common.cpp
=====================================
@@ -23,6 +23,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include <QAccessible>
#endif
+#include <QQuickItem>
#ifdef QT5_DECLARATIVE_PRIVATE
#include <private/qquickwindow_p.h>
@@ -168,6 +169,21 @@ void CompositorOffscreenWindow::setPseudoVisible(bool)
{
}
+void CompositorOffscreenWindow::focusOutEvent(QFocusEvent *ev)
+{
+ // QTBUG-125309
+ // Although on Qt 6.5 it appears that the focus item
+ // is restored, it is not the case with Qt 6.2.
+#if QT_VERSION < QT_VERSION_CHECK(6, 5, 3)
+ QPointer<QQuickItem> focusItem = activeFocusItem();
+ QQuickWindow::focusOutEvent(ev);
+ if (focusItem)
+ focusItem->forceActiveFocus();
+#else
+ QQuickWindow::focusOutEvent(ev);
+#endif
+}
+
#endif
=====================================
modules/gui/qt/maininterface/compositor_common.hpp
=====================================
@@ -70,6 +70,9 @@ public:
void setWindowStateExt(Qt::WindowState);
void setPseudoVisible(bool visible);
+
+protected:
+ void focusOutEvent(QFocusEvent *) override;
};
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e5d0b63c5fd220e0f15ac14f58971d2769af6cf6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e5d0b63c5fd220e0f15ac14f58971d2769af6cf6
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list