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. Can I avoid a list-item in ListView visually move?
Forum Updated to NodeBB v4.3 + New Features

Can I avoid a list-item in ListView visually move?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 4 Posters 318 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.
  • TomZT Offline
    TomZT Offline
    TomZ
    wrote on last edited by
    #1

    I have a ListView which is backed by a QAbstractListModel. It lists items from newest to oldest and that means that new items are inserted at the top.

    This visually is fine, in most cases its what you want.

    But there is a feature where I click on a specific item and I show some extra info in a popup. In that case it becomes very confusing when the underlying list-item it is for, moves. Due to a new item being inserted at the top of the list and moving all items down.

    So my question is; how do I avoid the list item moving on screen while my popup is open?

    I've tried to do a currentItem.mapToGlobal() and then adjust the contentY of the listview, which seems to not work very well as it feels like I'm fighting some listview stuff doing the same but in opposite direction.
    As a note, I remove all transitions but that didn't seem to help.

    The only thing I've got left is to somehow avoid the model updating while the popup is open, but that sounds very dirty and it would be nice to avoid more code in the model just to support the view.

    Does anyone have any ideas on how to keep the clicked listview item stable on screen while items are inserted above it?

    B 1 Reply Last reply
    0
    • TomZT TomZ

      I have a ListView which is backed by a QAbstractListModel. It lists items from newest to oldest and that means that new items are inserted at the top.

      This visually is fine, in most cases its what you want.

      But there is a feature where I click on a specific item and I show some extra info in a popup. In that case it becomes very confusing when the underlying list-item it is for, moves. Due to a new item being inserted at the top of the list and moving all items down.

      So my question is; how do I avoid the list item moving on screen while my popup is open?

      I've tried to do a currentItem.mapToGlobal() and then adjust the contentY of the listview, which seems to not work very well as it feels like I'm fighting some listview stuff doing the same but in opposite direction.
      As a note, I remove all transitions but that didn't seem to help.

      The only thing I've got left is to somehow avoid the model updating while the popup is open, but that sounds very dirty and it would be nice to avoid more code in the model just to support the view.

      Does anyone have any ideas on how to keep the clicked listview item stable on screen while items are inserted above it?

      B Offline
      B Offline
      Bob64
      wrote on last edited by
      #2

      @TomZ I'm not sure, but one thing that occurs to me is that if the model is updating while the popup is open, is it possible to get into a state where the item in question is pushed off the bottom of the visible items? That would perhaps suggest that disabling updates is a reasonable approach.

      1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #3

        I have the similar issue. I simply highlight the selected item for pop-up and the user still knows which one is selected. The user expects the item will move and you may not want to stop its move. Instead highlight the old item.

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

          @TomZ As @JoeCFD suggested we also hi light the item which is selected. This continue to hilight when the item is moved.

          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