Important: Please read the Qt Code of Conduct -

Qt designer putting stuff in funny places ...

  • I'm new to Qt Quick Designer ... but have used QtDesigner in the past.

    My first attempt isn't going well.

    I begin a new Qt Quick project ... I get a "Hello World" in the middle of the screen ... build is okay ... I drag a button over underneath the text and press the Run button and the button ends up a long way from where I put it. See
    image ... oh, I can't seem to add a screen image here ... but instead of being under the text its up near the top left and most of it isn't even visible.

    I've loaded examples and run them and my installation seems to be working fine.

    Any help would be appreciated.


  • Qt Champions 2017

    welcome to the forum. Just look at the qml file. It will show where it has put the button etc. It using x and y. Under the properties window, go to Layout and specify the Anchors etc. It will work

  • Hi and thanks for the reply. But I'm obviously confused. You seem to be saying that the tool isn't a WYSIWYG designer like QtDesigner?

    I applied left and right fills to the button, and sure enough, after the build the button spread across the screen, but in the designer it was still the same size but with a few extra blue lines.

  • Hi could it be that you were confused by anchors.centerIn?

    The text is centered to the window. Even if you move it around, you just change the margins/offsets. The exact position of the text depends on the size of the window. If you want absolute positions you have to turn off the anchors (Layout in the property editor).

    New items that you drag in are not anchored by default, but if you make them a child of the text their position will be relative to text.

    If I drag in a new Button and press anchors fill it works as expected.

  • I'm using Qt 5.3 on Ubuntu 12.04

    As I said I create a new project ... press Run and see "Hello World" in the centre of the screen. Fine. I click "Design" and "Hello World" is in the centre of the visual design canvas. I drag a button over underneath it. So I have on the visual design canvas a piece of text "Hello world" then a few mm below I have a button with "Button" on it. When I press Run I expect to see what I see in the visual design canvas. That's what I'd see using QtDesigner. But I don't. I haven't done anything else. I've had a very experience Qt Designer look at it and he just shakes his head and says "Looks busted to me". It looks busted to me also.

    Can somebody please do as I described above and tell me what they see?
    It takes about 15 seconds.

    Or explain why the visual design canvas should look quite different from the application.

  • Can you post the QML code?

  • Here's the qml code generated ...

    import QtQuick 2.2
    import QtQuick.Controls 1.1

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
    Text {
        text: qsTr("Hello World")
        anchors.centerIn: parent
    Button {
        id: button1
        x: -40
        y: 28
        text: qsTr("Button")


  • The Button has a negative x position. But when I try it out in the designer then everything does work.

  • By "work" are you saying that the generated qml code when you drag a button under the "Hello World" is different, i.e., doesn't have a negative x value?

  • If I open the file everything works as expected
    and if I run the application I get the same "result".

    Also I can drag in Buttons etc. without problems.

  • Ok, many thanks Thomas. Now I just have to work out how to make a bug report!

    When I take a piece of QML code and run it ... things are fine. It's just the Qt Quick Designer which is busted.

  • Moderators

    You can submit a bug report at :)

  • Many thanks JKSH.

  • Moderators

    You're welcome! Please post a link to your report here, so that other people with the same issue can follow it.

  • Ok, I've put in a bug report with screen shot ..

Log in to reply