on xenial help sign in
Remove workarounds for Qt bug 28403
d7e32fdAlbert Astals
Dash/Apps/RunningApplicationsGrid.qml+1
@@ -19,6 +19,7 @@ import "../../Components"
19
19
20ResponsiveFlowView {
20ResponsiveFlowView {
21 id: root
21 id: root
22+ clip: true
22
23
23 signal updateScreenshots
24 signal updateScreenshots
24
25
Dash/DashApps.qml+11−22
@@ -56,10 +56,10 @@ ScopeView {
56 ListModel {
56 ListModel {
57 id: categoryListModel
57 id: categoryListModel
58 // specifies app categories, type of delegate and model used in each category
58 // specifies app categories, type of delegate and model used in each category
59− ListElement { category: "Running apps"; component: "RunningApplicationsGrid"; modelName: "RunningApplicationsModel" }
59+ ListElement { category: "Running apps"; component: "Apps/RunningApplicationsGrid.qml"; modelName: "RunningApplicationsModel" }
60− ListElement { category: "Frequently used"; component: "ApplicationsFilterGrid"; modelName: "FrequentlyUsedAppsModel" }
60+ ListElement { category: "Frequently used"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "FrequentlyUsedAppsModel" }
61− ListElement { category: "Installed"; component: "ApplicationsFilterGrid"; modelName: "InstalledApplicationsModel" }
61+ ListElement { category: "Installed"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "InstalledApplicationsModel" }
62− ListElement { category: "Available for download"; component: "ApplicationsFilterGrid"; modelName: "AppsAvailableForDownloadModel" }
62+ ListElement { category: "Available for download"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "AppsAvailableForDownloadModel" }
63 function getCategory(category1) {
63 function getCategory(category1) {
64 if (category1 === "Running apps") {
64 if (category1 === "Running apps") {
65 return i18n.tr("Running apps");
65 return i18n.tr("Running apps");
@@ -95,23 +95,6 @@ ScopeView {
95 "AppsAvailableForDownloadModel": appsAvailableForDownloadModel,
95 "AppsAvailableForDownloadModel": appsAvailableForDownloadModel,
96 }
96 }
97
97
98− /* Workaround for bug: https://bugreports.qt-project.org/browse/QTBUG-28403
99− When using Loader to load external QML file in the list deelgate, the ListView has
100− a bug where it can position the delegate content to overlap the section header
101− of the ListView - a workaround is to use sourceComponent of Loader instead */
102− Component { id: runningApplicationsGrid; RunningApplicationsGrid { clip: true } }
103− Component {
104− id: applicationsFilterGrid;
105− ApplicationsFilterGrid {
106− onClicked: shell.activateApplication(data)
107− }
108− }
109−
110− property var componentModels: {
111− "RunningApplicationsGrid": runningApplicationsGrid,
112− "ApplicationsFilterGrid": applicationsFilterGrid,
113− }
114−
115 ScopeListView {
98 ScopeListView {
116 id: categoryView
99 id: categoryView
117 anchors.fill: parent
100 anchors.fill: parent
@@ -139,7 +122,7 @@ ScopeView {
139 left: parent.left
122 left: parent.left
140 right: parent.right
123 right: parent.right
141 }
124 }
142− sourceComponent: componentModels[component]
125+ source: component
143 onLoaded: {
126 onLoaded: {
144 if (modelName == "RunningApplicationsModel") {
127 if (modelName == "RunningApplicationsModel") {
145 item.firstModel = mainStageApplicationsModel
128 item.firstModel = mainStageApplicationsModel
@@ -147,7 +130,13 @@ ScopeView {
147 item.canEnableTerminationMode =
130 item.canEnableTerminationMode =
148 Qt.binding(function() { return isCurrent; })
131 Qt.binding(function() { return isCurrent; })
149 } else {
132 } else {
133+ function activateApplication(index, data) {
134+ shell.activateApplication(data);
135+ }
136+
150 item.model = categoryModels[modelName]
137 item.model = categoryModels[modelName]
138+ item.clicked.connect(activateApplication);
139+
151 }
140 }
152 }
141 }
153 }
142 }
Dash/DashHome.qml+12−25
@@ -32,9 +32,9 @@ ScopeView {
32 ListModel {
32 ListModel {
33 id: categoryListModel
33 id: categoryListModel
34 // specifies page's content categories, type of delegate and model used in each category
34 // specifies page's content categories, type of delegate and model used in each category
35− ListElement { category: "Frequent Apps"; component: "AppsGrid"; modelName: "AppsModel" }
35+ ListElement { category: "Frequent Apps"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "AppsModel" }
36− ListElement { category: "Recent Music"; component: "MusicGrid"; modelName: "MusicModel" }
36+ ListElement { category: "Recent Music"; component: "Music/MusicFilterGrid.qml"; modelName: "MusicModel" }
37− ListElement { category: "Videos Popular Online"; component: "VideosGrid"; modelName: "VideosModel" }
37+ ListElement { category: "Videos Popular Online"; component: "Video/VideosFilterGrid.qml"; modelName: "VideosModel" }
38 function getCategory(category1) {
38 function getCategory(category1) {
39 if (category1 === "Frequent Apps") {
39 if (category1 === "Frequent Apps") {
40 return i18n.tr("Frequent Apps");
40 return i18n.tr("Frequent Apps");
@@ -110,26 +110,6 @@ ScopeView {
110 "VideosModel": videosFilter,
110 "VideosModel": videosFilter,
111 }
111 }
112
112
113− /* Workaround for bug: https://bugreports.qt-project.org/browse/QTBUG-28403
114− When using Loader to load external QML file in the list deelgate, the ListView has
115− a bug where it can position the delegate content to overlap the section header
116− of the ListView - a workaround is to use sourceComponent of Loader instead */
117− Component {
118− id: applicationsFilterGrid
119− ApplicationsFilterGrid {
120− objectName: "dashHomeApplicationsGrid"
121− onClicked: shell.activateApplication(data);
122− }
123− }
124−
125− Component { id: musicGrid; MusicFilterGrid {} }
126− Component { id: videosGrid; VideosFilterGrid {} }
127− property var componentModels: {
128− "AppsGrid": applicationsFilterGrid,
129− "MusicGrid": musicGrid,
130− "VideosGrid": videosGrid,
131− }
132−
133 ScopeListView {
113 ScopeListView {
134 id: listView
114 id: listView
135 anchors.fill: parent
115 anchors.fill: parent
@@ -145,13 +125,13 @@ ScopeView {
145
125
146 Loader {
126 Loader {
147 anchors { top: parent.top; left: parent.left; right: parent.right }
127 anchors { top: parent.top; left: parent.left; right: parent.right }
148− sourceComponent: componentModels[component]
128+ source: component
149 onLoaded: {
129 onLoaded: {
150 item.model = categoryModels[modelName]
130 item.model = categoryModels[modelName]
151
131
152 //FIXME: workaround for lack of previews for videos in Home scope.
132 //FIXME: workaround for lack of previews for videos in Home scope.
153 //Need to connect to the clicked() signal here and act upon it here instead.
133 //Need to connect to the clicked() signal here and act upon it here instead.
154− if (component === "VideosGrid") {
134+ if (modelName === "VideosModel") {
155 function playVideo(index, data) {
135 function playVideo(index, data) {
156 if (data.fileUri) {
136 if (data.fileUri) {
157 shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', "/usr/share/demo-assets/videos/" + data.fileUri);
137 shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', "/usr/share/demo-assets/videos/" + data.fileUri);
@@ -159,6 +139,13 @@ ScopeView {
159 }
139 }
160
140
161 item.clicked.connect(playVideo);
141 item.clicked.connect(playVideo);
142+ } else if (modelName === "AppsModel") {
143+ function activateApplication(index, data) {
144+ shell.activateApplication(data);
145+ }
146+
147+ item.objectName = "dashHomeApplicationsGrid";
148+ item.clicked.connect(activateApplication);
162 }
149 }
163 }
150 }
164 }
151 }
Dash/DashMusic.qml+3−10
@@ -50,17 +50,10 @@ ScopeView {
50 }
50 }
51 }
51 }
52
52
53− /* Workaround for bug: https://bugreports.qt-project.org/browse/QTBUG-28403
54− When using Loader to load external QML file in the list deelgate, the ListView has
55− a bug where it can position the delegate content to overlap the section header
56− of the ListView - a workaround is to use sourceComponent of Loader instead */
57− Component { id: musicCarousel; MusicCarousel {} }
58− Component { id: musicFilterGrid; MusicFilterGrid {} }
59−
60 function getRenderer(categoryId) {
53 function getRenderer(categoryId) {
61 switch (categoryId) {
54 switch (categoryId) {
62− case 1: return musicCarousel
55+ case 1: return "Music/MusicCarousel.qml"
63− default: return musicFilterGrid
56+ default: return "Music/MusicFilterGrid.qml"
64 }
57 }
65 }
58 }
66
59
@@ -80,7 +73,7 @@ ScopeView {
80
73
81 Loader {
74 Loader {
82 anchors { top: parent.top; left: parent.left; right: parent.right }
75 anchors { top: parent.top; left: parent.left; right: parent.right }
83− sourceComponent: scopeView.getRenderer(base.categoryId)
76+ source: scopeView.getRenderer(base.categoryId)
84 onLoaded: {
77 onLoaded: {
85 item.model = results
78 item.model = results
86 }
79 }
Dash/DashVideos.qml+3−10
@@ -51,17 +51,10 @@ ScopeView {
51 }
51 }
52 }
52 }
53
53
54− /* Workaround for bug: https://bugreports.qt-project.org/browse/QTBUG-28403
55− When using Loader to load external QML file in the list deelgate, the ListView has
56− a bug where it can position the delegate content to overlap the section header
57− of the ListView - a workaround is to use sourceComponent of Loader instead */
58− Component { id: videosFilterGrid; VideosFilterGrid {} }
59− Component { id: videosCarousel; VideosCarousel {} }
60−
61 function getRenderer(categoryId) {
54 function getRenderer(categoryId) {
62 switch (categoryId) {
55 switch (categoryId) {
63− case 1: return videosCarousel
56+ case 1: return "Video/VideosCarousel.qml"
64− default: return videosFilterGrid
57+ default: return "Video/VideosFilterGrid.qml"
65 }
58 }
66 }
59 }
67
60
@@ -115,7 +108,7 @@ ScopeView {
115 Loader {
108 Loader {
116 id: loader
109 id: loader
117 anchors { top: parent.top; left: parent.left; right: parent.right }
110 anchors { top: parent.top; left: parent.left; right: parent.right }
118− sourceComponent: scopeView.getRenderer(base.categoryId)
111+ source: scopeView.getRenderer(base.categoryId)
119 onLoaded: {
112 onLoaded: {
120 item.model = results
113 item.model = results
121 }
114 }