fxutils
Utils related the fxgui
package.
add_shadows
add_shadows(
parent: QWidget,
shadow_object: QWidget,
color: str = "#000000",
blur: float = 10,
offset: float = 0,
) -> QGraphicsDropShadowEffect
Apply shadows to a widget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent |
QWidget
|
Parent object. |
required |
shadow_object |
QWidget
|
Object to receive shadows. |
required |
color |
str
|
Color of the shadows. Defaults to |
'#000000'
|
blur |
float
|
Blur level of the shadows. Defaults to |
10
|
offset |
float
|
Offset of the shadow from the
|
0
|
Returns:
Name | Type | Description |
---|---|---|
QGraphicsDropShadowEffect |
QGraphicsDropShadowEffect
|
The shadow object. |
Examples:
convert_qicon_to_qpixmap
Converts a QIcon to a QPixmap.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
icon |
QIcon
|
The QIcon to convert. |
required |
desired_size |
Optional[QSize]
|
The desired size for the pixmap (QSize). If |
None
|
Returns:
Name | Type | Description |
---|---|---|
QPixmap |
Optional[QPixmap]
|
A QPixmap or |
Examples:
Let the size be decided
Choose a size
create_action
create_action(
parent: QWidget,
name: str,
icon: str,
trigger: Callable,
enable: bool = True,
visible: bool = True,
shortcut: str = None,
) -> Optional[QAction]
Creates a QACtion.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent |
QWidget
|
Parent object. |
required |
name |
str
|
Name to display. |
required |
icon |
str
|
Icon path. |
required |
trigger |
Callable
|
Function to trigger when clicked. |
required |
enable |
bool
|
Enable/disable. Defaults to |
True
|
visible |
bool
|
Show/hide. Defaults to |
True
|
shortcut |
str
|
If not |
None
|
Returns:
Type | Description |
---|---|
Optional[QAction]
|
Optional[QAction]: The created QAction. |
deprecated
Decorator to mark functions as deprecated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
Callable
|
The function to mark as deprecated. |
required |
filter_tree
Filters the items of a tree by displaying or hiding them based on whether they match the filter text. Both root and child items are considered.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_bar_object |
QLineEdit
|
The QLineEdit widget representing the filter bar. |
required |
tree_to_filter |
QTreeWidget
|
The QTreeWidget to be filtered. |
required |
column |
int
|
The column index to use for text filtering.
Defaults to |
0
|
Examples:
load_ui
Load a UI file and return the loaded UI as a QWidget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent |
QWidget
|
Parent object. |
required |
ui_file |
str
|
Path to the UI file. |
required |
Returns:
Name | Type | Description |
---|---|---|
QWidget |
QWidget
|
The loaded UI. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the specified UI file doesn't exist. |
Examples:
To load a UI file located in the same directory as the Python script
set_formatted_tooltip
Set a formatted tooltip. The tooltip will be displayed with a bold title, and a separator line between the title and the tooltip text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget |
QWidget
|
The widget to set the tooltip. |
required |
title |
str
|
The title of the tooltip. |
required |
tooltip |
str
|
The tooltip text. |
required |
duration |
int
|
The duration in seconds to show the tooltip.
Defaults to |
5
|
Examples: