Changeset View
Changeset View
Standalone View
Standalone View
src/controls/templates/ApplicationHeader.qml
Show First 20 Lines • Show All 267 Lines • ▼ Show 20 Line(s) | 239 | delegate: MouseArea { | |||
---|---|---|---|---|---|
268 | } | 268 | } | ||
269 | 269 | | |||
270 | Loader { | 270 | Loader { | ||
271 | id: delegateLoader | 271 | id: delegateLoader | ||
272 | height: parent.height | 272 | height: parent.height | ||
273 | x: titleList.wideMode || headerStyle == ApplicationHeaderStyle.Titles ? (Math.min(delegate.width - implicitWidth, Math.max(0, titleList.contentX - delegate.x + navButtons.width))) : 0 | 273 | x: titleList.wideMode || headerStyle == ApplicationHeaderStyle.Titles ? (Math.min(delegate.width - implicitWidth, Math.max(0, titleList.contentX - delegate.x + navButtons.width))) : 0 | ||
274 | width: parent.width - x | 274 | width: parent.width - x | ||
275 | 275 | | |||
276 | Connections { | ||||
277 | target: delegateLoader.page | ||||
278 | Component.onDestruction: delegateLoader.sourceComponent = null | ||||
ratijas: Component attached object is a very special type in QML. It doesn't work that way. In fact this… | |||||
279 | } | ||||
280 | | ||||
276 | sourceComponent: header.pageDelegate | 281 | sourceComponent: header.pageDelegate | ||
277 | 282 | | |||
278 | readonly property Page page: __appWindow.pageStack.get(modelData) | 283 | readonly property Page page: __appWindow.pageStack.get(modelData) | ||
279 | //NOTE: why not use ListViewCurrentIndex? because listview itself resets | 284 | //NOTE: why not use ListViewCurrentIndex? because listview itself resets | ||
280 | //currentIndex in some situations (since here we are using an int as a model, | 285 | //currentIndex in some situations (since here we are using an int as a model, | ||
281 | //even more often) so the property binding gets broken | 286 | //even more often) so the property binding gets broken | ||
282 | readonly property bool current: __appWindow.pageStack.currentIndex == index | 287 | readonly property bool current: __appWindow.pageStack.currentIndex == index | ||
283 | readonly property int index: parent.currentIndex | 288 | readonly property int index: parent.currentIndex | ||
Show All 13 Lines |
Component attached object is a very special type in QML. It doesn't work that way. In fact this whole Connection block does nothing, while that Component.onDestruction only runs when the Connections object is destroyed as a whole.