mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
width of Lighting button is not so complicated to set and ton size is default to 8pt
This commit is contained in:
parent
06a2144b72
commit
bc9e7833b0
1 changed files with 8 additions and 10 deletions
|
|
@ -308,14 +308,15 @@ class ComponentItem(QtWidgets.QFrame):
|
|||
class LightingButton(QtWidgets.QPushButton):
|
||||
lightingbtnstyle = """
|
||||
QPushButton {
|
||||
font: %(font_size_pt)spt;
|
||||
text-align: center;
|
||||
color: #777777;
|
||||
background-color: transparent;
|
||||
border-width: 1px;
|
||||
border-color: #777777;
|
||||
border-style: solid;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
border-radius: 3px;
|
||||
|
|
@ -351,14 +352,11 @@ class LightingButton(QtWidgets.QPushButton):
|
|||
color: #4BF543;
|
||||
}
|
||||
"""
|
||||
def __init__(self, text, *args, **kwargs):
|
||||
super().__init__(text, *args, **kwargs)
|
||||
self.setStyleSheet(self.lightingbtnstyle)
|
||||
|
||||
def __init__(self, text, font_size_pt=8, *args, **kwargs):
|
||||
super(LightingButton, self).__init__(text, *args, **kwargs)
|
||||
self.setStyleSheet(self.lightingbtnstyle % {
|
||||
"font_size_pt": font_size_pt
|
||||
})
|
||||
self.setCheckable(True)
|
||||
|
||||
preview_font_metrics = self.fontMetrics().boundingRect(text)
|
||||
width = preview_font_metrics.width() + 16
|
||||
height = preview_font_metrics.height() + 5
|
||||
self.setMaximumWidth(width)
|
||||
self.setMaximumHeight(height)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue