Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Store extra information in QListWidget
Qt 6.12 LTS is out! See what's new in the release blog

Store extra information in QListWidget

Scheduled Pinned Locked Moved General and Desktop
qlistwidgetdelegate
2 Posts 2 Posters 1.1k Views 2 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,
    I need to create a list of time periods (after clicking over any of the periods the string becomes a qlineedit that allows you to modify the value)
    Right now I'm using a QListWidget with a delegate that allows me to do this.
    Then, when I need to get back the values of the list, I transform the text to the proper format to load in the qlineedit or whereever I need them.

    The problem is that now, I need to store the seconds while not displaying them in the list.
    Is there any way of doing it? Should I change the QListWidget to a QListView and create a model asociated to it?

    Thanks in advance and feel free to tell me if I haven't been specific enought.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Just store the full time in your model and use a QStyledItemDelegate to change the visualization part. It should be enough to just reimplement displayText.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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
      • Unsolved