Changeset View
Changeset View
Standalone View
Standalone View
src/kcm/package/contents/ui/Advanced.qml
Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 119 | ComboBox { | |||
---|---|---|---|---|---|
125 | textRole: "Description" | 125 | textRole: "Description" | ||
126 | model: SinkModel { | 126 | model: SinkModel { | ||
127 | onRowsInserted: sinks.updatePulseObject() | 127 | onRowsInserted: sinks.updatePulseObject() | ||
128 | onRowsRemoved: sinks.updatePulseObject() | 128 | onRowsRemoved: sinks.updatePulseObject() | ||
129 | onDataChanged: sinks.updatePulseObject() | 129 | onDataChanged: sinks.updatePulseObject() | ||
130 | } | 130 | } | ||
131 | onCurrentIndexChanged: updatePulseObject() | 131 | onCurrentIndexChanged: updatePulseObject() | ||
132 | onCurrentTextChanged: updatePulseObject() | 132 | onCurrentTextChanged: updatePulseObject() | ||
133 | Component.onCompleted: updatePulseObject() | 133 | Component.onCompleted: { | ||
134 | sinks.currentIndex = 0 | ||||
135 | updatePulseObject() | ||||
136 | } | ||||
134 | 137 | | |||
135 | function updatePulseObject() { | 138 | function updatePulseObject() { | ||
136 | Qt.callLater(function() { | 139 | Qt.callLater(function() { | ||
137 | pulseObject = model.data(model.index(sinks.currentIndex, 0), model.role("PulseObject")); | 140 | // When the combobox isn't shown currentIndex is -1, so use 0 in that case | ||
141 | pulseObject = model.data(model.index(Math.max(sinks.currentIndex, 0), 0), model.role("PulseObject")); | ||||
138 | }); | 142 | }); | ||
139 | } | 143 | } | ||
140 | } | 144 | } | ||
141 | } | 145 | } | ||
142 | 146 | | |||
143 | Grid { | 147 | Grid { | ||
144 | id: grid | 148 | id: grid | ||
145 | columns: 3 | 149 | columns: 3 | ||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |