diff --git a/containment/package/contents/ui/ConfigOverlay.qml b/containment/package/contents/ui/ConfigOverlay.qml index 6f1acf230..5c18bf2f1 100644 --- a/containment/package/contents/ui/ConfigOverlay.qml +++ b/containment/package/contents/ui/ConfigOverlay.qml @@ -181,9 +181,11 @@ MouseArea { if (!currentApplet || !root.dragOverlay.currentApplet - || (currentApplet &¤tApplet.isInternalViewSplitter)) { + || (currentApplet && currentApplet.isInternalViewSplitter)) { hideTimer.restart(); return; + } else if (currentApplet === ruler) { + return; } if(currentApplet.showZoomed !== undefined) @@ -312,7 +314,11 @@ MouseArea { Timer { id: hideTimer interval: units.longDuration * 2 - onTriggered: tooltip.visible = false; + onTriggered: { + if (!ruler.containsMouse && !tooltipMouseArea.containsMouse) { + tooltip.visible = false; + } + } } Connections { @@ -329,7 +335,7 @@ MouseArea { //BEGIN functions function updatePlacement(){ - if(currentApplet){ + if(currentApplet && currentApplet !== ruler){ var transformChoords = root.mapFromItem(currentApplet, 0, 0) handle.x = transformChoords.x; @@ -441,7 +447,7 @@ MouseArea { location: plasmoid.location onVisualParentChanged: { - if (visualParent && currentApplet && currentApplet.applet) { + if (visualParent && currentApplet && currentApplet.applet && currentApplet !== ruler) { configureButton.visible = (currentApplet.applet.pluginName !== root.plasmoidName) && currentApplet.applet.action("configure") && currentApplet.applet.action("configure").enabled; closeButton.visible = currentApplet.applet.action("remove") && currentApplet.applet.action("remove").enabled @@ -453,6 +459,15 @@ MouseArea { && !currentApplet.isInternalViewSplitter label.text = currentApplet.applet.title; + } else { + configureButton.visible = false; + closeButton.visible = false; + lockButton.visible = false; + + if (currentApplet === ruler) { + label.text = ruler.tooltip; + tooltip.visible = true; + } } } @@ -466,7 +481,17 @@ MouseArea { LayoutMirroring.childrenInherit: true onEntered: hideTimer.stop(); - onExited: hideTimer.restart(); + onExited: hideTimer.restart(); + + Connections { + target: ruler + onContainsMouseChanged: { + if (ruler.containsMouse) { + configurationArea.currentApplet = ruler; + } + } + } + Row { id: handleRow anchors.horizontalCenter: parent.horizontalCenter @@ -492,10 +517,7 @@ MouseArea { textFormat: Text.PlainText maximumLineCount: 1 } - } - Row{ - spacing: 0 PlasmaComponents.ToolButton{ id: lockButton checkable: true @@ -520,7 +542,6 @@ MouseArea { } } } - } } } diff --git a/containment/package/contents/ui/Ruler.qml b/containment/package/contents/ui/Ruler.qml index 6282393c7..52b2e6aa4 100644 --- a/containment/package/contents/ui/Ruler.qml +++ b/containment/package/contents/ui/Ruler.qml @@ -31,21 +31,26 @@ import org.kde.latte 0.1 as Latte Item{ id: rulerItem - width: root.isHorizontal ? root.maxLength : theme.defaultFont.pixelSize - height: root.isVertical ? root.maxLength : theme.defaultFont.pixelSize + width: root.isHorizontal ? root.maxLength : thickness + height: root.isVertical ? root.maxLength : thickness opacity: root.editMode ? 1 : 0 property int rulerAnimationTime: 0.8 * root.animationTime + readonly property bool containsMouse: rulerMouseArea.containsMouse + readonly property int thickness: theme.defaultFont.pixelSize + rMargin + + readonly property string tooltip: i18n("You can use mouse wheel to change the maximum length") + x: { if (root.isHorizontal) { return xL; } else { if (plasmoid.location === PlasmaCore.Types.LeftEdge){ - return editModeVisual.x + editModeVisual.width - theme.defaultFont.pixelSize - rMargin ; + return editModeVisual.x + editModeVisual.width - theme.defaultFont.pixelSize; } else if (plasmoid.location === PlasmaCore.Types.RightEdge){ - return editModeVisual.x + rMargin ; + return editModeVisual.x; } } } @@ -55,9 +60,9 @@ Item{ return yL; } else { if (plasmoid.location === PlasmaCore.Types.BottomEdge){ - return editModeVisual.y + rMargin; + return editModeVisual.y; } else if (plasmoid.location === PlasmaCore.Types.TopEdge){ - return editModeVisual.y + editModeVisual.height - theme.defaultFont.pixelSize - rMargin; + return editModeVisual.y + editModeVisual.height - theme.defaultFont.pixelSize; } } @@ -172,8 +177,8 @@ Item{ Grid{ id: rulerGrid - width: root.isHorizontal ? parent.width : undefined - height: root.isVertical ? parent.height : undefined + width: root.isHorizontal ? parent.length : undefined + height: root.isVertical ? parent.length : undefined rows: root.isHorizontal ? 1 : 0 columns: root.isVertical ? 1 : 0 @@ -181,6 +186,26 @@ Item{ flow: root.isHorizontal ? GridLayout.TopToBottom : GridLayout.LeftToRight + x: { + if (plasmoid.location === PlasmaCore.Types.LeftEdge) { + return -rMargin; + } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { + return rMargin; + } else { + return 0; + } + } + + y: { + if (plasmoid.location === PlasmaCore.Types.BottomEdge) { + return rMargin; + } else if (plasmoid.location === PlasmaCore.Types.TopEdge) { + return -rMargin; + } else { + return 0; + } + } + property int freeSpace: { if (root.isHorizontal) { return rulerItem.width - rulerGrid.spacing - 1 //((rulerGrid.children.length-2) * rulerGrid.spacing) diff --git a/containment/package/contents/ui/RulerMouseArea.qml b/containment/package/contents/ui/RulerMouseArea.qml index bca8847a0..b7d02146c 100644 --- a/containment/package/contents/ui/RulerMouseArea.qml +++ b/containment/package/contents/ui/RulerMouseArea.qml @@ -26,6 +26,7 @@ import org.kde.latte 0.1 as Latte MouseArea{ cursorShape: root.isHorizontal ? Qt.SizeHorCursor : Qt.SizeVerCursor + hoverEnabled: true onWheel: { var angle = wheel.angleDelta.y / 8; diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 250045d65..a2582160e 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -1492,6 +1492,7 @@ DragDrop.DropArea { Ruler{id: ruler} RulerMouseArea{ + id: rulerMouseArea anchors.fill: ruler z:1100 }