Skip to content

Commit 3d02e0f

Browse files
committed
qml: allow to load an image in an OptionButton
1 parent 84c9296 commit 3d02e0f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/qml/controls/OptionButton.qml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import QtQuick.Controls 2.15
77
import QtQuick.Layouts 1.15
88

99
Button {
10+
id: button
1011
property string description
1112
property bool recommended: false
12-
id: button
13+
property string image: ""
1314
padding: 15
1415
checkable: true
1516
implicitWidth: 450
@@ -25,6 +26,19 @@ Button {
2526
}
2627
contentItem: RowLayout {
2728
spacing: 3
29+
Loader {
30+
active: button.image !== ""
31+
visible: active
32+
Layout.rightMargin: 7
33+
sourceComponent: Button {
34+
icon.source: button.image
35+
icon.height: 40
36+
icon.width: 40
37+
icon.color: Theme.color.neutral9
38+
padding: 0
39+
background: null
40+
}
41+
}
2842
ColumnLayout {
2943
spacing: 3
3044
Layout.fillWidth: true

0 commit comments

Comments
 (0)