mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
implemented basic ImageButton
This commit is contained in:
parent
8f0dee171d
commit
1e29a7c14a
1 changed files with 26 additions and 0 deletions
|
|
@ -38,6 +38,32 @@ class PlaceholderLineEdit(QtWidgets.QLineEdit):
|
|||
self.setPalette(filter_palette)
|
||||
|
||||
|
||||
class ImageButton(QtWidgets.QPushButton):
|
||||
"""PushButton with icon and size of font.
|
||||
|
||||
Using font metrics height as icon size reference.
|
||||
|
||||
TODO:
|
||||
- handle changes of screen (different resolution)
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ImageButton, self).__init__(*args, **kwargs)
|
||||
self.setObjectName("ImageButton")
|
||||
|
||||
def _change_size(self):
|
||||
font_height = self.fontMetrics().height()
|
||||
self.setIconSize(QtCore.QSize(font_height, font_height))
|
||||
|
||||
def showEvent(self, event):
|
||||
super(ImageButton, self).showEvent(event)
|
||||
|
||||
self._change_size()
|
||||
|
||||
def sizeHint(self):
|
||||
return self.iconSize()
|
||||
|
||||
|
||||
class AssetWidget(QtWidgets.QWidget):
|
||||
"""A Widget to display a tree of assets with filter
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue