Search code examples
qmlqt-creatorqt-quick

How can I get Qt Creator to show the correct window size?


This is a maddening problem. I have a very simple test QML here:

import QtQuick 2.2
import QtQuick.Controls 1.1

ApplicationWindow {
    id: mainWindow
    visible: true
    width: 640
    height: 480
    title: qsTr("TextOperator")

    menuBar: MenuBar {
        Menu {
           title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }

    Rectangle {
        id: rectangle1
        anchors.fill: parent
        color: "#ffffff"
    }
}

In QtCreator, this shows up as a simple dot (since the window incorrectly has zero size and the rectangle is "filling" it). When I run the project, it works as expected. How can I get the design mode to correctly show the preview? I'm linking against the 64-bit msvc 2013 qt (direct x)

Bad QT Image


Solution

  • Upgrade Qt Creator. I'm using 3.1.2 and your code shows the window at the correct size in Qt Quick Designer.