I like how the the PDN tip object icon gets the overlay. Also items in the sketcher with errors or needing recompute.
I'd like to do something similar in Path to indicate disabled operations but I'm not sure how to get started. Can someone point me to relevant sample code or at least some 'google-ons' where I can get educated?
As the title indicates, I need to do this in python.
icons and overlays with python
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: icons and overlays with python
AFAIK such functionality was added to the Assembly 3 branch. As there wasn't much interest and to try to upstream the work done in scopes. Like Links, overlay icons ... likely a few more months will be needed before anything happens. If you don't need such functionality ASAP i would suggest to give the AppImage a try:
https://github.com/realthunder/FreeCAD_ ... 3/releases
And test the available overlay icons functionality. You can ask for guidance here:
https://forum.freecadweb.org/viewtopic.php?f=20&t=25712
P.S. If it does exactly what you are after you could i guess try to convince all parties involved to upstream the overlay icons functionality before FreeCAD 0.18 gets released. For Links we are likely too late now and have missed that chance. Overlay icons scope likely still is achievable. Especially if you will be able to confirm it is the functionality you need and it does the job.
https://github.com/realthunder/FreeCAD_ ... 3/releases
And test the available overlay icons functionality. You can ask for guidance here:
https://forum.freecadweb.org/viewtopic.php?f=20&t=25712
P.S. If it does exactly what you are after you could i guess try to convince all parties involved to upstream the overlay icons functionality before FreeCAD 0.18 gets released. For Links we are likely too late now and have missed that chance. Overlay icons scope likely still is achievable. Especially if you will be able to confirm it is the functionality you need and it does the job.
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: icons and overlays with python
Not exactly what you asked for, but look at ../Mod/PartDesign/Gui/ViewProvider.cpp - specifically
"QIcon ViewProvider::mergeTip(QIcon orig) const".
It uses XPM icons.
I'd just make 2 icons, one for enabled, one for disabled, and tell your ViewProvider(or button or ???) to change over when condition changes.
Re: icons and overlays with python
The actual algorithm is implemented here: https://github.com/FreeCAD/FreeCAD/blob ... y.cpp#L571
The whole trick is to open a QPainter on an existing QPixmap and then use drawPixmap to paint the overlay icon on top of it. Important for the overlay icon is that the background is transparent.
The whole trick is to open a QPainter on an existing QPixmap and then use drawPixmap to paint the overlay icon on top of it. Important for the overlay icon is that the background is transparent.
Re: icons and overlays with python
related:The actual algorithm is implemented here: https://github.com/FreeCAD/FreeCAD/blob ... y.cpp#L571
The whole trick is to open a QPainter on an existing QPixmap and then use drawPixmap to paint the overlay icon on top of it. Important for the overlay icon is that the background is transparent.
Overlaying icons over a feature https://forum.freecadweb.org/viewtopic. ... 48#p263148
https://github.com/reox/FreeCAD_gitproject/issues/7
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: icons and overlays with python
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs