[Interest] QML Loader component is not resized?
Alexander Dyagilev
alervdvcw at gmail.com
Sat Jan 8 11:14:14 CET 2022
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"
}
}
More information about the Interest
mailing list