Border on a QtPushButton

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Border on a QtPushButton

Post by keithsloan52 »

I am not seeing a border an a push button

Code: Select all

 def __init__(self,colour):
      super().__init__()
      self.resize(50, 20)

      palette = self.palette()
      palette.setColor(QtGui.QPalette.Button, QtGui.QColor(colour))
      self.setAutoFillBackground(True)
      self.setStyleSheet("QPushButton {border-color: black; border: 2px;}")
      self.setPalette(palette)
      self.setFlat(True)
      self.update()
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Border on a QtPushButton

Post by onekk »

Probably

Code: Select all

      self.setFlat(True)
will make it "flat" maybe check Qt documents, will help, but it may depends also on what platform you are using.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply