Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. sorting problem...same contents but 2 view (QListWidget and QTreeWidget)

sorting problem...same contents but 2 view (QListWidget and QTreeWidget)

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 530 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    sorting problem...same contents but 2 view (QListWidget and QTreeWidget).
    i use QListWidget and QTreeWidget in a QStackedWidget to represent same Contents, because i want to preview in multi-column ListMode from QTreeWidget, IconMode from QListWidget...
    right now, i can click on the Header of the QTreeWidget to sort the items, but after sorting in QTreeWidget, when i switch to IconMode which is in QListWidget, i want the items order is the same with the sorted items order in QTreeWidget...
    how can i do this ?

    1 Reply Last reply
    0
    • O Offline
      O Offline
      opengpu2
      wrote on last edited by
      #2

      can i have a try like this? because 1. the user are only allowed to sort in the QTreeWidget, by click on the multi-column Header. 2. both the items in QTreeWidget and QListWidget have a same data which is used setData() to the Item.

      1. click the Header in the QTreeWidget, sort it.
      2. get the items in the QTreeWidget(because it's designed that there only 1 level children)
      3. based sorted QTreeWidget's items Data, sort(or clear and re-create) the items in the QListWidget.
      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