fxicons
This module provides functionality for handling icons.
add_library
Add a new icon library to the available libraries.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
library |
str
|
The name of the library. |
required |
pattern |
str
|
The pattern to use for the library. Valid placeholders are:
- |
required |
defaults |
Dict
|
The default values for the library. |
required |
root |
Optional[Path]
|
The root path for the library. Defaults to
|
None
|
Examples:
change_pixmap_color
Change the color of a pixmap.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixmap |
QPixmap
|
The pixmap to change the color of. |
required |
color |
str
|
The color to apply. |
required |
Returns:
Name | Type | Description |
---|---|---|
QPixmap |
QPixmap
|
The pixmap with the new color applied. |
convert_icon_to_pixmap
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:
Type | Description |
---|---|
Optional[QPixmap]
|
A QPixmap or |
Examples:
Let the size be decided
Choose a size
get_available_icons_in_library
Get all available icon names in the specified library.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
library |
str
|
The name of the library. |
required |
Returns:
Type | Description |
---|---|
List[str]
|
List[str]: The available icon names in the library. |
Raises:
Type | Description |
---|---|
ValueError
|
If the library does not exist. |
FileNotFoundError
|
If no icons are found in the library. |
Examples:
get_available_libraries
get_icon
cached
get_icon(
icon_name: str,
width: Optional[int] = None,
height: Optional[int] = None,
color: Optional[str] = None,
library: Optional[str] = None,
style: Optional[str] = None,
extension: Optional[str] = None,
) -> QIcon
Get a QIcon of the specified icon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
icon_name |
str
|
The name of the icon. |
required |
width |
Optional[int]
|
The width of the pixmap. Defaults to |
None
|
height |
Optional[int]
|
The height of the pixmap. Defaults to |
None
|
color |
Optional[str]
|
The color to convert the pixmap to. Defaults to |
None
|
library |
Optional[str]
|
The library of the icon. Defaults to |
None
|
style |
Optional[str]
|
The style of the icon. Defaults to |
None
|
extension |
Optional[str]
|
The extension of the icon. Defaults to |
None
|
Returns:
Name | Type | Description |
---|---|---|
QIcon |
QIcon
|
The QIcon of the icon. |
Examples:
get_icon_path
get_icon_path(
icon_name: str,
library: Optional[str] = None,
style: Optional[str] = None,
extension: Optional[str] = None,
) -> str
Get the path of the specified icon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
icon_name |
str
|
The name of the icon. |
required |
library |
Optional[str]
|
The library of the icon. Defaults to |
None
|
style |
Optional[str]
|
The style of the icon. Defaults to |
None
|
extension |
Optional[str]
|
The extension of the icon. Defaults to |
None
|
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If verify is |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The path of the icon. |
Examples:
get_pixmap
cached
get_pixmap(
icon_name: str,
width: Optional[int] = None,
height: Optional[int] = None,
color: Optional[str] = None,
library: Optional[str] = None,
style: Optional[str] = None,
extension: Optional[str] = None,
) -> QPixmap
Get a QPixmap of the specified icon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
icon_name |
str
|
The name of the icon. |
required |
width |
Optional[int]
|
The width of the pixmap. Defaults to |
None
|
height |
Optional[int]
|
The height of the pixmap. Defaults to |
None
|
color |
Optional[str]
|
The color to convert the pixmap to. Defaults to |
None
|
library |
Optional[str]
|
The library of the icon. Defaults to |
None
|
style |
Optional[str]
|
The style of the icon. Defaults to |
None
|
extension |
Optional[str]
|
The extension of the icon. Defaults to |
None
|
Returns:
Name | Type | Description |
---|---|---|
QPixmap |
QPixmap
|
The QPixmap of the icon. |
Examples:
has_transparency
Check if a mask has any transparency.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask |
QBitmap
|
The mask to check. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
|
set_default_icon_library
set_icon_defaults
Set the default values for the icons.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
apply_to |
Optional[str]
|
The library to apply the defaults to. If set to |
None
|
**kwargs |
The default values to set. |
{}
|
Examples:
superpose_icons
Superpose multiple icons.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*icons |
QIcon
|
Icons to superpose. Add the icons in the order you want them to be superposed, from background to foreground. |
()
|
Returns:
Name | Type | Description |
---|---|---|
QIcon |
QIcon
|
The QIcon of the superposed icons. |
Notes
The size of the resulting icon is the size of the first icon.
Examples: