# eric7.EricNetwork.EricIPv4InputWidget

Module implementing a widget to enter an IPv4 address.

### Global Attributes

None

### Classes

EricIPv4InputWidget | Class implementing a widget to enter an IPv4 address.

### Functions

None

## EricIPv4InputWidget

Class implementing a widget to enter an IPv4 address.

### Signals

addressChanged()
  emitted to indicate a change of the entered IPv4 address

### Derived from

QWidget, Ui_EricIPv4InputWidget

### Class Attributes

None

### Class Methods

None

### Methods

EricIPv4InputWidget | Constructor
__clear | Private slot to handle the clear button press.
address | Public method to get the IPv4 address as an ipaddress.IPv4Address object.
clear | Public slot to clear the input fields.
eventFilter | Public method to filter pressing '.' to give focus to the next input field.
hasAcceptableInput | Public method to check, if the input is acceptable.
setAddress | Public method to set the IPv4 address given an ipaddress.IPv4Address object.
setText | Public method to set the IPv4 address given a string.
text | Public method to get the IPv4 address as a string.

### Static Methods

None

#### EricIPv4InputWidget (Constructor)

EricIPv4InputWidget(parent=None)

Constructor

parent (QWidget (optional))
  reference to the parent widget (defaults to None)

#### EricIPv4InputWidget.__clear

__clear()

Private slot to handle the clear button press.

#### EricIPv4InputWidget.address

address()

Public method to get the IPv4 address as an ipaddress.IPv4Address object.

Return:
  IPv4 address

Return Type:
  ipaddress.IPv4Address

Raises ValueError:
  raised to indicate an invalid IPv4 address

#### EricIPv4InputWidget.clear

clear()

Public slot to clear the input fields.

#### EricIPv4InputWidget.eventFilter

eventFilter(obj, evt)

Public method to filter pressing '.' to give focus to the next input field.

obj (QObject)
  reference to the object
evt (QEvent)
  reference to the event object

Return:
  flag indicating, that the event was handled

Return Type:
  bool

#### EricIPv4InputWidget.hasAcceptableInput

hasAcceptableInput()

Public method to check, if the input is acceptable.

Return:
  flag indicating acceptable input

Return Type:
  bool

#### EricIPv4InputWidget.setAddress

setAddress(address)

Public method to set the IPv4 address given an ipaddress.IPv4Address object.

address (ipaddress.IPv4Address)
  IPv4 address

Raises ValueError:
  raised to indicate an invalid IPv4 address

#### EricIPv4InputWidget.setText

setText(address)

Public method to set the IPv4 address given a string.

Note: If an invalid address is given, the input is cleared.

address (str)
  IPv4 address

#### EricIPv4InputWidget.text

text()

Public method to get the IPv4 address as a string.

Return:
  IPv4 address

Return Type:
  str

Up