help locating class definition

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

help locating class definition

Post by freman »

Hi,

I'm trying to work on some issues in PathWB and I'm having a little trouble exploring the many branches of the source code tree to find what I need.

I want to change the minimum property on an instance of quantitySpinBox. I suspect that this is part of a derivative class grouping a number of widgets: InputField, quantitySpinBox and the little "f(x)" glyph which opens the function evaluation dlg.

I'm looking at a Job.Operations.DressupBoundary.Stock.Placement.Position.x entry in the tree-view and this seems to use the same widget as Body.Placement.Position.x , for example. These are pretty ubiquitous , so I'm guessing they are defined as a class. Can anyone tell me the class name? That would save some time.

many thanks.
Attachments
Tree-view-Xpos.png
Tree-view-Xpos.png (23.2 KiB) Viewed 1000 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: help locating class definition

Post by DeepSOIC »

freman wrote: Wed Dec 11, 2019 11:35 am I want to change the minimum property on an instance of quantitySpinBox.
This is typically controlled by the definition of the property, not by some spinbox.
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: help locating class definition

Post by freman »

Thanks but the default for the standard GUI:QuantitySpinBox is: minimum(-DOUBLE_MAX) , not zero. I need to find out how and where it is getting set to zero. I won't get far searching for "0" so I need to know the class name, so I can find where it is set up .

I'm pretty sure the must a class for the this composed widget. ie it's the enhanced InputField I'm after not the spinbox on it, though I'm fairly sure it is the spinbox which is controlling the input values. It has that ability.

Code: Select all

void QuantitySpinBox::setValue(const Base::Quantity& value)
{
    Q_D(QuantitySpinBox);
    d->quantity = value;
    // check limits
    if (d->quantity.getValue() > d->maximum)
        d->quantity.setValue(d->maximum);
    if (d->quantity.getValue() < d->minimum)
        d->quantity.setValue(d->minimum);

    d->unit = value.getUnit();

    updateText(value);
}
I haven't yet found out how the new "stock" item gets pushed into the tree-view tree object.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: help locating class definition

Post by openBrain »

According the .ui panel resource of BoundaryDressUp, it seems that this is of class "Gui::InputField" and not "Gui::QuantitySpinBox". ;)
chrisb
Veteran
Posts: 54187
Joined: Tue Mar 17, 2015 9:14 am

Re: help locating class definition

Post by chrisb »

freman wrote: Wed Dec 11, 2019 11:35 am Hi,

I'm trying to work on some issues in PathWB and I'm having a little trouble exploring the many branches of the source code tree to find what I need.

I want to change the minimum property on an instance of quantitySpinBox.
You are probably talking about the Boundary dialog.Please note, that this is the same dialog which is used in the Job definition. There it is sensible to have 0 as minimum value.
If I understood it right, it was a mere time saver to reuse the dialog. From what we know now it may be discussed if a new dialog is sensible.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54187
Joined: Tue Mar 17, 2015 9:14 am

Re: help locating class definition

Post by chrisb »

Reference to discussion in Path forum: https://forum.freecadweb.org/viewtopic. ... 13#p353213.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: help locating class definition

Post by freman »

Indeed Chris, I'll discuss that in the other thread. I wanted to hack the code a bit and see what happens so I can have something concrete to discuss.

I posted this question here, since I need to find out how all this hangs together and it is not specific to PathWB, since it inherited from the tree-view and more global parts of FreeCAD. I thought it is probably more relevent to ask that here.
chrisb
Veteran
Posts: 54187
Joined: Tue Mar 17, 2015 9:14 am

Re: help locating class definition

Post by chrisb »

It's allright to be discussed here, just wanted to give the pointer, because I had later seen, that were already aware of my warning.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: help locating class definition

Post by freman »

openBrain wrote: Wed Dec 11, 2019 2:34 pm According the .ui panel resource of BoundaryDressUp, it seems that this is of class "Gui::InputField" and not "Gui::QuantitySpinBox". ;)
Thanks. That is why I'm trying not to discussing BoundaryDressUp here. There is a rather opaque thing going in here where InputField accepts downkey and will display values < 0 but the bounds box display does not match it. That input seems to be connected to the "Gui::QuantitySpinBox" in the tree-view, and that is what has minimum fixed on it.

Heck I was trying not mix the two but OK. It seems the Gui::QuantitySpinBox is the class I was looking for. After a close look this is indeed to one with the f(x) glyph etc. I still have not found where minimum is being set. I need to change this.

deepSOIC wrote:This is typically controlled by the definition of the property, not by some spinbox.
In this case, the property is Stock.Placement.Position.x but I can't find where it is being given the minimum of zero. :x
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: help locating class definition

Post by DeepSOIC »

freman wrote: Wed Dec 11, 2019 5:33 pm Stock.Placement.Position.x
That's not a property, Placement is the property. And its spinboxes don't have constraints, as far as I know. Can you provide a file with such an object? (I'm not familiar with Path :oops: )

EDIT: never mind, I figured out just creating a job is enough to have myself a Stock object to play with
Post Reply