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. List View: Reference Error: index is not defined.
Forum Updated to NodeBB v4.3 + New Features

List View: Reference Error: index is not defined.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 1.8k 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.
  • S Offline
    S Offline
    Shubham Gupta
    wrote on last edited by
    #1

    @dheerendra

    Hi, I have list view which contains 'n' no of items.
    When i click on the item, then "Reference Error: index is not defined." is shown and list view start scrolling and stop at anywhere.
    This happens when i click on item not for all item.

    I want, when i click on item then list view doesn't start scrolling.
    Please suggest

    Shubham Gupta

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Please show your sample code.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Shubham Gupta
        wrote on last edited by Shubham Gupta
        #3

        @dheerendra
        ListView{
        id:program_lv
        width:1280
        height:577
        model::Helper.all_programs_model
        delegate:refresh_del?null: program_del
        currentIndex: -1
        clip:true
        boundsBehavior: Flickable.StopAtBounds
        anchors{
        horizontalCenter: parent.horizontalCenter
        top:parent.top
        topMargin: parent.height0.1925//154
        }
        ScrollBar.vertical:ScrollBar {
        id: control
        width:parent.width
        0.020
        opacity: 0.85
        active: true
        orientation: Qt.Vertical
        visible: program_lv.contentHeight>program_lv.height
        anchors{right:parent.right;rightMargin:0}
        background:Rectangle{
        radius:width/4
        color: "lightgrey"
        }
        contentItem: Rectangle {
        implicitWidth:1
        implicitHeight: parent.height*0.189
        radius: width / 2
        opacity:0.85
        color: "grey"
        }
        }
        }

        Component{
            id:program_del
            ProgramListComponents.ProgramListDelegate{
                width:program_lv.width//1280
                height: product_id!=-1?program_lv.height*0.166:0//96
                visible: product_id!=-1
            }
        }
        

        Shubham Gupta

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Atleast I did not see something glaring mistake in your program. It is telling you that index is not defined. Are you using the index variable somewhere ? I did not see any index variable usage in your program. My suspect was that you are doing something inside the delegate using index variable. This may be causing the issue. However your code does not reflect that.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Shubham Gupta
            wrote on last edited by
            #5

            ok thanx

            Shubham Gupta

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #6

              Was it as issue in your code ?

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              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