Input Widgets¶
Text input widgets with auto-completion, password management, search history, and tab sanitization.
AutoCompleteInput¶
A QLineEdit subclass with a built-in QCompleter powered by a configurable list of string suggestions.
Constructor parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
parent |
QWidget \| None |
None |
Parent widget |
suggestions |
list[str] \| None |
None |
Initial list of completion candidates |
case_sensitive |
bool |
False |
Whether completion matching is case-sensitive |
filter_mode |
Qt.MatchFlag |
Qt.MatchFlag.MatchContains |
How typed text is matched against suggestions |
completion_mode |
QCompleter.CompletionMode |
QCompleter.CompletionMode.PopupCompletion |
How completions are presented |
Properties:
| Property | Type | Description |
|---|---|---|
suggestions |
list[str] |
Gets or sets the full list of completion candidates (returns a copy) |
case_sensitive |
bool |
Gets or sets case-sensitivity of matching |
filter_mode |
Qt.MatchFlag |
Gets or sets the filter mode |
completion_mode |
QCompleter.CompletionMode |
Gets or sets the completion mode |
Methods:
| Method | Signature | Description |
|---|---|---|
addSuggestion() |
(suggestion: str) -> None |
Adds a candidate if it is not already present |
removeSuggestion() |
(suggestion: str) -> None |
Removes a candidate if it exists |
clearSuggestions() |
() -> None |
Removes all candidates |
refreshStyle() |
() -> None |
Re-applies the QSS stylesheet |
Example:
from PySide6.QtWidgets import QApplication
from ezqt_widgets import AutoCompleteInput
app = QApplication([])
inp = AutoCompleteInput(
suggestions=["Python", "PySide6", "Qt", "PyQt6"],
case_sensitive=False,
)
inp.addSuggestion("Rust")
inp.show()
app.exec()
AutoCompleteInput
¶
AutoCompleteInput(parent: WidgetParent = None, suggestions: list[str] | None = None, case_sensitive: bool = False, filter_mode: MatchFlag = MatchContains, completion_mode: CompletionMode = PopupCompletion, *args: Any, **kwargs: Any)
Bases: QLineEdit
QLineEdit subclass with autocompletion support.
Provides a text input widget with autocompletion functionality. You can provide a list of suggestions (strings) to be used for autocompletion.
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The parent widget (default: None).
TYPE:
|
suggestions
|
List of strings to use for autocompletion (default: empty list).
TYPE:
|
case_sensitive
|
Whether the autocompletion is case sensitive (default: False).
TYPE:
|
filter_mode
|
Filter mode for completion (default: Qt.MatchFlag.MatchContains).
TYPE:
|
completion_mode
|
Completion mode (default: QCompleter.CompletionMode.PopupCompletion).
TYPE:
|
*args
|
Additional arguments passed to QLineEdit.
TYPE:
|
**kwargs
|
Additional keyword arguments passed to QLineEdit.
TYPE:
|
Properties
suggestions: Get or set the list of suggestions for autocompletion. case_sensitive: Get or set whether autocompletion is case sensitive. filter_mode: Get or set the filter mode for completion. completion_mode: Get or set the completion mode.
Example
from ezqt_widgets import AutoCompleteInput inp = AutoCompleteInput(suggestions=["Alice", "Bob", "Charlie"]) inp.case_sensitive = False inp.suggestions = ["Alice", "Bob", "Charlie", "Dave"] inp.show()
Initialize the auto-complete input.
Source code in src/ezqt_widgets/widgets/input/auto_complete_input.py
suggestions
property
writable
¶
Get the list of suggestions.
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
A copy of the current suggestions list. |
case_sensitive
property
writable
¶
Get whether autocompletion is case sensitive.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if case sensitive, False otherwise. |
filter_mode
property
writable
¶
Get the filter mode for completion.
| RETURNS | DESCRIPTION |
|---|---|
MatchFlag
|
The current filter mode. |
completion_mode
property
writable
¶
Get the completion mode.
| RETURNS | DESCRIPTION |
|---|---|
CompletionMode
|
The current completion mode. |
addSuggestion
¶
Add a suggestion to the list.
| PARAMETER | DESCRIPTION |
|---|---|
suggestion
|
The suggestion string to add.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/auto_complete_input.py
removeSuggestion
¶
Remove a suggestion from the list.
| PARAMETER | DESCRIPTION |
|---|---|
suggestion
|
The suggestion string to remove.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/auto_complete_input.py
clearSuggestions
¶
refreshStyle
¶
Refresh the widget's style.
Useful after dynamic stylesheet changes.
PasswordInput¶
A QWidget containing a QLineEdit in password mode, an optional colored strength bar, and a visibility-toggle icon.
Signals:
| Signal | Signature | Emitted when |
|---|---|---|
strengthChanged |
(int) |
The password text changes; value is the new strength score (0–100) |
iconClicked |
() |
The visibility-toggle icon is clicked |
Constructor parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
parent |
QWidget \| None |
None |
Parent widget |
show_strength |
bool |
True |
Whether to display the strength progress bar |
strength_bar_height |
int |
3 |
Height of the strength bar in pixels |
show_icon |
QIcon \| QPixmap \| str \| None |
icons8 URL | Icon displayed when the password is hidden (eye-open) |
hide_icon |
QIcon \| QPixmap \| str \| None |
icons8 URL | Icon displayed when the password is visible (eye-closed) |
icon_size |
QSize \| tuple[int, int] |
QSize(16, 16) |
Size of the toggle icon |
Properties:
| Property | Type | Description |
|---|---|---|
password |
str |
Gets or sets the raw password text |
show_strength |
bool |
Gets or sets strength bar visibility |
strength_bar_height |
int |
Gets or sets the bar height in pixels (minimum 1) |
show_icon |
QIcon \| None |
Gets or sets the icon shown when password is hidden |
hide_icon |
QIcon \| None |
Gets or sets the icon shown when password is visible |
icon_size |
QSize |
Gets or sets the toggle icon size |
Methods:
| Method | Signature | Description |
|---|---|---|
togglePassword() |
() -> None |
Switches the echo mode and updates the toggle icon |
updateStrength() |
(text: str) -> None |
Recalculates the strength score and updates the bar |
refreshStyle() |
() -> None |
Triggers a repaint |
Strength score:
The score ranges from 0 to 100. Each criterion adds points:
| Criterion | Points |
|---|---|
| Length >= 8 | +25 |
| Contains uppercase letter | +15 |
| Contains lowercase letter | +15 |
| Contains digit | +20 |
| Contains special character | +25 |
Bar color by score: 0–29 red, 30–59 orange, 60–79 green, 80–100 dark green.
Example:
from PySide6.QtWidgets import QApplication
from ezqt_widgets import PasswordInput
app = QApplication([])
field = PasswordInput(show_strength=True, strength_bar_height=4)
field.strengthChanged.connect(lambda score: print(f"Strength: {score}/100"))
field.show()
app.exec()
PasswordInput
¶
PasswordInput(parent: QWidget | None = None, show_strength: bool = True, strength_bar_height: int = 3, show_icon: IconSourceExtended = SVG_EYE_OPEN, hide_icon: IconSourceExtended = SVG_EYE_CLOSED, icon_size: QSize | tuple[int, int] = QSize(16, 16), *args: Any, **kwargs: Any)
Bases: QWidget
Enhanced password input widget with integrated strength bar.
Features
- QLineEdit in password mode with integrated strength bar
- Right-side icon with click functionality
- Icon management system (ThemeIcon, QIcon, QPixmap, path, URL, SVG)
- Animated strength bar that fills the bottom border
- Signal strengthChanged(int) emitted on password change
- Color-coded strength indicator
- External QSS styling support with CSS variables
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The parent widget (default: None).
TYPE:
|
show_strength
|
Whether to show the password strength bar (default: True).
TYPE:
|
strength_bar_height
|
Height of the strength bar in pixels (default: 3).
TYPE:
|
show_icon
|
Icon for show password (ThemeIcon, QIcon, QPixmap, str, or None, default: URL to icons8.com).
TYPE:
|
hide_icon
|
Icon for hide password (ThemeIcon, QIcon, QPixmap, str, or None, default: URL to icons8.com).
TYPE:
|
icon_size
|
Size of the icon (QSize or tuple, default: QSize(16, 16)).
TYPE:
|
*args
|
Additional arguments passed to QWidget.
TYPE:
|
**kwargs
|
Additional keyword arguments passed to QWidget.
TYPE:
|
Properties
password: Get or set the password text. show_strength: Get or set whether to show the strength bar. strength_bar_height: Get or set the strength bar height. show_icon: Get or set the show password icon. hide_icon: Get or set the hide password icon. icon_size: Get or set the icon size.
Signals
strengthChanged(int): Emitted when password strength changes. iconClicked(): Emitted when the icon is clicked.
Initialize the password input widget.
Source code in src/ezqt_widgets/widgets/input/password_input.py
password
property
writable
¶
Get the password text.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current password text. |
show_strength
property
writable
¶
Get whether the strength bar is shown.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if strength bar is shown, False otherwise. |
strength_bar_height
property
writable
¶
Get the strength bar height.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current strength bar height in pixels. |
show_icon
property
writable
¶
Get the show password icon.
| RETURNS | DESCRIPTION |
|---|---|
QIcon | None
|
The current show password icon, or None if not set. |
hide_icon
property
writable
¶
Get the hide password icon.
| RETURNS | DESCRIPTION |
|---|---|
QIcon | None
|
The current hide password icon, or None if not set. |
icon_size
property
writable
¶
Get the icon size.
| RETURNS | DESCRIPTION |
|---|---|
QSize
|
The current icon size. |
togglePassword
¶
Toggle password visibility.
Source code in src/ezqt_widgets/widgets/input/password_input.py
updateStrength
¶
Update password strength.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The password text to evaluate.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/password_input.py
setTheme
¶
Update all icons' color for the given theme.
Can be connected directly to a theme-change signal to keep icons in sync with the application's color scheme.
| PARAMETER | DESCRIPTION |
|---|---|
theme
|
The new theme (
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/password_input.py
refreshStyle
¶
SearchInput¶
A QLineEdit subclass that maintains a submission history navigable with the Up/Down arrow keys and emits searchSubmitted when the user presses Enter.
Signals:
| Signal | Signature | Emitted when |
|---|---|---|
searchSubmitted |
(str) |
The user presses Enter/Return; the text is also added to history |
Constructor parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
parent |
QWidget \| None |
None |
Parent widget |
max_history |
int |
20 |
Maximum number of history entries to keep |
search_icon |
QIcon \| QPixmap \| str \| None |
None |
Optional icon displayed in the field |
icon_position |
str |
"left" |
Icon position: "left" or "right" |
clear_button |
bool |
True |
Whether to show Qt's built-in clear button |
Properties:
| Property | Type | Description |
|---|---|---|
search_icon |
QIcon \| None |
Gets or sets the search icon |
icon_position |
str |
Gets or sets the icon position ("left" or "right") |
clear_button |
bool |
Gets or sets clear button visibility |
max_history |
int |
Gets or sets the history size limit |
Methods:
| Method | Signature | Description |
|---|---|---|
addToHistory() |
(text: str) -> None |
Adds a term to the front of history; ignores empty/whitespace-only strings |
getHistory() |
() -> list[str] |
Returns a copy of the current history list |
clearHistory() |
() -> None |
Empties the history and resets the navigation index |
setHistory() |
(history_list: list[str]) -> None |
Replaces history with the provided list, trimmed to max_history |
refreshStyle() |
() -> None |
Re-applies the QSS stylesheet |
Keyboard navigation:
| Key | Effect |
|---|---|
Enter / Return |
Submits current text, adds to history, emits searchSubmitted |
Up |
Navigates backward through history |
Down |
Navigates forward through history; restores current input at the end |
Example:
from PySide6.QtWidgets import QApplication
from ezqt_widgets import SearchInput
app = QApplication([])
search = SearchInput(max_history=10, clear_button=True)
search.setPlaceholderText("Type and press Enter...")
search.searchSubmitted.connect(lambda q: print(f"Search: {q}"))
search.show()
app.exec()
SearchInput
¶
SearchInput(parent: WidgetParent = None, max_history: int = 20, search_icon: IconSourceExtended = None, icon_position: str = 'left', clear_button: bool = True, *args: Any, **kwargs: Any)
Bases: QLineEdit
QLineEdit subclass for search input with integrated history.
Features
- Maintains a history of submitted searches
- Navigate history with up/down arrows
- Emits a searchSubmitted(str) signal on validation (Enter)
- Optional search icon (left or right)
- Optional clear button
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The parent widget (default: None).
TYPE:
|
max_history
|
Maximum number of history entries to keep (default: 20).
TYPE:
|
search_icon
|
Icon to display as search icon (ThemeIcon, QIcon, QPixmap, str, or None, default: None).
TYPE:
|
icon_position
|
Icon position, 'left' or 'right' (default: 'left').
TYPE:
|
clear_button
|
Whether to show a clear button (default: True).
TYPE:
|
*args
|
Additional arguments passed to QLineEdit.
TYPE:
|
**kwargs
|
Additional keyword arguments passed to QLineEdit.
TYPE:
|
Properties
search_icon: Get or set the search icon. icon_position: Get or set the icon position ('left' or 'right'). clear_button: Get or set whether the clear button is shown. max_history: Get or set the maximum history size.
Signals
searchSubmitted(str): Emitted when a search is submitted (Enter key).
Example
from ezqt_widgets import SearchInput search = SearchInput(max_history=10, clear_button=True) search.searchSubmitted.connect(lambda q: print(f"Search: {q}")) search.setPlaceholderText("Type and press Enter...") search.show()
Initialize the search input.
Source code in src/ezqt_widgets/widgets/input/search_input.py
search_icon
property
writable
¶
Get the search icon.
| RETURNS | DESCRIPTION |
|---|---|
QIcon | None
|
The current search icon, or None if not set. |
icon_position
property
writable
¶
Get the icon position.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current icon position ('left' or 'right'). |
clear_button
property
writable
¶
Get whether the clear button is shown.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if clear button is shown, False otherwise. |
max_history
property
writable
¶
Get the maximum history size.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The maximum number of history entries. |
addToHistory
¶
Add a search term to history.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The search term to add.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/search_input.py
getHistory
¶
Get the search history.
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
A copy of the search history list. |
clearHistory
¶
setHistory
¶
Set the search history.
| PARAMETER | DESCRIPTION |
|---|---|
history_list
|
List of history entries to set.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/search_input.py
keyPressEvent
¶
Handle key press events.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
The key event.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/search_input.py
setTheme
¶
Update the search icon color for the given theme.
Can be connected directly to a theme-change signal to keep the icon in sync with the application's color scheme.
| PARAMETER | DESCRIPTION |
|---|---|
theme
|
The new theme (
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/search_input.py
refreshStyle
¶
Refresh the widget style.
Useful after dynamic stylesheet changes.
TabReplaceTextEdit¶
A QPlainTextEdit subclass that intercepts paste events and replaces tab characters with a configurable string. Useful for pasting tabular or CSV data.
Constructor parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
parent |
QWidget \| None |
None |
Parent widget |
tab_replacement |
str |
"\n" |
String substituted for each \t character |
sanitize_on_paste |
bool |
True |
Whether to sanitize text on paste |
remove_empty_lines |
bool |
True |
Whether to discard empty lines during sanitization |
preserve_whitespace |
bool |
False |
If True, keeps lines that contain only whitespace |
Properties:
| Property | Type | Description |
|---|---|---|
tab_replacement |
str |
Gets or sets the tab replacement string |
sanitize_on_paste |
bool |
Gets or sets whether sanitization is active on paste |
remove_empty_lines |
bool |
Gets or sets whether empty lines are removed |
preserve_whitespace |
bool |
Gets or sets whitespace-only line preservation |
Methods:
| Method | Signature | Description |
|---|---|---|
sanitizeText() |
(text: str) -> str |
Applies tab replacement and optional empty-line removal; returns the result |
refreshStyle() |
() -> None |
Re-applies the QSS stylesheet |
Behavior notes:
- Pressing the Tab key inserts
tab_replacementat the cursor (no focus change). - Paste events (Ctrl+V) are intercepted when
sanitize_on_pasteisTrueand route throughsanitizeText()before insertion.
Example:
from PySide6.QtWidgets import QApplication
from ezqt_widgets import TabReplaceTextEdit
app = QApplication([])
# Pasting "col1\tcol2\n\ncol3\tcol4" produces "col1;col2\ncol3;col4"
editor = TabReplaceTextEdit(
tab_replacement=";",
remove_empty_lines=True,
)
editor.show()
app.exec()
TabReplaceTextEdit
¶
TabReplaceTextEdit(parent: WidgetParent = None, tab_replacement: str = '\n', sanitize_on_paste: bool = True, remove_empty_lines: bool = True, preserve_whitespace: bool = False, *args: Any, **kwargs: Any)
Bases: QPlainTextEdit
QPlainTextEdit subclass with tab replacement and text sanitization.
Sanitizes pasted text by replacing tab characters according to the chosen mode and removing empty lines. Useful for pasting tabular data or ensuring clean input.
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The parent widget (default: None).
TYPE:
|
tab_replacement
|
The string to replace tab characters with (default: "\n").
TYPE:
|
sanitize_on_paste
|
Whether to sanitize pasted text (default: True).
TYPE:
|
remove_empty_lines
|
Whether to remove empty lines during sanitization (default: True).
TYPE:
|
preserve_whitespace
|
Whether to preserve leading/trailing whitespace (default: False).
TYPE:
|
*args
|
Additional arguments passed to QPlainTextEdit.
TYPE:
|
**kwargs
|
Additional keyword arguments passed to QPlainTextEdit.
TYPE:
|
Properties
tab_replacement: Get or set the string used to replace tab characters. sanitize_on_paste: Enable or disable sanitizing pasted text. remove_empty_lines: Get or set whether to remove empty lines. preserve_whitespace: Get or set whether to preserve whitespace.
Example
from ezqt_widgets import TabReplaceTextEdit editor = TabReplaceTextEdit(tab_replacement=";", remove_empty_lines=True) editor.setPlainText("alpha\tbeta\n\ngamma\tdelta")
Paste triggers sanitization; tabs become ";" and empty lines removed¶
editor.show()
Initialize the tab replace text edit.
Source code in src/ezqt_widgets/widgets/input/tab_replace_textedit.py
tab_replacement
property
writable
¶
Get the string used to replace tab characters.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current tab replacement string. |
sanitize_on_paste
property
writable
¶
Get whether sanitizing pasted text is enabled.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if sanitization is enabled, False otherwise. |
remove_empty_lines
property
writable
¶
Get whether empty lines are removed.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if empty lines are removed, False otherwise. |
preserve_whitespace
property
writable
¶
Get whether whitespace is preserved.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if whitespace is preserved, False otherwise. |
sanitizeText
¶
Sanitize text by replacing tabs and optionally removing empty lines.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The text to sanitize.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The sanitized text. |
Source code in src/ezqt_widgets/widgets/input/tab_replace_textedit.py
keyPressEvent
¶
Handle key press events.
Overridden method from QPlainTextEdit. Modifies the behavior of the paste operation and tab key handling.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
The key event.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/tab_replace_textedit.py
refreshStyle
¶
Refresh the widget's style.
Useful after dynamic stylesheet changes.
FilePickerInput¶
A composite QWidget combining a QLineEdit and a folder icon button that opens a QFileDialog for file or directory selection. Supports theme-aware icon rendering via ThemeIcon.
Signals:
| Signal | Signature | Emitted when |
|---|---|---|
fileSelected |
(str) |
A path is chosen via the dialog |
pathChanged |
(str) |
The text in the QLineEdit changes (every keystroke) |
Constructor parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
parent |
QWidget \| None |
None |
Parent widget |
placeholder |
str |
"Select a file..." |
Placeholder text for the QLineEdit |
mode |
"file" \| "directory" |
"file" |
Whether the dialog selects a file or a directory |
filter |
str |
"" |
File filter string, e.g. "Images (*.png *.jpg)" |
dialog_title |
str |
"" |
Window title for the QFileDialog; auto-set if empty |
Properties:
| Property | Type | Description |
|---|---|---|
path |
str |
Gets or sets the current path shown in the QLineEdit |
mode |
"file" \| "directory" |
Gets or sets the selection mode |
placeholder_text |
str |
Gets or sets the QLineEdit placeholder text |
filter |
str |
Gets or sets the file dialog filter string |
dialog_title |
str |
Gets or sets the file dialog window title |
Methods:
| Method | Signature | Description |
|---|---|---|
clear() |
() -> None |
Clears the current path from the QLineEdit |
setTheme() |
(theme: str) -> None |
Updates the folder icon color; connect to a themeChanged signal |
refreshStyle() |
() -> None |
Re-applies the QSS stylesheet |
Behavior notes:
fileSelectedis emitted only when the user picks a path via the dialog, not on manual text edits.pathChangedis emitted on every text change in theQLineEdit, including manual entry.- When
modeis"directory", the dialog default title is"Select Directory"; when"file", it is"Select File". Settingdialog_titleoverrides both defaults. - Passing an invalid value to
mode(neither"file"nor"directory") leaves the mode unchanged.
Example:
from PySide6.QtWidgets import QApplication
from ezqt_widgets import FilePickerInput
app = QApplication([])
picker = FilePickerInput(
placeholder="Choose a CSV file...",
mode="file",
filter="CSV files (*.csv)",
)
picker.fileSelected.connect(lambda p: print(f"Selected: {p}"))
picker.pathChanged.connect(lambda p: print(f"Path text: {p}"))
picker.show()
app.exec()
FilePickerInput
¶
FilePickerInput(parent: WidgetParent = None, *, placeholder: str = 'Select a file...', mode: Literal['file', 'directory'] = 'file', filter: str = '', dialog_title: str = '')
Bases: QWidget
Composite input widget combining a QLineEdit and a folder icon button.
Clicking the folder button opens a QFileDialog (file or directory mode). The selected path is displayed in the QLineEdit. The widget supports theme-aware icon rendering via ThemeIcon.
Features
- File or directory selection via QFileDialog
- Editable QLineEdit for manual path entry
- Theme-aware folder icon via ThemeIcon
- Signals for file selection and path text changes
- Configurable placeholder, filter, and dialog title
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The parent widget (default: None).
TYPE:
|
placeholder
|
Placeholder text for the QLineEdit (default: "Select a file...").
TYPE:
|
mode
|
Selection mode, either "file" or "directory" (default: "file").
TYPE:
|
filter
|
File filter string for QFileDialog, e.g. "Images (.png .jpg)" (default: "").
TYPE:
|
dialog_title
|
Title for the QFileDialog window (default: "").
TYPE:
|
Properties
path: Get or set the current file/directory path. mode: Get or set the selection mode ("file" or "directory"). placeholder_text: Get or set the QLineEdit placeholder text. filter: Get or set the file dialog filter string. dialog_title: Get or set the file dialog window title.
Signals
fileSelected(str): Emitted when a path is chosen via the dialog. pathChanged(str): Emitted on every text change in the QLineEdit.
Example
from ezqt_widgets import FilePickerInput picker = FilePickerInput(placeholder="Choose a CSV file...", ... filter="CSV files (*.csv)") picker.fileSelected.connect(lambda p: print(f"Selected: {p}")) picker.show()
Initialize the file picker input.
Source code in src/ezqt_widgets/widgets/input/file_picker_input.py
path
property
writable
¶
Get the current path displayed in the QLineEdit.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current path string. |
mode
property
writable
¶
Get the file dialog selection mode.
| RETURNS | DESCRIPTION |
|---|---|
Literal['file', 'directory']
|
The current mode ("file" or "directory"). |
placeholder_text
property
writable
¶
Get the QLineEdit placeholder text.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current placeholder text. |
filter
property
writable
¶
Get the file dialog filter string.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current filter string. |
dialog_title
property
writable
¶
Get the file dialog window title.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current dialog title. |
clear
¶
setTheme
¶
Update the folder icon color for the given theme.
Can be connected directly to a theme-change signal to keep the icon in sync with the application's color scheme.
| PARAMETER | DESCRIPTION |
|---|---|
theme
|
The new theme (
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/file_picker_input.py
refreshStyle
¶
Refresh the widget style.
Useful after dynamic stylesheet changes.
SpinBoxInput¶
A fully custom numeric spin box QWidget with integrated decrement (−) and increment (+) QToolButton flanking a central QLineEdit. Supports mouse wheel input and real-time QIntValidator clamping.
Signals:
| Signal | Signature | Emitted when |
|---|---|---|
valueChanged |
(int) |
The integer value changes |
Constructor parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
parent |
QWidget \| None |
None |
Parent widget |
value |
int |
0 |
Initial value; clamped between minimum and maximum |
minimum |
int |
0 |
Minimum allowed value |
maximum |
int |
100 |
Maximum allowed value |
step |
int |
1 |
Increment/decrement step size (minimum 1) |
prefix |
str |
"" |
String prepended to the displayed value |
suffix |
str |
"" |
String appended to the displayed value |
Properties:
| Property | Type | Description |
|---|---|---|
value |
int |
Gets or sets the current value; clamped and emits valueChanged |
minimum |
int |
Gets or sets the minimum; updates the validator and re-clamps the value |
maximum |
int |
Gets or sets the maximum; updates the validator and re-clamps the value |
step |
int |
Gets or sets the step size (minimum 1) |
prefix |
str |
Gets or sets the display prefix; refreshes the QLineEdit |
suffix |
str |
Gets or sets the display suffix; refreshes the QLineEdit |
Methods:
| Method | Signature | Description |
|---|---|---|
setValue() |
(value: int) -> None |
Sets the value, clamped between minimum and maximum; emits valueChanged only if the value actually changes |
stepUp() |
() -> None |
Increments the value by step, clamped at maximum |
stepDown() |
() -> None |
Decrements the value by step, clamped at minimum |
refreshStyle() |
() -> None |
Re-applies the QSS stylesheet |
Behavior notes:
- Mouse wheel scrolling increments (
scroll up) or decrements (scroll down) by step when the widget has focus. valueChangedis emitted only when the value actually changes, not on every display refresh.prefixandsuffixare stripped before parsing theQLineEdittext.
Example:
from PySide6.QtWidgets import QApplication
from ezqt_widgets import SpinBoxInput
app = QApplication([])
spin = SpinBoxInput(value=10, minimum=0, maximum=200, step=5, suffix=" px")
spin.valueChanged.connect(lambda v: print(f"Value: {v}"))
spin.show()
app.exec()
SpinBoxInput
¶
SpinBoxInput(parent: WidgetParent = None, *, value: int = 0, minimum: int = 0, maximum: int = 100, step: int = 1, prefix: str = '', suffix: str = '')
Bases: QWidget
Custom numeric spin box with integrated decrement and increment buttons.
Provides a fully stylable numeric input with − and + buttons flanking a central QLineEdit. Supports mouse wheel increments and real-time QIntValidator clamping.
Features
- Decrement (−) and increment (+) QToolButtons
- Central QLineEdit with QIntValidator
- Mouse wheel increments/decrements by step
- Value clamped between minimum and maximum at all times
- Optional prefix and suffix labels
- Signal emitted only when value changes
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The parent widget (default: None).
TYPE:
|
value
|
Initial value (default: 0).
TYPE:
|
minimum
|
Minimum allowed value (default: 0).
TYPE:
|
maximum
|
Maximum allowed value (default: 100).
TYPE:
|
step
|
Step size for increment/decrement (default: 1).
TYPE:
|
prefix
|
String prepended to the displayed value (default: "").
TYPE:
|
suffix
|
String appended to the displayed value (default: "").
TYPE:
|
Properties
value: Get or set the current integer value. minimum: Get or set the minimum allowed value. maximum: Get or set the maximum allowed value. step: Get or set the step size. prefix: Get or set the display prefix. suffix: Get or set the display suffix.
Signals
valueChanged(int): Emitted when the value changes.
Example
from ezqt_widgets import SpinBoxInput spin = SpinBoxInput(value=10, minimum=0, maximum=100, step=5) spin.valueChanged.connect(lambda v: print(f"Value: {v}")) spin.show()
Initialize the spin box input.
Source code in src/ezqt_widgets/widgets/input/spin_box_input.py
value
property
writable
¶
Get the current integer value.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current value. |
minimum
property
writable
¶
Get the minimum allowed value.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current minimum. |
maximum
property
writable
¶
Get the maximum allowed value.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current maximum. |
step
property
writable
¶
Get the step size for increment/decrement.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current step size. |
prefix
property
writable
¶
Get the display prefix.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current prefix string. |
suffix
property
writable
¶
Get the display suffix.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The current suffix string. |
setValue
¶
Set the value, clamped between minimum and maximum.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The new value to set.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/spin_box_input.py
stepUp
¶
stepDown
¶
wheelEvent
¶
Handle mouse wheel to increment or decrement by step.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
The wheel event.
TYPE:
|
Source code in src/ezqt_widgets/widgets/input/spin_box_input.py
refreshStyle
¶
Refresh the widget style.
Useful after dynamic stylesheet changes.