Commit 818a7b22 authored by Kai Koehne's avatar Kai Koehne

New QmlDesigner plugin & Design mode

This adds a new "Design" mode that can be used to manipulate qml files
in a visual way. It will only get build if you have the declarativeui
module in Qt.

This is a squashed import from the Bauhaus project. Share & enjoy :)
parent ae535daa
......@@ -73,3 +73,6 @@ bin/qtcreator_process_stub*
bin/qtcreator.exe
share/doc/qtcreator/qtcreator.qch
tests/manual/cplusplus/cplusplus0
tests/auto/qml/qmldesigner/bauhaustests/tst_bauhaus
tests/auto/qml/qmldesigner/coretests/tst_qmldesigner_core
tests/auto/qml/qmldesigner/propertyeditortests/tst_propertyeditor
import Qt 4.6
Rectangle {
property var label: "Button"
signal clicked
width: 75
height: 20
radius: 10
color: "grey"
Rectangle {
anchors.fill: parent;
anchors.leftMargin: 1;
anchors.rightMargin: 1;
anchors.topMargin: 1;
anchors.bottomMargin: 1;
color: "#2c2c2c";
radius: 9
Rectangle {
id: buttonGradientRectangle
anchors.fill: parent;
anchors.leftMargin: 1;
anchors.rightMargin: 1;
anchors.topMargin: 1;
anchors.bottomMargin: 1;
color: "black";
gradient: normalGradient
radius: 8;
Gradient {
id: pressedGradient
GradientStop { position: 0.0; color: "#686868" }
GradientStop { position: 1.0; color: "#8a8a8a" }
}
Gradient {
id: normalGradient
GradientStop { position: 0.0; color: "#8a8a8a" }
GradientStop { position: 1.0; color: "#686868" }
}
}
}
Text {
color: "white"
text: parent.label
style: "Raised";
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
horizontalAlignment: "AlignHCenter";
verticalAlignment: "AlignVCenter";
}
MouseRegion {
id: mouseRegion
anchors.fill: parent
onReleased: { parent.clicked.emit(); }
}
states: [
State {
name: "released"
when: !mouseRegion.pressed
PropertyChanges {
target: buttonGradientRectangle
gradient: normalGradient
}
},
State {
name: "pressed"
when: mouseRegion.pressed
PropertyChanges {
target: buttonGradientRectangle
gradient: pressedGradient
}
}
]
}
import Qt 4.6
QWidget {
width:220;fixedWidth: width
height:220;fixedHeight: height
styleSheetFile: "anchorbox.css"
Script {
function isBorderAnchored() {
return anchorBackend.leftAnchored || anchorBackend.topAnchored || anchorBackend.rightAnchored || anchorBackend.bottomAnchored;
}
function fill() {
anchorBackend.fill();
}
function breakLayout() {
anchorBackend.resetLayout()
}
}
QPushButton {
text: "fill";
height:20;fixedHeight: height;
x: 0;
y: 0;
width:200;fixedWidth: width;
id: QPushButton1;
onReleased: fill();
}
QPushButton {
text: "break";
y: 200;
height:20;fixedHeight: height;
width:200;fixedWidth: width;
x: 0;
id: QPushButton3;
onReleased: breakLayout();
}
QPushButton {
height:100;fixedHeight: height;
text: "left";
font.bold: true;
x: 16 ;
y: 60;
//styleSheet: "border-radius:5px; background-color: #ffda82";
width:30;fixedWidth: width;
id: QPushButton5;
checkable: true;
checked: anchorBackend.leftAnchored;
onReleased: {
if (checked) {
anchorBackend.horizontalCentered = false;
anchorBackend.leftAnchored = true;
} else {
anchorBackend.leftAnchored = false;
}
}
}
QPushButton {
text: "top";
font.bold: true;
//styleSheet: "border-radius:5px; background-color: #ffda82";
height:72;fixedHeight: height;
width:100;fixedWidth: width;
x: 49;
y: 30;
id: QPushButton6;
checkable: true;
checked: anchorBackend.topAnchored;
onReleased: {
if (checked) {
anchorBackend.verticalCentered = false;
anchorBackend.topAnchored = true;
} else {
anchorBackend.topAnchored = false;
}
}
}
QPushButton {
text: "right";
font.bold: true;
x: 153;
y: 60;
//styleSheet: "border-radius:5px; background-color: #ffda82";
width:30;fixedWidth: width;
height:100;fixedHeight: height;
id: QPushButton7;
checkable: true;
checked: anchorBackend.rightAnchored;
onReleased: {
if (checked) {
anchorBackend.horizontalCentered = false;
anchorBackend.rightAnchored = true;
} else {
anchorBackend.rightAnchored = false;
}
}
}
QPushButton {
text: "bottom";
font.bold: true;
//styleSheet: "border-radius:5px; background-color: #ffda82";
width:100;fixedWidth: width;
x: 49;
y: 164;
height:27;fixedHeight: height;
id: QPushButton8;
checkable: true;
checked: anchorBackend.bottomAnchored;
onReleased: {
if (checked) {
anchorBackend.verticalCentered = false;
anchorBackend.bottomAnchored = true;
} else {
anchorBackend.bottomAnchored = false;
}
}
}
QToolButton {
width:100;fixedWidth: width;
//styleSheet: "border-radius:50px;background-color: rgba(85, 170, 255, 255)";
x: 49;
y: 60;
height:100;fixedHeight: height;
id: QPushButton9;
QPushButton {
width:24;fixedWidth: width;
//styleSheet: "border-radius:5px; background-color: #bf3f00;";
x: 38;
y: 2;
height:96;fixedHeight: height;
checkable: true;
id: horizontalCenterButton;
checked: anchorBackend.horizontalCentered;
onReleased: {
if (checked) {
anchorBackend.rightAnchored = false;
anchorBackend.leftAnchored = false;
anchorBackend.horizontalCentered = true;
} else {
anchorBackend.horizontalCentered = false;
}
}
}
QPushButton {
height:24;fixedHeight: height;
x: 2;
y: 38;
width:96;fixedWidth: width;
id: verticalCenterButton;
checkable: true;
checked: anchorBackend.verticalCentered;
onReleased: {
if (checked) {
anchorBackend.topAnchored = false;
anchorBackend.bottomAnchored = false;
anchorBackend.verticalCentered = true;
} else {
anchorBackend.verticalCentered = false;
}
}
}
QPushButton {
text: "center";
font.bold: true;
//styleSheet: "border-radius:20px; background-color: #ff5500";
width:40;fixedWidth: width;
height:40;fixedHeight: height;
x: 30;
y: 30;
id: centerButton;