Setting preference default in UI file

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Setting preference default in UI file

Post by chennes »

I've got a preference setting for the OpenSCAD workbench that is presented as an option menu: right now the value defaulted to zero and everything worked well. I'd like to change the default to 2: it's simple enough to change the other accesses in the code so that when the preference is unset, 2 is returned. But how do I do that for the UI file that generates the Preference page?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Setting preference default in UI file

Post by wandererfan »

chennes wrote: Wed May 03, 2023 5:59 pm But how do I do that for the UI file that generates the Preference page?
depends on what kind of widget you are trying to initialize.

if this for guiprefcomboSendVia in openscadprefs-base.ui, then set currentIndex to 2.
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Setting preference default in UI file

Post by chennes »

Perfect, thanks!
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply