El Thursday 29 January 2015, Christoph Petzold escribió: > qrc:/NotWorkingRectangle.qml:7:5: QML Canvas: Unable to use getContext() at > this time, please wait for available: true (...)
> NotWorkingRectangle.qml: > ----------------------------------- > import QtQuick 2.3 > import QtQuick.Controls 1.2 > Rectangle { > anchors.fill: parent > Canvas { > property var ctx: getContext("2d") (...) > In my real world component i have lots of painting functions and i do not > want to pass the ctx element every time i want to use it. I also do not > want to call getContext("2d") locally. I know it returns the same Object > every next call but it is just code i would like to spare. There are some things that I might try: Does it change if you set the property in Component.onCompleted? Or better yet, onAvailableChanged? After all is what the warning suggests. Note that your cpp file uses QQmlApplicationEngine, while qmlscene uses a QQuickView IIRC. It might be that some initialization is done earlier with the latter. Also, note that the canvas element already has a "context" property, so you should have access to it anyway. I don't understand why you want the custom "ctx" one. -- Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2 http://barnacity.net/ | http://disperso.net _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest