on xenial help sign in
Adapt to new TabBar
4ff1076Tim Peeters
qml/Dash/DashContent.qml+18−10
@@ -17,6 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import Unity 0.2
19import Unity 0.2
20+import Utils 0.1
20import "../Components"
21import "../Components"
21
22
22Item {
23Item {
@@ -183,23 +184,30 @@ Item {
183 width: parent.width
184 width: parent.width
184 style: DashContentTabBarStyle {}
185 style: DashContentTabBarStyle {}
185
186
186− model: dashContentList.model
187+ SortFilterProxyModel {
188+ id: tabBarModel
187
189
190+ model: dashContentList.model
191+
192+ property int selectedIndex: -1
188− onSelectedIndexChanged: {
193+ onSelectedIndexChanged: {
189− if (dashContentList.currentIndex == -1 && tabBar.selectedIndex != -1) {
194+ if (dashContentList.currentIndex == -1 && tabBar.selectedIndex != -1) {
190− // TODO This together with the Timer below
195+ // TODO This together with the Timer below
191− // are a workaround for the first tab sometimes not showing the text.
196+ // are a workaround for the first tab sometimes not showing the text.
192− // But Tabs are going away in the future so not sure if makes
197+ // But Tabs are going away in the future so not sure if makes
193− // sense invetigating what's the problem at this stage
198+ // sense invetigating what's the problem at this stage
194− selectionModeTimer.restart();
199+ selectionModeTimer.restart();
200+ }
201+ dashContentList.currentIndex = selectedIndex;
195 }
202 }
196− dashContentList.currentIndex = selectedIndex;
197 }
203 }
198
204
205+ model: tabBarModel.count > 0 ? tabBarModel : null
206+
199 Connections {
207 Connections {
200 target: dashContentList
208 target: dashContentList
201 onCurrentIndexChanged: {
209 onCurrentIndexChanged: {
202− tabBar.selectedIndex = dashContentList.currentIndex
210+ tabBarModel.selectedIndex = dashContentList.currentIndex
203 }
211 }
204 }
212 }
205
213