PageHeadState doens't correctly update head.contents

Bug #1400297 reported by Giulio Collura
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Fix Released
Undecided
Giulio Collura
Vivid
New
Undecided
Unassigned
ubuntu-ui-toolkit (Ubuntu RTM)
New
Undecided
Unassigned

Bug Description

See this small example code: http://paste.ubuntu.com/9426167/
As you can see, I set both PageHeadState to change their 'contents' property when changing state. The expected behavior would be to have in the page head a Label when state is "default" and a TextEntry when in "search" state. However after some interactions (switching state 2 times) both the Label and the Entry are shown.
As this doesn't happen with other properties, this should not happen with contents.
I can set a 'visible' property to each component as workaround though.

Thanks,
Giulio

Related branches

Revision history for this message
Giulio Collura (gcollura) wrote :
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

This seems similar to bug 1341814 where the head contents are not correctly handled when switching page head state.

Revision history for this message
Giulio Collura (gcollura) wrote :

Yes they are definitely similar. Feel free to mark this bug as duplicate if you want.
Thanks nik :)

Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Giulio Collura (gcollura)
status: New → Fix Committed
Revision history for this message
Giulio Collura (gcollura) wrote :

If you're developing targeting ubuntu-sdk-14.10 as toolkit, you could use the workaround in the page definition:

        property Item __oldContents: null
        Connections {
            target: page.head
            onContentsChanged: {
                if (page.__oldContents) {
                    page.__oldContents.parent = null;
                }
                page.__oldContents = page.head.contents;
            }
        }

see also the attached file.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-ui-toolkit - 1.1.1376+15.04.20150111-0ubuntu1

---------------
ubuntu-ui-toolkit (1.1.1376+15.04.20150111-0ubuntu1) vivid; urgency=medium

  [ Tim Peeters ]
  * Add a preview of the new list items to the UITK component gallery.

  [ Zoltan Balogh ]
  * Update the test plan and fix the PPA string in case it contains backslash.
  * Added Dialog CPO to test if OSK pushes up the the dialog.

  [ Zsombor Egri ]
  * ListItem highlight is driven also by the connection of a slot to
    the clicked() signal. This will also be applied when pressAndHold
    signal will be introduced. Fixes LP: #1399025

  [ Giulio Collura ]
  * Force the removal of the previous 'contents' item by removing its parent.
    This way we ensure that the contents are correctly hidden, focused and
    removed, without destroying them. Fixes LP: #1341814 LP: #1400297
 -- Ubuntu daily release <email address hidden> Sun, 11 Jan 2015 18:57:02 +0000

Changed in ubuntu-ui-toolkit (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Please backport this to RTM as well. :)

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.