Results 1 to 3 of 3

Thread: get background color of QPushButton [PyQt4]

  1. #1
    Join Date
    Sep 2011
    Posts
    2
    Qt products
    Platforms
    Windows

    Default get background color of QPushButton [PyQt4]

    Hello everybody,

    I create a plugin for the programm QuantumGIS.
    I want to get the background-color of my QPushButton to use it as color for a QgsRubberBand but I don't know how I get the color.

    My Code to give the QPushButton a color:
    Qt Code:
    1. self.button_color.setStyleSheet(_fromUtf8("background-color: rgb(62, 225, 95);"))
    To copy to clipboard, switch view to plain text mode 

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: get background color of QPushButton [PyQt4]

    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Sep 2011
    Posts
    2
    Qt products
    Platforms
    Windows

    Default Re: get background color of QPushButton [PyQt4]

    I have solved the problem with
    Qt Code:
    1. ... button.palette().color(1)
    To copy to clipboard, switch view to plain text mode 
    Thanks for help.

    This Thread can be closed!

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 10:23
  2. Background Color of QToolButton or QPushButton
    By metdos in forum Qt Programming
    Replies: 5
    Last Post: 17th June 2010, 11:02
  3. QPushButton color and background
    By satanowicz in forum Newbie
    Replies: 4
    Last Post: 25th May 2010, 20:56
  4. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 07:14
  5. QPushbutton background color
    By omega36 in forum Qt Programming
    Replies: 27
    Last Post: 31st October 2008, 12:47

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.