PDA

View Full Version : Cannot read property 'Stack' of null



joko
29th October 2015, 15:05
Hi,

I encountered this error message:

QQmlComponent: Component is not ready
file:///C:/Qt/Qt5.4.0/5.4/mingw491_32/qml/QtQuick/Controls/StackView.qml:836: TypeError: Cannot read property 'Stack' of null

I can't find any similar issues around.

And the error message is too vague, is there any way to configure Qt Creator to display a specific error?

Any advise what could possibly the cause of this error. Below is my code on StackView.


StackView {
id: mainStack

function effectivePop(clear) {
var prevItem = mainStack.find(function(item, index) {
return ( (item.transitory === undefined || !item.transitory) &&
(item !== mainStack.currentItem) ); } );
if ( (clear === undefined || clear) && prevItem.clear)
{
prevItem.clear();
}
mainStack.pop(prevItem);
}

anchors.fill: parent

visible: false

delegate: StackViewDelegate {
pushTransition: StackViewTransition {
PropertyAnimation { target: enterItem; property: "opacity"; from: 0; to: 1; duration: 100 }
PropertyAnimation { target: exitItem; property: "opacity"; from: 1; to: 0; duration: 100 }
}
}

Component.onCompleted: {
push(Qt.resolvedUrl("ConnectionPage.qml"));
push(Qt.resolvedUrl("Question.qml"));
}
}

If i'll add an initialItem, there's no error however, it won't display the actual page.

Please advise, thanks.