Kstars

KSTabBarArrow.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick 2.6
5import QtQuick.Layouts 1.2
6import QtQuick.Controls 2.0
7import "../constants" 1.0
8
9Button {
10 z: 1
11 id: arrow
12 property string imgSource
13 property Item tabBar
14 property int flickSpeed: 1000
15 state: "Invisible"
16
17 width:image.width*1.5
18 Image {
19 id: image
20 opacity: 0.6
21 anchors{
22 verticalCenter: parent.verticalCenter
23 horizontalCenter: parent.horizontalCenter
24 }
25 source: imgSource
26 }
27
28 background: Rectangle {
29 color: "grey"
30 opacity: 0.6
31 }
32
33 onPressedChanged: {
34 if(pressed) {
35 arrow.background.opacity = 0.3
36 tabBar.contentItem.flick(flickSpeed,0)
37 } else {
38 arrow.background.opacity = 0.6
39 }
40 }
41
42 states: [
43 State {
44 name: "Visible"
45 PropertyChanges{target: arrow; opacity: 1.0}
46 PropertyChanges{target: arrow; visible: true}
47 },
48 State {
49 name:"Invisible"
50 PropertyChanges{target: arrow; opacity: 0.0}
51 PropertyChanges{target: arrow; visible: false}
52 }
53 ]
54
55 transitions: [
56 Transition {
57 from: "Visible"
58 to: "Invisible"
59
60 SequentialAnimation{
61 NumberAnimation {
62 target: arrow
63 property: "opacity"
64 duration: arrow
65 easing.type: Easing.InOutQuad
66 }
67 NumberAnimation {
68 target: arrow
69 property: "visible"
70 duration: 50
71 }
72 }
73 },
74 Transition {
75 from: "Invisible"
76 to: "Visible"
77 SequentialAnimation{
78 NumberAnimation {
79 target: arrow
80 property: "visible"
81 duration: 0
82 }
83 NumberAnimation {
84 target: arrow
85 property: "opacity"
86 duration: 200
87 easing.type: Easing.InOutQuad
88 }
89 }
90 }
91 ]
92}
QString name(GameStandardAction id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.