qt - Error of 'TypeError: Cannot read property 'name' of undefined', it comes start to end or vice-versa of application window by moving mouse wheel scroll -
i working on qml, found found error during moving mouse wheel scrolling i.e.
"typeerror: cannot read property 'name' of undefined".
it appear when either mouse wheel scrolling or close application while during execution , beginning of application didn't show error.
one more thing, getting accurate data/result whatever want due error performance of application affected.
please let me know how can rid of issue?
also find below example see error.
my code is..
import qtquick 2.4 import qtquick.controls 1.3 import qtquick.layouts 1.1 applicationwindow { visible: true width: 640 height: 480 title: qstr("hello world") menubar: menubar { menu { title: qstr("file") menuitem { text: qstr("exit") ontriggered: qt.quit(); } } } tableview { anchors.fill: parent visible: true backgroundvisible: false alternatingrowcolors: false sortindicatorvisible: true clip: true highlightonfocus: false width: parent.width height: parent.height tableviewcolumn{ role: "code" ; title: "cde" ; width: 200; delegate: component { id: codedelegate item{ text { color: "lightgray" elide: styledata.elidemode text: styledata.value //modelsettingdata.get(styledata.row).name font.family: "arial" font.pixelsize: 18 wrapmode: text.wrapatwordboundaryoranywhere text { id: metadata color: "red" width: parent.width // height: 20 anchors.bottom: parent.bottom anchors.bottommargin: -parent.height/1.5 font.weight: font.extralight //elide: text.elidemiddle text: "time: " + modelsettingdata.get(styledata.row).name //error comes when part added need use same form } } } } } tableviewcolumn{ role: "name" ; title: "nme" ; width: 200 delegate: component { id: namedelegate text { color: "yellow" elide: styledata.elidemode text: styledata.value font.family: "arial" font.pixelsize: 18 } } } model: listmodel { id: modelsettingdata listelement { name: "aaaaaaaaaa" code: "3042666666666" } listelement { name: "bbbbbb" code: "32235" } listelement { name: "ccccccc" code: "32638" } listelement { name: "ddddddddddd" code: "00000000000" } listelement { name: "eeeeeeeeeeee" code: "111111111111" } listelement { name: "ffffffffffff" code: "222222222222" } listelement { name: "ggggggggggggg" code: "3333333333333" } listelement { name: "hhhhhhhhhhhhh" code: "4444444444444" } listelement { name: "iiiiiiiiiiiii" code: "5555555555555" } } rowdelegate: rectangle { property bool selected : styledata.selected width: parent.width-2 height: 100 color: styledata.selected? "black" : "black" rectangle { width: parent.width height: 1 anchors.bottom: parent.bottom visible: parent.selected color: "yellow" } } } }
Comments
Post a Comment