Changeset View
Changeset View
Standalone View
Standalone View
applets/kickoff/package/contents/ui/KickoffConfigurationButton.qml
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 | ||
20 | import org.kde.plasma.core 2.0 as PlasmaCore | 20 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
21 | import QtQuick.Controls 1.0 as QtControls | 21 | import QtQuick.Controls 1.0 as QtControls | ||
22 | import QtQuick.Layouts 1.1 | ||||
22 | import org.kde.kquickcontrolsaddons 2.0 | 23 | import org.kde.kquickcontrolsaddons 2.0 | ||
23 | 24 | | |||
24 | PlasmaCore.FrameSvgItem { | 25 | PlasmaCore.FrameSvgItem { | ||
25 | id: button | 26 | id: button | ||
26 | property alias icon: iconElement.source | 27 | property alias icon: iconElement.source | ||
27 | property alias text: textElement.text | 28 | property alias text: textElement.text | ||
28 | property string name | 29 | property string name | ||
29 | 30 | | |||
30 | width: units.gridUnit * 6 | 31 | width: units.gridUnit * 5 | ||
31 | height: units.gridUnit * 5 | 32 | height: units.gridUnit * 4 | ||
32 | 33 | | |||
33 | visible: name != "empty" | 34 | visible: name != "empty" | ||
34 | 35 | | |||
35 | imagePath: "widgets/background" | 36 | imagePath: "widgets/background" | ||
36 | 37 | | |||
38 | ColumnLayout { | ||||
39 | anchors.centerIn: parent | ||||
40 | | ||||
37 | PlasmaCore.IconItem { | 41 | PlasmaCore.IconItem { | ||
38 | id: iconElement | 42 | id: iconElement | ||
39 | 43 | | |||
40 | anchors.centerIn: parent | 44 | Layout.alignment: Qt.AlignHCenter | ||
41 | width: units.iconSizes.medium | 45 | Layout.preferredWidth: units.iconSizes.medium | ||
davidedmundson: It's almost always wrong to specify a width inside a ColumnLayout.
use implicitWidth or… | |||||
42 | height: width | 46 | Layout.preferredHeight: width | ||
43 | 47 | | |||
44 | source: icon | 48 | source: icon | ||
45 | } | 49 | } | ||
46 | 50 | | |||
47 | QtControls.Label { | 51 | QtControls.Label { | ||
48 | id: textElement | 52 | id: textElement | ||
49 | anchors { | 53 | Layout.alignment: Qt.AlignHCenter | ||
50 | top: iconElement.bottom | | |||
51 | left: parent.left | | |||
52 | right: parent.right | | |||
53 | } | | |||
54 | horizontalAlignment: Text.AlignHCenter | 54 | horizontalAlignment: Text.AlignHCenter | ||
55 | elide: Text.ElideRight | 55 | elide: Text.ElideRight | ||
56 | color: PlasmaCore.ColorScope.textColor | 56 | color: PlasmaCore.ColorScope.textColor | ||
57 | font.pointSize: theme.smallestFont.pointSize | 57 | font.pointSize: theme.smallestFont.pointSize | ||
58 | } | 58 | } | ||
59 | } | 59 | } | ||
60 | } |
It's almost always wrong to specify a width inside a ColumnLayout.
use implicitWidth or Layout.preferredWidth