Libplasma

TextFieldFocus.qml
1/*
2 SPDX-FileCopyrightText: 2011 Daker Fernandes Pinheiro <dakerfp@gmail.com>
3 SPDX-FileCopyrightText: 2011 Marco Martin <mart@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8import QtQuick
9import org.kde.ksvg as KSvg
10import org.kde.kirigami as Kirigami
11
12Item {
13 id: main
14 state: parent.state
15
16 KSvg.Svg {
17 id: lineEditSvg
18 property bool hasFocusFrame: lineEditSvg.hasElement("focusframe-center")
19 property bool hasFocusOverBase: lineEditSvg.hasElement("hint-focus-over-base")
20 imagePath: "widgets/lineedit"
21 onRepaintNeeded: {
22 if (hasFocusOverBase) {
23 main.z = 800
24 } else {
25 main.z = 0
26 }
27 }
28 Component.onCompleted: {
29 if (hasFocusOverBase) {
30 main.z = 800
31 } else {
32 main.z = 0
33 }
34 }
35 }
36
38 id: hover
39
40 anchors {
41 fill: parent
42 leftMargin: -margins.left
43 topMargin: -margins.top
44 rightMargin: -margins.right
45 bottomMargin: -margins.bottom
46 }
47 opacity: 0
48 visible: opacity > 0
49 imagePath: "widgets/lineedit"
50 prefix: "hover"
51 }
52
53 states: [
54 State {
55 name: "hover"
56 PropertyChanges {
57 target: hover
58 opacity: 1
59 prefix: "hover"
60 }
61 },
62 State {
63 name: "focus"
64 PropertyChanges {
65 target: hover
66 opacity: 1
67 prefix: "focus"
68 }
69 },
70 State {
71 name: "focusframe"
72 PropertyChanges {
73 target: hover
74 opacity: 1
75 prefix: lineEditSvg.hasFocusFrame ? "focusframe" : "focus"
76 }
77 },
78 State {
79 name: "hidden"
80 PropertyChanges {
81 target: hover
82 opacity: 0
83 prefix: "hover"
84 }
85 }
86 ]
87
88 transitions: [
89 Transition {
90 PropertyAnimation {
91 properties: "opacity"
92 duration: Kirigami.Units.longDuration
93 easing.type: Easing.OutQuad
94 }
95 }
96 ]
97}
QString name(GameStandardAction id)
KGuiItem properties()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:34:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.