[vlc-devel] [PATCH 23/29] qt: register qml singleton type PlayerListModel

Fatih Uzunoglu fuzun54 at outlook.com
Thu Apr 1 22:22:35 UTC 2021


qmlRegisterSingletonType provides a convenient way
for the QML-side to invoke static methods of classes
that are not created or can not be created.

PlayerListModel singleton is generated from the
static function of
PlayerControlbarModel::getPlaylistIdentifierListModel.
---
 modules/gui/qt/maininterface/mainui.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/gui/qt/maininterface/mainui.cpp b/modules/gui/qt/maininterface/mainui.cpp
index 0c518b2599..4711dd04b9 100644
--- a/modules/gui/qt/maininterface/mainui.cpp
+++ b/modules/gui/qt/maininterface/mainui.cpp
@@ -244,6 +244,7 @@ void MainUI::registerQMLTypes()
     qmlRegisterUncreatableType<ControlbarProfile>("org.videolan.vlc", 0, 1, "ControlbarProfile", "");
     qmlRegisterUncreatableType<PlayerControlbarModel>("org.videolan.vlc", 0, 1, "PlayerControlbarModel", "");
     qmlRegisterUncreatableType<ControlListModel>( "org.videolan.vlc", 0, 1, "ControlListModel", "" );
+    qmlRegisterSingletonType("org.videolan.vlc", 0, 1, "PlayerListModel", PlayerControlbarModel::getPlaylistIdentifierListModel);
 
     qRegisterMetaType<QmlMainContext*>();
     qmlRegisterType<QmlGlobalMenu>( "org.videolan.vlc", 0, 1, "QmlGlobalMenu" );
-- 
2.27.0



More information about the vlc-devel mailing list