NDEVR
API Documentation
IPWidget

A simple widget for entering in an IP address. More...

Public Member Functions

 IPWidget (QWidget *parent=nullptr)
 Constructs an IPWidget with four edit fields for each octet of an IPv4 address.
String address () const
 Returns the full IP address string assembled from the four edit fields.
bool checkIfValid () const
 Checks whether all four octet fields contain valid values.
void clear ()
 Clears all four octet edit fields.
QCustomLineEditeditBox (uint04 index) const
 Returns the QCustomLineEdit for the given octet index.
void editedSignal (QLineEdit *pEdit)
 Signal emitted when an edit field has been modified by the user.
void setAddress (const StringView &address)
 Sets the IP address by parsing a dot-separated string into the four edit fields.
QSize sizeHint () const
 Returns the recommended size for this widget.
void slotTextChanged (QLineEdit *pEdit)
 Slot invoked when the text in an edit field changes, handling auto-advance between octets.

Detailed Description

A simple widget for entering in an IP address.


Multiple QCustomLineEdits allow the user to enter in the parts of the IP connection.

Definition at line 14 of file IPWidget.h.

Constructor & Destructor Documentation

◆ IPWidget()

IPWidget::IPWidget ( QWidget * parent = nullptr)

Constructs an IPWidget with four edit fields for each octet of an IPv4 address.

Parameters
[in]parentThe parent widget.

References IPWidget().

Referenced by IPWidget().

Member Function Documentation

◆ address()

String IPWidget::address ( ) const

Returns the full IP address string assembled from the four edit fields.

Returns
The IP address as a dot-separated String (e.g., "192.168.1.1").

Referenced by setAddress().

◆ checkIfValid()

bool IPWidget::checkIfValid ( ) const

Checks whether all four octet fields contain valid values.

Returns
True if the IP address is valid, false otherwise.

◆ editBox()

QCustomLineEdit * IPWidget::editBox ( uint04 index) const
inline

Returns the QCustomLineEdit for the given octet index.

Parameters
[in]indexThe octet index (0-3).
Returns
A pointer to the QCustomLineEdit at the specified index.

Definition at line 38 of file IPWidget.h.

◆ editedSignal()

void IPWidget::editedSignal ( QLineEdit * pEdit)

Signal emitted when an edit field has been modified by the user.

Parameters
[in]pEditThe line edit that was edited.

◆ setAddress()

void IPWidget::setAddress ( const StringView & address)

Sets the IP address by parsing a dot-separated string into the four edit fields.

Parameters
[in]addressThe IP address string to parse.

References address().

◆ sizeHint()

QSize IPWidget::sizeHint ( ) const

Returns the recommended size for this widget.

Returns
The size hint as a QSize.

◆ slotTextChanged()

void IPWidget::slotTextChanged ( QLineEdit * pEdit)

Slot invoked when the text in an edit field changes, handling auto-advance between octets.

Parameters
[in]pEditThe line edit that was modified.

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