Changeset View
Changeset View
Standalone View
Standalone View
examples/gallery/contents/ui/gallery/RadioButtonGallery.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.0 | 20 | import QtQuick 2.0 | ||
21 | import QtQuick.Controls 1.2 as Controls | 21 | import QtQuick.Controls 2.0 as Controls | ||
22 | import QtQuick.Layouts 1.2 | 22 | import QtQuick.Layouts 1.2 | ||
23 | import org.kde.kirigami 1.0 | 23 | import org.kde.kirigami 2.0 | ||
24 | 24 | | |||
25 | ScrollablePage { | 25 | ScrollablePage { | ||
26 | id: page | 26 | id: page | ||
27 | Layout.fillWidth: true | 27 | Layout.fillWidth: true | ||
28 | 28 | | |||
29 | title: "Radio buttons" | 29 | title: "Radio buttons" | ||
30 | actions { | 30 | actions { | ||
31 | main: Action { | 31 | main: Action { | ||
32 | iconName: "document-edit" | 32 | iconName: "document-edit" | ||
33 | text: "Main Action Text" | 33 | text: "Main Action Text" | ||
34 | onTriggered: { | 34 | onTriggered: { | ||
35 | showPassiveNotification("Action button in buttons page clicked"); | 35 | showPassiveNotification("Action button in buttons page clicked"); | ||
36 | } | 36 | } | ||
37 | } | 37 | } | ||
38 | left: Action { | 38 | left: Action { | ||
39 | iconName: "folder-sync" | 39 | iconName: "folder-sync" | ||
40 | text: "Left Action Text" | 40 | text: "Left Action Text" | ||
41 | onTriggered: { | 41 | onTriggered: { | ||
42 | showPassiveNotification("Left action triggered") | 42 | showPassiveNotification("Left action triggered") | ||
43 | } | 43 | } | ||
44 | } | 44 | } | ||
45 | } | 45 | } | ||
46 | 46 | | |||
47 | Controls.ButtonGroup { | ||||
48 | buttons: column1.children | ||||
49 | } | ||||
47 | 50 | | |||
48 | ColumnLayout { | 51 | ColumnLayout { | ||
49 | width: page.width | 52 | width: page.width | ||
50 | Controls.ExclusiveGroup { | | |||
51 | id: radioGroup | | |||
52 | } | | |||
53 | Controls.ExclusiveGroup { | | |||
54 | id: radioGroup2 | | |||
55 | } | | |||
56 | 53 | | |||
57 | Item { | 54 | Item { | ||
58 | Layout.fillWidth: true | 55 | Layout.fillWidth: true | ||
59 | Layout.minimumHeight: Units.gridUnit * 10 | 56 | Layout.minimumHeight: Units.gridUnit * 10 | ||
60 | GridLayout { | 57 | RowLayout { | ||
61 | anchors.centerIn: parent | 58 | anchors.centerIn: parent | ||
62 | columns: 3 | 59 | ColumnLayout { | ||
63 | rows: 3 | 60 | Layout.fillHeight: true | ||
64 | rowSpacing: Units.smallSpacing | | |||
65 | | ||||
66 | Item { | 61 | Item { | ||
67 | width: 1 | 62 | width: 1 | ||
68 | height: 1 | 63 | height: 1 | ||
64 | Layout.fillHeight: true | ||||
69 | } | 65 | } | ||
70 | Label { | 66 | Label { | ||
71 | text: "Normal" | 67 | text: "On" | ||
68 | Layout.preferredHeight: radio1.height | ||||
72 | } | 69 | } | ||
73 | Label { | 70 | Label { | ||
74 | text: "Disabled" | 71 | text: "Off" | ||
75 | enabled: false | 72 | Layout.preferredHeight: radio1.height | ||
76 | } | 73 | } | ||
74 | } | ||||
75 | ColumnLayout { | ||||
76 | id: column1 | ||||
77 | Label { | 77 | Label { | ||
78 | text: "On" | 78 | text: "Normal" | ||
79 | } | 79 | } | ||
80 | Controls.RadioButton { | 80 | Controls.RadioButton { | ||
81 | id: radio1 | ||||
81 | text: "On" | 82 | text: "On" | ||
82 | checked: true | 83 | checked: true | ||
83 | exclusiveGroup: radioGroup | | |||
84 | } | 84 | } | ||
85 | Controls.RadioButton { | 85 | Controls.RadioButton { | ||
86 | text: "On" | 86 | text: "Off" | ||
87 | checked: true | 87 | checked: false | ||
88 | enabled: false | | |||
89 | exclusiveGroup: radioGroup2 | | |||
90 | } | 88 | } | ||
89 | } | ||||
90 | ColumnLayout { | ||||
91 | id: column2 | ||||
92 | enabled: false | ||||
91 | Label { | 93 | Label { | ||
92 | text: "Off" | 94 | text: "Disabled" | ||
93 | } | 95 | } | ||
94 | Controls.RadioButton { | 96 | Controls.RadioButton { | ||
95 | text: "Off" | 97 | text: "On" | ||
96 | checked: false | 98 | checked: true | ||
97 | exclusiveGroup: radioGroup | | |||
98 | } | 99 | } | ||
99 | Controls.RadioButton { | 100 | Controls.RadioButton { | ||
100 | text: "Off" | 101 | text: "Off" | ||
101 | checked: false | 102 | checked: false | ||
102 | enabled: false | 103 | } | ||
103 | exclusiveGroup: radioGroup2 | | |||
104 | } | 104 | } | ||
105 | } | 105 | } | ||
106 | } | 106 | } | ||
107 | } | 107 | } | ||
108 | } | 108 | } |