Important: Please read the Qt Code of Conduct -

Resize window to content

  • Is there any easy way to automatically adjust the window size to fit the content (text, it's a message dialog)?

  • @AlexP11223

    ApplicationWindow performs auto resize to fit their children

    import QtQuick 2.11
    import QtQuick.Controls 1.4
    ApplicationWindow {
        id: window
        visible: true
        title: "My Window Title"
            id: rect1
            color: "#ff00ff"
            width:360; height: 50
            id: rect2
            color: "#ff0000"
            anchors {top: rect1.bottom; left: rect1.left}
            width: 280; height: 280
            id: rect3
            color: "#ffff00"
            anchors {left: rect2.right; top: rect1.bottom}
            width: 120; height: 150

Log in to reply