[vlc-commits] [Git][videolan/vlc][master] qml: use `instanceof` instead of casting object into string in FSM.qml

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 6 08:43:55 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
01f0d3eb by Fatih Uzunoglu at 2024-09-06T08:04:39+00:00
qml: use `instanceof` instead of casting object into string in FSM.qml

- Qt 6.2 requires the type to be creatable (Qt bug).
- Qt 6.7 does not require the type to be creatable.

Since `FSMState` type is creatable, we can use `instanceof`.

- - - - -


1 changed file:

- modules/gui/qt/util/qml/FSM.qml


Changes:

=====================================
modules/gui/qt/util/qml/FSM.qml
=====================================
@@ -134,8 +134,7 @@ FSMState {
         const transitions = state.transitions[event]
         if (transitions === undefined) {
             console.warn(`undefined transition for ${state}::${event}`)
-            //FIXME: comparing object to QML type with instanceof fails with 5.12
-        } else if (transitions === null || transitions.toString().startsWith("FSMState")) {
+        } else if (transitions === null || (transitions instanceof FSMState)) {
             _changeState(transitions)
             return true
         } else if (Helpers.isArray(transitions)) {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/01f0d3ebb4f31a0a2b6fe25ebc2b872bd112ae4d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/01f0d3ebb4f31a0a2b6fe25ebc2b872bd112ae4d
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