fxwidgets
fxwidgets
¶
Custom Qt widgets for fxgui.
This package provides a collection of custom Qt widgets built on top of qtpy, offering enhanced functionality and consistent styling for DCC applications.
Classes:
| Name | Description |
|---|---|
FXAccordion |
A multi-section collapsible accordion widget. |
FXAccordionSection |
Deprecated: Use FXCollapsibleWidget instead. |
FXApplication |
Customized QApplication class. |
FXBreadcrumb |
A clickable breadcrumb trail for hierarchical navigation. |
FXCamelCaseValidator |
Validator for camelCase without special characters or numbers. |
FXCapitalizedLetterValidator |
Validator for names that must start with a capital letter and contain |
FXCodeBlock |
A code block widget with syntax highlighting and theme-aware styling. |
FXCollapsibleWidget |
A widget that can expand or collapse its content. |
FXColorLabelDelegate |
A custom delegate to paint items with specific colors and icons based |
FXDropZone |
A drag and drop zone widget for file and folder selection. |
FXElidedLabel |
A QLabel that elides text with '...' when it doesn't fit. |
FXFilePathWidget |
A line edit with integrated browse button for file/folder selection. |
FXFloatingDialog |
A floating dialog that appears at the cursor's position. |
FXFuzzySearchList |
A searchable list widget with fuzzy matching capabilities. |
FXFuzzySearchTree |
A searchable tree widget with fuzzy matching capabilities. |
FXIconLineEdit |
A line edit that displays an icon on the left or right side. |
FXItemDelegate |
Minimal delegate that enables QIcon mode switching on hover/selection. |
FXLettersUnderscoreValidator |
Validator for letters and underscores, with optional numbers support. |
FXLoadingOverlay |
A loading overlay that blocks the parent widget. |
FXLoadingSpinner |
A themeable animated loading indicator. |
FXLowerCaseValidator |
Validator for lowercase letters only, with optional numbers and |
FXMainWindow |
Customized QMainWindow class. |
FXNotificationBanner |
Animated pop-up notification cards that slide in from the right. |
FXOutputLogHandler |
Custom logging handler that sends log messages to an output log widget. |
FXOutputLogWidget |
A reusable read-only output log widget for displaying application logs. |
FXPasswordLineEdit |
A custom widget that includes a password line edit with a show/hide button. |
FXProgressCard |
A card widget showing task/step progress. |
FXRangeSlider |
A slider with two handles for selecting a min/max range. |
FXRatingWidget |
A clickable star rating widget. |
FXResizedScrollArea |
A custom scroll area that emits a signal when resized. |
FXSearchBar |
An enhanced search input widget with built-in features. |
FXSingleton |
Metaclass for Qt classes that are singletons. |
FXSortedTreeWidgetItem |
Custom |
FXSplashScreen |
Customized QSplashScreen class. |
FXStatusBar |
Customized QStatusBar class. |
FXSystemTray |
A system tray icon with a context menu. |
FXTagChip |
A single removable tag chip. |
FXTagInput |
A styled input widget that displays tags as removable chips. |
FXThemeAware |
Mixin that makes widgets automatically respond to theme changes. |
FXThemeColors |
Namespace for accessing theme colors with dot notation. |
FXThemeManager |
Singleton that emits theme_changed(str) when the theme changes. |
FXThumbnailDelegate |
Custom item delegate for showing thumbnails in tree/list views. |
FXTimelineSlider |
A timeline/scrubber widget perfect for DCC applications. |
FXToggleSwitch |
A modern iOS/Material-style animated toggle switch. |
FXTooltip |
A rich, theme-aware tooltip with advanced features. |
FXTooltipManager |
Global manager that intercepts standard Qt tooltips and shows FXTooltip instead. |
FXTooltipPosition |
Tooltip position relative to anchor widget. |
FXValidatedLineEdit |
A line edit that provides visual feedback when input is rejected. |
FXWidget |
|
Functions:
| Name | Description |
|---|---|
set_tooltip |
Attach an FXTooltip to a widget or item with a simple API. |
Classes¶
FXAccordion
¶
FXAccordion(
parent: Optional[QWidget] = None,
exclusive: bool = True,
animation_duration: int = 150,
)
Bases: QWidget
flowchart TD
fxgui.fxwidgets.FXAccordion[FXAccordion]
click fxgui.fxwidgets.FXAccordion href "" "fxgui.fxwidgets.FXAccordion"
A multi-section collapsible accordion widget.
Uses FXCollapsibleWidget for each section. By default, only one section can be open at a time (exclusive mode).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
bool
|
If True, only one section can be open at a time. |
True
|
|
int
|
Duration of expand/collapse animation in ms. |
150
|
Signals
section_expanded: Emitted when a section is expanded (section index). section_collapsed: Emitted when a section is collapsed (section index).
Examples:
>>> accordion = FXAccordion()
>>> accordion.add_section("General", general_content, icon="settings")
>>> accordion.add_section("Advanced", advanced_content, icon="tune")
>>> accordion.add_section("Info", info_content, icon="info")
Methods:
| Name | Description |
|---|---|
__iter__ |
Iterate over sections. |
__len__ |
Return the number of sections. |
add_section |
Add a new section to the accordion. |
collapse_all |
Collapse all sections. |
collapse_section |
Collapse a section by index. |
expand_all |
Expand all sections (only works if not exclusive). |
expand_section |
Expand a section by index. |
get_section |
Get a section by index. |
remove_section |
Remove a section by index. |
Attributes:
| Name | Type | Description |
|---|---|---|
exclusive |
bool
|
Return whether accordion is in exclusive mode. |
Attributes¶
Functions¶
add_section
¶
add_section(
title: str,
content: Optional[Union[QWidget, QLayout]] = None,
icon: Optional[str] = None,
) -> FXCollapsibleWidget
Add a new section to the accordion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
¶ |
str
|
Section title. |
required |
content
¶ |
Optional[Union[QWidget, QLayout]]
|
Content widget or layout. |
None
|
icon
¶ |
Optional[str]
|
Optional icon name for the header. |
None
|
Returns:
| Type | Description |
|---|---|
FXCollapsibleWidget
|
The created FXCollapsibleWidget. |
collapse_section
¶
expand_section
¶
get_section
¶
get_section(index: int) -> Optional[FXCollapsibleWidget]
Get a section by index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
¶ |
int
|
The section index. |
required |
Returns:
| Type | Description |
|---|---|
Optional[FXCollapsibleWidget]
|
The FXCollapsibleWidget or None if index is invalid. |
FXAccordionSection
¶
FXAccordionSection(
parent: Optional[QWidget] = None,
title: str = "",
icon: Optional[str] = None,
animation_duration: int = 150,
)
Bases: FXCollapsibleWidget
flowchart TD
fxgui.fxwidgets.FXAccordionSection[FXAccordionSection]
fxgui.fxwidgets._collapsible.FXCollapsibleWidget[FXCollapsibleWidget]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxwidgets._collapsible.FXCollapsibleWidget --> fxgui.fxwidgets.FXAccordionSection
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._collapsible.FXCollapsibleWidget
click fxgui.fxwidgets.FXAccordionSection href "" "fxgui.fxwidgets.FXAccordionSection"
click fxgui.fxwidgets._collapsible.FXCollapsibleWidget href "" "fxgui.fxwidgets._collapsible.FXCollapsibleWidget"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Deprecated: Use FXCollapsibleWidget instead.
This class is kept for backward compatibility only.
FXApplication
¶
Bases: QApplication
flowchart TD
fxgui.fxwidgets.FXApplication[FXApplication]
click fxgui.fxwidgets.FXApplication href "" "fxgui.fxwidgets.FXApplication"
Customized QApplication class.
On initialization, the application loads the previously saved theme from persistent storage. If no theme was saved, defaults to "dark".
Methods:
| Name | Description |
|---|---|
instance |
Return the existing instance or create a new one if it doesn't |
FXBreadcrumb
¶
FXBreadcrumb(
parent: Optional[QWidget] = None,
separator: str = "chevron_right",
home_icon: str = "home",
show_navigation: bool = False,
path_separator: str = "/",
home_path: Optional[List[str]] = None,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXBreadcrumb[FXBreadcrumb]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXBreadcrumb
click fxgui.fxwidgets.FXBreadcrumb href "" "fxgui.fxwidgets.FXBreadcrumb"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A clickable breadcrumb trail for hierarchical navigation.
This widget provides a navigation breadcrumb with clickable path segments, separator icons, and optional back/forward navigation. Double-click the breadcrumb to switch to edit mode for typing paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Icon name for separator between segments. |
'chevron_right'
|
|
str
|
Icon name for the home/root segment. |
'home'
|
|
bool
|
Show back/forward navigation buttons. |
False
|
|
str
|
Character used to join path segments in edit mode. |
'/'
|
|
Optional[List[str]]
|
Path segments to navigate to when home is clicked. If None, navigates to the first segment only. |
None
|
Signals
segment_clicked: Emitted when a segment is clicked (index, path list). home_clicked: Emitted when the home segment is clicked. path_edited: Emitted when user submits a typed path (raw string). navigated_back: Emitted when navigating back in history. navigated_forward: Emitted when navigating forward in history.
Examples:
>>> breadcrumb = FXBreadcrumb(show_navigation=True)
>>> breadcrumb.set_path(["Home", "Projects", "MyProject", "Assets"])
>>> breadcrumb.segment_clicked.connect(
... lambda idx, path: print(f"Navigate to: {'/'.join(path[:idx+1])}")
... )
>>> breadcrumb.path_edited.connect(lambda text: print(f"User typed: {text}"))
Methods:
| Name | Description |
|---|---|
append_segment |
Append a segment to the path. |
can_go_back |
Check if back navigation is available. |
can_go_forward |
Check if forward navigation is available. |
clear |
Clear the breadcrumb path. |
clear_history |
Clear the navigation history. |
enter_edit_mode |
Programmatically enter edit mode. |
eventFilter |
Handle escape key and focus loss to exit edit mode. |
go_back |
Navigate to the previous path in history. |
go_forward |
Navigate to the next path in history. |
is_editing |
Check if currently in edit mode. |
navigate_to |
Navigate to a specific path index, removing subsequent segments. |
pop_segment |
Remove and return the last segment. |
set_path |
Set the breadcrumb path. |
Attributes:
| Name | Type | Description |
|---|---|---|
home_path |
Optional[List[str]]
|
Get the home path. |
path |
List[str]
|
Return the current path segments. |
Attributes¶
Functions¶
append_segment
¶
go_back
¶
go_back() -> bool
Navigate to the previous path in history.
Returns:
| Type | Description |
|---|---|
bool
|
True if navigation occurred, False if at beginning of history. |
go_forward
¶
go_forward() -> bool
Navigate to the next path in history.
Returns:
| Type | Description |
|---|---|
bool
|
True if navigation occurred, False if at end of history. |
navigate_to
¶
pop_segment
¶
FXCamelCaseValidator
¶
Bases: QRegularExpressionValidator
flowchart TD
fxgui.fxwidgets.FXCamelCaseValidator[FXCamelCaseValidator]
click fxgui.fxwidgets.FXCamelCaseValidator href "" "fxgui.fxwidgets.FXCamelCaseValidator"
Validator for camelCase without special characters or numbers.
This validator ensures input follows camelCase format: starts with a lowercase letter, followed by zero or more groups of an uppercase letter followed by lowercase letters.
Examples:
>>> from qtpy.QtWidgets import QLineEdit
>>> line_edit = QLineEdit()
>>> line_edit.setValidator(FXCamelCaseValidator())
FXCapitalizedLetterValidator
¶
Bases: QValidator
flowchart TD
fxgui.fxwidgets.FXCapitalizedLetterValidator[FXCapitalizedLetterValidator]
click fxgui.fxwidgets.FXCapitalizedLetterValidator href "" "fxgui.fxwidgets.FXCapitalizedLetterValidator"
Validator for names that must start with a capital letter and contain only letters.
This validator ensures the first character is uppercase and all characters are alphabetic.
Examples:
>>> from qtpy.QtWidgets import QLineEdit
>>> line_edit = QLineEdit()
>>> line_edit.setValidator(FXCapitalizedLetterValidator())
Methods:
| Name | Description |
|---|---|
fixup |
Automatically capitalize the first letter. |
validate |
Allow only letters and must start with a capital letter. |
FXCodeBlock
¶
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXCodeBlock[FXCodeBlock]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXCodeBlock
click fxgui.fxwidgets.FXCodeBlock href "" "fxgui.fxwidgets.FXCodeBlock"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A code block widget with syntax highlighting and theme-aware styling.
This widget displays code with: - Syntax highlighting for 500+ languages via Pygments - Theme-aware background and text colors - Monospace font - Read-only, selectable text
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The code string to display. |
''
|
|
str
|
The programming language (e.g., "python", "javascript"). |
'python'
|
|
Optional[QWidget]
|
The parent widget. |
None
|
Example
code = ''' ... def hello(): ... print("Hello, World!") ... ''' code_block = FXCodeBlock(code)
Methods:
| Name | Description |
|---|---|
code |
Get the current code. |
set_code |
Set the code to display. |
set_language |
Set the programming language for syntax highlighting. |
FXCollapsibleWidget
¶
FXCollapsibleWidget(
parent: Optional[QWidget] = None,
title: str = "",
icon: Optional[Union[QIcon, str]] = None,
animation_duration: int = 150,
max_content_height: int = 300,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXCollapsibleWidget[FXCollapsibleWidget]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXCollapsibleWidget
click fxgui.fxwidgets.FXCollapsibleWidget href "" "fxgui.fxwidgets.FXCollapsibleWidget"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A widget that can expand or collapse its content.
The widget consists of a header with a toggle button and a content area that can be shown or hidden with an animation effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Title displayed in the header. |
''
|
|
Optional[Union[QIcon, str]]
|
Optional icon to display before the title. Can be a QIcon, an icon name string (for fxicons), or None. |
None
|
|
int
|
Duration of expand/collapse animation in ms. |
150
|
|
int
|
Maximum height for content area when expanded (0 = no limit). |
300
|
Signals
expanded: Emitted when the widget is expanded. collapsed: Emitted when the widget is collapsed.
Examples:
>>> from qtpy.QtWidgets import QLabel, QVBoxLayout
>>> collapsible = FXCollapsibleWidget(title="Settings")
>>> layout = QVBoxLayout()
>>> layout.addWidget(QLabel("Option 1"))
>>> layout.addWidget(QLabel("Option 2"))
>>> collapsible.set_content_layout(layout)
>>>
>>> # With an icon
>>> collapsible_with_icon = FXCollapsibleWidget(
... title="Settings",
... icon="settings"
... )
Initialize the collapsible section.
Methods:
| Name | Description |
|---|---|
collapse |
Collapse the widget to hide content. |
expand |
Expand the widget to show content. |
get_icon |
Get the current icon. |
get_title |
Get the current title text. |
get_title_icon |
Get the title icon (deprecated, use get_icon). |
set_content_layout |
Set the layout for the content area. |
set_content_widget |
Set the content widget directly. |
set_icon |
Set an icon to display before the title. |
set_title |
Set the title text. |
set_title_icon |
Set the title icon (deprecated, use set_icon). |
toggle |
Toggle the expanded/collapsed state. |
Attributes:
| Name | Type | Description |
|---|---|---|
animation_duration |
int
|
Return the animation duration in milliseconds. |
content_area |
QScrollArea
|
Return the content area (deprecated, use _content_area). |
header_widget |
QFrame
|
Return the header widget (deprecated, use _header). |
is_expanded |
bool
|
Return whether the widget is expanded. |
max_content_height |
int
|
Return the maximum content height. |
title |
str
|
Return the title text. |
title_icon_label |
QLabel
|
Return the icon label (deprecated, use _icon_label). |
title_label |
QLabel
|
Return the title label (deprecated, use _title_label). |
toggle_button |
QToolButton
|
Return the toggle button (deprecated, use _toggle_btn). |
Attributes¶
animation_duration
property
writable
¶
animation_duration: int
Return the animation duration in milliseconds.
content_area
property
¶
Return the content area (deprecated, use _content_area).
title_icon_label
property
¶
Return the icon label (deprecated, use _icon_label).
toggle_button
property
¶
Return the toggle button (deprecated, use _toggle_btn).
Functions¶
collapse
¶
expand
¶
get_icon
¶
get_icon() -> Optional[QIcon]
Get the current icon.
Returns:
| Type | Description |
|---|---|
Optional[QIcon]
|
The current icon, or None if no icon is set. |
set_content_layout
¶
set_content_layout(content_layout: QLayout) -> None
Set the layout for the content area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content_layout
¶ |
QLayout
|
The layout to set for the content area. |
required |
set_content_widget
¶
set_content_widget(widget: QWidget) -> None
Set the content widget directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
¶ |
QWidget
|
The widget to display when expanded. |
required |
set_icon
¶
set_title
¶
set_title_icon
¶
Set the title icon (deprecated, use set_icon).
FXColorLabelDelegate
¶
FXColorLabelDelegate(
colors_icons: Dict[str, Tuple[QColor, QColor, QColor, QIcon, bool]],
parent: Optional[QWidget] = None,
margin_left: int = 2,
margin_top: Optional[int] = None,
margin_bottom: Optional[int] = None,
)
Bases: FXThemeAware, QStyledItemDelegate
flowchart TD
fxgui.fxwidgets.FXColorLabelDelegate[FXColorLabelDelegate]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXColorLabelDelegate
click fxgui.fxwidgets.FXColorLabelDelegate href "" "fxgui.fxwidgets.FXColorLabelDelegate"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A custom delegate to paint items with specific colors and icons based on their text content.
Note
This delegate automatically refreshes when the theme changes, ensuring that default colors (for items without explicit color mappings) stay in sync with the current theme.
Initializes the delegate with a dictionary of colors and icons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Dict[str, Tuple[QColor, QColor, QColor, QIcon, bool]]
|
A dictionary where keys are text patterns and values are tuples containing background color, border color, text/icon color, icon, and a boolean indicating if the icon should be colored. |
required |
|
Optional[QWidget]
|
The parent object. |
None
|
|
int
|
The left margin for the text and icon. Defaults to 2. |
2
|
|
Optional[int]
|
The top margin for the text and icon. Defaults to
|
None
|
|
Optional[int]
|
The bottom margin for the text and icon. Defaults to
|
None
|
Methods:
| Name | Description |
|---|---|
paint |
Paints the item with the specified colors and icons. |
sizeHint |
Provides the size hint for the item. |
FXDropZone
¶
FXDropZone(
parent: Optional[QWidget] = None,
title: str = "Drag and Drop Files Here",
description: str = "or use the Browse Files... button below",
accept_mode: str = "files",
extensions: Optional[Set[str]] = None,
multiple: bool = True,
icon_name: str = "upload_file",
show_formats: bool = True,
show_buttons: bool = True,
show_tree: bool = True,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXDropZone[FXDropZone]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXDropZone
click fxgui.fxwidgets.FXDropZone href "" "fxgui.fxwidgets.FXDropZone"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A drag and drop zone widget for file and folder selection.
This widget provides a visual drop target for files and folders with: - Drag and drop support with visual feedback - Optional browse and clear buttons (external to drop area) - Customizable accepted extensions with display - Support for files, folders, or both - Visual states: default, hover, drag-active - Built-in tree view that appears after files are dropped - Tree view also accepts drag & drop for additional files - Context menu for removing individual files
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Main title text displayed in the drop zone. |
'Drag and Drop Files Here'
|
|
str
|
Description text displayed below the title. |
'or use the Browse Files... button below'
|
|
str
|
What to accept - 'files', 'folders', or 'both'. |
'files'
|
|
Optional[Set[str]]
|
Set of allowed file extensions (e.g., {'.png', '.jpg'}). If None, all extensions are accepted. |
None
|
|
bool
|
Whether to allow multiple file/folder selection. |
True
|
|
str
|
Icon name to display (default: 'upload_file'). |
'upload_file'
|
|
bool
|
Whether to display accepted formats below title. |
True
|
|
bool
|
Whether to show Browse/Clear buttons. |
True
|
|
bool
|
Whether to show file tree after files are dropped. |
True
|
Signals
files_dropped: Emitted when files/folders are dropped or selected. Passes a list of Path objects. files_cleared: Emitted when files are cleared. file_removed: Emitted when a single file is removed from the tree. Passes the Path that was removed. drag_entered: Emitted when a valid drag enters the drop zone. drag_left: Emitted when a drag leaves the drop zone.
Examples:
>>> # Accept image files only with tree view
>>> drop_zone = FXDropZone(
... title="Drop Images Here",
... description="or use the Browse Files... button below",
... extensions={'.png', '.jpg', '.exr'},
... show_tree=True
... )
>>> drop_zone.files_dropped.connect(lambda paths: print(paths))
>>>
>>> # Accept folders only (no tree)
>>> folder_zone = FXDropZone(
... title="Drop Project Folder",
... accept_mode='folders',
... show_tree=False
... )
Methods:
| Name | Description |
|---|---|
add_files |
Add files to the current selection programmatically. |
clear |
Clear the drop zone state (programmatic clear). |
eventFilter |
Filter events for the drop area. |
set_files |
Set the selected files programmatically. |
set_icon |
Set the icon displayed in the drop zone. |
show_file_tree |
Show the file tree (hide placeholder). |
show_placeholder |
Show the drop placeholder (hide tree). |
Attributes:
| Name | Type | Description |
|---|---|---|
accept_mode |
str
|
Return the accept mode. |
description |
str
|
Return the description text. |
extensions |
Optional[Set[str]]
|
Return the accepted extensions. |
file_tree |
Optional[QTreeWidget]
|
Return the file tree widget (if show_tree is True). |
has_files |
bool
|
Return whether files have been added. |
multiple |
bool
|
Return whether multiple selection is enabled. |
selected_files |
List[Path]
|
Return the list of selected files. |
title |
str
|
Return the title text. |
FXElidedLabel
¶
Bases: QLabel
flowchart TD
fxgui.fxwidgets.FXElidedLabel[FXElidedLabel]
click fxgui.fxwidgets.FXElidedLabel href "" "fxgui.fxwidgets.FXElidedLabel"
A QLabel that elides text with '...' when it doesn't fit.
This label automatically truncates text and adds an ellipsis when the text is too long to fit within the available space.
Methods:
| Name | Description |
|---|---|
resizeEvent |
Re-elide text when the label is resized. |
setText |
Set the text and store the full text for elision. |
FXFilePathWidget
¶
FXFilePathWidget(
parent: Optional[QWidget] = None,
mode: str = "file",
placeholder: str = "Select path...",
file_filter: str = "All Files (*)",
default_path: Optional[str] = None,
validate: bool = True,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXFilePathWidget[FXFilePathWidget]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXFilePathWidget
click fxgui.fxwidgets.FXFilePathWidget href "" "fxgui.fxwidgets.FXFilePathWidget"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A line edit with integrated browse button for file/folder selection.
This widget provides: - File or folder mode selection - Drag & drop support - Path validation indicator - Browse button with file dialog
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Selection mode ('file', 'files', 'folder', 'save'). |
'file'
|
|
str
|
Placeholder text. |
'Select path...'
|
|
str
|
File filter for file dialogs (e.g., "Images (.png .jpg)"). |
'All Files (*)'
|
|
Optional[str]
|
Default path for the file dialog. |
None
|
|
bool
|
Whether to show validation indicator. |
True
|
Signals
path_changed: Emitted when the path changes. path_valid: Emitted with True/False when validation state changes.
Examples:
>>> path_widget = FXFilePathWidget(mode='file', file_filter="Python (*.py)")
>>> path_widget.path_changed.connect(lambda p: print(f"Path: {p}"))
>>>
>>> # Folder mode
>>> folder_widget = FXFilePathWidget(mode='folder')
Methods:
| Name | Description |
|---|---|
clear |
Clear the path input. |
dragEnterEvent |
Handle drag enter for file drops. |
dropEvent |
Handle file drop. |
get_path |
Return the current path. |
is_valid |
Return whether the current path is valid. |
set_file_filter |
Set the file filter. |
set_mode |
Set the selection mode. |
set_path |
Set the path. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
Return the current path. |
FXFloatingDialog
¶
FXFloatingDialog(
parent: Optional[QWidget] = None,
icon: Optional[QPixmap] = None,
title: Optional[str] = None,
parent_package: Optional[int] = None,
popup: bool = False,
)
Bases: FXThemeAware, QDialog
flowchart TD
fxgui.fxwidgets.FXFloatingDialog[FXFloatingDialog]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXFloatingDialog
click fxgui.fxwidgets.FXFloatingDialog href "" "fxgui.fxwidgets.FXFloatingDialog"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A floating dialog that appears at the cursor's position. It closes when any mouse button except the right one is pressed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
QtWidget
|
Parent widget. Defaults to |
None
|
|
QPixmap
|
The QPixmap icon. |
None
|
|
str
|
The dialog title. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
dialog_icon |
QIcon
|
The icon of the dialog. |
dialog_title |
str
|
The title of the dialog. |
drop_position |
QPoint
|
The drop position of the dialog. |
dialog_position |
Tuple[int, int]
|
The position of the dialog. |
parent_package |
int
|
Whether the dialog is standalone application, or belongs to a DCC parent. |
popup |
bool
|
Whether the dialog is a popup or not. |
Methods:
| Name | Description |
|---|---|
closeEvent |
Removes the parent of the dialog and closes it. |
mousePressEvent |
Closes the dialog when any mouse button except the right one is pressed. |
set_dialog_icon |
Sets the dialog's icon. |
set_dialog_title |
Sets the dialog's title. |
show_under_cursor |
Moves the dialog to the current cursor position and displays it. |
Functions¶
closeEvent
¶
closeEvent(event: QCloseEvent) -> None
Removes the parent of the dialog and closes it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
¶ |
QCloseEvent
|
The close event. |
required |
mousePressEvent
¶
mousePressEvent(event: QMouseEvent) -> None
Closes the dialog when any mouse button except the right one is pressed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
¶ |
QMouseEvent
|
The mouse press event. |
required |
set_dialog_icon
¶
Sets the dialog's icon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
¶ |
QPixmap
|
The QPixmap icon. |
None
|
set_dialog_title
¶
FXFuzzySearchList
¶
FXFuzzySearchList(
parent: Optional[QWidget] = None,
placeholder: str = "Search...",
ratio: float = 0.5,
show_ratio_slider: bool = False,
color_match: bool = True,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXFuzzySearchList[FXFuzzySearchList]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXFuzzySearchList
click fxgui.fxwidgets.FXFuzzySearchList href "" "fxgui.fxwidgets.FXFuzzySearchList"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A searchable list widget with fuzzy matching capabilities.
This widget combines a search bar with a list view that uses fuzzy matching to filter and sort items by relevance. Items are colored based on their match quality (green for good matches, red for poor matches).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Placeholder text for the search input. |
'Search...'
|
|
float
|
Initial similarity ratio threshold (0.0 to 1.0). |
0.5
|
|
bool
|
Whether to show the ratio adjustment slider. |
False
|
|
bool
|
Whether to color items based on match quality. |
True
|
Signals
item_selected: Emitted when an item is clicked. Passes the item text. item_double_clicked: Emitted when an item is double-clicked. Passes the item text. item_activated: Emitted when Enter is pressed on an item. Passes the item text. selection_changed: Emitted when the selection changes. Passes a list of selected item texts.
Examples:
Basic usage with a list of strings:
>>> fuzzy_list = FXFuzzySearchList(placeholder="Search fruits...")
>>> fuzzy_list.set_items(["apple", "apricot", "banana", "cherry"])
>>> fuzzy_list.item_selected.connect(lambda text: print(f"Selected: {text}"))
With ratio slider for user adjustment:
>>> fuzzy_list = FXFuzzySearchList(show_ratio_slider=True, ratio=0.6)
>>> fuzzy_list.set_items(["character_hero", "character_villain", "prop_chair"])
Methods:
| Name | Description |
|---|---|
add_item |
Add a single item to the list. |
clear |
Clear all items from the list. |
clear_search |
Clear the search input. |
remove_item |
Remove an item from the list by its text. |
select_item |
Select an item by its text. |
setFocus |
Set focus to the search input. |
set_color_match |
Enable or disable color-coded match quality. |
set_items |
Set the list items from a list of strings. |
set_placeholder |
Set the search bar placeholder text. |
set_selection_mode |
Set the list view selection mode. |
show_ratio_slider |
Show or hide the ratio adjustment slider. |
Attributes:
| Name | Type | Description |
|---|---|---|
current_item |
Optional[str]
|
Return the current item text. |
items |
List[str]
|
Return all items in the source model. |
list_view |
QListView
|
Return the list view for advanced customization. |
proxy_model |
FXSortFilterProxyModel
|
Return the proxy model for advanced customization. |
ratio |
float
|
Return the current similarity ratio threshold. |
search_text |
str
|
Return the current search text. |
selected_items |
List[str]
|
Return currently selected items. |
source_model |
QStandardItemModel
|
Return the source model for advanced customization. |
visible_items |
List[str]
|
Return currently visible (filtered) items. |
Attributes¶
current_item
property
¶
items
property
¶
list_view
property
¶
Return the list view for advanced customization.
Returns:
| Type | Description |
|---|---|
QListView
|
The underlying QListView. |
proxy_model
property
¶
proxy_model: FXSortFilterProxyModel
Return the proxy model for advanced customization.
Returns:
| Type | Description |
|---|---|
FXSortFilterProxyModel
|
The underlying FXSortFilterProxyModel. |
ratio
property
writable
¶
ratio: float
Return the current similarity ratio threshold.
Returns:
| Type | Description |
|---|---|
float
|
The ratio threshold (0.0 to 1.0). |
selected_items
property
¶
source_model
property
¶
Return the source model for advanced customization.
Returns:
| Type | Description |
|---|---|
QStandardItemModel
|
The underlying QStandardItemModel. |
visible_items
property
¶
Functions¶
add_item
¶
remove_item
¶
select_item
¶
set_color_match
¶
set_items
¶
set_placeholder
¶
FXFuzzySearchTree
¶
FXFuzzySearchTree(
parent: Optional[QWidget] = None,
placeholder: str = "Search...",
ratio: float = 0.5,
show_ratio_slider: bool = False,
color_match: bool = True,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXFuzzySearchTree[FXFuzzySearchTree]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXFuzzySearchTree
click fxgui.fxwidgets.FXFuzzySearchTree href "" "fxgui.fxwidgets.FXFuzzySearchTree"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A searchable tree widget with fuzzy matching capabilities.
This widget combines a search bar with a tree view that uses fuzzy matching to filter and sort items by relevance. Items are colored based on their match quality (green for good matches, red for poor matches).
The tree supports hierarchical data with parent-child relationships. When filtering, parent items remain visible if any of their children match.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Placeholder text for the search input. |
'Search...'
|
|
float
|
Initial similarity ratio threshold (0.0 to 1.0). |
0.5
|
|
bool
|
Whether to show the ratio adjustment slider. |
False
|
|
bool
|
Whether to color items based on match quality. |
True
|
Signals
item_selected: Emitted when an item is clicked. Passes the item text. item_double_clicked: Emitted when an item is double-clicked. Passes the item text. item_activated: Emitted when Enter is pressed on an item. Passes the item text. selection_changed: Emitted when the selection changes. Passes a list of selected item texts. item_expanded: Emitted when an item is expanded. Passes the item text. item_collapsed: Emitted when an item is collapsed. Passes the item text.
Examples:
Basic usage with hierarchical data:
>>> fuzzy_tree = FXFuzzySearchTree(placeholder="Search assets...")
>>> fuzzy_tree.add_item("Characters")
>>> fuzzy_tree.add_item("Hero", parent="Characters")
>>> fuzzy_tree.add_item("Villain", parent="Characters")
>>> fuzzy_tree.item_selected.connect(lambda text: print(f"Selected: {text}"))
With ratio slider for user adjustment:
>>> fuzzy_tree = FXFuzzySearchTree(show_ratio_slider=True, ratio=0.6)
>>> fuzzy_tree.set_items({
... "Props": ["sword", "shield", "chair"],
... "Vehicles": ["car", "truck", "motorcycle"],
... })
Methods:
| Name | Description |
|---|---|
add_item |
Add a single item to the tree. |
clear |
Clear all items from the tree. |
clear_search |
Clear the search input. |
collapse_all |
Collapse all items in the tree. |
collapse_item |
Collapse an item by its text. |
expand_all |
Expand all items in the tree. |
expand_item |
Expand an item by its text. |
get_item |
Get an item by its text. |
remove_item |
Remove an item from the tree by its text. |
select_item |
Select an item by its text. |
setFocus |
Set focus to the search input. |
set_color_match |
Enable or disable color-coded match quality. |
set_items |
Set the tree items from a list or dictionary. |
set_placeholder |
Set the search bar placeholder text. |
set_selection_mode |
Set the tree view selection mode. |
show_ratio_slider |
Show or hide the ratio adjustment slider. |
Attributes:
| Name | Type | Description |
|---|---|---|
current_item |
Optional[str]
|
Return the current item text. |
items |
List[str]
|
Return all item texts in the source model. |
proxy_model |
FXSortFilterProxyModel
|
Return the proxy model for advanced customization. |
ratio |
float
|
Return the current similarity ratio threshold. |
search_text |
str
|
Return the current search text. |
selected_items |
List[str]
|
Return currently selected items. |
source_model |
QStandardItemModel
|
Return the source model for advanced customization. |
top_level_items |
List[str]
|
Return top-level item texts. |
tree_view |
QTreeView
|
Return the tree view for advanced customization. |
Attributes¶
current_item
property
¶
items
property
¶
proxy_model
property
¶
proxy_model: FXSortFilterProxyModel
Return the proxy model for advanced customization.
Returns:
| Type | Description |
|---|---|
FXSortFilterProxyModel
|
The underlying proxy model. |
ratio
property
writable
¶
ratio: float
Return the current similarity ratio threshold.
Returns:
| Type | Description |
|---|---|
float
|
The ratio threshold (0.0 to 1.0). |
selected_items
property
¶
source_model
property
¶
Return the source model for advanced customization.
Returns:
| Type | Description |
|---|---|
QStandardItemModel
|
The underlying QStandardItemModel. |
top_level_items
property
¶
tree_view
property
¶
Return the tree view for advanced customization.
Returns:
| Type | Description |
|---|---|
QTreeView
|
The underlying QTreeView. |
Functions¶
add_item
¶
Add a single item to the tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
¶ |
str
|
The item text to add. |
required |
parent
¶ |
Optional[str]
|
The parent item text. If None, adds as top-level item. |
None
|
data
¶ |
Optional[dict]
|
Optional dictionary of user data to store on the item. |
None
|
Returns:
| Type | Description |
|---|---|
QStandardItem
|
The created QStandardItem. |
collapse_item
¶
expand_item
¶
get_item
¶
remove_item
¶
select_item
¶
set_color_match
¶
set_items
¶
set_placeholder
¶
FXIconLineEdit
¶
FXIconLineEdit(
icon_name: Optional[str] = None,
icon_position: str = "left",
parent: Optional[QWidget] = None,
)
Bases: FXThemeAware, QLineEdit
flowchart TD
fxgui.fxwidgets.FXIconLineEdit[FXIconLineEdit]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXIconLineEdit
click fxgui.fxwidgets.FXIconLineEdit href "" "fxgui.fxwidgets.FXIconLineEdit"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A line edit that displays an icon on the left or right side.
The icon is theme-aware and will refresh automatically when the application theme changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[str]
|
The name of the icon to display. |
None
|
|
str
|
The position of the icon ('left' or 'right'). |
'left'
|
|
Optional[QWidget]
|
The parent widget. |
None
|
Methods:
| Name | Description |
|---|---|
resizeEvent |
Reposition the icon when the line edit is resized. |
FXItemDelegate
¶
Bases: QStyledItemDelegate
flowchart TD
fxgui.fxwidgets.FXItemDelegate[FXItemDelegate]
click fxgui.fxwidgets.FXItemDelegate href "" "fxgui.fxwidgets.FXItemDelegate"
Minimal delegate that enables QIcon mode switching on hover/selection.
Qt's default item view painting only uses QIcon.Selected for selected items. This delegate adds QIcon.Active support for hover states, making icons change color when items are hovered.
This is a drop-in replacement for QStyledItemDelegate with no layout changes. Apply it to any QListView, QTreeView, or QTableView for icon color switching.
Examples:
>>> from fxgui import fxwidgets
>>> list_widget = QListWidget()
>>> list_widget.setItemDelegate(fxwidgets.FXItemDelegate())
FXLettersUnderscoreValidator
¶
FXLettersUnderscoreValidator(
allow_numbers: bool = False, parent: Optional[QWidget] = None
)
Bases: QRegularExpressionValidator
flowchart TD
fxgui.fxwidgets.FXLettersUnderscoreValidator[FXLettersUnderscoreValidator]
click fxgui.fxwidgets.FXLettersUnderscoreValidator href "" "fxgui.fxwidgets.FXLettersUnderscoreValidator"
Validator for letters and underscores, with optional numbers support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
If |
False
|
|
Optional[QWidget]
|
Parent widget. |
None
|
Examples:
>>> from qtpy.QtWidgets import QLineEdit
>>> line_edit = QLineEdit()
>>> line_edit.setValidator(FXLettersUnderscoreValidator(allow_numbers=True))
FXLoadingOverlay
¶
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXLoadingOverlay[FXLoadingOverlay]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXLoadingOverlay
click fxgui.fxwidgets.FXLoadingOverlay href "" "fxgui.fxwidgets.FXLoadingOverlay"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A loading overlay that blocks the parent widget.
This widget creates a semi-transparent overlay with a loading spinner, useful for indicating that a long operation is in progress.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget to overlay. |
None
|
|
Optional[str]
|
Optional message to display below the spinner. |
None
|
Examples:
>>> overlay = FXLoadingOverlay(my_widget, "Loading assets...")
>>> overlay.show()
>>> # ... do some work ...
>>> overlay.hide()
Methods:
| Name | Description |
|---|---|
hide |
Hide the overlay and stop the spinner. |
paintEvent |
Paint the semi-transparent background. |
resizeEvent |
Handle parent resize. |
show |
Show the overlay and start the spinner. |
FXLoadingSpinner
¶
FXLoadingSpinner(
parent: Optional[QWidget] = None,
size: int = 32,
line_width: int = 3,
color: Optional[str] = None,
style: str = "spinner",
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXLoadingSpinner[FXLoadingSpinner]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXLoadingSpinner
click fxgui.fxwidgets.FXLoadingSpinner href "" "fxgui.fxwidgets.FXLoadingSpinner"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A themeable animated loading indicator.
This widget provides a modern spinning/pulsing loading indicator with customizable colors and animation styles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
int
|
Size of the spinner in pixels. |
32
|
|
int
|
Width of the spinner lines. |
3
|
|
Optional[str]
|
Spinner color. If None, uses theme accent. |
None
|
|
str
|
Animation style ('spinner', 'dots', 'pulse'). |
'spinner'
|
Examples:
>>> spinner = FXLoadingSpinner(size=32)
>>> spinner.start()
>>> # ... do some work ...
>>> spinner.stop()
Methods:
| Name | Description |
|---|---|
angle |
Set the rotation angle. |
is_spinning |
Return whether the spinner is currently animating. |
paintEvent |
Paint the loading spinner. |
set_color |
Set the spinner color. |
set_style |
Set the animation style. |
start |
Start the loading animation. |
stop |
Stop the loading animation. |
FXLowerCaseValidator
¶
FXLowerCaseValidator(
allow_numbers: bool = False,
allow_underscores: bool = False,
parent: Optional[QWidget] = None,
)
Bases: QRegularExpressionValidator
flowchart TD
fxgui.fxwidgets.FXLowerCaseValidator[FXLowerCaseValidator]
click fxgui.fxwidgets.FXLowerCaseValidator href "" "fxgui.fxwidgets.FXLowerCaseValidator"
Validator for lowercase letters only, with optional numbers and underscores support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
If |
False
|
|
bool
|
If |
False
|
|
Optional[QWidget]
|
Parent widget. |
None
|
Examples:
>>> from qtpy.QtWidgets import QLineEdit
>>> line_edit = QLineEdit()
>>> line_edit.setValidator(FXLowerCaseValidator(allow_numbers=True))
FXMainWindow
¶
FXMainWindow(
parent: Optional[QWidget] = None,
icon: Optional[str] = None,
title: Optional[str] = None,
size: Optional[Tuple[int, int]] = None,
documentation: Optional[str] = None,
project: Optional[str] = None,
version: Optional[str] = None,
company: Optional[str] = None,
ui_file: Optional[str] = None,
set_stylesheet: bool = True,
)
Bases: FXThemeAware, QMainWindow
flowchart TD
fxgui.fxwidgets.FXMainWindow[FXMainWindow]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXMainWindow
click fxgui.fxwidgets.FXMainWindow href "" "fxgui.fxwidgets.FXMainWindow"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Customized QMainWindow class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
QWidget
|
Parent widget. Defaults to |
None
|
|
str
|
Path to the window icon image. Defaults to |
None
|
|
str
|
Title of the window. Defaults to |
None
|
|
Tuple[int, int]
|
Window size as width and height.
Defaults to |
None
|
|
str
|
URL to the tool's documentation.
Defaults to |
None
|
|
str
|
Version label for the window.
Defaults to |
None
|
|
str
|
Company name for the window.
Defaults to |
None
|
|
str
|
Path to the UI file for loading.
Defaults to |
None
|
|
bool
|
Whether to set the default stylesheet.
Defaults to |
True
|
Methods:
| Name | Description |
|---|---|
center_on_screen |
Center the window on the primary screen. |
closeEvent |
Handle the window close event. |
get_available_themes |
Get a list of all available theme names. |
hide_banner |
Hides the banner. |
hide_status_line |
Hides the status line. |
setCentralWidget |
Override the QMainWindow's setCentralWidget method. |
setWindowTitle |
Override the setWindowTitle method. |
set_banner_icon |
Sets the icon of the banner. |
set_banner_text |
Sets the text of the banner. |
set_company_label |
Sets the company label in the status bar. |
set_project_label |
Sets the project label in the status bar. |
set_status_line_colors |
Set the colors of the status line. |
set_theme |
Set the theme of the window. |
set_ui_file |
Sets the UI file and loads the UI. |
set_version_label |
Sets the version label in the status bar. |
show_banner |
Shows the banner. |
show_status_line |
Shows the status line. |
statusBar |
Returns the FXStatusBar instance associated with this window. |
toggle_theme |
Toggle the theme of the window to the next available theme. |
Functions¶
center_on_screen
¶
closeEvent
¶
closeEvent(event: QCloseEvent) -> None
Handle the window close event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
¶ |
QCloseEvent
|
The close event. |
required |
get_available_themes
¶
setCentralWidget
¶
setCentralWidget(widget: QWidget) -> None
Override the QMainWindow's setCentralWidget method.
Ensures that the status line is always at the bottom of the window and the banner is always at the top.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
¶ |
QWidget
|
The widget to set as the central widget. |
required |
Note
Overrides the base class method.
setWindowTitle
¶
set_banner_icon
¶
Sets the icon of the banner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
¶ |
Optional[Union[QIcon, str]]
|
The icon to set in the banner. Can be a QIcon or an icon name string for theme-aware icons. |
required |
size
¶ |
int
|
The size of the icon. Defaults to 20. |
20
|
Note
Using an icon name string (e.g., "widgets") is recommended for theme-aware icons that automatically update when the theme changes.
set_banner_text
¶
set_company_label
¶
set_project_label
¶
set_status_line_colors
¶
set_theme
¶
Set the theme of the window.
This method can be called from external code to apply a specific theme, including when running inside a DCC like Houdini, Maya, or Nuke where you don't have direct access to QApplication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
¶ |
str
|
The theme name to apply (e.g., "dark", "light", or custom). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The theme that was applied. |
Examples:
set_ui_file
¶
set_version_label
¶
statusBar
¶
statusBar() -> FXStatusBar
Returns the FXStatusBar instance associated with this window.
Returns:
| Name | Type | Description |
|---|---|---|
FXStatusBar |
FXStatusBar
|
The FXStatusBar instance associated with this window. |
Note
Overrides the base class method.
toggle_theme
¶
toggle_theme() -> str
Toggle the theme of the window to the next available theme.
This method can be called from external code to cycle through themes, including when running inside a DCC like Houdini, Maya, or Nuke where you don't have direct access to QApplication.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The new theme that was applied. |
Examples:
FXNotificationBanner
¶
FXNotificationBanner(
parent: Optional[QWidget] = None,
message: str = "",
severity_type: Optional[int] = None,
timeout: int = 5000,
action_text: Optional[str] = None,
closable: bool = True,
width: int = 320,
logger: Optional[Logger] = None,
title: Optional[str] = None,
icon: Optional[str] = None,
margin: int = 16,
spacing: int = 8,
)
Bases: FXThemeAware, QFrame
flowchart TD
fxgui.fxwidgets.FXNotificationBanner[FXNotificationBanner]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXNotificationBanner
click fxgui.fxwidgets.FXNotificationBanner href "" "fxgui.fxwidgets.FXNotificationBanner"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Animated pop-up notification cards that slide in from the right.
This widget provides toast-style notifications with severity levels, auto-dismiss, and optional action buttons. Notifications automatically stack when multiple are shown and reposition when one is dismissed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget (required for positioning). |
None
|
|
str
|
The notification message. |
''
|
|
Optional[int]
|
Severity level (CRITICAL, ERROR, WARNING, SUCCESS, INFO, DEBUG). If None, a custom notification is shown using title and icon. |
None
|
|
int
|
Auto-dismiss timeout in milliseconds (0 = no auto-dismiss). |
5000
|
|
Optional[str]
|
Text for the optional action button. |
None
|
|
bool
|
Whether to show a close button. |
True
|
|
int
|
Fixed width of the notification card (default 320). |
320
|
|
Optional[Logger]
|
A logger object to log the message when shown. The severity level is mapped to the appropriate logging level. |
None
|
|
Optional[str]
|
Custom title for the notification. Overrides severity-based title. |
None
|
|
Optional[str]
|
Custom icon name for the notification. Overrides severity-based icon. |
None
|
|
int
|
Margin from the edges of the parent widget (default 16). |
16
|
|
int
|
Spacing between stacked notifications (default 8). |
8
|
Signals
closed: Emitted when the banner is closed. action_clicked: Emitted when the action button is clicked.
Examples:
>>> # Simple notification - auto-positions and stacks
>>> banner = FXNotificationBanner(
... parent=window,
... message="File saved successfully!",
... severity_type=SUCCESS,
... )
>>> banner.show()
>>>
>>> # Custom notification
>>> banner = FXNotificationBanner(
... parent=window,
... message="New version available!",
... title="Update",
... icon="system_update",
... )
>>> banner.show()
Methods:
| Name | Description |
|---|---|
dismiss |
Dismiss the notification with slide-out animation to the right. |
eventFilter |
Handle parent resize events to reposition notifications. |
set_message |
Set the notification message. |
set_timeout |
Set the auto-dismiss timeout. |
show |
Show the notification with slide-in animation from the right. |
Functions¶
eventFilter
¶
eventFilter(obj, event) -> bool
Handle parent resize events to reposition notifications.
set_message
¶
set_timeout
¶
show
¶
Show the notification with slide-in animation from the right.
Automatically calculates position based on other active notifications for the same parent widget, stacking them vertically with spacing.
FXOutputLogHandler
¶
FXOutputLogHandler(log_widget: FXOutputLogWidget)
Bases: Handler
flowchart TD
fxgui.fxwidgets.FXOutputLogHandler[FXOutputLogHandler]
click fxgui.fxwidgets.FXOutputLogHandler href "" "fxgui.fxwidgets.FXOutputLogHandler"
Custom logging handler that sends log messages to an output log widget.
This handler is used internally by FXOutputLogWidget to capture
log messages and display them in the widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXOutputLogWidget
|
The |
required |
Methods:
| Name | Description |
|---|---|
emit |
Emit a log record to the output log widget. |
FXOutputLogWidget
¶
FXOutputLogWidget(
parent: Optional[QWidget] = None, capture_output: bool = False
)
Bases: QWidget
flowchart TD
fxgui.fxwidgets.FXOutputLogWidget[FXOutputLogWidget]
click fxgui.fxwidgets.FXOutputLogWidget href "" "fxgui.fxwidgets.FXOutputLogWidget"
A reusable read-only output log widget for displaying application logs.
This widget provides a text display area that captures and shows logging output from the application. It supports ANSI color codes, search functionality, and log throttling for performance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
bool
|
If |
False
|
Signals
log_message: Emitted when a log message is received (for thread-safe delivery).
Examples:
>>> from fxgui import fxwidgets
>>> log_widget = fxwidgets.FXOutputLogWidget(capture_output=True)
>>> log_widget.show()
Initialize the output log widget.
Methods:
| Name | Description |
|---|---|
append_log |
Append text to the log output with ANSI color conversion. |
clear_log |
Clear the log output. |
closeEvent |
Handle widget close event to restore output streams. |
keyPressEvent |
Handle keyboard shortcuts. |
restore_output_streams |
Remove logging handler from all loggers where it was added. |
FXPasswordLineEdit
¶
FXPasswordLineEdit(
parent: Optional[QWidget] = None, icon_position: str = "right"
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXPasswordLineEdit[FXPasswordLineEdit]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXPasswordLineEdit
click fxgui.fxwidgets.FXPasswordLineEdit href "" "fxgui.fxwidgets.FXPasswordLineEdit"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A custom widget that includes a password line edit with a show/hide button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
The parent widget. |
None
|
|
str
|
The position of the icon ('left' or 'right'). |
'right'
|
Methods:
| Name | Description |
|---|---|
toggle_reveal |
Toggles the echo mode between password and normal, and changes the |
FXProgressCard
¶
FXProgressCard(
parent: Optional[QWidget] = None,
title: str = "Task",
description: Optional[str] = None,
progress: int = 0,
status: Optional[int] = None,
show_percentage: bool = True,
icon: Optional[str] = None,
)
Bases: FXThemeAware, QFrame
flowchart TD
fxgui.fxwidgets.FXProgressCard[FXProgressCard]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXProgressCard
click fxgui.fxwidgets.FXProgressCard href "" "fxgui.fxwidgets.FXProgressCard"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A card widget showing task/step progress.
This widget provides a styled card with: - Title and description - Progress bar or circular progress - Status icon - Perfect for pipeline tools and task tracking
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Card title. |
'Task'
|
|
Optional[str]
|
Optional description text. |
None
|
|
int
|
Initial progress value (0-100). |
0
|
|
Optional[int]
|
Status icon type (SUCCESS, ERROR, WARNING, INFO, etc.). |
None
|
|
bool
|
Whether to show percentage text. |
True
|
|
Optional[str]
|
Optional icon name to display next to the title. |
None
|
Signals
progress_changed: Emitted when progress changes. completed: Emitted when progress reaches 100%.
Examples:
>>> card = FXProgressCard(
... title="Rendering",
... description="Frame 50/100",
... progress=50
... )
>>> card.set_progress(75)
Methods:
| Name | Description |
|---|---|
increment |
Increment the progress by a given amount. |
reset |
Reset progress to 0. |
set_description |
Set the card description. |
set_progress |
Set the progress value. |
set_status |
Set the status icon. |
set_title |
Set the card title. |
Attributes:
| Name | Type | Description |
|---|---|---|
progress |
int
|
Return the current progress value. |
FXRangeSlider
¶
FXRangeSlider(
parent: Optional[QWidget] = None,
minimum: int = 0,
maximum: int = 100,
low: Optional[int] = None,
high: Optional[int] = None,
show_values: bool = True,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXRangeSlider[FXRangeSlider]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXRangeSlider
click fxgui.fxwidgets.FXRangeSlider href "" "fxgui.fxwidgets.FXRangeSlider"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A slider with two handles for selecting a min/max range.
This widget provides a dual-handle slider perfect for filtering values within a range (e.g., frame ranges, price ranges).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
int
|
Minimum value of the range. |
0
|
|
int
|
Maximum value of the range. |
100
|
|
Optional[int]
|
Initial low value. |
None
|
|
Optional[int]
|
Initial high value. |
None
|
|
bool
|
Whether to show value labels. |
True
|
Signals
range_changed: Emitted when either handle changes (low, high). low_changed: Emitted when the low value changes. high_changed: Emitted when the high value changes.
Examples:
>>> slider = FXRangeSlider(minimum=0, maximum=100)
>>> slider.range_changed.connect(lambda l, h: print(f"Range: {l}-{h}"))
>>> slider.set_range(25, 75)
Methods:
| Name | Description |
|---|---|
leaveEvent |
Handle mouse leave. |
minimumSizeHint |
Return the minimum size. |
mouseMoveEvent |
Handle mouse move. |
mousePressEvent |
Handle mouse press. |
mouseReleaseEvent |
Handle mouse release. |
paintEvent |
Paint the range slider. |
set_maximum |
Set the maximum value. |
set_minimum |
Set the minimum value. |
set_range |
Set both low and high values. |
sizeHint |
Return the preferred size. |
Attributes:
| Name | Type | Description |
|---|---|---|
high |
int
|
Return the high value. |
low |
int
|
Return the low value. |
FXRatingWidget
¶
FXRatingWidget(
parent: Optional[QWidget] = None,
max_rating: int = 5,
initial_rating: float = 0,
allow_half: bool = False,
icon_size: int = 20,
filled_icon: str = "star",
empty_icon: str = "star_border",
half_icon: str = "star_half",
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXRatingWidget[FXRatingWidget]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXRatingWidget
click fxgui.fxwidgets.FXRatingWidget href "" "fxgui.fxwidgets.FXRatingWidget"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A clickable star rating widget.
This widget provides a configurable star rating with: - Configurable max stars - Half-star support (optional) - Hover preview - Theme-aware icons
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
int
|
Maximum number of stars. |
5
|
|
float
|
Initial rating value. |
0
|
|
bool
|
Whether to allow half-star ratings. |
False
|
|
int
|
Size of star icons in pixels. |
20
|
|
str
|
Icon name for filled stars. |
'star'
|
|
str
|
Icon name for empty stars. |
'star_border'
|
|
str
|
Icon name for half-filled stars. |
'star_half'
|
Signals
rating_changed: Emitted when the rating changes.
Examples:
>>> rating = FXRatingWidget(max_rating=5, initial_rating=3)
>>> rating.rating_changed.connect(lambda r: print(f"Rating: {r}"))
Methods:
| Name | Description |
|---|---|
clear_rating |
Clear the rating (set to 0). |
enterEvent |
Handle mouse enter. |
get_rating |
Return the current rating. |
leaveEvent |
Handle mouse leave to clear hover. |
mouseMoveEvent |
Handle mouse move for hover preview. |
mousePressEvent |
Handle mouse click to set rating. |
set_rating |
Set the rating value. |
Attributes:
| Name | Type | Description |
|---|---|---|
rating |
float
|
Return the current rating. |
FXResizedScrollArea
¶
Bases: QScrollArea
flowchart TD
fxgui.fxwidgets.FXResizedScrollArea[FXResizedScrollArea]
click fxgui.fxwidgets.FXResizedScrollArea href "" "fxgui.fxwidgets.FXResizedScrollArea"
A custom scroll area that emits a signal when resized.
This widget extends QScrollArea to emit a resized signal whenever
the widget is resized, which is useful for responsive layouts.
Signals
resized: Emitted when the scroll area is resized.
Examples:
Methods:
| Name | Description |
|---|---|
resizeEvent |
Emit the resized signal when the widget is resized. |
FXSearchBar
¶
FXSearchBar(
parent: Optional[QWidget] = None,
placeholder: str = "Search...",
debounce_ms: int = 300,
show_filter: bool = False,
filters: Optional[list] = None,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXSearchBar[FXSearchBar]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXSearchBar
click fxgui.fxwidgets.FXSearchBar href "" "fxgui.fxwidgets.FXSearchBar"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
An enhanced search input widget with built-in features.
This widget provides a search input with: - Search icon - Clear button - Optional filter dropdown - Debounced search signal for live filtering
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Placeholder text. |
'Search...'
|
|
int
|
Debounce delay in milliseconds for search_changed signal. |
300
|
|
bool
|
Whether to show the filter dropdown. |
False
|
|
Optional[list]
|
List of filter options for the dropdown. |
None
|
Signals
search_changed: Emitted when the search text changes (debounced). search_submitted: Emitted when Enter is pressed. filter_changed: Emitted when the filter selection changes.
Examples:
>>> search = FXSearchBar(placeholder="Search assets...")
>>> search.search_changed.connect(lambda text: print(f"Searching: {text}"))
>>> search.set_filters(["All", "Models", "Textures", "Materials"])
Methods:
| Name | Description |
|---|---|
clear |
Clear the search input. |
setFocus |
Set focus to the search input. |
set_filters |
Set the filter dropdown options. |
set_placeholder |
Set the placeholder text. |
show_filter |
Show or hide the filter dropdown. |
Attributes:
| Name | Type | Description |
|---|---|---|
filter |
str
|
Return the current filter selection. |
text |
str
|
Return the current search text. |
FXSingleton
¶
Bases: type(QObject)
flowchart TD
fxgui.fxwidgets.FXSingleton[FXSingleton]
click fxgui.fxwidgets.FXSingleton href "" "fxgui.fxwidgets.FXSingleton"
Metaclass for Qt classes that are singletons.
This metaclass ensures that only one instance of each class can exist. If an instance already exists, it returns the existing instance instead of creating a new one. Each subclass gets its own singleton instance.
Examples:
>>> from fxgui import fxwidgets
>>>
>>> class MySingletonWindow(fxwidgets.FXMainWindow, metaclass=fxwidgets.FXSingleton):
... pass
>>>
>>> window1 = MySingletonWindow()
>>> window2 = MySingletonWindow()
>>> assert window1 is window2 # Same instance
Methods:
| Name | Description |
|---|---|
reset_instance |
Reset the singleton instance. Useful for testing or cleanup. |
FXSortedTreeWidgetItem
¶
Bases: QTreeWidgetItem
flowchart TD
fxgui.fxwidgets.FXSortedTreeWidgetItem[FXSortedTreeWidgetItem]
click fxgui.fxwidgets.FXSortedTreeWidgetItem href "" "fxgui.fxwidgets.FXSortedTreeWidgetItem"
Custom QTreeWidgetItem that provides natural sorting for strings
containing numbers. This is useful for sorting items like version numbers
or other strings where numeric parts should be ordered numerically.
For example, this class will sort the following strings in the correct human-friendly order:
- "something1"
- "something9"
- "something17"
- "something25"
Instead of the default sorting order:
- "something1"
- "something17"
- "something25"
- "something9"
Methods:
| Name | Description |
|---|---|
__lt__ |
Override the less-than operator to provide a custom sorting logic. |
Functions¶
__lt__
¶
__lt__(other: FXSortedTreeWidgetItem) -> bool
Override the less-than operator to provide a custom sorting logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
¶ |
FXSortedTreeWidgetItem
|
Another instance of |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
the natural sort order, |
FXSplashScreen
¶
FXSplashScreen(
image_path: Optional[str] = None,
icon: Optional[str] = None,
title: Optional[str] = None,
information: Optional[str] = None,
show_progress_bar: bool = False,
project: Optional[str] = None,
version: Optional[str] = None,
company: Optional[str] = None,
fade_in: bool = False,
set_stylesheet: bool = True,
overlay_opacity: float = 1.0,
corner_radius: int = 0,
border_width: int = 0,
border_color: str = "#4a4949",
)
Bases: FXThemeAware, QSplashScreen
flowchart TD
fxgui.fxwidgets.FXSplashScreen[FXSplashScreen]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXSplashScreen
click fxgui.fxwidgets.FXSplashScreen href "" "fxgui.fxwidgets.FXSplashScreen"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Customized QSplashScreen class.
Methods:
| Name | Description |
|---|---|
paintEvent |
Override to draw the pixmap with rounded corners. |
set_border |
Set the border around the splash screen. |
set_company_label |
Set the company name for the splash screen. |
set_corner_radius |
Set the corner radius for rounded corners. |
set_icon |
Set the icon for the splash screen. |
set_information_text |
Set the information text for the splash screen. |
set_overlay_opacity |
Set the opacity of the grey overlay background. |
set_pixmap |
Set the pixmap for the splash screen. |
set_progress |
Set the progress value for the splash screen. |
set_project_label |
Set the project name for the splash screen. |
set_title |
Set the title for the splash screen. |
set_version_label |
Set the version information for the splash screen. |
toggle_fade_in |
Toggle the fade-in effect for the splash screen. |
toggle_progress_bar_visibility |
Toggle the visibility of the progress bar. |
FXStatusBar
¶
FXStatusBar(
parent: Optional[QWidget] = None,
project: Optional[str] = None,
version: Optional[str] = None,
company: Optional[str] = None,
)
Bases: FXThemeAware, QStatusBar
flowchart TD
fxgui.fxwidgets.FXStatusBar[FXStatusBar]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXStatusBar
click fxgui.fxwidgets.FXStatusBar href "" "fxgui.fxwidgets.FXStatusBar"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Customized QStatusBar class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
QWidget
|
Parent widget. Defaults to |
None
|
|
str
|
Project name. Defaults to |
None
|
|
str
|
Version information. Defaults to |
None
|
|
str
|
Company name. Defaults to |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
project |
str
|
The project name. |
version |
str
|
The version string. |
company |
str
|
The company name. |
icon_label |
QLabel
|
The icon label. |
message_label |
QLabel
|
The message label. |
project_label |
QLabel
|
The project label. |
version_label |
QLabel
|
The version label. |
company_label |
QLabel
|
The company label. |
Methods:
| Name | Description |
|---|---|
clearMessage |
Clears the message from the status bar. |
hide_status_line |
Hide the status line and border line. |
resizeEvent |
Handle resize to position the status line and border correctly. |
set_status_line_colors |
Set the status line gradient colors. |
showMessage |
Display a message in the status bar with a specified severity. |
show_status_line |
Show the status line and border line. |
Functions¶
clearMessage
¶
Clears the message from the status bar.
Note
Overrides the base class method.
resizeEvent
¶
Handle resize to position the status line and border correctly.
set_status_line_colors
¶
showMessage
¶
showMessage(
message: str,
severity_type: int = 4,
duration: float = 2.5,
time: bool = True,
logger: Optional[Logger] = None,
set_color: bool = True,
pixmap: Optional[QPixmap] = None,
background_color: Optional[str] = None,
)
Display a message in the status bar with a specified severity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
¶ |
str
|
The message to be displayed. |
required |
severity_type
¶ |
int
|
The severity level of the message.
Should be one of |
4
|
duration
¶ |
float
|
The duration in seconds for which
the message should be displayed. Defaults to |
2.5
|
time
¶ |
bool
|
Whether to display the current time before
the message. Defaults to |
True
|
logger
¶ |
Logger
|
A logger object to log the message.
Defaults to |
None
|
set_color
¶ |
bool
|
Whether to set the status bar color depending on
the log verbosity. Defaults to |
True
|
pixmap
¶ |
QPixmap
|
A custom pixmap to be displayed in the
status bar. Defaults to |
None
|
background_color
¶ |
str
|
A custom background color for
the status bar. Defaults to |
None
|
Examples:
To display a critical error message with a red background
>>> self.showMessage(
... "Critical error occurred!",
... severity_type=self.CRITICAL,
... duration=5,
... logger=my_logger,
... )
Note
You can either use the FXMainWindow instance to retrieve the
verbosity constants, or the fxwidgets module.
Overrides the base class method.
FXSystemTray
¶
Bases: QObject
flowchart TD
fxgui.fxwidgets.FXSystemTray[FXSystemTray]
click fxgui.fxwidgets.FXSystemTray href "" "fxgui.fxwidgets.FXSystemTray"
A system tray icon with a context menu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
QWidget
|
The parent widget. Defaults to None. |
None
|
|
str
|
The icon path. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
tray_icon |
QSystemTrayIcon
|
The system tray icon. |
quit_action |
QAction
|
The action to quit the application. |
tray_menu |
QMenu
|
The tray menu. |
Methods:
| Name | Description |
|---|---|
show |
Shows the system tray icon. |
on_tray_icon_activated |
Shows the tray menu above the taskbar. |
closeEvent |
Closes the application. |
Examples:
>>> app = FXApplication()
>>> system_tray = FXSystemTray()
>>> hello_action = QAction(
... fxicons.get_icon("visibility"), "Set Project", system_tray
... )
>>> system_tray.tray_menu.insertAction(
... system_tray.quit_action, hello_action
... )
>>> system_tray.tray_menu.insertSeparator(system_tray.quit_action)
>>> system_tray.show()
>>> app.exec_()
Note
Inherits from QObject, not QSystemTrayIcon.
FXTagChip
¶
Bases: FXThemeAware, QFrame
flowchart TD
fxgui.fxwidgets.FXTagChip[FXTagChip]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXTagChip
click fxgui.fxwidgets.FXTagChip href "" "fxgui.fxwidgets.FXTagChip"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A single removable tag chip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The tag text. |
required |
|
Optional[QWidget]
|
Parent widget. |
None
|
|
bool
|
Whether the chip can be removed. |
True
|
Signals
removed: Emitted when the remove button is clicked.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
Return the tag text. |
FXTagInput
¶
FXTagInput(
parent: Optional[QWidget] = None,
placeholder: str = "Add tag and press Enter...",
max_tags: int = 0,
allow_duplicates: bool = False,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXTagInput[FXTagInput]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXTagInput
click fxgui.fxwidgets.FXTagInput href "" "fxgui.fxwidgets.FXTagInput"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A styled input widget that displays tags as removable chips.
This widget provides an input field where users can type and press Enter to add tags. Tags are displayed as styled chips that can be removed by clicking the × button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Placeholder text for the input field. |
'Add tag and press Enter...'
|
|
int
|
Maximum number of tags allowed (0 = unlimited). |
0
|
|
bool
|
Whether duplicate tags are allowed. |
False
|
Signals
tags_changed: Emitted when tags are added or removed. tag_added: Emitted when a single tag is added. tag_removed: Emitted when a single tag is removed.
Examples:
>>> tag_input = FXTagInput(placeholder="Add tags...")
>>> tag_input.tags_changed.connect(lambda tags: print(f"Tags: {tags}"))
>>> tag_input.add_tag("python")
>>> tag_input.add_tag("qt")
Methods:
| Name | Description |
|---|---|
add_tag |
Add a tag to the input. |
clear_tags |
Remove all tags. |
remove_tag |
Remove a tag from the input. |
set_tags |
Set the tags, replacing any existing tags. |
Attributes:
| Name | Type | Description |
|---|---|---|
tags |
List[str]
|
Return the list of current tags. |
FXThemeAware
¶
Mixin that makes widgets automatically respond to theme changes.
This mixin provides automatic theme updates for custom widgets. When the theme changes, connected widgets are notified and can update their appearance.
Usage
- Inherit from FXThemeAware FIRST:
class MyWidget(FXThemeAware, QWidget) - Override
_on_theme_changed()to apply custom colors (optional) - Use
self.themeproperty to access current theme colors - Optionally declare a
theme_styleclass attribute for automatic QSS
Examples:
New API (recommended):
>>> from fxgui import fxstyle
>>> class FXMyWidget(FXThemeAware, QWidget):
... # Option 1: Declarative QSS with color tokens
... theme_style = '''
... FXMyWidget {
... background: @surface;
... border: 1px solid @border;
... }
... '''
...
... # Option 2: Programmatic colors in paintEvent
... def paintEvent(self, event):
... painter = QPainter(self)
... painter.fillRect(self.rect(), QColor(self.theme.surface))
Legacy API (deprecated, still works):
>>> class FXMyWidget(FXThemeAware, QWidget):
... def _apply_theme_styles(self):
... colors = fxstyle.get_theme_colors()
... self.setStyleSheet(f"background: {colors['surface']};")
Attributes:
| Name | Type | Description |
|---|---|---|
theme |
FXThemeColors
|
Property returning current theme colors as a FXThemeColors object. |
theme_style |
str
|
Optional class attribute with QSS containing @color tokens. |
Attributes¶
theme
property
¶
theme: FXThemeColors
Get current theme colors as a namespace object.
Returns:
| Type | Description |
|---|---|
FXThemeColors
|
FXThemeColors object with color attributes (e.g., theme.surface, |
FXThemeColors
|
theme.accent_primary, theme.text). |
Examples:
Functions¶
__apply_theme_style_attribute
¶
Process the theme_style class attribute and apply it.
FXThemeColors
¶
FXThemeColors(colors_dict: dict)
Namespace for accessing theme colors with dot notation.
This class provides a convenient way to access theme colors using attribute access instead of dictionary lookup.
Examples:
>>> colors = FXThemeColors(fxstyle.get_theme_colors())
>>> colors.surface # "#302f2f"
>>> colors.accent_primary # "#2196F3"
Initialize with a colors dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
Dictionary of color name to hex value mappings. |
required |
Functions¶
FXThemeManager
¶
Bases: QObject
flowchart TD
fxgui.fxwidgets.FXThemeManager[FXThemeManager]
click fxgui.fxwidgets.FXThemeManager href "" "fxgui.fxwidgets.FXThemeManager"
Singleton that emits theme_changed(str) when the theme changes.
Methods:
| Name | Description |
|---|---|
notify_theme_changed |
Called by apply_theme() when theme changes. |
Attributes:
| Name | Type | Description |
|---|---|---|
current_theme |
str
|
Return the current theme name. |
FXThumbnailDelegate
¶
Bases: FXThemeAware, QStyledItemDelegate
flowchart TD
fxgui.fxwidgets.FXThumbnailDelegate[FXThumbnailDelegate]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXThumbnailDelegate
click fxgui.fxwidgets.FXThumbnailDelegate href "" "fxgui.fxwidgets.FXThumbnailDelegate"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Custom item delegate for showing thumbnails in tree/list views.
This delegate displays items with thumbnails, titles, descriptions, and status indicators. It supports Markdown formatting in descriptions and tooltips. Additionally, it supports custom background colors via Qt.BackgroundRole with rounded corners and borders for visual hierarchy.
Note
Store data in items using the following roles:
- Qt.BackgroundRole (QColor/QBrush): Custom background color
with rounded corners and border.
- Qt.DecorationRole (QIcon): Icon for items without thumbnails.
- Qt.UserRole + 1 (bool): Whether to show the thumbnail.
- Qt.UserRole + 2 (str): Path to the thumbnail image.
- Qt.UserRole + 3 (str): Description text (supports Markdown).
- Qt.UserRole + 4 (QColor): Status dot indicator color.
- Qt.UserRole + 5 (QColor): Status label background color.
- Qt.UserRole + 6 (str): Status label text.
- Qt.UserRole + 7 (bool): Whether to show the status dot.
- Qt.UserRole + 8 (bool): Whether to show the status label.
- Qt.UserRole + 9 (QIcon): Status label icon (displayed before text).
Properties
show_thumbnail: Whether to show thumbnails globally. show_status_dot: Whether to show the status dot indicator globally. show_status_label: Whether to show the status label globally.
Note
Global properties and per-item roles work together: - An element is shown only if BOTH global property is True AND per-item role is True (or None/unset). - Setting per-item role to False hides that element for that item.
Note
When using custom backgrounds (Qt.BackgroundRole), call
FXThumbnailDelegate.apply_transparent_selection(view) to disable the
native Qt selection/hover highlighting, allowing the delegate's custom
highlighting to be visible.
Examples:
>>> from fxgui import fxwidgets
>>> from qtpy.QtWidgets import QTreeWidget, QTreeWidgetItem
>>> from qtpy.QtCore import Qt
>>> from qtpy.QtGui import QColor
>>>
>>> tree = QTreeWidget()
>>> delegate = fxwidgets.FXThumbnailDelegate()
>>> delegate.show_thumbnail = True
>>> delegate.show_status_dot = True
>>> delegate.show_status_label = True
>>> tree.setItemDelegate(delegate)
>>>
>>> item = QTreeWidgetItem(tree, ["My Item"])
>>> item.setData(0, fxwidgets.FXThumbnailDelegate.THUMBNAIL_VISIBLE_ROLE, True)
>>> item.setData(0, fxwidgets.FXThumbnailDelegate.THUMBNAIL_PATH_ROLE, "/path/to/image.png")
>>> item.setData(0, fxwidgets.FXThumbnailDelegate.DESCRIPTION_ROLE, "**Bold** description")
>>> item.setData(0, fxwidgets.FXThumbnailDelegate.STATUS_DOT_COLOR_ROLE, QColor("green"))
>>> # Hide status dot for this specific item
>>> item.setData(0, fxwidgets.FXThumbnailDelegate.STATUS_DOT_VISIBLE_ROLE, False)
>>> # Custom background color with rounded corners and border
>>> item.setBackground(0, QColor("#252424"))
Initialize the thumbnail delegate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
The parent widget. |
None
|
Methods:
| Name | Description |
|---|---|
apply_transparent_selection |
Apply transparent selection stylesheet to a tree view widget. |
helpEvent |
Provide Markdown-formatted tooltips. |
markdown_to_html |
Convert Markdown text to HTML. |
markdown_to_plain_text |
Convert Markdown text to plain text by removing formatting. |
paint |
Paint the item with custom background, border, and hover/selection. |
sizeHint |
Return the size hint for the item at the given index. |
Attributes:
| Name | Type | Description |
|---|---|---|
show_status_dot |
bool
|
Whether the status dot is shown. |
show_status_label |
bool
|
Whether the status label is shown. |
show_thumbnail |
bool
|
Whether thumbnails are shown globally. |
Attributes¶
show_thumbnail
property
writable
¶
show_thumbnail: bool
Whether thumbnails are shown globally.
Individual items can override via THUMBNAIL_VISIBLE_ROLE.
Functions¶
apply_transparent_selection
staticmethod
¶
apply_transparent_selection(view: QWidget) -> None
Apply transparent selection stylesheet to a tree view widget.
This method disables the default Qt selection/hover backgrounds by applying a comprehensive stylesheet directly to the widget. The delegate handles all selection and hover highlighting itself.
Call this on QTreeView/QTreeWidget instances that use custom backgrounds with FXThumbnailDelegate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
¶ |
QWidget
|
The tree view widget to apply transparent selection to. |
required |
helpEvent
¶
helpEvent(
event: QHelpEvent,
view: QAbstractItemView,
option: QStyleOptionViewItem,
index: QModelIndex,
) -> bool
Provide Markdown-formatted tooltips.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
¶ |
QHelpEvent
|
The help event. |
required |
view
¶ |
QAbstractItemView
|
The view widget. |
required |
option
¶ |
QStyleOptionViewItem
|
Style options. |
required |
index
¶ |
QModelIndex
|
The model index. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the event was handled. |
markdown_to_html
staticmethod
¶
markdown_to_plain_text
staticmethod
¶
paint
¶
Paint the item with custom background, border, and hover/selection.
This method handles all painting consistently across all items and columns, ensuring hover and selection highlighting looks the same everywhere. It supports custom background colors via Qt.BackgroundRole with rounded corners and borders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
painter
¶ |
QPainter
|
The painter to use for drawing. |
required |
option
¶ |
QStyleOptionViewItem
|
The style options for the item. |
required |
index
¶ |
QModelIndex
|
The model index of the item. |
required |
sizeHint
¶
FXTimelineSlider
¶
FXTimelineSlider(
parent: Optional[QWidget] = None,
start_frame: int = 1,
end_frame: int = 100,
current_frame: Optional[int] = None,
fps: int = 24,
show_controls: bool = True,
show_spinbox: bool = True,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXTimelineSlider[FXTimelineSlider]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXTimelineSlider
click fxgui.fxwidgets.FXTimelineSlider href "" "fxgui.fxwidgets.FXTimelineSlider"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A timeline/scrubber widget perfect for DCC applications.
This widget provides a timeline slider with: - Frame range display - Keyframe markers - Current frame indicator - Optional playback controls
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
int
|
Start frame of the timeline. |
1
|
|
int
|
End frame of the timeline. |
100
|
|
Optional[int]
|
Initial current frame. |
None
|
|
int
|
Frames per second for playback (default 24). |
24
|
|
bool
|
Whether to show playback controls. |
True
|
|
bool
|
Whether to show the frame spinbox. |
True
|
Signals
frame_changed: Emitted when the current frame changes. playback_started: Emitted when playback starts. playback_stopped: Emitted when playback stops.
Examples:
>>> timeline = FXTimelineSlider(start_frame=1, end_frame=100)
>>> timeline.frame_changed.connect(lambda f: print(f"Frame: {f}"))
>>> timeline.add_keyframe(10)
>>> timeline.add_keyframe(50)
Methods:
| Name | Description |
|---|---|
add_keyframe |
Add a keyframe marker. |
clear_keyframes |
Remove all keyframe markers. |
go_to_end |
Go to the end frame. |
go_to_start |
Go to the start frame. |
next_frame |
Advance to the next frame. |
play |
Start playback. |
previous_frame |
Go to the previous frame. |
remove_keyframe |
Remove a keyframe marker. |
set_fps |
Set the frames per second. |
set_frame |
Set the current frame. |
set_range |
Set the frame range. |
stop |
Stop playback. |
toggle_playback |
Toggle playback state. |
Attributes:
| Name | Type | Description |
|---|---|---|
current_frame |
int
|
Return the current frame. |
fps |
int
|
Return the current FPS. |
frame_range |
Tuple[int, int]
|
Return the frame range as (start, end). |
FXToggleSwitch
¶
FXToggleSwitch(
parent: Optional[QWidget] = None,
on_color: Optional[str] = None,
off_color: Optional[str] = None,
thumb_color: Optional[str] = None,
)
Bases: FXThemeAware, QAbstractButton
flowchart TD
fxgui.fxwidgets.FXToggleSwitch[FXToggleSwitch]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXToggleSwitch
click fxgui.fxwidgets.FXToggleSwitch href "" "fxgui.fxwidgets.FXToggleSwitch"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A modern iOS/Material-style animated toggle switch.
This widget provides a sleek alternative to QCheckBox with smooth sliding animation and theme-aware colors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
Optional[str]
|
Color when switch is on. If None, uses theme accent. |
None
|
|
Optional[str]
|
Color when switch is off. If None, uses theme surface. |
None
|
|
Optional[str]
|
Color of the thumb/knob. If None, uses white. |
None
|
Signals
toggled: Emitted when the switch state changes.
Examples:
>>> switch = FXToggleSwitch()
>>> switch.toggled.connect(lambda checked: print(f"Switch: {checked}"))
>>> switch.setChecked(True)
Methods:
| Name | Description |
|---|---|
hitButton |
Return True if pos is inside the clickable area. |
minimumSizeHint |
Return the minimum size of the switch. |
paintEvent |
Paint the toggle switch. |
position |
Set the animation position and trigger repaint. |
sizeHint |
Return the preferred size of the switch. |
Functions¶
FXTooltip
¶
FXTooltip(
parent: Optional[QWidget] = None,
title: Optional[str] = None,
description: str = "",
icon: Optional[str] = None,
image: Optional[QPixmap] = None,
shortcut: Optional[str] = None,
action_text: Optional[str] = None,
action_callback: Optional[Callable] = None,
position: FXTooltipPosition = AUTO,
show_delay: int = 500,
hide_delay: int = 200,
duration: int = 0,
persistent: bool = False,
show_arrow: bool = True,
max_width: int = 300,
)
Bases: FXThemeAware, QFrame
flowchart TD
fxgui.fxwidgets.FXTooltip[FXTooltip]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXTooltip
click fxgui.fxwidgets.FXTooltip href "" "fxgui.fxwidgets.FXTooltip"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A rich, theme-aware tooltip with advanced features.
This widget provides an enhanced tooltip experience with: - Rich content: title, description, icon, images, shortcuts - Smart positioning with arrow pointing to anchor - Theme-aware styling - Fade in/out animations - Hover or programmatic trigger - Configurable delays - Optional action buttons - Persistent mode (stays until clicked away)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget (anchor for positioning). |
None
|
|
Optional[str]
|
Optional title text (bold). |
None
|
|
str
|
Main tooltip content. |
''
|
|
Optional[str]
|
Optional icon name (from fxicons). |
None
|
|
Optional[QPixmap]
|
Optional QPixmap image to display. |
None
|
|
Optional[str]
|
Optional keyboard shortcut to display. |
None
|
|
Optional[str]
|
Optional action button text. |
None
|
|
Optional[Callable]
|
Callback for action button click. |
None
|
|
FXTooltipPosition
|
Preferred position relative to anchor. |
AUTO
|
|
int
|
Delay in ms before showing (default 500). |
500
|
|
int
|
Delay in ms before hiding after mouse leaves (default 200). |
200
|
|
int
|
Auto-hide duration in ms (0 = no auto-hide). |
0
|
|
bool
|
If True, tooltip stays until explicitly closed. |
False
|
|
bool
|
Whether to show the pointing arrow. |
True
|
|
int
|
Maximum width of the tooltip. |
300
|
Signals
shown: Emitted when the tooltip is shown. hidden: Emitted when the tooltip is hidden. action_clicked: Emitted when the action button is clicked.
Examples:
>>> # Simple tooltip attached to a button
>>> tooltip = FXTooltip(
... parent=my_button,
... title="Save",
... description="Save the current file to disk",
... shortcut="Ctrl+S",
... )
>>>
>>> # Rich tooltip with image and action
>>> tooltip = FXTooltip(
... parent=my_widget,
... title="New Feature!",
... description="Click here to learn about the new export options.",
... icon="lightbulb",
... action_text="Learn More",
... action_callback=lambda: show_help(),
... persistent=True,
... )
>>>
>>> # Programmatic show/hide
>>> tooltip.show_tooltip()
>>> tooltip.hide_tooltip()
Methods:
| Name | Description |
|---|---|
enterEvent |
Handle mouse entering tooltip. |
eventFilter |
Handle hover events on anchor widget and click-outside detection. |
hide_tooltip |
Programmatically hide the tooltip. |
leaveEvent |
Handle mouse leaving tooltip. |
mousePressEvent |
Handle click to dismiss persistent tooltip. |
paintEvent |
Paint the tooltip with arrow. |
set_anchor |
Change the anchor widget. |
set_content |
Update tooltip content dynamically. |
show_at_point |
Show tooltip at a specific global position. |
show_at_rect |
Show tooltip positioned relative to a global rectangle. |
show_for_rect |
Convenience method to show a tooltip for a screen rectangle. |
show_for_widget |
Convenience method to show a tooltip for a widget. |
show_tooltip |
Programmatically show the tooltip. |
Functions¶
eventFilter
¶
eventFilter(watched, event) -> bool
Handle hover events on anchor widget and click-outside detection.
set_anchor
¶
set_anchor(widget: QWidget) -> None
Change the anchor widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
¶ |
QWidget
|
New anchor widget. |
required |
set_content
¶
show_at_point
¶
show_at_point(global_pos: QPoint, position: FXTooltipPosition = BOTTOM) -> None
Show tooltip at a specific global position.
The tooltip will be positioned relative to the given point, treating it as a zero-size anchor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
global_pos
¶ |
QPoint
|
Global (screen) coordinates where tooltip should appear. |
required |
position
¶ |
FXTooltipPosition
|
Which direction the tooltip should extend from the point. |
BOTTOM
|
Examples:
show_at_rect
¶
show_at_rect(rect: QRect, position: Optional[FXTooltipPosition] = None) -> None
Show tooltip positioned relative to a global rectangle.
This is useful for showing tooltips relative to tree items, table cells, or other sub-widget regions that aren't QWidget instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rect
¶ |
QRect
|
Rectangle in global (screen) coordinates to position relative to. |
required |
position
¶ |
Optional[FXTooltipPosition]
|
Optional position override. Uses instance position if None. |
None
|
Examples:
show_for_rect
staticmethod
¶
show_for_rect(
rect: QRect,
title: Optional[str] = None,
description: str = "",
icon: Optional[str] = None,
shortcut: Optional[str] = None,
duration: int = 3000,
position: FXTooltipPosition = AUTO,
max_width: int = 300,
) -> FXTooltip
Convenience method to show a tooltip for a screen rectangle.
Creates and shows a tooltip immediately, auto-hiding after duration. Useful for tree items, table cells, or other non-widget regions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rect
¶ |
QRect
|
Rectangle in global (screen) coordinates. |
required |
title
¶ |
Optional[str]
|
Optional title. |
None
|
description
¶ |
str
|
Tooltip description. |
''
|
icon
¶ |
Optional[str]
|
Optional icon name. |
None
|
shortcut
¶ |
Optional[str]
|
Optional shortcut text. |
None
|
duration
¶ |
int
|
Auto-hide duration in ms. |
3000
|
position
¶ |
FXTooltipPosition
|
Tooltip position. |
AUTO
|
max_width
¶ |
int
|
Maximum width of the tooltip. |
300
|
Returns:
| Type | Description |
|---|---|
FXTooltip
|
The created FXTooltip instance. |
Examples:
>>> # Show tooltip for a tree item
>>> item_rect = tree.visualItemRect(item)
>>> global_rect = QRect(
... tree.viewport().mapToGlobal(item_rect.topLeft()),
... item_rect.size()
... )
>>> FXTooltip.show_for_rect(
... global_rect,
... title="Item Info",
... description="Details about this item",
... duration=2000
... )
show_for_widget
staticmethod
¶
show_for_widget(
widget: QWidget,
title: Optional[str] = None,
description: str = "",
icon: Optional[str] = None,
shortcut: Optional[str] = None,
duration: int = 3000,
position: FXTooltipPosition = AUTO,
) -> FXTooltip
Convenience method to show a tooltip for a widget.
Creates and shows a tooltip immediately, auto-hiding after duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
¶ |
QWidget
|
Widget to show tooltip for. |
required |
title
¶ |
Optional[str]
|
Optional title. |
None
|
description
¶ |
str
|
Tooltip description. |
''
|
icon
¶ |
Optional[str]
|
Optional icon name. |
None
|
shortcut
¶ |
Optional[str]
|
Optional shortcut text. |
None
|
duration
¶ |
int
|
Auto-hide duration in ms. |
3000
|
position
¶ |
FXTooltipPosition
|
Tooltip position. |
AUTO
|
Returns:
| Type | Description |
|---|---|
FXTooltip
|
The created FXTooltip instance. |
Examples:
FXTooltipManager
¶
FXTooltipManager(
parent: Optional[QObject] = None,
show_delay: int = 500,
hide_delay: int = 200,
max_width: int = 300,
)
Bases: QObject
flowchart TD
fxgui.fxwidgets.FXTooltipManager[FXTooltipManager]
click fxgui.fxwidgets.FXTooltipManager href "" "fxgui.fxwidgets.FXTooltipManager"
Global manager that intercepts standard Qt tooltips and shows FXTooltip instead.
This allows you to use the standard widget.setToolTip("text") API
and have FXTooltip displayed automatically.
The manager installs an application-wide event filter that intercepts QEvent.ToolTip events and shows an FXTooltip with the widget's tooltip text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QObject]
|
Parent QObject (typically QApplication.instance()). |
None
|
|
int
|
Delay in ms before showing tooltip (default 500). |
500
|
|
int
|
Delay in ms before hiding tooltip after mouse leaves (default 200). |
200
|
|
int
|
Maximum width of tooltips (default 300). |
300
|
Examples:
>>> # Install globally for the entire application
>>> app = QApplication(sys.argv)
>>> FXTooltipManager.install()
>>>
>>> # Now all setToolTip() calls will use FXTooltip
>>> button = QPushButton("Click me")
>>> button.setToolTip("This will show as an FXTooltip!")
>>>
>>> # Uninstall to restore default Qt tooltips
>>> FXTooltipManager.uninstall()
Methods:
| Name | Description |
|---|---|
eventFilter |
Intercept tooltip events and show FXTooltip instead. |
install |
Install the global tooltip manager. |
instance |
Get the current tooltip manager instance. |
is_installed |
Check if the tooltip manager is currently installed. |
uninstall |
Uninstall the global tooltip manager. |
Functions¶
eventFilter
¶
eventFilter(watched: QObject, event: QEvent) -> bool
Intercept tooltip events and show FXTooltip instead.
install
classmethod
¶
install(
show_delay: int = 500, hide_delay: int = 200, max_width: int = 300
) -> FXTooltipManager
Install the global tooltip manager.
After calling this, all widgets using setToolTip() will display FXTooltip instead of the standard Qt tooltip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_delay
¶ |
int
|
Delay in ms before showing tooltip. |
500
|
hide_delay
¶ |
int
|
Delay in ms before hiding tooltip. |
200
|
max_width
¶ |
int
|
Maximum width of tooltips. |
300
|
Returns:
| Type | Description |
|---|---|
FXTooltipManager
|
The installed FXTooltipManager instance. |
Examples:
instance
classmethod
¶
instance() -> Optional[FXTooltipManager]
Get the current tooltip manager instance.
Returns:
| Type | Description |
|---|---|
Optional[FXTooltipManager]
|
The FXTooltipManager instance, or None if not installed. |
is_installed
classmethod
¶
is_installed() -> bool
Check if the tooltip manager is currently installed.
Returns:
| Type | Description |
|---|---|
bool
|
True if installed, False otherwise. |
uninstall
classmethod
¶
FXTooltipPosition
¶
Bases: IntEnum
flowchart TD
fxgui.fxwidgets.FXTooltipPosition[FXTooltipPosition]
click fxgui.fxwidgets.FXTooltipPosition href "" "fxgui.fxwidgets.FXTooltipPosition"
Tooltip position relative to anchor widget.
FXValidatedLineEdit
¶
FXValidatedLineEdit(
parent: Optional[QWidget] = None,
shake_amplitude: int = 4,
shake_duration: int = 300,
flash_duration: int = 400,
)
Bases: FXThemeAware, QLineEdit
flowchart TD
fxgui.fxwidgets.FXValidatedLineEdit[FXValidatedLineEdit]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXValidatedLineEdit
click fxgui.fxwidgets.FXValidatedLineEdit href "" "fxgui.fxwidgets.FXValidatedLineEdit"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A line edit that provides visual feedback when input is rejected.
When a validator rejects input (e.g., typing an invalid character), this widget shows a brief shake animation with a red border flash to indicate to the user that their input was not accepted.
The error color is theme-aware and uses the feedback "error" color from the current theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
The parent widget. |
None
|
|
int
|
Maximum horizontal displacement in pixels. |
4
|
|
int
|
Total duration of shake animation in milliseconds. |
300
|
|
int
|
Duration of red border flash in milliseconds. |
400
|
Examples:
>>> from qtpy.QtWidgets import QLineEdit
>>> from fxgui.fxwidgets import FXValidatedLineEdit, FXCamelCaseValidator
>>> line_edit = FXValidatedLineEdit()
>>> line_edit.setValidator(FXCamelCaseValidator())
>>> line_edit.setPlaceholderText("camelCase only")
Methods:
| Name | Description |
|---|---|
keyPressEvent |
Intercept key presses to detect rejected input. |
FXWidget
¶
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets.FXWidget[FXWidget]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets.FXWidget
click fxgui.fxwidgets.FXWidget href "" "fxgui.fxwidgets.FXWidget"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Functions¶
set_tooltip
¶
set_tooltip(
target: Union[QWidget, QTreeWidgetItem, QListWidgetItem, QTableWidgetItem],
description: str = "",
title: Optional[str] = None,
icon: Optional[str] = None,
shortcut: Optional[str] = None,
position: FXTooltipPosition = AUTO,
show_delay: int = 500,
hide_delay: int = 200,
) -> FXTooltip
Attach an FXTooltip to a widget or item with a simple API.
This is a convenience function similar to fxicons.set_icon() that creates
and attaches an FXTooltip to the given target. The tooltip is automatically
shown on hover and hidden when the mouse leaves.
Supports both QWidget subclasses and item-based widgets: - QWidget (buttons, labels, etc.) - QTreeWidgetItem - QListWidgetItem - QTableWidgetItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Union[QWidget, QTreeWidgetItem, QListWidgetItem, QTableWidgetItem]
|
The widget or item to attach the tooltip to. |
required |
|
str
|
Main tooltip content text. |
''
|
|
Optional[str]
|
Optional bold title text. |
None
|
|
Optional[str]
|
Optional icon name (from fxicons). |
None
|
|
Optional[str]
|
Optional keyboard shortcut to display. |
None
|
|
FXTooltipPosition
|
Preferred position relative to target. |
AUTO
|
|
int
|
Delay in ms before showing (default 500). |
500
|
|
int
|
Delay in ms before hiding after mouse leaves (default 200). |
200
|
Returns:
| Type | Description |
|---|---|
FXTooltip
|
The created FXTooltip instance (kept internally to prevent GC). |
Examples:
>>> # Simple tooltip on a button
>>> set_tooltip(button, "Click to save the file")
>>>
>>> # Rich tooltip with all options
>>> set_tooltip(
... button,
... description="Save the current document to disk.",
... title="Save",
... icon="save",
... shortcut="Ctrl+S",
... )
>>>
>>> # Tooltip on a tree item
>>> item = QTreeWidgetItem(tree, ["Item 1"])
>>> set_tooltip(
... item,
... description="This is a tree item tooltip",
... title="Item Info",
... icon="info",
... )