[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt/interface_window_handler: Make the visualFocus condition generic

François Cartegnie (@fcartegnie) gitlab at videolan.org
Sat Apr 23 11:19:48 UTC 2022



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
7cb89f2b by Benjamin Arnaud at 2022-04-23T11:05:12+00:00
qt/interface_window_handler: Make the visualFocus condition generic

Previously this condition was only working for QQuickControl(s). But we might want it
to work with a non Control component, like a TextInput. In that case we declare
a 'visualFocus' property manually and bind it to a parent Control 'visualFocus' property.

- - - - -
135cc667 by Benjamin Arnaud at 2022-04-23T11:05:12+00:00
qml/SpinBoxExt: Add Navigation support

- - - - -
03b1c923 by Benjamin Arnaud at 2022-04-23T11:05:12+00:00
qml/TeletextWidget: Add an IntValidator and a fixed SpinBox width

- - - - -
945095a8 by Benjamin Arnaud at 2022-04-23T11:05:12+00:00
qml/TeletextWidget: Disable buttons when the teletext is off

- - - - -


3 changed files:

- modules/gui/qt/maininterface/interface_window_handler.cpp
- modules/gui/qt/player/qml/controlbarcontrols/TeletextWidget.qml
- modules/gui/qt/widgets/qml/SpinBoxExt.qml


Changes:

=====================================
modules/gui/qt/maininterface/interface_window_handler.cpp
=====================================
@@ -365,10 +365,9 @@ bool InterfaceWindowHandler::applyKeyEvent(QKeyEvent * event) const
 
     QQuickItem * item = p_intf->p_compositor->activeFocusItem();
 
-    // NOTE: When this item is a control and has visual focus we let it handle the key.
-    if (item && item->inherits("QQuickControl")
-        &&
-        QQmlProperty(item, "visualFocus", qmlContext(item)).read().toBool())
+    // NOTE: When the item has visual focus we let it handle the key. When the item does not
+    //       inherit from QQuickControl we have to declare the 'visualFocus' property ourselves.
+    if (item && QQmlProperty(item, "visualFocus", qmlContext(item)).read().toBool())
     {
         return false;
     }


=====================================
modules/gui/qt/player/qml/controlbarcontrols/TeletextWidget.qml
=====================================
@@ -78,6 +78,8 @@ T.Pane {
 
             paintOnly: root.paintOnly
 
+            enabled: teleActivateBtn.checked
+
             opacity: 0.5
 
             iconText: VLCIcons.tvtelx
@@ -97,8 +99,20 @@ T.Pane {
 
         Widgets.SpinBoxExt{
             id: telePageNumber
+
+            // NOTE: We want a fixed size for the TextInput.
+            width: VLCStyle.dp(64, VLCStyle.scale)
+
+            enabled: teleActivateBtn.checked
+
             from: 100
             to: 899
+
+            validator: IntValidator {
+                bottom: telePageNumber.from
+                top: telePageNumber.to
+            }
+
             editable: true
             textColor: colors.text
             bgColor: colors.bg
@@ -138,6 +152,8 @@ T.Pane {
 
             paintOnly: root.paintOnly
 
+            enabled: teleActivateBtn.checked
+
             iconText: VLCIcons.record
             text: I18n.qtr("Index key")
 
@@ -161,6 +177,8 @@ T.Pane {
 
             paintOnly: root.paintOnly
 
+            enabled: teleActivateBtn.checked
+
             iconText: VLCIcons.record
             text: I18n.qtr("Red key")
 
@@ -184,6 +202,8 @@ T.Pane {
 
             paintOnly: root.paintOnly
 
+            enabled: teleActivateBtn.checked
+
             iconText: VLCIcons.record
             text: I18n.qtr("Green key")
 
@@ -207,6 +227,8 @@ T.Pane {
 
             paintOnly: root.paintOnly
 
+            enabled: teleActivateBtn.checked
+
             iconText: VLCIcons.record
             text: I18n.qtr("Yellow key")
 
@@ -230,6 +252,8 @@ T.Pane {
 
             paintOnly: root.paintOnly
 
+            enabled: teleActivateBtn.checked
+
             iconText: VLCIcons.record
             text: I18n.qtr("Blue key")
 


=====================================
modules/gui/qt/widgets/qml/SpinBoxExt.qml
=====================================
@@ -51,6 +51,9 @@ SpinBox{
     }
 
     contentItem: TextInput {
+        // NOTE: This is required for InterfaceWindowHandler::applyKeyEvent.
+        property bool visualFocus: control.visualFocus
+
         text: control.textFromValue(control.value, control.locale)
 
         font: control.font
@@ -62,6 +65,13 @@ SpinBox{
         autoScroll: false
         readOnly: !control.editable
         validator: control.validator
+
+        Keys.priority: Keys.AfterItem
+
+        Keys.onPressed: Navigation.defaultKeyAction(event)
+        Keys.onReleased: Navigation.defaultKeyReleaseAction(event)
+
+        Navigation.parentItem: control
     }
     up.indicator: Rectangle {
         x: parent.width - width



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/29b742d3a76eb8f36b1fe93aec101f2b4fcd14f3...945095a85560a59061c474f1da2453505d14cdaf

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/29b742d3a76eb8f36b1fe93aec101f2b4fcd14f3...945095a85560a59061c474f1da2453505d14cdaf
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