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 with sticky date indicator
Forum Updated to NodeBB v4.3 + New Features

QML ListView with sticky date indicator

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 839 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.
  • A Offline
    A Offline
    alexej.k
    wrote on last edited by
    #1

    Hi,

    I am building a chat window in QML and am using a (clipped) ListView to display the chat history.

    In the ListView, between the chat messages I have special separator delegates which display the day for all following messages (e.g. "Today" or "May 1st"), just like in WhatsApp or Telegram. I would like to "pin" these elements to the top of the list such that the right date is always displayed while the user is scrolling through the history. Whenever the user reaches a new day in the history, the old pinned element should be replaced by the new one.

    Is there any efficient way to find out which element is currenty displayed on top of the ListView area, such that I can find out which day's messages are currently displayed?

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      shaan7
      wrote on last edited by
      #2

      I haven't attempted to replicate your use-case but using ListView sections and displaying the currentSection in a Label as header with headerPositioning: ListView.OverlayHeader should help.

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved