ReferenceError when moving from QtQuick 1 to QtQuick 2 in example code
I am looking at the CollapsiblePanel example found here:
http://developer.nokia.com/community...Panel_with_QML
It was done with QtQuick 1.0
With Qt 5.2.1 I created a QtQuick 2.0 project and copied in the main.qml, CollapsiblePanel.qml, and icons. I changed the imports from QtQuick 1.0 to QtQuick 2.0. When clicking on an item in the panel, the Application Output window displays
file:///Projects/buildCollapsiblePanel/qml/CollapsiblePanel/main.qml:98: ReferenceError: myRect is not defined
For some reason it is unable to access the CollapsiblePanel ID from the ListView delegate.
Why is this broken? Is there a new and better way to do this?
Thanks ......
Re: ReferenceError when moving from QtQuick 1 to QtQuick 2 in example code
There is no element in main.qml with id "myRect"
There is also no context property with that name.
Which element is this supposed to refer to?
Cheers,
_
Re: ReferenceError when moving from QtQuick 1 to QtQuick 2 in example code
"myRect" is the id of the CollapsiblePanel Component from which the panel objects (panel1, panel2, panel3) come from. The CollapsiblePanel contains the ListView, and the ListView's delegate is found back in the main.qml code.
As noted with Qt 5.2.1 and QtQuick 1 this works, but with Qt 5.2.1 and QtQuick 2 it does not.
-
Added after 35 minutes:
A solution to the problem is to move Component (ie: myDelegate) from main.qml to CollapsiblePanel.qml. Fix up the LIstView delegate assignment and remove the customDelegate alias.
Apparently you can call from the CollapsiblePanel Component into main.qml but not the other way around.
I would really like to know if this is as intended (ie: there was a bug in QtQuick 1 that is now fixed) or is there now a bug (ie: QtQuick 1 was correct).
(sigh)
-
Re: ReferenceError when moving from QtQuick 1 to QtQuick 2 in example code
I am pretty sure the QtQuick2 behavior is correct. Which of the three instances of CollapsiblePanel would myRect refer to?
Cheers,
_