Ubuntu – Am I getting the error “Cannot assign to non-existent property ”head”

application-developmentqmlubuntu-sdkubuntu-touch

I'm actually on Trusty, and I want to try new "head" property which comes with API 14.10 of Ubuntu SDK.

When I launch qmlscene to test my applicaton, I get this error :

Cannot assign to non-existent property "head"

I imported this on my qml file :

import QtQuick 2.2
import Ubuntu.Components 1.1

Thanks for your help.

EDIT : Example of code

import Ubuntu.Components 1.1
import QtQuick 2.2
MainView {
    width: units.gu(50)
    height: units.gu(80)
    useDeprecatedToolbar: false
    Page {
        id: page
        title: "Sections"
        head {
            sections {
                model: ["one", "two", "three"]
            }
        }
        Label {
            anchors.centerIn: parent
            text: "Section " + page.head.sections.selectedIndex
        }
    }
}

Best Answer

  • This is because you are running an out of date version of the Ubuntu SDK. The Ubuntu SDK is no longer updated on Ubuntu 14.04 (Trusty) even if you have added the SDK PPA. This is because the Ubuntu SDK requires Qt 5.3 which is only available in Ubuntu 14.10.

    You can solve this by,

    • Using the Emulator for testing your applications. So you code on Trusty, but run it in the emulator to see if it works as expected. You can find more information on getting started with the emulator here.
    • Upgrading to 14.10 to able to test and run applications on the desktop
    • Use a Utopic VirtualBox VM
  • Related Question