aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2016-09-30 11:06:42 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2016-09-30 11:06:42 (GMT)
commitdd390d9a99bf19a6812e1866cff999aa147fde9f (patch)
tree16c893989f0a7bdf5e8556f1b77fd39b102a436f
parent5519b0ec5da7e78430f5deb6042195961af49e1c (diff)
Qt5: Port KeyboardLayout.qml And Friends
The course and keyboard layout editor seems to work fully again.
-rw-r--r--src/qml/KeyboardLayoutEditor.qml26
-rw-r--r--src/qml/SelectionGrip.qml33
-rw-r--r--src/qml/SelectionRectangle.qml2
3 files changed, 27 insertions, 34 deletions
diff --git a/src/qml/KeyboardLayoutEditor.qml b/src/qml/KeyboardLayoutEditor.qml
index c4b3797..ff65ecf 100644
--- a/src/qml/KeyboardLayoutEditor.qml
+++ b/src/qml/KeyboardLayoutEditor.qml
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
+import QtQuick 2.4
import ktouch 1.0
Item {
@@ -25,10 +25,10 @@ Item {
id: preferences
}
- property real scaleFactor: Math.pow(2, zoomLevel / 2)
+ property real scaleFactor: Math.pow(2, keyboardLayoutEditor.zoomLevel / 2)
property real horizontalScaleFactor: scaleFactor
property real verticalScaleFactor: scaleFactor
- property KeyboardLayout layout: keyboardLayout
+ property KeyboardLayout layout: keyboardLayoutEditor.keyboardLayout
property int lastZIndex: 0
width: keyContainer.width + 40
@@ -38,7 +38,7 @@ Item {
anchors.fill: parent
onPressed: {
if (mouse.button == Qt.LeftButton) {
- selectedKey = null
+ keyboardLayoutEditor.selectedKey = null
mouse.accepted = true
}
}
@@ -64,21 +64,22 @@ Item {
id: keyItem
keyboardLayout: layout;
keyIndex: index
- isHighlighted: keyItem.key == selectedKey
+ isHighlighted: keyItem.key == keyboardLayoutEditor.selectedKey
animateHighlight: false
opacity: manipulated? 0.7: 1.0
MouseArea {
anchors.fill: parent
+ cursorShape: keyItem.manipulated? Qt.SizeAllCursor: Qt.ArrowCursor
onPressed: {
if (mouse.button == Qt.LeftButton) {
- selectedKey = layout.key(index)
+ keyboardLayoutEditor.selectedKey = layout.key(index)
root.lastZIndex++
keyItem.z = root.lastZIndex
}
}
drag {
- target: !readOnly? keyItem: undefined
+ target: !keyboardLayoutEditor.readOnly? keyItem: undefined
axis: Drag.XandYAxis
minimumX: 0
maximumX: keyContainer.width - keyItem.width
@@ -89,17 +90,12 @@ Item {
if (!drag.active) {
var left = 10 * Math.round(keyItem.x / scaleFactor / 10)
var top = 10 * Math.round(keyItem.y / scaleFactor / 10)
- setKeyGeometry(keyIndex, left, top, keyItem.key.width, keyItem.key.height)
+ keyboardLayoutEditor.setKeyGeometry(keyIndex, left, top, keyItem.key.width, keyItem.key.height)
}
}
}
}
- CursorShapeArea {
- anchors.fill: parent
- cursorShape: manipulated? Qt.SizeAllCursor: Qt.ArrowCursor
- }
-
Behavior on opacity {
NumberAnimation { duration: 150 }
}
@@ -108,9 +104,9 @@ Item {
SelectionRectangle {
keyboardLayout: layout;
- target: selectedKey
+ target: keyboardLayoutEditor.selectedKey
z: root.lastZIndex + 1
- interactive: !readOnly
+ interactive: !keyboardLayoutEditor.readOnly
}
}
}
diff --git a/src/qml/SelectionGrip.qml b/src/qml/SelectionGrip.qml
index e32ed5d..1ac3808 100644
--- a/src/qml/SelectionGrip.qml
+++ b/src/qml/SelectionGrip.qml
@@ -15,10 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
+import QtQuick 2.4
import ktouch 1.0
-import Effects 1.0
Item {
id: root
@@ -48,10 +46,10 @@ Item {
xLocked = true
var effX = Math.round(x / scaleFactor)
if (horizontalPosition == "left") {
- setKeyGeometry(targetItem.keyIndex, effX, target.top, target.width + target.left - effX, target.height)
+ keyboardLayoutEditor.setKeyGeometry(targetItem.keyIndex, effX, target.top, target.width + target.left - effX, target.height)
}
else {
- setKeyGeometry(targetItem.keyIndex, target.left, target.top, effX - target.left, target.height)
+ keyboardLayoutEditor.setKeyGeometry(targetItem.keyIndex, target.left, target.top, effX - target.left, target.height)
}
xLocked = false
}
@@ -62,10 +60,10 @@ Item {
yLocked = true
var effY = Math.round(y / scaleFactor)
if (verticalPosition == "top") {
- setKeyGeometry(targetItem.keyIndex, target.left, effY, target.width, target.height + target.top - effY)
+ keyboardLayoutEditor.setKeyGeometry(targetItem.keyIndex, target.left, effY, target.width, target.height + target.top - effY)
}
else {
- setKeyGeometry(targetItem.keyIndex, target.left, target.top, target.width, effY - target.top)
+ keyboardLayoutEditor.setKeyGeometry(targetItem.keyIndex, target.left, target.top, target.width, effY - target.top)
}
yLocked = false
}
@@ -74,7 +72,12 @@ Item {
width: 1
height: 1
- PlasmaCore.SvgItem {
+ SystemPalette {
+ id: palette
+ colorGroup: SystemPalette.Active
+ }
+
+ Rectangle {
anchors {
centerIn: parent
verticalCenterOffset: verticalPosition == "top"? -10: 10
@@ -82,16 +85,14 @@ Item {
}
width: 15
height: 15
- svg: PlasmaCore.Svg {
- imagePath: findImage("resizegrip.svgz")
- usingRenderingCache: false
- }
- elementId: "grip"
+ color: palette.highlight
visible: interactive
+
MouseArea {
id: mouseArea
anchors.fill: parent
+ cursorShape: ((horizontalPosition == "left") != (verticalPosition == "top"))? Qt.SizeBDiagCursor: Qt.SizeFDiagCursor
onClicked: {
mouse.accepted = true
}
@@ -109,14 +110,10 @@ Item {
var top = 10 * Math.round(target.top / 10)
var width = 10 * Math.round(target.width / 10)
var height = 10 * Math.round(target.height / 10)
- setKeyGeometry(targetItem.keyIndex, left, top, width, height)
+ keyboardLayoutEditor.setKeyGeometry(targetItem.keyIndex, left, top, width, height)
}
}
}
}
- CursorShapeArea {
- anchors.fill: parent
- cursorShape: ((horizontalPosition == "left") != (verticalPosition == "top"))? Qt.SizeBDiagCursor: Qt.SizeFDiagCursor
- }
}
}
diff --git a/src/qml/SelectionRectangle.qml b/src/qml/SelectionRectangle.qml
index 1be29a2..941289e 100644
--- a/src/qml/SelectionRectangle.qml
+++ b/src/qml/SelectionRectangle.qml
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
+import QtQuick 2.4
import ktouch 1.0
Item