Results 1 to 6 of 6

Thread: Change the color of the button by clicking on it.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Change the color of the button by clicking on it.

    I want change botton color, with click on it.
    like picture under.
    dokme.gif
    my code:
    Qt Code:
    1. import QtQuick 2.0
    2. import QtQuick.Controls 1.1
    3. Item {
    4. width: 100; height: 100
    5. property bool bImgChange: true
    6.  
    7. Component.onCompleted: {
    8. for (var i = 0; i < 5; i++)
    9. repeater.append({"name": i})
    10. }
    11.  
    12. Row {
    13. Repeater {
    14. model: ListModel {
    15. id: repeater
    16. }
    17.  
    18. Button {
    19. id:dokme
    20. y:20
    21. width:20
    22. height:20
    23. Text{
    24. text:name
    25. anchors.centerIn: parent
    26. }
    27.  
    28. }
    29. }
    30. }
    31. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Change the color of the button by clicking on it.

    The image looks like you want the button to change when it is pressed, not after it has been clicked.

    Can you clarify which you want?

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    ravandi (25th February 2016)

  4. #3
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Re: Change the color of the button by clicking on it.

    I want to change the color of the button.
    Of course , The button that was clicked.
    And other buttons restored.
    like picture under.
    dokme.gif

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Change the color of the button by clicking on it.

    So, restating the very same information that left some questions open is helping answering these questions how?

    Cheers,
    _

Similar Threads

  1. Draw a shape upon clicking a button
    By ZsCosa in forum Newbie
    Replies: 2
    Last Post: 22nd July 2013, 17:30
  2. Replies: 2
    Last Post: 13th November 2011, 02:30
  3. How to change text color of push button?
    By augusbas in forum Qt Programming
    Replies: 2
    Last Post: 3rd July 2009, 10:32
  4. Custom QStyle: change only tool button text color
    By Lykurg in forum Qt Programming
    Replies: 0
    Last Post: 27th February 2009, 19:55
  5. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 22:25

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.