help locating class definition

A forum for research and development of the user interface of FreeCAD

Moderator: agryson

User avatar
freman
Posts: 914
Joined: Tue Nov 27, 2018 10:30 pm

help locating class definition

Post by freman » 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. 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 268 times
User avatar
DeepSOIC
Posts: 7291
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: help locating class definition

Post by DeepSOIC » Wed Dec 11, 2019 1:03 pm

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
Posts: 914
Joined: Tue Nov 27, 2018 10:30 pm

Re: help locating class definition

Post by freman » Wed Dec 11, 2019 1:55 pm

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
Posts: 3091
Joined: Fri Nov 09, 2018 5:38 pm

Re: help locating class definition

Post by openBrain » 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". ;)
chrisb
Posts: 21442
Joined: Tue Mar 17, 2015 9:14 am

Re: help locating class definition

Post by chrisb » Wed Dec 11, 2019 2:44 pm

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.
chrisb
Posts: 21442
Joined: Tue Mar 17, 2015 9:14 am

Re: help locating class definition

Post by chrisb » Wed Dec 11, 2019 2:46 pm

Reference to discussion in Path forum: https://forum.freecadweb.org/viewtopic. ... 13#p353213.
User avatar
freman
Posts: 914
Joined: Tue Nov 27, 2018 10:30 pm

Re: help locating class definition

Post by freman » Wed Dec 11, 2019 3:21 pm

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
Posts: 21442
Joined: Tue Mar 17, 2015 9:14 am

Re: help locating class definition

Post by chrisb » Wed Dec 11, 2019 5:26 pm

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.
User avatar
freman
Posts: 914
Joined: Tue Nov 27, 2018 10:30 pm

Re: help locating class definition

Post by freman » Wed Dec 11, 2019 5:33 pm

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
Posts: 7291
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: help locating class definition

Post by DeepSOIC » Wed Dec 11, 2019 5:59 pm

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

Who is online

Users browsing this forum: No registered users and 4 guests