Adding icon resource to Qt rc file.

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Adding icon resource to Qt rc file.

Post by keithsloan52 »

I am trying to add an icon to the OpenSCAD workbench.
I have added the icon svg fle reference to the QRC file and tried to rebuiid the runtime rc file with pyside-rcc -o ../OpenSCAD_rc.py OpenSCAD.qrc

But when I refer to the workbench in FreeCAD I get the following error

Code: Select all

PySide2.QtCore.qRegisterResourceData' called with wrong argument types:
  PySide2.QtCore.qRegisterResourceData(int, str, str, str)
Supported signatures:
  PySide2.QtCore.qRegisterResourceData(int, bytes, bytes, bytes)
I am guessing that this maybe due to python3 changes.

One web reference says to Solved this issue by adding PyQt5 module to the exclude list in the spec file but I am not sure how I do that
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Adding icon resource to Qt rc file.

Post by vocx »

keithsloan52 wrote: Fri Sep 27, 2019 7:30 am I am trying to add an icon to the OpenSCAD workbench.
I have added the icon svg fle reference to the QRC file and tried to rebuiid the runtime rc file with pyside-rcc -o ../OpenSCAD_rc.py OpenSCAD.qrc
...
Do not compile the resource file yourself. You need to add the icon to the .qrc file, and then compile the entire FreeCAD source code or just the OpenSCAD module. In the OpenSCAD CMakeFile there is this line

Code: Select all

IF (BUILD_GUI)
    PYSIDE_WRAP_RC(OpenSCAD_QRC_SRCS Resources/OpenSCAD.qrc)
ENDIF (BUILD_GUI)
This will compile the new OpenSCAD_rc.py properly. How exactly does it do it? Who knows, but it does.

Maybe manually you need to use pyside2-rcc or something like that. Whenever it has a 2 it refers to Python 3 and Qt5, otherwise it's Python 2 and Qt4.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Adding icon resource to Qt rc file.

Post by keithsloan52 »

Don't want to build FreeCAD from source. Have built Qt Resource files by hand in the past. Think something changed due toPython3

Tried pip install PySide2
then pyside2-rcc -o ../OpenSCAD_rc.py OpenSCAD.qrc

But still get same error message
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Adding icon resource to Qt rc file.

Post by keithsloan52 »

Also tried

sudo apt install pyqt5-dev-tools
pyrcc5 -o ../OpenSCAD_rc.py OpenSCAD.qrc

But still get error
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Adding icon resource to Qt rc file.

Post by keithsloan52 »

Okay think I have fixed, was not updating in the right directory.
Post Reply