From 1b5e64275a2c95b4478a1b7b957bac6273af7b03 Mon Sep 17 00:00:00 2001 From: WorldTeacher <41587052+WorldTeacher@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:15:05 +0200 Subject: [PATCH] add icon class --- src/utils/icon.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/utils/icon.py diff --git a/src/utils/icon.py b/src/utils/icon.py new file mode 100644 index 0000000..4297a5e --- /dev/null +++ b/src/utils/icon.py @@ -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