mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-09 17:18:11 +03:00
enable ruler tooltip in editing mode
This commit is contained in:
parent
86aac1fa4b
commit
3195cc206c
@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -1492,6 +1492,7 @@ DragDrop.DropArea {
|
||||
Ruler{id: ruler}
|
||||
|
||||
RulerMouseArea{
|
||||
id: rulerMouseArea
|
||||
anchors.fill: ruler
|
||||
z:1100
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user