Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved]initialize error of ComboBox : Cannot read property 'constructor' of undefined
Forum Updated to NodeBB v4.3 + New Features

[Solved]initialize error of ComboBox : Cannot read property 'constructor' of undefined

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      Found the solution, use loader to load the ComboBox when insert or
      "Your text to link here...":http://stackoverflow.com/questions/20833809/initialize-error-of-combobox-cannot-read-property-constructor-of-undefined#comment31247640_20833809

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved