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. Playlist index
Qt 6.11 is out! See what's new in the release blog

Playlist index

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

    Hello, I have listWidget with items (songs) and enabled internal move (Ex.1)... So lets say I want to change playlist order and place Song 7 on place of song 3... Items in listWidget change and I guess their indexes as well... But problem is with playlist... When change item order, indexes in playlist does not change... How they should change... If I put Song 7 on place of Song 3,... Song 7 should get index of 3 and all next items should get index+1 (Ex.2)... I hope you understand what I am saying... Each next item of Song 7 should get new index...

    Ex.1:
    Song 1 (index1)
    Song 2 (index 2)
    Song 3 and so on
    Song 4
    Song 5
    Song 6
    Song 7

    Ex.2:
    Song 1 (index 1)
    Song 2 (index 2)
    ---- We move Song 7 on place of Song 3 ---- Song 7 gets index of song 3
    Song 4 (Song 3 now moves 1 index up and gets new value index+1)
    Song 5 (Song 4 gets new value index+1)
    Song 6
    Song 7

    Song 1 (Index 1)
    Song 2 (Index 2)
    Song 3 (Index 3). (Song 7 from Ex.1)
    Song 4 (Index 4) . (Song 3 from Ex.1)
    Song 5 (Index 5)
    Song 6 (Index 6)
    Song 7 (Index 7)

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      listWidget must somehow send signal to playlist what index has moved and where... then playlist must change index of moved item to the index of next item (ex. if we moved item in front of index 3, moved item should take index 3), and all next indexes should get new index = currentIndex+1...

      listWidget and playlist have same indexes... Ex: Index of song 1 in playlist is same to the index of song 1 in listwidget...

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

        Hi,

        It's up to you to create this functionality.

        The signal
        @void QListView::indexesMoved(const QModelIndexList & indexes)@

        will probably be a good start

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