Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/components/ActionButton.qml
Show All 11 Lines | |||||
12 | * GNU General Public License for more details | 12 | * GNU General Public License for more details | ||
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.8 | ||
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 | ||
27 | | ||||
28 | // If we're using software rendering, draw outlines instead of shadows | ||||
29 | // See https://bugs.kde.org/show_bug.cgi?id=398317 | ||||
30 | readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software | ||||
31 | | ||||
26 | property alias text: label.text | 32 | property alias text: label.text | ||
27 | property alias iconSource: icon.source | 33 | property alias iconSource: icon.source | ||
28 | property alias containsMouse: mouseArea.containsMouse | 34 | property alias containsMouse: mouseArea.containsMouse | ||
29 | property alias font: label.font | 35 | property alias font: label.font | ||
30 | signal clicked | 36 | signal clicked | ||
31 | 37 | | |||
32 | activeFocusOnTab: true | 38 | activeFocusOnTab: true | ||
33 | 39 | | |||
Show All 9 Lines | 47 | anchors { | |||
43 | horizontalCenter: parent.horizontalCenter | 49 | horizontalCenter: parent.horizontalCenter | ||
44 | } | 50 | } | ||
45 | width: iconSize | 51 | width: iconSize | ||
46 | height: iconSize | 52 | height: iconSize | ||
47 | 53 | | |||
48 | colorGroup: PlasmaCore.ColorScope.colorGroup | 54 | colorGroup: PlasmaCore.ColorScope.colorGroup | ||
49 | active: mouseArea.containsMouse || root.activeFocus | 55 | active: mouseArea.containsMouse || root.activeFocus | ||
50 | } | 56 | } | ||
57 | | ||||
58 | DropShadow { | ||||
59 | id: labelShadow | ||||
60 | visible: !softwareRendering | ||||
61 | anchors.fill: label | ||||
62 | source: label | ||||
63 | horizontalOffset: 1 | ||||
64 | verticalOffset: 1 | ||||
65 | radius: 4 | ||||
66 | samples: 9 | ||||
67 | spread: 0.35 | ||||
68 | color: "black" // matches Breeze window decoration and desktopcontainment | ||||
69 | } | ||||
70 | | ||||
51 | PlasmaComponents.Label { | 71 | PlasmaComponents.Label { | ||
52 | id: label | 72 | id: label | ||
53 | anchors { | 73 | anchors { | ||
54 | top: icon.bottom | 74 | top: icon.bottom | ||
55 | topMargin: units.smallSpacing | 75 | topMargin: units.smallSpacing | ||
56 | left: parent.left | 76 | left: parent.left | ||
57 | right: parent.right | 77 | right: parent.right | ||
58 | } | 78 | } | ||
Show All 21 Lines |