actons does not show in MainView

Bug #1481147 reported by XiaoGuo, Liu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I created a very simple MainView app, and I got an action in the MainView. The actions do not show up:

import QtQuick 2.0
import Ubuntu.Components 1.1

/*!
    \brief MainView with a Label and Button elements.
*/

MainView {
    // objectName for functional testing purposes (autopilot-qt5)
    objectName: "mainView"

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "maiviewactions.liu-xiao-guo"

    /*
     This property enables the application to change orientation
     when the device is rotated. The default is false.
    */
    //automaticOrientation: true

    // Removes the old toolbar and enables new features of the new header.
    useDeprecatedToolbar: false

    width: units.gu(60)
    height: units.gu(85)

    actions: [
        Action {
            objectName: "action"

            // iconSource: Qt.resolvedUrl("images/avatar.jpg")
            iconName: "active-call"

            onTriggered: {
                console.log("action is clicked!");
            }
        }
    ]

    Page {
        title: i18n.tr("maiviewactions")

        Label {
            anchors.centerIn: parent
            text: "this is the label"
        }

    }
}

Thanks & best regards,
XiaoGuo

Revision history for this message
Cris Dywan (kalikiana) wrote :

I think you misunderstood the API (or wrongly guessed its purpose). MainView.actions is a list of actions globally available in the app, originally incepted for the HUD. If you want actions to show in the header, you actually need to use Page.head.actions.

Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Invalid
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.