Skip to main content

QCustomInput

QCustomInput

A modern text input with design-token variants and sizes.

Replaces hand-crafted QLineEdit styling with a tokenized API:

  • variant: "primary" | "secondary" | "outline" (default) | "ghost"
  • sizeVariant: "sm" | "md" (default) | "lg"
  • state: "default" | "focused" | "error" | "disabled"

Works seamlessly with QCustomForm fields.

At a glance

TierFree (GPLv3)
Importfrom Custom_Widgets.QCustomInput import QCustomInput
Qt DesignerYes — drag it from the palette

Quick start

from Custom_Widgets.QCustomInput import QCustomInput

widget = QCustomInput()

Dark theme

Colours come from the design tokens, so the widget follows the app theme with no extra work.

QCustomInput in dark theme

Properties

Every property below is settable in code and in Qt Designer.

PropertyTypeDefault
inputMaskstring
textstring
maxLengthint
framebool
echoModeQLineEdit::EchoMode
displayTextstring
cursorPositionint
alignmentQFlags<Qt::AlignmentFlag>
modifiedbool
hasSelectedTextbool
selectedTextstring
dragEnabledbool
readOnlybool
undoAvailablebool
redoAvailablebool
acceptableInputbool
placeholderTextstring
cursorMoveStyleQt::CursorMoveStyle
clearButtonEnabledbool
variantenum: primary/secondary/outline/ghost``outline
sizeVariantenum: sm/md/lg``md
statestring

Methods

MethodDescription
setError(error_text=None)Set the input to error state and optionally show an error message.
sizeVariant(*args, **kwargs)Size variant.
state(*args, **kwargs)State.
variant(*args, **kwargs)Variant.

Theming

Colours come from the design tokens, so they follow the active theme. Roles used: surface, on-surface, outline, focus-ring, accent.

See Design tokens.

QCustomButtonGroup · QCustomCheckBox · QCustomColorPicker · QCustomComboBox · QCustomDateEdit · QCustomDateRangePicker · QCustomEmojiPicker · QCustomFileDropZone