[vlc-devel] [PATCH 03/27] qt: register QmlMainContext* as a meta-type

Pierre Lamot pierre at videolabs.io
Fri Dec 4 10:15:39 CET 2020


On 2020-12-04 00:01, Fatih Uzunoglu wrote:
> in some cases qml fails to access QmlMainContext* property when it is
> not registered as a meta-type.
> ---
>  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 41a78da1be..9cfd98cfa7 100644
> --- a/modules/gui/qt/maininterface/mainui.cpp
> +++ b/modules/gui/qt/maininterface/mainui.cpp
> @@ -222,6 +222,7 @@ void MainUI::registerQMLTypes()
> 
>      qmlRegisterType<PlayerControlBarModel>( "org.videolan.vlc", 0, 1,
> "PlayerControlBarModel");
> 
> +    qRegisterMetaType<QmlMainContext*>();

Is there a reason you register the type with a * ?

>      qmlRegisterType<QmlGlobalMenu>( "org.videolan.vlc", 0, 1,
> "QmlGlobalMenu" );
>      qmlRegisterType<QmlMenuBar>( "org.videolan.vlc", 0, 1, 
> "QmlMenuBar" );
>      qmlRegisterType<NetworkMediaContextMenu>( "org.videolan.vlc", 0,
> 1, "NetworkMediaContextMenu" );


More information about the vlc-devel mailing list