KQuickImageEditor

SelectionBackground.qml
1 /* SPDX-FileCopyrightText: 2021 Noah Davis <[email protected]>
2  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
3  */
4 
5 import QtQuick 2.15
6 import QtQuick.Shapes 1.15
7 import org.kde.kirigami 2.15 as Kirigami
8 
9 Shape {
10  id: root
11  property bool enableAnimation: !(root.parent instanceof SelectionTool)
12  || !(parent.selectionArea.drag.active
13  || (parent.pressedHandle && parent.pressedHandle.drag.active))
14  Rectangle {
15  z: -1
16  anchors.fill: parent
17  anchors.margins: -1
18  color: "transparent"
19  border.color: Kirigami.Theme.highlightColor
20  border.width: 1
21  }
22  ShapePath {
23  id: shapePath
24  fillColor: "transparent"
25  strokeWidth: 1
26  strokeColor: "white"
27  strokeStyle: ShapePath.DashLine
28  // for some reason, +2 makes the spacing and dash lengths the same, no matter what the strokeWidth is.
29  dashPattern: [Kirigami.Units.smallSpacing / strokeWidth, Kirigami.Units.smallSpacing / strokeWidth + 2]
30  dashOffset: 0
31  startX: -strokeWidth/2; startY: startX
32  PathLine { x: root.width - shapePath.startX; y: shapePath.startY }
33  PathLine { x: root.width - shapePath.startX; y: root.height - shapePath.startY }
34  PathLine { x: shapePath.startX; y: root.height - shapePath.startY }
35  PathLine { x: shapePath.startX; y: shapePath.startY }
36  NumberAnimation on dashOffset {
37  running: root.enableAnimation
38  loops: Animation.Infinite
39  from: shapePath.dashOffset; to: shapePath.dashOffset + shapePath.dashPattern[0] + shapePath.dashPattern[1]
40  duration: 1000
41  }
42  }
43 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 23:08:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.