Adding PropertyChanges to PageHeadState overwrites previous PropertyChanges

Bug #1345775 reported by Tim Peeters
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Won't Fix
High
Tim Peeters

Bug Description

When adding PropertyChanges inside a PageHeadState, all the PropertyChanges defined inside the PageHeadState don't work aonymore, so setting the backAction, contents, actions does not work any more. See attached example.

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

Launchpad breaks when I try to add a qml file, so here is the source code to reproduce the problem:

import Ubuntu.Components 1.1
import QtQuick 2.2

MainView {
    width: units.gu(40)
    height: units.gu(40)

    useDeprecatedToolbar: false

    Page {
        id: searchPage

        title: "search page"
        Label {
            id: label
            anchors.centerIn: parent
            text: "normal mode" //searchPage.state == "search" ? "search mode" : "normal mode"
        }

        state: "default"
        states: [
            PageHeadState {
                name: "default"
                head: searchPage.head
                actions: Action {
                    id: searchAction
                    iconName: "search"
                    onTriggered: searchPage.state = "search"
                }
            },
            PageHeadState {
                id: headerState
                name: "search"
                head: searchPage.head
                actions: [
                    Action {
                        iconName: "contact"
                    }
                ]
                backAction: Action {
                    id: leaveSearchAction
                    text: "back"
                    iconName: "back"
                    onTriggered: searchPage.state = "default"
                }
                contents: TextField {
                    placeholderText: "search..."
                }
                PropertyChanges {
                    target: label
                    text: "search mode"
                }
            }
        ]
    }
}

Changed in ubuntu-ui-toolkit:
assignee: nobody → Tim Peeters (tpeeters)
Revision history for this message
Tim Peeters (tpeeters) wrote :

^ with the above code, the PropertyChanges for label invalidate the PropertyChanges done by the PageHeadState. Removing The PropertyChanges for label makes it work again.

tags: added: header
Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit:
status: New → Confirmed
Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit:
importance: High → Medium
Revision history for this message
Zsombor Egri (zsombi) wrote :

Try to add extra PropertyChanges like
PageHeadStyle {
    changes: [
        PropertyChanges {
            target: label
            text: "search mode"
        }
    ]
}

Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit:
importance: Medium → High
Revision history for this message
Tim Peeters (tpeeters) wrote :

a workaround to get it working properly is to use a normal State, but then you have to define the actions etc. in the State so it requires extra code.

Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Tim Peeters (tpeeters)
importance: Undecided → High
status: New → Confirmed
Zoltan Balogh (bzoltan)
no longer affects: ubuntu-ui-toolkit
Revision history for this message
Tim Peeters (tpeeters) wrote :

PageHeadState is now deprecated. Instead, a different Page.header can be set. See https://developer.ubuntu.com/en/blog/2016/02/24/pageheader-tutorial/

Changed in ubuntu-ui-toolkit (Ubuntu):
status: Confirmed → Won't Fix
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.