creating the semafor buttons and the resizable borders

This commit is contained in:
Alexandre Van de Sande 2015-03-04 18:41:49 -03:00
parent 5984ef2bb6
commit df4dc6026b

View file

@ -13,9 +13,10 @@ import "../ext/http.js" as Http
ApplicationWindow { ApplicationWindow {
id: root id: root
flags: Qt.FramelessWindowHint flags: Qt.FramelessWindowHint | Qt.Window
//flags: Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
// Use this to make the window frameless. But then you'll need to do move and resize by hand // Use this to make the window frameless. But then you'll need to do move and resize by hand
color: "transparent"
property var ethx : Eth.ethx property var ethx : Eth.ethx
property var catalog; property var catalog;
@ -262,13 +263,118 @@ ApplicationWindow {
id: blockModel id: blockModel
} }
Rectangle {
id: windowChrome
color: "#EBE8E8"
anchors.fill: parent
radius: 3
/************************/
/* */
/* Resizeable Borders */
/* */
/************************/
MouseArea {
id: rightResizableBar
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
}
width: 5
cursorShape: Qt.SizeHorCursor;
property real lastMouseX: 0
onPressed: {
lastMouseX = mouseX
}
onPositionChanged: {
if (!(root.width + mouseX - lastMouseX < root.minimumWidth)) {
root.width += (mouseX - lastMouseX)
}
}
}
MouseArea {
id: leftResizableBar
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
}
width: 5
cursorShape: Qt.SizeHorCursor;
property real lastMouseX: 0
property real lastRight: root.x + root.width
onPressed: {
lastMouseX = mouseX
lastRight = root.x + root.width
}
onPositionChanged: {
if (!(root.width - mouseX + lastMouseX < root.minimumWidth)) {
//root.x += (mouseX - lastMouseX)
root.width -= (mouseX - lastMouseX)
root.x = lastRight - root.width
}
}
}
MouseArea {
id: bottomResizableBar
anchors {
bottom: parent.bottom
right: parent.right
left: parent.left
}
height: 5
cursorShape: Qt.SizeVerCursor;
property real lastMouseY: 0
onPressed: {
lastMouseY = mouseY
}
onPositionChanged: {
if (!(root.height + mouseY - lastMouseY < root.minimumHeight)) {
root.height += (mouseY - lastMouseY)
}
}
}
MouseArea {
id: topResizableBar
anchors {
top: parent.top
right: parent.right
left: parent.left
}
height: 5
cursorShape: Qt.SizeVerCursor;
property real lastMouseY: 0
property real lastTop: root.y + root.height
onPressed: {
lastMouseY = mouseY
lastTop = root.y + root.height
}
onPositionChanged: {
if (!(root.height - mouseY + lastMouseY < root.minimumHeight)) {
root.height -= (mouseY - lastMouseY)
root.y = lastTop - root.height
}
}
}
}
SplitView { SplitView {
property var views: []; property var views: [];
id: mainSplit id: mainSplit
anchors.fill: parent anchors.fill: windowChrome
anchors.margins: 2 anchors.margins: 2
// radius: 3 //color: "brown"
//radius: 5
//resizing: false // this is NOT where we remove that damning resizing handle.. //resizing: false // this is NOT where we remove that damning resizing handle..
handleDelegate: Item { handleDelegate: Item {
@ -689,56 +795,61 @@ ApplicationWindow {
anchors.right: parent.right anchors.right: parent.right
spacing: 3 spacing: 3
/************************/
/* Semafor Buttons */
/************************/
RowLayout { RowLayout {
id: semaphorButtons id: semaforButtons
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
right: parent.right right: parent.right
leftMargin: 8 leftMargin: 8
bottomMargin: 8
} }
height: 16 height: 37
spacing: 6 spacing: 6
Rectangle { Rectangle {
color: 'red' color: 'red'
width: 14 width: 11
height: 14 height: 11
radius: 7 radius: 7
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.log("quit"); console.log("stop");
Qt.quit(); //gui.stop();
} }
} }
} }
Rectangle { Rectangle {
color: 'yellow' color: 'yellow'
width: 14 width: 11
height: 14 height: 11
radius: 7 radius: 7
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.log("quit"); console.log("minimize window");
Qt.quit();
} }
} }
} }
Rectangle { Rectangle {
color: 'green' color: 'green'
width: 14 width: 11
height: 14 height: 11
radius: 7 radius: 7
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.log("quit"); console.log("maximize window");
Qt.quit();
} }
} }
} }
@ -909,104 +1020,6 @@ ApplicationWindow {
return view; return view;
} }
} }
/************************/
/* */
/* Resizeable Borders */
/* */
/************************/
MouseArea {
id: rightResizableBar
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
}
width: 5
cursorShape: Qt.SizeHorCursor;
property real lastMouseX: 0
onPressed: {
lastMouseX = mouseX
}
onPositionChanged: {
if (!(root.width + mouseX - lastMouseX < root.minimumWidth)) {
root.width += (mouseX - lastMouseX)
}
}
}
MouseArea {
id: leftResizableBar
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
}
width: 5
cursorShape: Qt.SizeHorCursor;
property real lastMouseX: 0
property real lastRight: root.x + root.width
onPressed: {
lastMouseX = mouseX
lastRight = root.x + root.width
}
onPositionChanged: {
if (!(root.width - mouseX + lastMouseX < root.minimumWidth)) {
//root.x += (mouseX - lastMouseX)
root.width -= (mouseX - lastMouseX)
root.x = lastRight - root.width
}
}
}
MouseArea {
id: bottomResizableBar
anchors {
bottom: parent.bottom
right: parent.right
left: parent.left
}
height: 5
cursorShape: Qt.SizeVerCursor;
property real lastMouseY: 0
onPressed: {
lastMouseY = mouseY
}
onPositionChanged: {
if (!(root.height + mouseY - lastMouseY < root.minimumHeight)) {
root.height += (mouseY - lastMouseY)
}
}
}
MouseArea {
id: topResizableBar
anchors {
top: parent.top
right: parent.right
left: parent.left
}
height: 5
cursorShape: Qt.SizeVerCursor;
property real lastMouseY: 0
property real lastTop: root.y + root.height
onPressed: {
lastMouseY = mouseY
lastTop = root.y + root.height
}
onPositionChanged: {
if (!(root.height - mouseY + lastMouseY < root.minimumHeight)) {
root.height -= (mouseY - lastMouseY)
root.y = lastTop - root.height
}
}
}
} }
} }