← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mzanetti/ubuntu-docviewer-app/fix-layouts-with-icons into lp:ubuntu-docviewer-app

 

Michael Zanetti has proposed merging lp:~mzanetti/ubuntu-docviewer-app/fix-layouts-with-icons into lp:ubuntu-docviewer-app with lp:~verzegnassi-stefano/ubuntu-docviewer-app/attempt-fix-zooming-1 as a prerequisite.

Commit message:
properly set icon sizes inside layouts

Requested reviews:
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)

For more details, see:
https://code.launchpad.net/~mzanetti/ubuntu-docviewer-app/fix-layouts-with-icons/+merge/254072

QtQuick.Layouts ignore width/height and only act on implicitWidth/implicitHeight. Given that the implicit size of an Icon does not necessarily match the requested width/height (for example if the icon loads a png which simply isn't available in the requested size) this can badly mess up the layout and even end up in a loop reloading the image.

sizes in Layouts should always be set using Layout.preferredWidth/preferredHeight.
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~mzanetti/ubuntu-docviewer-app/fix-layouts-with-icons into lp:ubuntu-docviewer-app.
=== modified file 'src/app/qml/documentPage/DocumentGridDelegate.qml'
--- src/app/qml/documentPage/DocumentGridDelegate.qml	2015-03-04 19:38:48 +0000
+++ src/app/qml/documentPage/DocumentGridDelegate.qml	2015-03-25 11:45:29 +0000
@@ -79,7 +79,8 @@
             anchors.centerIn: parent
             anchors.verticalCenterOffset: - infoColumn.height * 0.3
 
-            width: units.gu(8); height: width
+            Layout.preferredWidth: units.gu(8);
+            Layout.preferredHeight: width
 
             // At the moment the suru icon theme doesn't have much icons.
             // Just some note for the future:

=== modified file 'src/app/qml/documentPage/DocumentListDelegate.qml'
--- src/app/qml/documentPage/DocumentListDelegate.qml	2015-03-04 17:44:36 +0000
+++ src/app/qml/documentPage/DocumentListDelegate.qml	2015-03-25 11:45:29 +0000
@@ -59,8 +59,8 @@
         spacing: units.gu(2)
 
         Icon {
-            width: height
-            height: units.gu(5)
+            Layout.preferredWidth: height
+            Layout.preferredHeight: units.gu(5)
 
             // At the moment the suru icon theme doesn't have much icons.
             name: {


Follow ups