Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt designer putting stuff in funny places ...

Qt designer putting stuff in funny places ...

Scheduled Pinned Locked Moved Qt Creator and other tools
15 Posts 4 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    geoffrussell
    wrote on last edited by
    #1

    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.

    Thanks.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      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

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • G Offline
        G Offline
        geoffrussell
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          ThomasHartmann
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            geoffrussell
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              ThomasHartmann
              wrote on last edited by
              #6

              Can you post the QML code?

              1 Reply Last reply
              0
              • G Offline
                G Offline
                geoffrussell
                wrote on last edited by
                #7

                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")
                }
                

                }
                @

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  ThomasHartmann
                  wrote on last edited by
                  #8

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

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    geoffrussell
                    wrote on last edited by
                    #9

                    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?

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      ThomasHartmann
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        geoffrussell
                        wrote on last edited by
                        #11

                        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.

                        1 Reply Last reply
                        0
                        • JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #12

                          You can submit a bug report at https://bugreports.qt-project.org/ :)

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            geoffrussell
                            wrote on last edited by
                            #13

                            Many thanks JKSH.

                            1 Reply Last reply
                            0
                            • JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on last edited by
                              #14

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

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                geoffrussell
                                wrote on last edited by
                                #15

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

                                https://bugreports.qt-project.org/browse/QTCREATORBUG-12911

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved