PDA

View Full Version : initialize error of ComboBox : Cannot read property 'constructor' of undefined



stereoMatching
26th December 2013, 15:12
When I try to initialize the model of ComboBox, weird error pop out


import QtQuick 2.2
import QtQuick.Controls 1.1

Rectangle {
width: 100
height: 62

ListModel{
id: modelA
}

ComboBox{
model: modelA
}

Component.onCompleted: {
modelA.append({"source" : "hhhh"})
}
}


error message

file:///C:/Qt/Qt5.2.0/5.2.0/mingw48_32/qml/QtQuick/Controls/ComboBox.qml:496: TypeError: Cannot read property 'constructor' of undefined

How could I fix this error?

stereoMatching
30th December 2013, 14:53
Found the solution, use loader to load the ComboBox when insert or http://stackoverflow.com/questions/20833809/initialize-error-of-combobox-cannot-read-property-constructor-of-undefined#comment31247640_20833809