Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
I noticed an issue in FC's definition of Gui::PrefUnitSpinBox and Gui::QuantitySpinBox.
They don't inherit e.g. the alignment property from QAbstractSpinBox. Other spin boxes have this and therefore support these useful settings:
Is it OK to add this inheritance? I would e.g. like to set the alignment for all spin boxes in a dialog, not only for the Q spin boxes.
They don't inherit e.g. the alignment property from QAbstractSpinBox. Other spin boxes have this and therefore support these useful settings:
Is it OK to add this inheritance? I would e.g. like to set the alignment for all spin boxes in a dialog, not only for the Q spin boxes.
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
Hmm, looking in the code, they seem to do but Qt designer doesn't not recognize them. I can also not find anything about this in
https://wiki.freecadweb.org/Developer_hub
I also searched the Wiki.
So how can I tell Qt designer how to handle the GUI:: widgets?
- wandererfan
- Veteran
- Posts: 6270
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
They already inherit QAbstractSpinBox. Maybe your plugin (libFreeCAD_widgers.so on linux. don't know about Win) is not up to date?
see QuantitySpinBox.h
Code: Select all
class GuiExport QuantitySpinBox : public QAbstractSpinBox, public ExpressionBinding
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
It's not a matter of inheritance but a matter of the lack of the Qt plugin. It's possible to use custom FreeCAD widgets in the designer without the FreeCAD plugin but its usage is limited. If you look at the XML code inside a .ui file and search for QuantitySpinBox you can see that adding custom properties is possible and at the end you will see there is a block:uwestoehr wrote: ↑Thu Mar 26, 2020 11:28 pmHmm, looking in the code, they seem to do but Qt designer doesn't not recognize them. I can also not find anything about this in
https://wiki.freecadweb.org/Developer_hub
I also searched the Wiki.
So how can I tell Qt designer how to handle the GUI:: widgets?
Code: Select all
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
The problem here is that in real C++ QuantitySpinBox inherits from QAbstractSpinBox but it's not possible to say so in the .ui file because QAbstractSpinBox is an abstract class and cannot be instantiated. If you try it anyway the designer raises an error when loading the modified .ui file.
To have full access over QuantitySpinBox in Qt designer then the only option is to build the FreeCAD plugin and put it into the plugins directory of your Qt installation.
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
I want to do so and document this in my build on Windows instructions in the Wiki. However, it is not yet clear to me how this is done.
In my build folder I find the folder "QtUiPlugin" that contains custom Qt designer widgets. But how do I say Qt designer to use them?
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
You must build this plugin: https://github.com/FreeCAD/FreeCAD/tree ... ins/widget
On Windows open command line shell from within VS or of the VS installation in the start menu. Then cd to the directory and enter
Copy the dll to the designer sub-directory of the plugins folder of Qt.
On Windows open command line shell from within VS or of the VS installation in the start menu. Then cd to the directory and enter
Code: Select all
qmake plugin.pro
nmake -f Makefile.Release
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
Thanks. However, I am not able to build this, because despite I am in the VS shell for x64, it tells me that the target destination is x86:wmayer wrote: ↑Fri Mar 27, 2020 1:44 pm You must build this plugin: https://github.com/FreeCAD/FreeCAD/tree ... ins/widget
On Windows open command line shell from within VS or of the VS installation in the start menu. Then cd to the directory and enterCopy the dll to the designer sub-directory of the plugins folder of Qt.Code: Select all
qmake plugin.pro nmake -f Makefile.Release
I cannot find a way to tell qmake and nmake to use the x64 version.
- wandererfan
- Veteran
- Posts: 6270
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
I only have Qt 5.12.1 installed here.
Re: Gui::QuantitySpinBox miss QAbstractSpinBox inheritance
You can also try: qmake -t vclib plugin.pro to create a VS project.