Results 1 to 5 of 5

Thread: changing button background color

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: changing button background color

    There is no simple way to do this with palettes or stylesheets. On some operating systems it will work, but others (<cough>Windows<cough>) do not allow button backgrounds to be altered. The only foolproof way to do this is to derive your own button class and override the paint method.

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: changing button background color

    Third party here:

    That will make the button a solid color, is there a way to change the button color with shades, so it looks like a modern button. Like it does by default, except chaning the theme color.

    Any suggestions?
    To make the shade in buttons , u can use stylesheets's transparent property or u can design ur own images and apply to the button;

    for Gradient:
    Qt Code:
    1. QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c);
    To copy to clipboard, switch view to plain text mode 

    for images :
    Qt Code:
    1. background-image: url(/path/to/image.png);
    To copy to clipboard, switch view to plain text mode 

    Hope it helps

    Bala

Similar Threads

  1. button background color when it is clicked
    By navi1084 in forum Qt Programming
    Replies: 5
    Last Post: 24th June 2024, 12:09
  2. Changing the background color of a cell in a QTableView
    By scarleton in forum Qt Programming
    Replies: 1
    Last Post: 30th June 2010, 13:23
  3. changing color of push button
    By babu198649 in forum Newbie
    Replies: 1
    Last Post: 2nd March 2008, 12:55
  4. prob with changing QLineEdit background color
    By Ahmad in forum Qt Programming
    Replies: 2
    Last Post: 30th April 2007, 12:44

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.