Hello,

I use Loader and it seems it's not resizing to its component's size.

It's not centered in parent despite explicit anchors.centerIn: parent.

Adding the following workaround to the loader's code resolves the issue:

onLoaded: {
         width = Qt.binding(function(){return item.width;});
         height = Qt.binding(function(){return item.height;});
}

Is this a bug or am I missing something?

The full code:

Loader {
        id: loader
        anchors.centerIn: parent
        /* uncomment it to "fix" the issue
        onLoaded: {
            width = Qt.binding(function(){return item.width;});
            height = Qt.binding(function(){return item.height;});
        }*/
    }

function showLoader()
{
     loader.source = "file:///D:/4/main.qml";
}

Contents of file:///D:/4/main.qml:

import QtQuick 2.12
import QtQuick.Controls 2.12

Popup
{
   modal: true
   focus: true
   visible: true

   width: 200
   height: 200

   Label
   {
     text: "TEST"
   }
}


_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to