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. qml listview ListView.view accessed from highlight is null
Forum Updated to NodeBB v4.3 + New Features

qml listview ListView.view accessed from highlight is null

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 187 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.
  • Crawl.WC Offline
    Crawl.WC Offline
    Crawl.W
    wrote on last edited by
    #1
    ListView
    {
            width: 274
            height: count > 0 ? 0 : contentHeight
            spacing: 2
            highlightFollowsCurrentItem: true
    
            model: assignTargetModel
            //delegate: lvDelegate
            highlight: lvHighlight
        
            Component
            {
                 id: lvHighlight
                 Item
                 {
                      id: item
                       width: 274
                      height: 56
                       Image
                       {
                           source: (item.index === /*item.*/ListView.view.count - 1) ? "qrc:/Analysis/assets/target5_bg2_3615_778.png" : "qrc:/Analysis/assets/a_b_bg1_3615_757.png"
                       }
                  }
    }
    

    Right in delegate, I guess highlight is created dynamically and the highlight is undefined by default. And so the ListView.view has not been attached to delegate.
    If so, this is a terrible way that can cause unintentional errors.

    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