Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/components/ActionButton.qml
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.2 | 20 | import QtQuick 2.2 | ||
21 | import QtGraphicalEffects 1.0 | ||||
21 | import org.kde.plasma.core 2.0 as PlasmaCore | 22 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
22 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
23 | 24 | | |||
24 | Item { | 25 | Item { | ||
25 | id: root | 26 | id: root | ||
26 | property alias text: label.text | 27 | property alias text: label.text | ||
27 | property alias iconSource: icon.source | 28 | property alias iconSource: icon.source | ||
28 | property alias containsMouse: mouseArea.containsMouse | 29 | property alias containsMouse: mouseArea.containsMouse | ||
29 | property alias font: label.font | 30 | property alias font: label.font | ||
31 | property alias labelShadow: labelShadow.visible | ||||
30 | signal clicked | 32 | signal clicked | ||
31 | 33 | | |||
32 | activeFocusOnTab: true | 34 | activeFocusOnTab: true | ||
33 | 35 | | |||
34 | property int iconSize: units.gridUnit * 3 | 36 | property int iconSize: units.gridUnit * 3 | ||
35 | 37 | | |||
36 | implicitWidth: Math.max(iconSize + units.largeSpacing * 2, label.contentWidth) | 38 | implicitWidth: Math.max(iconSize + units.largeSpacing * 2, label.contentWidth) | ||
37 | implicitHeight: iconSize + units.smallSpacing + label.implicitHeight | 39 | implicitHeight: iconSize + units.smallSpacing + label.implicitHeight | ||
38 | 40 | | |||
39 | PlasmaCore.IconItem { | 41 | PlasmaCore.IconItem { | ||
40 | id: icon | 42 | id: icon | ||
41 | anchors { | 43 | anchors { | ||
42 | top: parent.top | 44 | top: parent.top | ||
43 | horizontalCenter: parent.horizontalCenter | 45 | horizontalCenter: parent.horizontalCenter | ||
44 | } | 46 | } | ||
45 | width: iconSize | 47 | width: iconSize | ||
46 | height: iconSize | 48 | height: iconSize | ||
47 | 49 | | |||
48 | colorGroup: PlasmaCore.ColorScope.colorGroup | 50 | colorGroup: PlasmaCore.ColorScope.colorGroup | ||
49 | active: mouseArea.containsMouse || root.activeFocus | 51 | active: mouseArea.containsMouse || root.activeFocus | ||
50 | } | 52 | } | ||
53 | | ||||
54 | DropShadow { | ||||
55 | id: labelShadow | ||||
56 | visible: false | ||||
57 | anchors.fill: label | ||||
58 | source: label | ||||
59 | horizontalOffset: 0 | ||||
60 | verticalOffset: 1 | ||||
61 | radius: 12 | ||||
62 | samples: 32 | ||||
63 | spread: 0.35 | ||||
64 | color: PlasmaCore.ColorScope.backgroundColor | ||||
65 | } | ||||
51 | PlasmaComponents.Label { | 66 | PlasmaComponents.Label { | ||
52 | id: label | 67 | id: label | ||
53 | anchors { | 68 | anchors { | ||
54 | top: icon.bottom | 69 | top: icon.bottom | ||
55 | topMargin: units.smallSpacing | 70 | topMargin: units.smallSpacing | ||
56 | left: parent.left | 71 | left: parent.left | ||
57 | right: parent.right | 72 | right: parent.right | ||
58 | } | 73 | } | ||
Show All 21 Lines |