Results 1 to 4 of 4

Thread: change color QPushButton Previous post methods not working Qt 5.4.1 VS 2013 Windows 7

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,330
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: change color QPushButton Previous post methods not working Qt 5.4.1 VS 2013 Windo

    You might be running into this (from the Qt Style Sheets Reference):

    QPushButton
    Supports the box model. Supports the :default, :flat, :checked pseudo states.
    For QPushButton with a menu, the menu indicator is styled using the ::menu-indicator subcontrol. Appearance of checkable push buttons can be customized using the : open and : closed pseudo-states.
    Warning: If you only set a background-color on a QPushButton, the background may not appear unless you set the border property to some value. This is because, by default, the QPushButton draws a native border which completely overlaps the background-color. For example,

    QPushButton { background-color: red; border: none; }

    See Customizing QPushButton for an example.
    So try setting the border as well.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. #2
    Join Date
    Mar 2014
    Location
    USA
    Posts
    85
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: change color QPushButton Previous post methods not working Qt 5.4.1 VS 2013 Windo

    My problem was I had no clue on how to set up style sheets. In the help I stumbled across "Qt Style Sheets Reference" which told me the syntax I needed and what it did, like "border-radius" to round the corners. I didn't know that border-radius existed or what it did. I didn't know what to call anything so that I could set it. I found it there. It's a great reference, you just have to find it. I didn't think finding it was all that easy.

  3. #3
    Join Date
    Mar 2014
    Location
    USA
    Posts
    85
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: change color QPushButton Previous post methods not working Qt 5.4.1 VS 2013 Windo

    Quote Originally Posted by TonyInSoMD View Post
    My problem was I had no clue on how to set up style sheets. In the help I stumbled across "Qt Style Sheets Reference" which told me the syntax I needed and what it did, like "border-radius" to round the corners. I didn't know that border-radius existed or what it did. I didn't know what to call anything so that I could set it. I found it there. It's a great reference, you just have to find it. I didn't think finding it was all that easy.
    BTW, you have to scroll down the page some to get to the list of properties

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 10:23
  2. Replies: 6
    Last Post: 25th May 2010, 10:42
  3. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 07:14
  4. How to change color of a QPushButton?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 5th March 2008, 13:22
  5. Change background color for a QPushButton?
    By Harvey West in forum Qt Programming
    Replies: 6
    Last Post: 5th January 2007, 14:23

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.