Why there is no button to add a empty slot?
-
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.
-
!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)!
-
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.
-
[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. -
@import QtQuick 2.3
import QtQuick.Controls 1.2ApplicationWindow {
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" }
}
@ -
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/