Issue
The documentation for PyQt6 states that
Support for Qt’s resource system has been removed (i.e. there is no
pyrcc6
).
In light of this, how should one provide resources for a PyQt6 application?
Solution
There has been some discussion on the PyQt mailing list when this was found out.
The maintainer is not interested in maintaining pyrcc anymore as he believes that it doesn't provide any major benefit considering that python already uses multiple files anyway.
The easiest solution is probably to use the static methods of QDir setSearchPaths()
or addSearchPath()
.
The difference will be that resources will be loaded using the prefix used for the methods above.
Considering the previous situation:
icon = QtGui.QIcon(':/icons/myicon.png')
Now it would become like this:
# somewhere at the beginning of your program
QtCore.QDir.addSearchPath('icons', 'path_to_icons/')
icon = QtGui.QIcon('icons:myicon.png')
Answered By - musicamante
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.