[vlc-devel] [PATCH 9/9] qml: postpone the creation of the dialogs

Romain Vimont rom1v at videolabs.io
Fri Aug 28 17:45:19 CEST 2020


On Fri, Aug 28, 2020 at 04:25:56PM +0200, Pierre Lamot wrote:
> ---
>  .../gui/qt/maininterface/qml/MainInterface.qml   | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/gui/qt/maininterface/qml/MainInterface.qml b/modules/gui/qt/maininterface/qml/MainInterface.qml
> index 714e637b85..2e3dd9b8ef 100644
> --- a/modules/gui/qt/maininterface/qml/MainInterface.qml
> +++ b/modules/gui/qt/maininterface/qml/MainInterface.qml
> @@ -34,6 +34,7 @@ Rectangle {
>      property bool _playlistReady: false
>  
>      property alias mainInterfaceRect: root
> +    property variant g_dialogs: dialogsLoader.item
>  
>      Binding {
>          target: VLCStyle.self
> @@ -163,10 +164,19 @@ Rectangle {
>          }
>      }
>  
> -    DG.Dialogs {
> -        id: g_dialogs
> +    Loader {
> +        id: dialogsLoader
> +
>          anchors.fill: parent
> -        bgContent: root
> +        asynchronous: true
> +        source: "qrc:///dialogs/Dialogs.qml"

Doesn't it load the component immediately (as soon as the "source"
property is set)?

The first example in the doc assigns "source" only when they want to
load the component:
https://doc.qt.io/qt-5/qml-qtquick-loader.html#details

> +
> +        onLoaded:  {
> +            item.bgContent = root
> +        }
> +    }
> +    Connections {
> +        target: dialogsLoader.item
>          onRestoreFocus: {
>              stackView.focus = true
>          }
> -- 
> 2.25.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list