The PrefQuantitySpinBox class. More...
#include <PrefWidgets.h>
Public Member Functions | |
| int | historySize () const |
| get the value of the history size property More... | |
| PrefQuantitySpinBox (QWidget *parent=nullptr) | |
| void | setHistorySize (int) |
| set the value of the history size property More... | |
| void | setToLastUsedValue () |
| set the input field to the last used value (works only if the setParamGrpPath() was called) More... | |
| virtual | ~PrefQuantitySpinBox () |
Public Member Functions inherited from Gui::QuantitySpinBox | |
| 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 () |
Public Member Functions inherited from Gui::PrefWidget | |
| QByteArray | entryName () const |
| Returns the widget's preference name. More... | |
| virtual void | OnChange (Base::Subject< const char * > &rCaller, const char *sReason) |
| This method is called if one or more values in the parameter settings are changed where getParamGrp() points to. More... | |
| void | onRestore () |
| Restores the preferences of the widget. More... | |
| void | onSave () |
| Saves the current preferences of the widget. More... | |
| QByteArray | paramGrpPath () const |
| Returns the widget's preferences path. More... | |
| void | setEntryName (const QByteArray &name) |
| Sets the preference name to name. More... | |
| void | setParamGrpPath (const QByteArray &path) |
| Sets the preference path to path. More... | |
| void | setPrefEntry (const QByteArray &name) |
| Does the same as setEntryName(). More... | |
| void | setPrefPath (const QByteArray &name) |
| Does the same as setParamGrpPath(). More... | |
Public Member Functions inherited from Gui::WindowParameter | |
| ParameterGrp::handle | getWindowParameter (void) |
| return the parameter group of this window More... | |
| void | OnChange (Base::Subject< const char * > &rCaller, const char *sReason) |
| bool | setGroupName (const char *name) |
| Sets the group of the window to name. More... | |
| WindowParameter (const char *name) | |
| virtual | ~WindowParameter () |
Properties | |
| int | historySize |
| QByteArray | prefEntry |
| QByteArray | prefPath |
Properties inherited from Gui::QuantitySpinBox | |
| QString | binding |
| QString | expression |
| double | maximum |
| double | minimum |
| double | rawValue |
| double | singleStep |
| QString | unit |
| Base::Quantity | value |
history and default management | |
| void | pushToHistory (const QString &value=QString()) |
| push a new value to the history, if no string given the actual text of the input field is used. More... | |
| QStringList | getHistory () const |
| get the history of the field, newest first More... | |
| virtual void | contextMenuEvent (QContextMenuEvent *event) |
| void | restorePreferences () |
| Restores the preferences Must be reimplemented in any subclasses. More... | |
| void | savePreferences () |
| Save the preferences Must be reimplemented in any subclasses. More... | |
Additional Inherited Members | |
Public Slots inherited from Gui::QuantitySpinBox | |
| 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 inherited from Gui::QuantitySpinBox | |
| 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... | |
Static Public Member Functions inherited from Gui::WindowParameter | |
| static ParameterGrp::handle | getDefaultParameter (void) |
| get the parameters More... | |
Protected Types inherited from Gui::ExpressionSpinBox | |
| enum class | Number { KeepCurrent = 0 , SetIfNumber = 1 } |
Protected Slots inherited from Gui::QuantitySpinBox | |
| void | handlePendingEmit (bool updateUnit=true) |
| void | userInput (const QString &text) |
Protected Member Functions inherited from Gui::QuantitySpinBox | |
| 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) |
Protected Member Functions inherited from Gui::PrefWidget | |
| void | failedToRestore (const QString &) const |
| Print warning that restoring failed. More... | |
| void | failedToSave (const QString &) const |
| Print warning that saving failed. More... | |
| PrefWidget () | |
| Constructs a preference widget. More... | |
| virtual void | restorePreferences ()=0 |
| Restores the preferences Must be reimplemented in any subclasses. More... | |
| virtual void | savePreferences ()=0 |
| Save the preferences Must be reimplemented in any subclasses. More... | |
| virtual | ~PrefWidget () |
| Destroys the widget and detaches it from its parameter group. More... | |
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 |
The PrefQuantitySpinBox class.
| PrefQuantitySpinBox::PrefQuantitySpinBox | ( | QWidget * | parent = nullptr | ) |
|
virtual |
|
protectedvirtual |
References pushToHistory().
| QStringList PrefQuantitySpinBox::getHistory | ( | void | ) | const |
get the history of the field, newest first
Referenced by setToLastUsedValue().
| int PrefQuantitySpinBox::historySize | ( | void | ) | const |
get the value of the history size property
| void PrefQuantitySpinBox::pushToHistory | ( | const QString & | value = QString() | ) |
push a new value to the history, if no string given the actual text of the input field is used.
References Gui::PrefWidget::onSave().
Referenced by contextMenuEvent().
|
protectedvirtual |
Restores the preferences Must be reimplemented in any subclasses.
Implements Gui::PrefWidget.
References Gui::PrefWidget::entryName(), Gui::PrefWidget::failedToRestore(), ParameterGrp::GetGroup(), Gui::WindowParameter::getWindowParameter(), and draftgeoutils.general::isNull().
|
protectedvirtual |
Save the preferences Must be reimplemented in any subclasses.
Implements Gui::PrefWidget.
References Gui::PrefWidget::entryName(), Gui::PrefWidget::failedToSave(), ParameterGrp::GetGroup(), Gui::WindowParameter::getWindowParameter(), draftgeoutils.general::isNull(), and ParameterGrp::SetASCII().
| void PrefQuantitySpinBox::setHistorySize | ( | int | i | ) |
set the value of the history size property
| void PrefQuantitySpinBox::setToLastUsedValue | ( | void | ) |
set the input field to the last used value (works only if the setParamGrpPath() was called)
References getHistory().
|
readwrite |
|
readwrite |
|
readwrite |