maksim1979, it works fine for me:
import QtQuick 2.0
Rectangle {
id: root;
width: 256;
height: 306;
MouseArea {
anchors.fill: parent
onClicked: {console.log(root.width + " " + root.height)}
}
}
So, even if width and height are set, showMaximized() will override that here and the correct width and height will be printed to the console.
Sorry if I’m misunderstanding what you’re trying to say.
EDIT: I also don’t think you’ll need to create the dialog dynamically. If you don’t need to move the dialog around, you can just set its anchors.centerIn: parent. If you do need to move it, then its x and y properties like this:
x: (root.width - dialog.width)/2
y: (root.height - dialog.height)/2
↧