In Qt Designer, I defined a couple of icons in the resource browser and I attached them to buttons and actions. The Designer preview shows the icons. Icons are stored in icons.qrc file.
But when I load the UI file :
class MyQtApp():
def __init__(self):
super().__init__()
self.ui = QUiLoader().load("ui/main.ui")
self.ui.show()
if __name__ == '__main__':
app = QtWidgets.QApplication([])
my_app = MyQtApp()
app.exec_()
the icons are lost. They don't appear on the buttons.
I don't mind compiling the icons.qrc using :
pyside2-rcc.exe icons.qrc -o icons_rc.py
but how can I link the icons_rc.py to my code if I use QUiLoader().load() ?
PS: Of course, when I use both the resource and the ui compiler (pyside2-uic.exe and pyside2-rcc.exe), I don't have this issue but I prefer using QUiLoader().load() if possible.