add icon class
This commit is contained in:
18
src/utils/icon.py
Normal file
18
src/utils/icon.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from PyQt6 import QtCore, QtGui
|
||||||
|
|
||||||
|
|
||||||
|
class Icon:
|
||||||
|
def __init__(self, icon_name, extension="svg"):
|
||||||
|
self.icon = QtGui.QIcon()
|
||||||
|
self.icon.addPixmap(
|
||||||
|
QtGui.QPixmap(f"icons/{icon_name}.{extension}"),
|
||||||
|
QtGui.QIcon.Mode.Normal,
|
||||||
|
QtGui.QIcon.State.Off,
|
||||||
|
)
|
||||||
|
|
||||||
|
def set_icon(self, widget):
|
||||||
|
widget.setIcon(self.icon)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def icondata(self):
|
||||||
|
return self.icon
|
||||||
Reference in New Issue
Block a user