Results 1 to 3 of 3

Thread: How to access child properties from another child in QML

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2013
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question How to access child properties from another child in QML

    I want to change image(child of Rectangle) on mouse hover of MouseArea(child of Rectangle)
    here is my code:
    javascript Code:
    1. Rectangle
    2. {
    3. width: 600; height: 400
    4. Row
    5. {
    6. id: myRow; spacing: 5; x: 50; y: 200
    7. Repeater
    8. {
    9. id: myRepeater; model: 10
    10. Rectangle
    11. {
    12. width: 100; height: 100;
    13. property int myIndex: index
    14. Image
    15. {
    16. source: "../GrayPoint.png"
    17. }
    18. MouseArea
    19. {
    20. id: mouseArea; anchors.fill: parent; hoverEnabled: true
    21. onEntered:
    22. updateUI( parent )
    23. }
    24. }
    25.  
    26. }
    27. }
    28. function updateUI( theParent )
    29. {
    30. theParent.childAt( 0, 0 ).source = "../RedPoint.png"
    31. }
    32. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 13th June 2013 at 11:44.

Similar Threads

  1. Handle child of QProcess's child.
    By gcubar in forum Newbie
    Replies: 4
    Last Post: 30th November 2012, 02:59
  2. Access parent's function from child widget
    By el33t in forum Qt Programming
    Replies: 4
    Last Post: 16th March 2011, 14:20
  3. Replies: 4
    Last Post: 17th January 2011, 14:05
  4. How To Access To Child's Of A Tab
    By hotjava in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2008, 13:21
  5. How to access myApp->method from a child
    By bnilsson in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2008, 13:22

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.