![]() |
NDEVR
API Documentation
|
A line edit allows users to enter and edit a single line of plain text with useful editing functions, including undo and redo, cut and paste, and drag and drop. More...
Public Member Functions | |
| QCustomLineEdit (const QString &value, QWidget *parent=Q_NULLPTR) | |
| Constructs a QCustomLineEdit with an initial value and the given parent widget. | |
| QCustomLineEdit (QWidget *parent=Q_NULLPTR) | |
| Constructs a QCustomLineEdit with the given parent widget. | |
| ~QCustomLineEdit () | |
| Destroys the line edit and its resources. | |
| RGBColor | backgroundColor () const |
| Returns the current background color of the line edit. | |
| void | clearBackgroundColor () |
| Clears any custom background color, reverting to the default. | |
| void | clearInputHint () |
| Clears the input hint text. | |
| void | clearValue () |
| Clears the current value of the line edit. | |
| QCustomValidator & | customValidator () |
| Returns a mutable reference to the custom validator used for input validation. | |
| const QCustomValidator & | customValidator () const |
| Returns a const reference to the custom validator used for input validation. | |
| void | editedSignal () |
| Emitted when the text is edited by the user. | |
| void | editingFinishedSignal () |
| Emitted when the user finishes editing (focus lost or enter pressed). | |
| bool | event (QEvent *event) override |
| Handles generic events such as tooltip and theme updates. | |
| void | forceValue (const StringView &forced_value) |
| Ignores validation steps, password encoding, etc. | |
| template<class t_type> | |
| t_type | getAs () const |
| Returns the current value converted to the requested type. | |
| template<class t_type> | |
| t_type | getAs (bool allow_placeholder) const |
| Returns the current value converted to the requested type. | |
| template<class t_angle_type = fltp08> | |
| Angle< t_angle_type > | getUnitAngle (bool allow_placeholder=true) const |
| Returns the current value as an Angle in internal representation. | |
| fltp08 | getUnitValue (bool allow_placeholder=true) const |
| Returns the current value as a floating-point number in user-facing units. | |
| String | getValue () const |
| Returns the current text value of the line edit. | |
| String | getValue (bool allow_placeholder) const |
| Returns the current text value of the line edit. | |
| bool | hasUserFocus () const |
| Returns whether the line edit currently has user focus (keyboard or touch). | |
| const TranslatedString & | inputHint () const |
| Returns the current input hint text. | |
| void | inputHintChangedSignal () |
| Emitted when the input hint text changes. | |
| bool | isEditable () const |
| Returns whether the line edit is currently editable. | |
| bool | isEditing () const |
| Returns whether the user is currently editing this line edit. | |
| bool | isPassword () const |
| Returns whether this line edit is in password mode. | |
| bool | isValid () const |
| Returns whether the current text passes validation. | |
| QSize | minimumSizeHint () const override |
| Returns the minimum size hint for layout purposes. | |
| void | onEdited () |
| Slot invoked when the text has been edited by the user. | |
| void | onFinishedSlot () |
| Slot invoked when editing is finished, to commit the value. | |
| const String & | passwordEncoder () const |
| Returns the password encoder string used for cross-session password storage. | |
| void | setAllowPlaceholderAsValue (bool allow) |
| Sets whether the placeholder text should be treated as a valid value when the field is empty. | |
| void | setAsKeyboardFocus () |
| Sets this line edit as the primary keyboard focus target. | |
| void | setAutoShowTooltip (bool auto_show_tooltip) |
| Sets whether the tooltip should automatically update to show the current value. | |
| void | setBackgroundColor (const RGBColor &color) |
| Sets the background color of the line edit. | |
| void | setBold (bool is_bold) |
| Sets whether the line edit text is rendered in bold. | |
| void | setConstantUnit (const ConstPointer< Unit > &unit, uint01 dimension=Constant< uint01 >::Invalid) |
| Sets a constant unit for value formatting and conversion. | |
| void | setCustomUnit (const StringView &unit, UnitCategory fallback_unit, uint01 dimension=Constant< uint01 >::Invalid) |
| Sets a custom unit string with a fallback unit category. | |
| void | setEditable (bool editable) |
| Sets whether the line edit is editable by the user. | |
| void | setFontMultiplier (fltp04 font_multiplier) |
| Sets a multiplier applied to the base font size. | |
| void | setInputHint (const TranslatedString &hint) |
| Sets an input hint displayed to guide the user on expected input. | |
| void | setIsPassword (bool is_password, const StringView &encoder=StringView()) |
| Sets this widget to be a password. | |
| void | setPlaceholderText (const QString &value) |
| Sets the placeholder text displayed when the field is empty. | |
| void | setPlaceHolderUnitValue (fltp08 value) |
| Sets the placeholder value as a floating-point number in user-facing units. | |
| template<class t_type> | |
| void | setPlaceholderValue (const t_type &input_value, bool allow_placeholder_as_value=true) |
| Sets a placeholder value displayed when the field is empty. | |
| void | setPlaceholderValue (const TranslatedString &input_value, bool allow_placeholder_as_value=true) |
| Sets a translated placeholder value displayed when the field is empty. | |
| void | setRegex (const StringView ®ex) |
| Sets a custom regex pattern for input validation. | |
| void | setStep (fltp08 step) |
| Sets the step increment used when scrolling or using arrow keys on numeric values. | |
| virtual void | setTitle (const TranslatedString &title) |
| Sets the display title for the line edit, used as a label or placeholder context. | |
| void | setToolTip (const TranslatedString &tooltip) |
| Sets the tooltip text for the line edit. | |
| void | setUnitType (UnitCategory unit, uint01 dimension=Constant< uint01 >::Invalid) |
| Sets the unit type used for value formatting and conversion. | |
| template<class t_angle_type> | |
| void | setUnitValue (Angle< t_angle_type > value) |
| Sets the value as an angle, converting to internal representation first. | |
| void | setUnitValue (fltp08 value) |
| Sets the value as a floating-point number in user-facing units. | |
| template<class t_type> | |
| void | setup (ApplicationOption< t_type > &option) |
| Sets up the line edit from an ApplicationOption, using its label and resource. | |
| template<class t_type> | |
| void | setup (const TranslatedString &title) |
| Sets up the line edit for a specific type with a title, configuring validation accordingly. | |
| void | setup (const TranslatedString &title, const TypeInfo &type) |
| Sets up the line edit with a title and type info for validation. | |
| void | setup (const TranslatedString &title, Resource< String > &resource) |
| Sets up the line edit bound to a String resource with a title. | |
| template<class t_type> | |
| void | setup (const TranslatedString &title, Resource< t_type > &resource) |
| Sets up two-way binding between this line edit and a Resource. | |
| void | setup (const TranslatedString &title, UnitCategory unit_type, uint01 dim=Constant< uint01 >::Invalid) |
| Sets up the line edit with a title and unit type. | |
| void | setup (GenericOption &option) |
| Sets up the line edit from a GenericOption, binding title, type, and resource. | |
| void | setup (Resource< String > &resource) |
| Sets up the line edit bound to a String resource, using the resource name as the title. | |
| void | setValue (const Angle< fltp08 > &input_value) |
| Sets the value from an Angle<fltp08>. | |
| void | setValue (const Angle< sint04 > &input_value) |
| Sets the value from an Angle<sint04>. | |
| void | setValue (const PasswordString &input_value) |
| Sets the value from a PasswordString. | |
| void | setValue (const StringView &input_value) |
| Sets the value from a StringView. | |
| template<class t_type> | |
| std::enable_if< ObjectInfo< t_type >::Number, void >::type | setValue (const t_type &input_value) |
| Sets the value from a numeric type, applying unit formatting if configured. | |
| void | setValue (const TimeSpan &input_value) |
| Sets the value from a TimeSpan. | |
| void | setValue (const TranslatedString &input_value) |
| Sets the value from a TranslatedString. | |
| QSize | sizeHint () const override |
| Returns the recommended size for the line edit. | |
| void | startUserEdit (bool select_all=true) |
| Begins user editing of the line edit, optionally selecting all text. | |
| void | updateColor () |
| Slot to update the line edit color based on validation state. | |
| void | wheelEvent (QWheelEvent *event) override |
| Handles mouse wheel events for incrementing or decrementing numeric values. | |
Static Public Member Functions | |
| static bool | UseKeypad () |
| Returns whether the touch keypad should be used for input. | |
Protected Attributes | |
| TranslatedString | m_title |
| The display title for the line edit. | |
| TranslatedString | m_tooltip |
| The tooltip text. | |
Private Member Functions | |
| virtual void | creatUnitLister () |
| Creates a unit lister popup for selecting units. | |
| virtual void | focusInEvent (QFocusEvent *e) override |
| Handles focus-in events to begin editing state. | |
| virtual void | focusOutEvent (QFocusEvent *e) override |
| Handles focus-out events to finalize editing. | |
| virtual void | mousePressEvent (QMouseEvent *e) override |
| Handles mouse press events to initiate editing or show the keypad. | |
| void | paintEvent (QPaintEvent *event) override |
| Custom paint event for rendering the line edit with background color and decorations. | |
A line edit allows users to enter and edit a single line of plain text with useful editing functions, including undo and redo, cut and paste, and drag and drop.
In touch mode, a popup Keypad will appear based on the type of data being input.
Definition at line 191 of file QCustomLineEdit.h.
|
explicit |
Constructs a QCustomLineEdit with the given parent widget.
| [in] | parent | The parent widget. |
Referenced by DesignObjectSearchWidget::DesignObjectSearchWidget(), and DesignObjectStringWidget::DesignObjectStringWidget().
|
explicit |
Constructs a QCustomLineEdit with an initial value and the given parent widget.
| [in] | value | The initial text value. |
| [in] | parent | The parent widget. |
| RGBColor QCustomLineEdit::backgroundColor | ( | ) | const |
Returns the current background color of the line edit.
| QCustomValidator & QCustomLineEdit::customValidator | ( | ) |
Returns a mutable reference to the custom validator used for input validation.
Referenced by DesignObjectSearchWidget::DesignObjectSearchWidget(), DesignObjectStringWidget::DesignObjectStringWidget(), DesignObjectSearchWidget::setNDPO(), DesignObjectStringWidget::setNDPO(), and setup().
| const QCustomValidator & QCustomLineEdit::customValidator | ( | ) | const |
Returns a const reference to the custom validator used for input validation.
|
override |
Handles generic events such as tooltip and theme updates.
| [in] | event | The event to handle. |
References event().
Referenced by event(), paintEvent(), and wheelEvent().
|
overrideprivatevirtual |
Handles focus-in events to begin editing state.
| [in] | e | The focus event. |
|
overrideprivatevirtual |
Handles focus-out events to finalize editing.
| [in] | e | The focus event. |
| void QCustomLineEdit::forceValue | ( | const StringView & | forced_value | ) |
Ignores validation steps, password encoding, etc.
The value will be this
|
inline |
Returns the current value converted to the requested type.
Definition at line 482 of file QCustomLineEdit.h.
References getValue().
|
inline |
Returns the current value converted to the requested type.
| [in] | allow_placeholder | Whether to use the placeholder value if the field is empty. |
Definition at line 473 of file QCustomLineEdit.h.
References getValue().
Referenced by DesignObjectStringWidget::setNDPO(), and setup().
|
inline |
Returns the current value as an Angle in internal representation.
| [in] | allow_placeholder | Whether to use the placeholder value if the field is empty. |
Definition at line 349 of file QCustomLineEdit.h.
References getUnitValue(), and INTERNAL_ANGLE.
| fltp08 QCustomLineEdit::getUnitValue | ( | bool | allow_placeholder = true | ) | const |
Returns the current value as a floating-point number in user-facing units.
| [in] | allow_placeholder | Whether to use the placeholder value if the field is empty. |
Referenced by getUnitAngle(), and setup().
| String QCustomLineEdit::getValue | ( | ) | const |
Returns the current text value of the line edit.
| String QCustomLineEdit::getValue | ( | bool | allow_placeholder | ) | const |
Returns the current text value of the line edit.
| [in] | allow_placeholder | Whether to return the placeholder value if the field is empty. |
Referenced by getAs(), getAs(), DesignObjectSearchWidget::getObjectsBeginningWithSearch(), and DesignObjectSearchWidget::getObjectsContainingSearch().
| bool QCustomLineEdit::hasUserFocus | ( | ) | const |
Returns whether the line edit currently has user focus (keyboard or touch).
Referenced by setValue().
| const TranslatedString & QCustomLineEdit::inputHint | ( | ) | const |
Returns the current input hint text.
|
inline |
Returns whether the line edit is currently editable.
Definition at line 263 of file QCustomLineEdit.h.
| bool QCustomLineEdit::isEditing | ( | ) | const |
Returns whether the user is currently editing this line edit.
| bool QCustomLineEdit::isPassword | ( | ) | const |
Returns whether this line edit is in password mode.
| bool QCustomLineEdit::isValid | ( | ) | const |
Returns whether the current text passes validation.
|
override |
Returns the minimum size hint for layout purposes.
|
overrideprivatevirtual |
Handles mouse press events to initiate editing or show the keypad.
| [in] | e | The mouse event. |
|
overrideprivate |
| const String & QCustomLineEdit::passwordEncoder | ( | ) | const |
Returns the password encoder string used for cross-session password storage.
| void QCustomLineEdit::setAllowPlaceholderAsValue | ( | bool | allow | ) |
Sets whether the placeholder text should be treated as a valid value when the field is empty.
| [in] | allow | Whether to allow the placeholder as a value. |
Referenced by DesignObjectStringWidget::DesignObjectStringWidget(), and setPlaceholderValue().
|
inline |
Sets whether the tooltip should automatically update to show the current value.
| [in] | auto_show_tooltip | Whether to enable automatic tooltip updates. |
Definition at line 610 of file QCustomLineEdit.h.
| void QCustomLineEdit::setBackgroundColor | ( | const RGBColor & | color | ) |
Sets the background color of the line edit.
| [in] | color | The background color to apply. |
| void QCustomLineEdit::setBold | ( | bool | is_bold | ) |
Sets whether the line edit text is rendered in bold.
| [in] | is_bold | Whether the text should be bold. |
| void QCustomLineEdit::setConstantUnit | ( | const ConstPointer< Unit > & | unit, |
| uint01 | dimension = Constant< uint01 >::Invalid ) |
Sets a constant unit for value formatting and conversion.
| [in] | unit | The constant unit pointer to use. |
| [in] | dimension | The specific unit dimension, or Invalid for default. |
| void QCustomLineEdit::setCustomUnit | ( | const StringView & | unit, |
| UnitCategory | fallback_unit, | ||
| uint01 | dimension = Constant< uint01 >::Invalid ) |
Sets a custom unit string with a fallback unit category.
| [in] | unit | The custom unit string. |
| [in] | fallback_unit | The fallback unit category if the custom unit is not recognized. |
| [in] | dimension | The specific unit dimension, or Invalid for default. |
| void QCustomLineEdit::setEditable | ( | bool | editable | ) |
Sets whether the line edit is editable by the user.
| [in] | editable | Whether the line edit should be editable. |
| void QCustomLineEdit::setFontMultiplier | ( | fltp04 | font_multiplier | ) |
Sets a multiplier applied to the base font size.
| [in] | font_multiplier | The font size multiplier. |
| void QCustomLineEdit::setInputHint | ( | const TranslatedString & | hint | ) |
Sets an input hint displayed to guide the user on expected input.
| [in] | hint | The hint text to display. |
| void QCustomLineEdit::setIsPassword | ( | bool | is_password, |
| const StringView & | encoder = StringView() ) |
Sets this widget to be a password.
No input will be logged, and data will be stored as a PasswordString.
| [in] | is_password | Whether or not the LineEdit should be treated as a password. |
| [in] | encoder | A special encoder in case the password should be used across sessions. |
| void QCustomLineEdit::setPlaceholderText | ( | const QString & | value | ) |
Sets the placeholder text displayed when the field is empty.
| [in] | value | The placeholder text. |
Referenced by DesignObjectSearchWidget::DesignObjectSearchWidget(), and setPlaceholderValue().
| void QCustomLineEdit::setPlaceHolderUnitValue | ( | fltp08 | value | ) |
Sets the placeholder value as a floating-point number in user-facing units.
| [in] | value | The placeholder unit value. |
|
inline |
Sets a placeholder value displayed when the field is empty.
| [in] | input_value | The placeholder value to display. |
| [in] | allow_placeholder_as_value | Whether the placeholder counts as a valid value. |
Definition at line 557 of file QCustomLineEdit.h.
References StringView::getAs(), setAllowPlaceholderAsValue(), and setPlaceholderText().
| void QCustomLineEdit::setPlaceholderValue | ( | const TranslatedString & | input_value, |
| bool | allow_placeholder_as_value = true ) |
Sets a translated placeholder value displayed when the field is empty.
| [in] | input_value | The translated placeholder value. |
| [in] | allow_placeholder_as_value | Whether the placeholder counts as a valid value. |
|
inline |
Sets a custom regex pattern for input validation.
| [in] | regex | The regex pattern string. |
Definition at line 375 of file QCustomLineEdit.h.
| void QCustomLineEdit::setStep | ( | fltp08 | step | ) |
Sets the step increment used when scrolling or using arrow keys on numeric values.
| [in] | step | The step increment value. |
|
virtual |
Sets the display title for the line edit, used as a label or placeholder context.
| [in] | title | The title to display. |
Reimplemented in DesignObjectStringWidget.
Referenced by DesignObjectStringWidget::setTitle(), and setup().
| void QCustomLineEdit::setToolTip | ( | const TranslatedString & | tooltip | ) |
Sets the tooltip text for the line edit.
| [in] | tooltip | The tooltip text to display. |
| void QCustomLineEdit::setUnitType | ( | UnitCategory | unit, |
| uint01 | dimension = Constant< uint01 >::Invalid ) |
Sets the unit type used for value formatting and conversion.
| [in] | unit | The unit category to use. |
| [in] | dimension | The specific unit dimension, or Invalid for default. |
|
inline |
Sets the value as an angle, converting to internal representation first.
| [in] | value | The angle value to set. |
Definition at line 329 of file QCustomLineEdit.h.
References setUnitValue().
Referenced by setUnitValue(), and setup().
| void QCustomLineEdit::setUnitValue | ( | fltp08 | value | ) |
Sets the value as a floating-point number in user-facing units.
| [in] | value | The unit value to set. |
|
inline |
Sets up the line edit from an ApplicationOption, using its label and resource.
| [in] | option | The application option to bind to. |
Definition at line 403 of file QCustomLineEdit.h.
References ApplicationOption< t_type >::getResource(), ApplicationOption< t_type >::label(), and setup().
|
inline |
Sets up the line edit for a specific type with a title, configuring validation accordingly.
| [in] | title | The display title for the line edit. |
Definition at line 364 of file QCustomLineEdit.h.
References GetTypeInfo(), StringStream< t_type >::getValidRegex(), and setTitle().
| void QCustomLineEdit::setup | ( | const TranslatedString & | title, |
| const TypeInfo & | type ) |
Sets up the line edit with a title and type info for validation.
| [in] | title | The display title. |
| [in] | type | The type information for validation. |
| void QCustomLineEdit::setup | ( | const TranslatedString & | title, |
| Resource< String > & | resource ) |
Sets up the line edit bound to a String resource with a title.
| [in] | title | The display title. |
| [in] | resource | The string resource to bind to. |
|
inline |
Sets up two-way binding between this line edit and a Resource.
When the line edit value changes, the resource is updated. When the resource changes externally, the line edit display is updated.
| [in] | title | The display title for the line edit. |
| [in] | resource | The resource to bind to. |
Definition at line 416 of file QCustomLineEdit.h.
References ResourceBase::addListener(), customValidator(), editingFinishedSignal(), Resource< T >::get(), getAs(), getUnitValue(), Resource< T >::set(), setUnitValue(), setup(), and setValue().
| void QCustomLineEdit::setup | ( | const TranslatedString & | title, |
| UnitCategory | unit_type, | ||
| uint01 | dim = Constant< uint01 >::Invalid ) |
Sets up the line edit with a title and unit type.
| [in] | title | The display title. |
| [in] | unit_type | The unit category for formatting. |
| [in] | dim | The unit dimension, or Invalid for default. |
| void QCustomLineEdit::setup | ( | GenericOption & | option | ) |
Sets up the line edit from a GenericOption, binding title, type, and resource.
| [in] | option | The generic option to bind to. |
Sets up the line edit bound to a String resource, using the resource name as the title.
| [in] | resource | The string resource to bind to. |
Sets the value from an Angle<fltp08>.
| [in] | input_value | The angle value to set. |
Definition at line 537 of file QCustomLineEdit.h.
References setValue().
Sets the value from an Angle<sint04>.
| [in] | input_value | The angle value to set. |
Definition at line 529 of file QCustomLineEdit.h.
References setValue().
| void QCustomLineEdit::setValue | ( | const PasswordString & | input_value | ) |
Sets the value from a PasswordString.
| [in] | input_value | The password value to set. |
| void QCustomLineEdit::setValue | ( | const StringView & | input_value | ) |
Sets the value from a StringView.
| [in] | input_value | The string value to set. |
|
inline |
Sets the value from a numeric type, applying unit formatting if configured.
| [in] | input_value | The numeric value to set. |
Definition at line 491 of file QCustomLineEdit.h.
References hasUserFocus(), and IsValid().
Referenced by setup(), setValue(), and setValue().
| void QCustomLineEdit::setValue | ( | const TimeSpan & | input_value | ) |
Sets the value from a TimeSpan.
| [in] | input_value | The time span value to set. |
| void QCustomLineEdit::setValue | ( | const TranslatedString & | input_value | ) |
Sets the value from a TranslatedString.
| [in] | input_value | The translated string value to set. |
|
override |
Returns the recommended size for the line edit.
| void QCustomLineEdit::startUserEdit | ( | bool | select_all = true | ) |
Begins user editing of the line edit, optionally selecting all text.
| [in] | select_all | Whether to select all text when entering edit mode. |
|
static |
Returns whether the touch keypad should be used for input.
|
override |