Results 1 to 6 of 6

Thread: button background color when it is clicked

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: button background color when it is clicked

    try this

    Qt Code:
    1. QString style_sheet_btn =" QPushButton:checked {background-color:rgb(255,100,100);border-style:solid;border-width:1.5px;border-color:gray;}";
    To copy to clipboard, switch view to plain text mode 
    Jerry

  2. #2
    Join Date
    Jun 2024
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: button background color when it is clicked

    Quote Originally Posted by calmspeaker View Post
    try this

    Qt Code:
    1. QString style_sheet_btn =" QPushButton:checked {background-color:rgb(255,100,100);border-style:solid;border-width:1.5px;border-color:gray;}";
    To copy to clipboard, switch view to plain text mode 
    See this <https://youtu.be/DwZ-B_ipmQY?si=nkvHz1obS0PLWOgL>

    Simply receive the button event and then change the style of the button that triggered the event using setStyleSheet() method

Similar Threads

  1. Replies: 10
    Last Post: 6th July 2008, 09:46
  2. Replies: 4
    Last Post: 29th February 2008, 10:04
  3. Replies: 3
    Last Post: 13th May 2007, 20:55

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.