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. Re-ordering QListWidget's items in IconMode
Forum Updated to NodeBB v4.3 + New Features

Re-ordering QListWidget's items in IconMode

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.7k 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.
  • V Offline
    V Offline
    viktor-zin
    wrote on last edited by
    #1

    I want to use QListWidget to provide users an opportunity to re-order items with drag'n'drop technology. When QListWidget is in ListMode it's working fine. When I switch to IconMode, items are moved freely without autoarranging into single line. How can I use QListWidget for this task? Shoud I use another controls or model-based widgets?

    Sorry for my English.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris H
      wrote on last edited by
      #2

      Can you use QListView::Snap mode and set an appropriate grid size with setGridSize()?

      1 Reply Last reply
      0
      • V Offline
        V Offline
        viktor-zin
        wrote on last edited by
        #3

        When I use Snap mode and I set the grid size, items are snapped to the grid but user can still move them from one cell to other cell remaining empty cells. I want user to able to change the items' order. Items must be layed out from left to right without any spaces. I saw something like in a Flow Layout Example in Qt.

        When user drags an item, the special placeholder should appear between other items under mouse pointer. When user drops the item, the list widget should insert it between other items.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chris H
          wrote on last edited by
          #4

          Oh, I see. I don't think that functionality is built into QListWidget. I guess you could subclass QListView and reimplement the drag event to move the widgets around so that there was always a "hole" under the cursor.

          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