Results 1 to 3 of 3

Thread: Refer to qml item itself from delegate

  1. #1
    Join Date
    Oct 2011
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Refer to qml item itself from delegate

    I have Repeater and delegate:
    Qt Code:
    1. Component {
    2. id: delegateItem
    3. Button {
    4. onClicked: { d.curBlock = [B]itself[/B]; }
    5. }
    6. }
    7.  
    8. Repeater {
    9. model: somemodel
    10. delegate: delegateItem
    11. }
    To copy to clipboard, switch view to plain text mode 
    How can I assign to d.curBlock item itself, so that d.curBlock always keep last item clicked?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Refer to qml item itself from delegate

    javascript Code:
    1. Column {
    2. id: d
    3. property Item currentItem
    4.  
    5. Repeater {
    6. model: somemodel
    7. Button {
    8. id: button
    9. onClicked: d.currentItem = button
    10. }
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2011
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Refer to qml item itself from delegate

    Oh. So easy, thx.

Similar Threads

  1. Replies: 0
    Last Post: 10th March 2011, 11:44
  2. Item Delegate Visibility
    By raneeshambat in forum Newbie
    Replies: 1
    Last Post: 18th September 2009, 20:41
  3. Replies: 5
    Last Post: 10th August 2009, 10:50
  4. Delegate for a certain item?
    By somebody in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2008, 22:55
  5. Item Delegate Painting
    By stevey in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2008, 07:37

Bookmarks

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.