Commit e23b4069 authored by Tanbir Jishan's avatar Tanbir Jishan Committed by Nate Graham
Browse files

applets/margin-separator: use an svg icon for display in editmode

Currently it uses a rectangle which is too wide. Use a svg icon
with proper click area for a better look.
parent 49f04efb
Pipeline #207823 passed with stage
in 5 minutes and 10 seconds
......@@ -10,18 +10,30 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
Rectangle {
Item {
id: root
color: Plasmoid.editMode ? PlasmaCore.Theme.buttonFocusColor : "transparent" // So that user can identify the Plasmoid in edit mode
Layout.minimumWidth: Plasmoid.editMode ? units.largeSpacing : 1 // We don't have zeroSpacing and assigning 0 does not work as well
readonly property bool isVertical: Plasmoid.formFactor === PlasmaCore.Types.Vertical
Layout.minimumWidth: Plasmoid.editMode && !isVertical ? PlasmaCore.Units.largeSpacing : PlasmaCore.Units.devicePixelRatio
Layout.preferredWidth: Layout.minimumWidth
Layout.maximumWidth: Layout.minimumWidth
Layout.minimumHeight: Layout.minimumWidth
Layout.minimumHeight: Plasmoid.editMode && isVertical ? PlasmaCore.Units.largeSpacing : Layout.minimumWidth
Layout.preferredHeight: Layout.minimumHeight
Layout.maximumHeight: Layout.minimumHeight
Plasmoid.constraintHints: PlasmaCore.Types.MarginAreasSeparator
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Loader {
anchors.centerIn: parent
active: Plasmoid.editMode
sourceComponent: PlasmaCore.SvgItem {
height: root.isVertical ? PlasmaCore.Units.devicePixelRatio : Math.round(root.height / 2)
width: root.isVertical ? Math.round(root.width / 2) : PlasmaCore.Units.devicePixelRatio
svg: PlasmaCore.Svg {imagePath: "widgets/line"}
elementId: root.isVertical ? "vertical-line" : "horizontal-line"
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment