QNodeEditor.widgets.text_box.TextBox#

class QNodeEditor.widgets.text_box.TextBox(name: str = '', parent: ~PyQt5.QtWidgets.QWidget = None, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>)#

Bases: QWidget

Widget with a string value that allows for text inputs.

The text box by default is a line edit. The widget can switch to a label displaying the widget name instead (used when an edge is connected to an entry with this widget).

Properties

completer

Get or set whether the completer that is used in the QLineEdit

editing(bool)

Signal that emits when the user starts/stops editing the line edit

input_mask

Get or set whether the input mask that is used in the QLineEdit

max_length

Get or set whether the maximum length that is used in the QLineEdit

name

Get or set the text box name

show_clear_button

Get or set whether the line edit should show a clear all button when not empty.

theme

Get or set the text box theme

validator

Get or set whether the validator that is used in the QLineEdit

value

Get or set the current value.

value_changed(QString)

Signal that emits the box value if it changed

Methods

__init__

Create a new text box.

create_layout

Create the layout of the text box with a stacked layout.

enterEvent

Change the line edit style when the mouse hover enters it.

leaveEvent

Change the line edit style when the mouse hover leaves it.

set_label_only

Hide/show the text box and hide/show only the label instead.

update_editing_signal

Update the editing signal of the text box when focus enters/leaves the line edit.

update_style

Update the style of the line edit based on the current properties.

__init__(name: str = '', parent: ~PyQt5.QtWidgets.QWidget = None, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>)#

Create a new text box.

Parameters:
  • name (str, optional) – Name of the text box

  • parent (QWidget, optional) – Parent widget (if any)

  • theme (Type[Theme], optional) – Theme for the text box (default: DarkTheme)

create_layout() None#

Create the layout of the text box with a stacked layout.

The first page of the stacked layout contains the line edit, the second page contains only a label. These can be switched between when an entry is connected to another node.

Return type:

None

enterEvent(_) None#

Change the line edit style when the mouse hover enters it.

Return type:

None

leaveEvent(_) None#

Change the line edit style when the mouse hover leaves it.

Return type:

None

set_label_only(label_only: bool) None#

Hide/show the text box and hide/show only the label instead.

Parameters:

label_only (bool) – Whether to only show the name label

Return type:

None

update_editing_signal(has_focus: bool) None#

Update the editing signal of the text box when focus enters/leaves the line edit.

Parameters:

has_focus (bool) – Whether the line edit has focus

Return type:

None

update_style() None#

Update the style of the line edit based on the current properties.

Return type:

None

property completer: QCompleter | None#

Get or set whether the completer that is used in the QLineEdit

editing(bool): Signal#

Signal that emits when the user starts/stops editing the line edit

Type:

Signal

property input_mask: str#

Get or set whether the input mask that is used in the QLineEdit

property max_length: int#

Get or set whether the maximum length that is used in the QLineEdit

property name: str#

Get or set the text box name

property show_clear_button: bool#

Get or set whether the line edit should show a clear all button when not empty.

property theme: Type[Theme]#

Get or set the text box theme

property validator: QValidator | None#

Get or set whether the validator that is used in the QLineEdit

property value: str#

Get or set the current value.

value_changed(QString): Signal#

Signal that emits the box value if it changed

Type:

Signal