← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-layout-with-icons-2 into lp:ubuntu-docviewer-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-layout-with-icons-2 into lp:ubuntu-docviewer-app.

Commit message:
Properly set sizes inside QtQuick.Layouts

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

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/fix-layout-with-icons-2/+merge/263369

Original description from Michael Zanetti:
"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."

The fix has been extended also to common/ToastWithAction.qml with the revision 162.
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-layout-with-icons-2 into lp:ubuntu-docviewer-app.
=== modified file 'src/app/qml/common/ToastWithAction.qml'
--- src/app/qml/common/ToastWithAction.qml	2015-04-07 22:52:48 +0000
+++ src/app/qml/common/ToastWithAction.qml	2015-06-30 14:55:46 +0000
@@ -60,8 +60,8 @@
         }
 
         AbstractButton {
-            width: actionLabel.paintedWidth
-            height: parent.height
+            Layout.preferredWidth: actionLabel.paintedWidth
+            Layout.fillHeight: true
 
             onClicked: {
                 action.triggered("[Toast] Action %1 clicked!".arg(action.text))

=== modified file 'src/app/qml/documentPage/DocumentGridDelegate.qml'
--- src/app/qml/documentPage/DocumentGridDelegate.qml	2015-05-13 14:22:36 +0000
+++ src/app/qml/documentPage/DocumentGridDelegate.qml	2015-06-30 14:55:46 +0000
@@ -94,7 +94,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-06-22 17:01:23 +0000
+++ src/app/qml/documentPage/DocumentListDelegate.qml	2015-06-30 14:55:46 +0000
@@ -85,8 +85,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: {

=== modified file 'src/app/qml/documentPage/SortSettingsDialog.qml'
--- src/app/qml/documentPage/SortSettingsDialog.qml	2015-06-10 17:17:47 +0000
+++ src/app/qml/documentPage/SortSettingsDialog.qml	2015-06-30 14:55:46 +0000
@@ -18,7 +18,7 @@
 import QtQuick 2.0
 import Ubuntu.Components 1.1
 import Ubuntu.Components.Popups 1.0
-import QtQuick.Layouts 1.0
+import QtQuick.Layouts 1.1
 
 Dialog {
     id: sortSettingsDialog


Follow ups