Results 1 to 2 of 2

Thread: Change delegate property depending on Listview action

  1. #1
    Join Date
    Apr 2012
    Qt products
    MacOS X Unix/X11 Symbian S60

    Default Change delegate property depending on Listview action

    I am making a simple music player for Symbian that uses FolderListModel and a Listview to select a file to be played. The problem is I don't know how to access delegates by index, directly from the Listview.

    On clicking a file, the file is played using the Audio element. I also want to show some text in the Listview row that the file is playing e.g. "Playing" When another file is clicked, the "Playing" label of the currently playing file should disappear, and the new file should have its "Playing" label shown.

    Is it possible to do this:
    Listview.delegate.item[index].property = value

    This is the delegate I'm using:
    Qt Code:
    1. Component {
    2. id: songviewComponent
    4. ListItem {
    5. id: songItem
    7. Text {
    8. id: filename
    9. text: fileName
    10. color: "white"
    11. font.pixelSize: 22
    12. }
    14. Text {
    15. id: songStatus
    16. text: "Playing"
    17. color: "red"
    18. visible: false
    19. }
    21. onClicked: {
    22. // play file that is clicked
    23. // set playing label of current index to visible
    24. // remove other playing label
    25. }
    26. }
    To copy to clipboard, switch view to plain text mode 

    Screen shot 2012-06-20 at 5.07.28 PM.jpg

    Here is my mockup from the simulator. If I click on Sweetest Perfection.mp3 the "Playing" label should appear for that file only. If click on Waiting for the Night.mp3, the "Playing" label for other files should disappear, and only the label for that file should be visible. Also, when I click the stop button on the toolbar, all "Playing" labels should disappear.

  2. #2
    Join Date
    Nov 2010
    Thanked 9 Times in 9 Posts
    Qt products
    Unix/X11 Windows

    Default Re: Change delegate property depending on Listview action

    it is possible to access through the listview but it s not recommended
    you must add a property like "active" to the items of you model and set that property when the file is playing
    the you display the "playing" message if active == true

Similar Threads

  1. Change LCD color depending on the condition
    By lamusek17 in forum Newbie
    Replies: 1
    Last Post: 18th April 2012, 16:32
  2. Replies: 1
    Last Post: 20th February 2012, 21:44
  3. Replies: 0
    Last Post: 22nd May 2011, 09:42
  4. Change Stylesheet Using Dynamic Property
    By stefanadelbert in forum Qt Programming
    Replies: 4
    Last Post: 26th August 2010, 08:48
  5. Replies: 2
    Last Post: 2nd November 2009, 14:24


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.