Playlist index



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



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


  • Lifetime Qt Champion

    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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.