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. Error of 'TypeError: Cannot read property 'name' of undefined' when it comes start to end or vice-versa of application window by moving mouse wheel scroll

Error of 'TypeError: Cannot read property 'name' of undefined' when it comes start to end or vice-versa of application window by moving mouse wheel scroll

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.3k Views
  • 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.
  • V Offline
    V Offline
    Vicky Sharma
    wrote on last edited by Vicky Sharma
    #1

    Hello everyone,

    I am working on qml, found found an error during moving mouse wheel scrolling i.e. "TypeError: Cannot read property 'name' of undefined".

    It only appear when either mouse wheel scrolling or close the application while during execution and beginning of the application didn't show this error.

    One more thing, I am getting accurate data/result whatever I want but due to this error the performance of application get affected.

    Please let me know how can I get rid of this issue?

    also find below example to see error.

    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 this part added but I need to use it with the 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"
                }
            }
    
        }
    
    }
    
    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vicky Sharma
      wrote on last edited by
      #2

      Yeah I did resolve at my end..:)

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jerry369
        wrote on last edited by
        #3

        how to solve this

        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