on xenial help sign in
Remove workarounds for Qt bug 28403

. Approved by Gerry Boland, PS Jenkins bot.

commitd7e32fdeecf8e203ee4bf49f245d8e092360e828 authorAlbert Astals <albert.astals@canonical.com> dateFri 5 Jul 2013, 12:39 (13 years ago) parent7bac1d5c1c1c80
5 files changed+30−67
Dash/Apps/RunningApplicationsGrid.qml+1 Dash/DashApps.qml+11−22 Dash/DashHome.qml+12−25 Dash/DashMusic.qml+3−10 Dash/DashVideos.qml+3−10
Dash/Apps/RunningApplicationsGrid.qml+1
@@ -19,6 +19,7 @@ import "../../Components"
1919
2020ResponsiveFlowView {
2121 id: root
22+ clip: true
2223
2324 signal updateScreenshots
2425
Dash/DashApps.qml+11−22
@@ -56,10 +56,10 @@ ScopeView {
5656 ListModel {
5757 id: categoryListModel
5858 // specifies app categories, type of delegate and model used in each category
59− ListElement { category: "Running apps"; component: "RunningApplicationsGrid"; modelName: "RunningApplicationsModel" }
60− ListElement { category: "Frequently used"; component: "ApplicationsFilterGrid"; modelName: "FrequentlyUsedAppsModel" }
61− ListElement { category: "Installed"; component: "ApplicationsFilterGrid"; modelName: "InstalledApplicationsModel" }
62− ListElement { category: "Available for download"; component: "ApplicationsFilterGrid"; modelName: "AppsAvailableForDownloadModel" }
59+ ListElement { category: "Running apps"; component: "Apps/RunningApplicationsGrid.qml"; modelName: "RunningApplicationsModel" }
60+ ListElement { category: "Frequently used"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "FrequentlyUsedAppsModel" }
61+ ListElement { category: "Installed"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "InstalledApplicationsModel" }
62+ ListElement { category: "Available for download"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "AppsAvailableForDownloadModel" }
6363 function getCategory(category1) {
6464 if (category1 === "Running apps") {
6565 return i18n.tr("Running apps");
@@ -95,23 +95,6 @@ ScopeView {
9595 "AppsAvailableForDownloadModel": appsAvailableForDownloadModel,
9696 }
9797
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−
11598 ScopeListView {
11699 id: categoryView
117100 anchors.fill: parent
@@ -139,7 +122,7 @@ ScopeView {
139122 left: parent.left
140123 right: parent.right
141124 }
142− sourceComponent: componentModels[component]
125+ source: component
143126 onLoaded: {
144127 if (modelName == "RunningApplicationsModel") {
145128 item.firstModel = mainStageApplicationsModel
@@ -147,7 +130,13 @@ ScopeView {
147130 item.canEnableTerminationMode =
148131 Qt.binding(function() { return isCurrent; })
149132 } else {
133+ function activateApplication(index, data) {
134+ shell.activateApplication(data);
135+ }
136+
150137 item.model = categoryModels[modelName]
138+ item.clicked.connect(activateApplication);
139+
151140 }
152141 }
153142 }
Dash/DashHome.qml+12−25
@@ -32,9 +32,9 @@ ScopeView {
3232 ListModel {
3333 id: categoryListModel
3434 // specifies page's content categories, type of delegate and model used in each category
35− ListElement { category: "Frequent Apps"; component: "AppsGrid"; modelName: "AppsModel" }
36− ListElement { category: "Recent Music"; component: "MusicGrid"; modelName: "MusicModel" }
37− ListElement { category: "Videos Popular Online"; component: "VideosGrid"; modelName: "VideosModel" }
35+ ListElement { category: "Frequent Apps"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "AppsModel" }
36+ ListElement { category: "Recent Music"; component: "Music/MusicFilterGrid.qml"; modelName: "MusicModel" }
37+ ListElement { category: "Videos Popular Online"; component: "Video/VideosFilterGrid.qml"; modelName: "VideosModel" }
3838 function getCategory(category1) {
3939 if (category1 === "Frequent Apps") {
4040 return i18n.tr("Frequent Apps");
@@ -110,26 +110,6 @@ ScopeView {
110110 "VideosModel": videosFilter,
111111 }
112112
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−
133113 ScopeListView {
134114 id: listView
135115 anchors.fill: parent
@@ -145,13 +125,13 @@ ScopeView {
145125
146126 Loader {
147127 anchors { top: parent.top; left: parent.left; right: parent.right }
148− sourceComponent: componentModels[component]
128+ source: component
149129 onLoaded: {
150130 item.model = categoryModels[modelName]
151131
152132 //FIXME: workaround for lack of previews for videos in Home scope.
153133 //Need to connect to the clicked() signal here and act upon it here instead.
154− if (component === "VideosGrid") {
134+ if (modelName === "VideosModel") {
155135 function playVideo(index, data) {
156136 if (data.fileUri) {
157137 shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', "/usr/share/demo-assets/videos/" + data.fileUri);
@@ -159,6 +139,13 @@ ScopeView {
159139 }
160140
161141 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);
162149 }
163150 }
164151 }
Dash/DashMusic.qml+3−10
@@ -50,17 +50,10 @@ ScopeView {
5050 }
5151 }
5252
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−
6053 function getRenderer(categoryId) {
6154 switch (categoryId) {
62− case 1: return musicCarousel
63− default: return musicFilterGrid
55+ case 1: return "Music/MusicCarousel.qml"
56+ default: return "Music/MusicFilterGrid.qml"
6457 }
6558 }
6659
@@ -80,7 +73,7 @@ ScopeView {
8073
8174 Loader {
8275 anchors { top: parent.top; left: parent.left; right: parent.right }
83− sourceComponent: scopeView.getRenderer(base.categoryId)
76+ source: scopeView.getRenderer(base.categoryId)
8477 onLoaded: {
8578 item.model = results
8679 }
Dash/DashVideos.qml+3−10
@@ -51,17 +51,10 @@ ScopeView {
5151 }
5252 }
5353
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−
6154 function getRenderer(categoryId) {
6255 switch (categoryId) {
63− case 1: return videosCarousel
64− default: return videosFilterGrid
56+ case 1: return "Video/VideosCarousel.qml"
57+ default: return "Video/VideosFilterGrid.qml"
6558 }
6659 }
6760
@@ -115,7 +108,7 @@ ScopeView {
115108 Loader {
116109 id: loader
117110 anchors { top: parent.top; left: parent.left; right: parent.right }
118− sourceComponent: scopeView.getRenderer(base.categoryId)
111+ source: scopeView.getRenderer(base.categoryId)
119112 onLoaded: {
120113 item.model = results
121114 }