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. Why there is no button to add a empty slot?
Forum Updated to NodeBB v4.3 + New Features

Why there is no button to add a empty slot?

Scheduled Pinned Locked Moved Qt Creator and other tools
11 Posts 2 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.
  • D Offline
    D Offline
    Darkmalex
    wrote on last edited by
    #2

    Your answer is not very informative, could you provide some screenshots of the problem. Also this might be the problem with Qt Designer not understanding your qml code. Try creating an empty project, and see if the problem remains. Also this might happen because of a new QtQuick version, so I might suggest trying Importing an older version like 2.2 or 2.0.

    P.S. You might also add states manualy via qml code, like this:

    ...
    @
    states: [
    State {
    name: "State1"

            PropertyChanges {
                target: sometarget
                x: somthing.x
                y: somthing.y
            }
        },
    
        State {
            name: "State2"
    
            PropertyChanges {
                target: sometarget
                x: somthingelse.x
                y: somthingelse.y
            }
        }
    ]@
    

    P.P.S. Try not to ask the same question twice, rater edit one question.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JasonLee
      wrote on last edited by
      #3

      !http://qt-project.org/doc/qtcreator-2.8/images/qmldesigner-tutorial-desing-mode.png(There is a button on the top right, with a Plus Sign)!

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Darkmalex
        wrote on last edited by
        #4

        So it seems you don't have one? Well try my suggestion and see if they work. Also Qt Designer IMHO, is more of a helping tool, rather than an actual development device, so I suggest that you also familiarise with the actual qml coding (it's not that hard, trust me), and don't rely on designer, as it has a tendency to break every now and then when coding gets serious and complex.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JasonLee
          wrote on last edited by
          #5

          As you can see, there is a button with a Plus Sign on the top, you can click it to add empty slots. But in my project, why I cannot find it?

          And...I am just a novice to start using Qt 5. Maybe its a simple problem for you...

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Darkmalex
            wrote on last edited by
            #6

            [quote author="JasonLee" date="1413830002"]As you can see, there is a button with a Plus Sign on the top, you can click it to add empty slots. But in my project, why I cannot find it?

            And...I am just a novice to start using Qt 5. Maybe its a simple problem for you...[/quote]
            Trust me we've all been there, and Qt always suprises all of us (plesantly or else). If you didn't understand my solution, I may guide you through it but it would be easier if you showed me your main.qml code.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JasonLee
              wrote on last edited by
              #7

              When I start some examples in the Welcome Panel in Qt 5, there are actually this kind of buttons in the State Pane on the top of the Qt Designer in these examples. Yet when I begin a new project, there is nothing there.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JasonLee
                wrote on last edited by
                #8

                @import QtQuick 2.3
                import QtQuick.Controls 1.2

                ApplicationWindow {
                id: page
                visible: true
                width: 640
                height: 480
                color: "#343434"
                title: qsTr("Program_MyChild")

                menuBar: MenuBar {
                    Menu {
                        title: qsTr("File")
                        MenuItem {
                            text: qsTr("&Open")
                            onTriggered: console.log("Open action triggered");
                        }
                        MenuItem {
                            text: qsTr("Exit")
                            onTriggered: Qt.quit();
                        }
                    }
                }
                
                Rectangle {
                    id: topLeftRect
                    x: 10
                    width: 200
                    height: 200
                    color: "#00000000"
                    radius: 6
                    anchors.left: parent.left
                    anchors.leftMargin: 10
                    anchors.top: parent.top
                    anchors.topMargin: 20
                    border.color: "#808080"
                    border.width: 1
                
                    MouseArea {
                        id: mouseArea1
                        onClicked: page.state = ''
                    }
                }
                
                Rectangle {
                    id: middleRightRect
                    x: 8
                    y: 2
                    width: 200
                    height: 200
                    color: "#00000000"
                    radius: 6
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.right: parent.right
                    anchors.rightMargin: 10
                    MouseArea {
                        id: mouseArea2
                        anchors.fill: parent
                        onClicked: page.state = 'State1'
                    }
                    border.width: 1
                    border.color: "#808080"
                }
                
                Rectangle {
                    id: bottomLeftRect
                    y: 264
                    width: 200
                    height: 200
                    color: "#00000000"
                    radius: 6
                    anchors.left: parent.left
                    anchors.leftMargin: 10
                    anchors.bottom: parent.bottom
                    anchors.bottomMargin: 20
                    MouseArea {
                        id: mouseArea3
                        anchors.fill: parent
                        onClicked: page.state = 'State2'
                    }
                    border.width: 1
                    border.color: "#808080"
                }
                
                Image {
                    id: image1
                    x: 10
                    y: 20
                    width: 200
                    height: 200
                    source: "child.jpg"
                }
                

                }
                @

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JasonLee
                  wrote on last edited by
                  #9

                  Oh, yes. I think I solved it.

                  Don't laugh at me... I just find that you should add codes in main.qml first, and that button will automatically show up...

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    Darkmalex
                    wrote on last edited by
                    #10

                    I think I found the source of the problem, -Qt Designer can't add states to an ApplicationWindow root object, so a quick dirty workaround would bу to firstly work with a root Rectangle object, add states and then turn it into an ApplicatonWindow.-
                    Sorry, my bad, ApplicationWindow does not seem to have states at all. So work with a child rectangle if you realy need states and ApplicationWindow neats at the same time/

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      JasonLee
                      wrote on last edited by
                      #11

                      Yes, thank you very much!

                      I think you are right, I should not use ApplicationWindow. Just use Rectangle straightly, that will work correctly.

                      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