NDEVR
API Documentation
DesignObjectStringWidget

A widget allowing easy access to change the properties of a designObject by taking user string input. More...

Inheritance diagram for DesignObjectStringWidget:
[legend]
Collaboration diagram for DesignObjectStringWidget:
[legend]

Public Member Functions

 DesignObjectStringWidget (QWidget *parent=nullptr)
 Constructs a DesignObjectStringWidget for editing a string property of a design object.
void clearTarget ()
 Clears the current target design object.
void setNDPO (NDPO property)
 Sets the design object property to edit and updates validation rules accordingly.
void setTarget (const DynamicPointer< QTDesignObject > &object)
 Sets the target design object, connecting update and deletion signals.
void setTarget (NDPO property, const DynamicPointer< QTDesignObject > &object)
 Sets both the target design object and the property to edit.
void setTitle (const TranslatedString &title) override
 Sets the display title, falling back to the property or metadata name if empty.
void setupForMetadata (const StringView &metadata)
 Configures this widget to edit a specific metadata key.
void setupForMetadata (TranslatedString title, const StringView &metadata)
 Configures this widget to edit a specific metadata key with a custom title.
Public Member Functions inherited from QCustomLineEdit
 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.
QCustomValidatorcustomValidator ()
 Returns a mutable reference to the custom validator used for input validation.
const QCustomValidatorcustomValidator () 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 TranslatedStringinputHint () 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 StringpasswordEncoder () 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 &regex)
 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.
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.

Protected Member Functions

void onObjectDeletedSlot ()
 Slot called when the target design object is deleted, clearing the target.
void onObjectUpdatedSlot ()
 Slot called when the target design object is updated, refreshing the displayed value.
void sendCommand ()
 Sends the edited value as a command to the target design object.

Protected Attributes

String m_meta_data
 The metadata key when editing metadata properties.
NDPO m_property
 The design object property being edited.
DynamicPointer< QTDesignObjectm_target
 The target design object.
Protected Attributes inherited from QCustomLineEdit
TranslatedString m_title
 The display title for the line edit.
TranslatedString m_tooltip
 The tooltip text.

Additional Inherited Members

Static Public Member Functions inherited from QCustomLineEdit
static bool UseKeypad ()
 Returns whether the touch keypad should be used for input.

Detailed Description

A widget allowing easy access to change the properties of a designObject by taking user string input.


Definition at line 42 of file DesignObjectStringWidget.h.

Constructor & Destructor Documentation

◆ DesignObjectStringWidget()

DesignObjectStringWidget::DesignObjectStringWidget ( QWidget * parent = nullptr)
inline

Constructs a DesignObjectStringWidget for editing a string property of a design object.

Parameters
[in]parentThe parent widget.

Definition at line 50 of file DesignObjectStringWidget.h.

References QCustomLineEdit::QCustomLineEdit(), QCustomLineEdit::customValidator(), QCustomLineEdit::editingFinishedSignal(), m_property, property_size, sendCommand(), and QCustomLineEdit::setAllowPlaceholderAsValue().

Member Function Documentation

◆ setNDPO()

void DesignObjectStringWidget::setNDPO ( NDPO property)
inline

Sets the design object property to edit and updates validation rules accordingly.

Parameters
[in]propertyThe NDPO property to bind to.

Definition at line 101 of file DesignObjectStringWidget.h.

References QCustomLineEdit::customValidator(), String::DisplayString(), file, RegexFunctions::FileRegex(), QCustomLineEdit::getAs(), m_meta_data, m_property, QCustomLineEdit::m_title, meta_data, and onObjectUpdatedSlot().

Referenced by setTarget(), setupForMetadata(), and setupForMetadata().

◆ setTarget() [1/2]

void DesignObjectStringWidget::setTarget ( const DynamicPointer< QTDesignObject > & object)
inline

Sets the target design object, connecting update and deletion signals.

Parameters
[in]objectThe design object to edit.

Definition at line 79 of file DesignObjectStringWidget.h.

References QTDesignObject::deletedSignal(), m_target, onObjectDeletedSlot(), onObjectUpdatedSlot(), and QTDesignObject::updatedSignal().

◆ setTarget() [2/2]

void DesignObjectStringWidget::setTarget ( NDPO property,
const DynamicPointer< QTDesignObject > & object )
inline

Sets both the target design object and the property to edit.

Parameters
[in]propertyThe NDPO property to bind to.
[in]objectThe design object to edit.

Definition at line 70 of file DesignObjectStringWidget.h.

References setNDPO(), and setTarget().

Referenced by clearTarget(), onObjectDeletedSlot(), and setTarget().

◆ setTitle()

void DesignObjectStringWidget::setTitle ( const TranslatedString & title)
inlineoverridevirtual

Sets the display title, falling back to the property or metadata name if empty.

Parameters
[in]titleThe translated title to display.

Reimplemented from QCustomLineEdit.

Definition at line 146 of file DesignObjectStringWidget.h.

References TranslatedString::DirectString(), String::DisplayString(), m_meta_data, m_property, QCustomLineEdit::m_title, meta_data, and QCustomLineEdit::setTitle().

◆ setupForMetadata() [1/2]

void DesignObjectStringWidget::setupForMetadata ( const StringView & metadata)
inline

Configures this widget to edit a specific metadata key.

Parameters
[in]metadataThe metadata key to edit.

Definition at line 137 of file DesignObjectStringWidget.h.

References m_meta_data, meta_data, and setNDPO().

◆ setupForMetadata() [2/2]

void DesignObjectStringWidget::setupForMetadata ( TranslatedString title,
const StringView & metadata )
inline

Configures this widget to edit a specific metadata key with a custom title.

Parameters
[in]titleThe display title for the widget.
[in]metadataThe metadata key to edit.

Definition at line 127 of file DesignObjectStringWidget.h.

References m_meta_data, QCustomLineEdit::m_title, meta_data, and setNDPO().


The documentation for this class was generated from the following file: