Pages hidden in an AdpativePageLayout stack have their width changed to zero

Bug #1492343 reported by Andrew Hayzen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Fix Released
High
Zsombor Egri

Bug Description

As shown in this example [0], if you select the "Albums for artist" button to push a page onto the stack, you can see in the console that the width of the old component is changed to zero, which causes it then to reflow as the width is increased when it is brought back into view. Instead, the width should not be changed when the page is hidden.

0 - http://pastebin.ubuntu.com/12274053/

Related branches

Revision history for this message
Tim Peeters (tpeeters) wrote :

Internally the AdaptivePageLayout has an Item with id hiddenPages which is the parent for the Pages that were added but not visible. We did not set its anchors, that is why it is null. A quick fix to make its width not 0 is to make it fill its parent (the AdaptivePageLayout), but then still the width would change when a Page becomes hidden in a multi-column layout because the hidden pages would span the full width.

Basically, there is no fixed width that the parent of the hidden pages must have because the pages may go to different columns when they become visible.

Is there a way you can prevent the page from re-layouting when it is not visible?

Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Confirmed
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

OK, so for music the pages that are noticeable with this bug use the custom ColumnFlow, so I have patched [1] this to only update the widths of the cards when the view is visible, which appears to have resolved the issue for us.

However, this should probably still be a bug in the SDK as it was unexpected that the width should change when the page is made invisible.

1 - http://bazaar.launchpad.net/~ahayzen/music-app/refactor-adaptive-page-layout/revision/901

Revision history for this message
Zsombor Egri (zsombi) wrote :

The root cause of the problem you see is because the Page itself anchor fills to its parent. This was connected badly, and because of that we have this problem.

A fix would be to have property change for each Page added into the hidden item to unset the anchor.fill of the page and restore it when the parent is changed back. However, this would cause Page width changes as well, which is also bad. Another solution is not to reparent but hide the entire Page from the cold,n, which then would break the eventual bindings applied on the opacity/visible properties...

We need to study a solution that would prevent Page size changes while reside in the hidden Item.

Revision history for this message
Tim Peeters (tpeeters) wrote :

Zsombi what do you mean with "connected badly"?

The page fills its parent, but that is what you want, also when it is (visible) inside the AdaptivePageLayout. You should not set a fixed width because the columns can be resized (by changing the window size, changing the column layouts, or directly changing the column widths by dragging their edges), and the Pages need to keep filling their column.

Is it not a solution if the Page width becomes 0 when it is invisible and not to re-layout when changing to 0, as Andrew did above?

Revision history for this message
Zsombor Egri (zsombi) wrote :

Tim, sorry, this auto-correct reformulated my words, I meant concepted badly :)

Page filling its parent is what causes the width changes when reparented, do you agree? I do not say that width becoming 0 is right, but I disagree Page filling its parent is also a wanted behaviour. You can always fill it if you want, so Page then will follow its parent width. Also it is not "QMLish" to automatically fill the parent's area.

Revision history for this message
Tim Peeters (tpeeters) wrote :

Actually the Page does not fill its parent, but anchors to all sides except the top, and the Page.height depends on the parent, the header, and whether the Page has a flickable. As long as we don't move the header into the page, I don't see a better solution than what we have now. If we don't anchor it to parent.bottom, then we need to offset its y depending on the header.

That said, if the header goes into the page, we could set implicitWidth and implicitHeight of the Page instead of anchoring, or don't set any anchors/width/height at all (although mostly it will have to fill its parent).

Anyway, I don't think any choice we make will fix the current bug, so that's a separate discussion.

Revision history for this message
Zsombor Egri (zsombi) wrote :

While implementing the bug fix for #1499178 I started to get segfault on UITK Gallery when one column mode was set. Every time I tried to push a second page in a column was causing segfault. Sizing invisible item to fill the AdaptivePageLayout solves the segfault, however would not solve the pages hidden from individual columns.

Changed in ubuntu-ui-toolkit (Ubuntu):
importance: Undecided → High
status: Confirmed → In Progress
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Zsombor Egri (zsombi)
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.