#include <QuantitySpinBox.h>
Public Slots | |
void | setValue (const Base::Quantity &val) |
Sets the field with a quantity. More... | |
void | setValue (double) |
Set a numerical value which gets converted to a quantity with the currently set unit type. More... | |
Signals | |
void | showFormulaDialog (bool) |
Gets emitted if formula dialog is about to be opened (true) or finished (false). More... | |
void | textChanged (const QString &) |
The new value is passed in text with unit. More... | |
void | valueChanged (const Base::Quantity &) |
Gets emitted if the user has entered a VALID input Valid means the user inputted string obeys all restrictions like: minimum, maximum and/or the right Unit (if specified). More... | |
void | valueChanged (double) |
Gets emitted if the user has entered a VALID input Valid means the user inputted string obeys all restrictions like: minimum, maximum and/or the right Unit (if specified). More... | |
Public Member Functions | |
bool | apply (const std::string &propName) |
void | bind (const App::ObjectIdentifier &_path) |
QString | boundToName () const |
Gets the path of the bound property. More... | |
virtual void | clear () |
void | clearSchema () |
Clears the schemaand again use the system-wide schema. More... | |
int | decimals () const |
Gets the number of decimals. More... | |
bool | event (QEvent *event) |
QString | expressionText () const |
Gets the expression as a string. More... | |
virtual void | fixup (QString &str) const |
bool | hasValidInput () const |
Gives the current state of the user input, gives true if it is a valid input with correct quantity or returns false if the input is a unparsable string or has a wrong unit. More... | |
double | maximum () const |
Gets the value of the maximum property. More... | |
double | minimum () const |
Gets the value of the minimum property. More... | |
QSize | minimumSizeHint () const |
QuantitySpinBox (QWidget *parent=nullptr) | |
double | rawValue () const |
Get the current quantity without unit. More... | |
void | selectNumber () |
Set the number portion selected. More... | |
void | setBoundToByName (const QString &path) |
Sets the path of the bound property. More... | |
void | setDecimals (int v) |
Sets the number of decimals. More... | |
void | setMaximum (double max) |
Sets the value of the maximum property. More... | |
void | setMinimum (double min) |
Sets the value of the minimum property. More... | |
void | setNumberExpression (App::NumberExpression *) |
void | setRange (double min, double max) |
void | setSchema (const Base::UnitSystem &s) |
Sets a specific unit schema to handle quantities. More... | |
void | setSingleStep (double val) |
Set the value of the singleStep property. More... | |
void | setUnit (const Base::Unit &unit) |
void | setUnitText (const QString &) |
Set the unit property. More... | |
double | singleStep () const |
Get the value of the singleStep property. More... | |
QSize | sizeForText (const QString &) const |
This is a helper function to determine the size this widget requires to fully display the text. More... | |
QSize | sizeHint () const |
virtual void | stepBy (int steps) |
QString | textFromValue (const Base::Quantity &val) const |
Base::Unit | unit () const |
Sets the Unit this widget is working with. More... | |
QString | unitText (void) |
Get the unit property. More... | |
virtual QValidator::State | validate (QString &input, int &pos) const |
Base::Quantity | value () const |
Get the current quantity. More... | |
Base::Quantity | valueFromText (const QString &text) const |
virtual | ~QuantitySpinBox () |
Public Member Functions inherited from Gui::ExpressionSpinBox | |
void | bind (const App::ObjectIdentifier &_path) |
ExpressionSpinBox (QAbstractSpinBox *) | |
void | setExpression (std::shared_ptr< App::Expression > expr) |
virtual | ~ExpressionSpinBox () |
Public Member Functions inherited from Gui::ExpressionBinding | |
virtual bool | apply () |
virtual bool | apply (const std::string &propName) |
bool | autoApply () const |
virtual void | bind (const App::ObjectIdentifier &_path) |
virtual void | bind (const App::Property &prop) |
ExpressionBinding () | |
QPixmap | getIcon (const char *name, const QSize &size) const |
bool | hasExpression () const |
bool | isBound () const |
void | setAutoApply (bool value) |
void | unbind () |
virtual | ~ExpressionBinding () |
Protected Slots | |
void | handlePendingEmit (bool updateUnit=true) |
void | userInput (const QString &text) |
Protected Member Functions | |
virtual void | closeEvent (QCloseEvent *event) |
virtual void | focusInEvent (QFocusEvent *event) |
virtual void | focusOutEvent (QFocusEvent *event) |
virtual void | hideEvent (QHideEvent *event) |
virtual void | keyPressEvent (QKeyEvent *event) |
virtual void | openFormulaDialog () |
virtual void | paintEvent (QPaintEvent *event) |
virtual void | resizeEvent (QResizeEvent *event) |
virtual void | setExpression (std::shared_ptr< App::Expression > expr) |
virtual void | showEvent (QShowEvent *event) |
virtual StepEnabled | stepEnabled () const |
Protected Member Functions inherited from Gui::ExpressionSpinBox | |
void | clearExpression () |
void | drawControl (QStyleOptionSpinBox &) |
bool | handleKeyEvent (const QString &) |
void | onChange () |
virtual void | openFormulaDialog () |
void | resizeWidget () |
virtual void | setNumberExpression (App::NumberExpression *)=0 |
void | showInvalidExpression (const QString &) |
void | showValidExpression (Number number) |
void | updateExpression () |
Protected Member Functions inherited from Gui::ExpressionBinding | |
void | expressionChange (const App::ObjectIdentifier &id) |
std::string | getEscapedExpressionString () const |
std::shared_ptr< App::Expression > | getExpression () const |
std::string | getExpressionString (bool no_throw=true) const |
const App::ObjectIdentifier & | getPath () const |
void | makeLabel (QLineEdit *parent) |
void | objectDeleted (const App::DocumentObject &) |
virtual void | onChange () |
virtual void | setExpression (std::shared_ptr< App::Expression > expr) |
Properties | |
QString | binding |
QString | expression |
double | maximum |
double | minimum |
double | rawValue |
double | singleStep |
QString | unit |
Base::Quantity | value |
Additional Inherited Members | |
Protected Types inherited from Gui::ExpressionSpinBox | |
enum class | Number { KeepCurrent = 0 , SetIfNumber = 1 } |
Protected Attributes inherited from Gui::ExpressionSpinBox | |
QLineEdit * | lineedit |
QAbstractSpinBox * | spinbox |
Protected Attributes inherited from Gui::ExpressionBinding | |
QPalette | defaultPalette |
boost::signals2::scoped_connection | expressionchanged |
int | iconHeight |
ExpressionLabel * | iconLabel |
bool | m_autoApply |
boost::signals2::scoped_connection | objectdeleted |
|
explicit |
References draftgeoutils.intersections::connect(), handlePendingEmit(), textChanged(), and userInput().
|
virtual |
|
virtual |
Reimplemented from Gui::ExpressionBinding.
References Gui::ExpressionBinding::apply(), Gui::Command::Doc, Base::Persistence::getClassTypeId(), Gui::ExpressionBinding::getPath(), Base::Persistence::getTypeId(), Base::Quantity::getValue(), Gui::ExpressionBinding::isBound(), Base::Type::isDerivedFrom(), App::Property::isReadOnly(), Base::toRadians(), and value.
Referenced by PartGui::OffsetWidget::accept().
|
virtual |
Reimplemented from Gui::ExpressionBinding.
References Gui::ExpressionBinding::bind(), and Gui::ExpressionBinding::iconLabel.
Referenced by PartGui::OffsetWidget::OffsetWidget(), setBoundToByName(), and PartGui::ThicknessWidget::ThicknessWidget().
QString QuantitySpinBox::boundToName | ( | ) | const |
Gets the path of the bound property.
References Gui::ExpressionBinding::getPath(), Gui::ExpressionBinding::isBound(), and App::ObjectIdentifier::toString().
|
virtual |
void QuantitySpinBox::clearSchema | ( | ) |
Clears the schemaand again use the system-wide schema.
|
protectedvirtual |
References handlePendingEmit().
int QuantitySpinBox::decimals | ( | ) | const |
Gets the number of decimals.
References event(), Base::Tools::fromStdString(), Gui::ExpressionBinding::getExpression(), Gui::ExpressionBinding::isBound(), and DraftVecUtils::toString().
Referenced by event().
QString Gui::QuantitySpinBox::expressionText | ( | ) | const |
Gets the expression as a string.
|
virtual |
Referenced by valueFromText().
|
protectedvirtual |
|
protectedvirtual |
|
protectedslot |
Referenced by closeEvent(), hideEvent(), QuantitySpinBox(), and userInput().
bool QuantitySpinBox::hasValidInput | ( | ) | const |
Gives the current state of the user input, gives true if it is a valid input with correct quantity or returns false if the input is a unparsable string or has a wrong unit.
|
protectedvirtual |
References handlePendingEmit().
|
protectedvirtual |
double QuantitySpinBox::maximum | ( | void | ) | const |
Gets the value of the maximum property.
double QuantitySpinBox::minimum | ( | void | ) | const |
Gets the value of the minimum property.
QSize QuantitySpinBox::minimumSizeHint | ( | ) | const |
|
protectedvirtual |
|
protectedvirtual |
double QuantitySpinBox::rawValue | ( | ) | const |
Get the current quantity without unit.
|
protectedvirtual |
References Gui::ExpressionSpinBox::resizeWidget().
void QuantitySpinBox::selectNumber | ( | void | ) |
Set the number portion selected.
Referenced by focusInEvent(), showEvent(), and stepBy().
void QuantitySpinBox::setBoundToByName | ( | const QString & | name | ) |
Sets the path of the bound property.
Create an object identifier by name.
An identifier is written as document::documentobject.property.subproperty1...subpropertyN document# may be dropped, in this case the active document is used.
References bind(), App::Application::getActiveDocument(), App::GetApplication(), App::Application::getDocument(), and App::ObjectIdentifier::Component::SimpleComponent().
void QuantitySpinBox::setDecimals | ( | int | v | ) |
Sets the number of decimals.
References Base::QuantityFormat::precision.
Referenced by FemGui::PlaneWidget::PlaneWidget(), and FemGui::SphereWidget::SphereWidget().
|
protectedvirtual |
Reimplemented from Gui::ExpressionBinding.
References Gui::ExpressionBinding::isBound(), Gui::ExpressionBinding::setExpression(), and Gui::ExpressionSpinBox::showInvalidExpression().
Referenced by openFormulaDialog().
void QuantitySpinBox::setMaximum | ( | double | max | ) |
Sets the value of the maximum property.
References maximum.
Referenced by Gui::LocationWidget::LocationWidget(), ImageGui::Ui_ImageOrientationDialog::setupUi(), MeshGui::Ui_DlgRegularSolid::setupUi(), PartGui::Ui_DlgExtrusion::setupUi(), PartGui::Ui_DlgPartBox::setupUi(), PartGui::Ui_DlgPartCylinder::setupUi(), SketcherGui::Ui_SketchOrientationDialog::setupUi(), MeshGui::Ui_DlgSettingsImportExport::setupUi(), MeshGui::Ui_RemeshGmsh::setupUi(), MeshPartGui::Ui_TaskCurveOnMesh::setupUi(), MeshPartGui::Ui_Tessellation::setupUi(), PartDesignGui::Ui_DlgPrimitives::setupUi(), PartDesignGui::Ui_TaskChamferParameters::setupUi(), PartDesignGui::Ui_TaskDraftParameters::setupUi(), PartDesignGui::Ui_TaskHelixParameters::setupUi(), PartDesignGui::Ui_TaskPolarPatternParameters::setupUi(), PartDesignGui::Ui_TaskRevolutionParameters::setupUi(), PartDesignGui::Ui_TaskThicknessParameters::setupUi(), PartGui::Ui_DlgPrimitives::setupUi(), PartGui::Ui_TaskAttacher::setupUi(), TechDrawGui::Ui_TaskCenterLine::setupUi(), TechDrawGui::Ui_TaskCosVertex::setupUi(), TechDrawGui::Ui_TaskSectionView::setupUi(), and FemGui::TaskFemConstraintForce::TaskFemConstraintForce().
void QuantitySpinBox::setMinimum | ( | double | min | ) |
Sets the value of the minimum property.
References minimum.
Referenced by Gui::LocationWidget::LocationWidget(), ImageGui::Ui_ImageOrientationDialog::setupUi(), MeshGui::Ui_DlgRegularSolid::setupUi(), PartGui::Ui_DlgExtrusion::setupUi(), PartGui::Ui_DlgPartBox::setupUi(), PartGui::Ui_DlgPartCylinder::setupUi(), SketcherGui::Ui_SketchOrientationDialog::setupUi(), MeshGui::Ui_DlgSettingsImportExport::setupUi(), MeshGui::Ui_RemeshGmsh::setupUi(), MeshPartGui::Ui_TaskCurveOnMesh::setupUi(), MeshPartGui::Ui_Tessellation::setupUi(), PartDesignGui::Ui_DlgPrimitives::setupUi(), PartDesignGui::Ui_TaskChamferParameters::setupUi(), PartDesignGui::Ui_TaskDraftParameters::setupUi(), PartDesignGui::Ui_TaskHelixParameters::setupUi(), PartDesignGui::Ui_TaskPadPocketParameters::setupUi(), PartDesignGui::Ui_TaskPolarPatternParameters::setupUi(), PartDesignGui::Ui_TaskRevolutionParameters::setupUi(), PartDesignGui::Ui_TaskThicknessParameters::setupUi(), PartGui::Ui_DlgPrimitives::setupUi(), PartGui::Ui_TaskAttacher::setupUi(), Ui_TaskActiveView::setupUi(), Ui_TaskHoleParameters::setupUi(), TechDrawGui::Ui_TaskBalloon::setupUi(), TechDrawGui::Ui_TaskCenterLine::setupUi(), TechDrawGui::Ui_TaskCosVertex::setupUi(), TechDrawGui::Ui_TaskDimension::setupUi(), TechDrawGui::Ui_TaskGeomHatch::setupUi(), TechDrawGui::Ui_TaskHatch::setupUi(), TechDrawGui::Ui_TaskProjGroup::setupUi(), TechDrawGui::Ui_TaskRichAnno::setupUi(), TechDrawGui::Ui_TaskSectionView::setupUi(), and FemGui::TaskFemConstraintForce::TaskFemConstraintForce().
|
virtual |
Implements Gui::ExpressionSpinBox.
References App::UnitExpression::getQuantity().
void QuantitySpinBox::setRange | ( | double | min, |
double | max | ||
) |
void QuantitySpinBox::setSchema | ( | const Base::UnitSystem & | s | ) |
Sets a specific unit schema to handle quantities.
The system-wide schema won't be used any more.
References Base::UnitsApi::createSchema().
void QuantitySpinBox::setSingleStep | ( | double | val | ) |
Set the value of the singleStep property.
References value.
Referenced by PartGui::OffsetWidget::OffsetWidget(), ImageGui::Ui_ImageOrientationDialog::setupUi(), InspectionGui::Ui_VisualInspection::setupUi(), SketcherGui::Ui_SketchOrientationDialog::setupUi(), MeshGui::Ui_DlgSettingsImportExport::setupUi(), MeshGui::Ui_RemeshGmsh::setupUi(), MeshPartGui::Ui_Tessellation::setupUi(), PartDesignGui::Ui_TaskChamferParameters::setupUi(), PartDesignGui::Ui_TaskDraftParameters::setupUi(), PartDesignGui::Ui_TaskHelixParameters::setupUi(), PartDesignGui::Ui_TaskRevolutionParameters::setupUi(), PartDesignGui::Ui_TaskThicknessParameters::setupUi(), PartGui::Ui_DlgFilletEdges::setupUi(), PartGui::Ui_Location::setupUi(), Ui_TaskActiveView::setupUi(), Ui_TaskHoleParameters::setupUi(), TechDrawGui::Ui_TaskBalloon::setupUi(), TechDrawGui::Ui_TaskCenterLine::setupUi(), TechDrawGui::Ui_TaskDetail::setupUi(), TechDrawGui::Ui_TaskDimension::setupUi(), TechDrawGui::Ui_TaskGeomHatch::setupUi(), TechDrawGui::Ui_TaskHatch::setupUi(), TechDrawGui::Ui_TaskLeaderLine::setupUi(), TechDrawGui::Ui_TaskRichAnno::setupUi(), and PartGui::ThicknessWidget::ThicknessWidget().
void QuantitySpinBox::setUnit | ( | const Base::Unit & | unit | ) |
References unit.
Referenced by MeshPartGui::CrossSections::CrossSections(), Gui::LocationWidget::LocationWidget(), PartGui::OffsetWidget::OffsetWidget(), setUnitText(), FemGui::PlaneWidget::setViewProvider(), FemGui::SphereWidget::setViewProvider(), and InspectionGui::VisualInspection::VisualInspection().
void QuantitySpinBox::setUnitText | ( | const QString & | str | ) |
Set the unit property.
References Base::Quantity::getUnit(), Base::Quantity::parse(), and setUnit().
|
slot |
Sets the field with a quantity.
References Base::Quantity::setValue(), and value.
Referenced by MeshPartGui::CrossSections::CrossSections(), InspectionGui::VisualInspection::loadSettings(), MeshGui::DlgSettingsImportExport::loadSettings(), PartGui::OffsetWidget::OffsetWidget(), FemGui::PlaneWidget::onChange(), FemGui::SphereWidget::onChange(), Gui::TaskCSysDragger::open(), Gui::PrefUnitSpinBox::restorePreferences(), PartGui::FilletRadiusDelegate::setEditorData(), Gui::LocationWidget::setPosition(), InspectionGui::Ui_VisualInspection::setupUi(), MeshGui::Ui_DlgRegularSolid::setupUi(), PartGui::Ui_DlgExtrusion::setupUi(), PartGui::Ui_DlgPartBox::setupUi(), PartGui::Ui_DlgPartCylinder::setupUi(), MeshGui::Ui_DlgSettingsImportExport::setupUi(), MeshGui::Ui_RemeshGmsh::setupUi(), MeshPartGui::Ui_TaskCurveOnMesh::setupUi(), MeshPartGui::Ui_Tessellation::setupUi(), PartDesignGui::Ui_DlgPrimitives::setupUi(), PartDesignGui::Ui_TaskChamferParameters::setupUi(), PartDesignGui::Ui_TaskDraftParameters::setupUi(), PartDesignGui::Ui_TaskHelixParameters::setupUi(), PartDesignGui::Ui_TaskLinearPatternParameters::setupUi(), PartDesignGui::Ui_TaskPolarPatternParameters::setupUi(), PartDesignGui::Ui_TaskRevolutionParameters::setupUi(), PartDesignGui::Ui_TaskThicknessParameters::setupUi(), PartGui::Ui_DlgFilletEdges::setupUi(), PartGui::Ui_DlgPrimitives::setupUi(), Ui_TaskActiveView::setupUi(), Ui_TaskFemConstraintForce::setupUi(), TechDrawGui::Ui_DlgPrefsTechDrawAnnotationImp::setupUi(), TechDrawGui::Ui_DlgPrefsTechDrawDimensionsImp::setupUi(), TechDrawGui::Ui_DlgPrefsTechDrawGeneralImp::setupUi(), TechDrawGui::Ui_DlgPrefsTechDrawScaleImp::setupUi(), TechDrawGui::Ui_TaskBalloon::setupUi(), TechDrawGui::Ui_TaskCenterLine::setupUi(), TechDrawGui::Ui_TaskDetail::setupUi(), TechDrawGui::Ui_TaskDimension::setupUi(), TechDrawGui::Ui_TaskGeomHatch::setupUi(), TechDrawGui::Ui_TaskHatch::setupUi(), TechDrawGui::Ui_TaskLeaderLine::setupUi(), TechDrawGui::Ui_TaskLineDecor::setupUi(), TechDrawGui::Ui_TaskRichAnno::setupUi(), TechDrawGui::Ui_TaskSectionView::setupUi(), setValue(), FemGui::TaskFemConstraintForce::TaskFemConstraintForce(), and PartGui::ThicknessWidget::ThicknessWidget().
|
slot |
Set a numerical value which gets converted to a quantity with the currently set unit type.
References setValue().
|
protectedvirtual |
References selectNumber().
|
signal |
Gets emitted if formula dialog is about to be opened (true) or finished (false).
Referenced by openFormulaDialog().
double QuantitySpinBox::singleStep | ( | void | ) | const |
Get the value of the singleStep property.
QSize QuantitySpinBox::sizeForText | ( | const QString & | txt | ) | const |
This is a helper function to determine the size this widget requires to fully display the text.
References Gui::QtTools::horizontalAdvance(), and Gui::ExpressionBinding::iconHeight.
Referenced by FemGui::PlaneWidget::PlaneWidget(), and FemGui::SphereWidget::SphereWidget().
QSize QuantitySpinBox::sizeHint | ( | ) | const |
|
virtual |
References minimum, and selectNumber().
|
protectedvirtual |
|
signal |
The new value is passed in text with unit.
Referenced by QuantitySpinBox().
QString QuantitySpinBox::textFromValue | ( | const Base::Quantity & | val | ) | const |
Referenced by minimumSizeHint(), and sizeHint().
Base::Unit QuantitySpinBox::unit | ( | ) | const |
Sets the Unit this widget is working with.
After setting the Unit the widget will only accept user input with this unit type. Or if the user input a value without unit, this one will be added to the resulting Quantity.
QString QuantitySpinBox::unitText | ( | void | ) |
Get the unit property.
|
protectedslot |
References handlePendingEmit().
Referenced by QuantitySpinBox().
|
virtual |
Referenced by AddonManager.CommandAddonManager::startup().
Base::Quantity QuantitySpinBox::value | ( | ) | const |
Get the current quantity.
Referenced by PathScripts.PathProperty.Property::displayString(), PathScripts.PathProperty.PropertyQuantity::displayString(), PathScripts.PathSetupSheetOpPrototype.Property::displayString(), PathScripts.PathSetupSheetOpPrototype.PropertyQuantity::displayString(), Mod.PartDesign.WizardShaft.SegmentFunction.SegmentFunction::evaluate(), PathScripts.PathProperty.Property::getValue(), PathScripts.PathSetupSheetOpPrototype.Property::getValue(), Mod.PartDesign.WizardShaft.SegmentFunction.IntervalFunction::lowervalue(), PathScripts.PathProperty.Property::setValue(), and PathScripts.PathSetupSheetOpPrototype.Property::setValue().
|
signal |
Gets emitted if the user has entered a VALID input Valid means the user inputted string obeys all restrictions like: minimum, maximum and/or the right Unit (if specified).
|
signal |
Gets emitted if the user has entered a VALID input Valid means the user inputted string obeys all restrictions like: minimum, maximum and/or the right Unit (if specified).
Base::Quantity QuantitySpinBox::valueFromText | ( | const QString & | text | ) | const |
References fixup().
|
readwrite |
|
read |
|
readwrite |
Referenced by setMaximum(), and setRange().
|
readwrite |
Referenced by setMinimum(), setRange(), and stepBy().
|
readwrite |
|
readwrite |
|
readwrite |
Referenced by setUnit().
|
readwrite |
Referenced by ImageGui::ImageOrientationDialog::accept(), InspectionGui::VisualInspection::accept(), PartGui::OffsetWidget::accept(), PartGui::ThicknessWidget::accept(), MeshPartGui::CrossSections::apply(), apply(), PathScripts.PathProperty.Property::displayString(), PathScripts.PathProperty.PropertyQuantity::displayString(), PathScripts.PathSetupSheetOpPrototype.Property::displayString(), PathScripts.PathSetupSheetOpPrototype.PropertyQuantity::displayString(), Mod.PartDesign.WizardShaft.SegmentFunction.SegmentFunction::evaluate(), FemGui::TaskFemConstraintForce::getForce(), Gui::LocationWidget::getPosition(), PathScripts.PathProperty.Property::getValue(), PathScripts.PathSetupSheetOpPrototype.Property::getValue(), InspectionGui::VisualInspection::loadSettings(), MeshGui::DlgSettingsImportExport::loadSettings(), Mod.PartDesign.WizardShaft.SegmentFunction.IntervalFunction::lowervalue(), InspectionGui::VisualInspection::saveSettings(), MeshGui::DlgSettingsImportExport::saveSettings(), PartGui::FilletRadiusDelegate::setModelData(), setSingleStep(), setValue(), PathScripts.PathProperty.Property::setValue(), and PathScripts.PathSetupSheetOpPrototype.Property::setValue().