Adds Feather Icons usable in QML for PySide6
Project description
PySide6 Feather Icons
A PySide6 library for integrating Feather icons into QML.
Installation
In your Python project, if you are using a virtual environment, source it, then run
pip install PySide6-FeatherIcons-QML
Your app's QQmlApplicationEngine
first needs to be registered before any icons can be used. This is done with the FeatherIconsQML.register(e: QQmlApplicationEngine)
method.
# main.py
(...)
from PySide6.QtQml import QQmlApplicationEngine
import FeatherIconsQML
(...)
engine = QQmlApplicationEngine()
FeatherIconsQML.register(engine)
The FeatherIcons
module can now be imported inside QML files:
// view.qml
import FeatherIcons
Usage
1. FeatherIcon QML object
The FeatherIcon
QML object is used to display icons.
Properties
Name | Type | Required | Default | Notes |
---|---|---|---|---|
icon | string | true | A valid Feather icon name. All possible Feather icons can be found here: https://feathericons.com/ | |
iconSize | real | false | 24 | |
strokeWidth | real | false | 2.0 | Accepted values are: 0.5, 1.0, 1.5, 2.0, 2.5, 3.0 |
color | color | false | "black" | |
shadowEnabled | bool | false | false | This and other shadow/blur-related properties are passed to a MultiEffect QML object (https://doc.qt.io/qt-6/qml-qtquick-effects-multieffect.html) |
shadowColor | color | false | "black" | |
shadowHorizontalOffset | real | false | 2 | |
shadowVerticalOffset | real | false | 2 | |
shadowBlur | real | false | 0.6 | Value ranges from 0.0 to 1.0 |
shadowOpacity | real | false | 0.6 | Value ranges from 0.0 to 1.0 |
shadowScale | real | false | 1.0 | |
blurEnabled | bool | false | false | |
blur | real | false | 0.0 | Value ranges from 0.0 to 1.0 |
blurMax | int | false | 32 | Affects both blur and shadow effects. |
blurMultiplier | real | false | 1.0 | Affects both blur and shadow effects. |
Because a FeatherIcon
is first and foremost a QML Item
under the hood, it also supports the properties listed here: https://doc.qt.io/qt-6/qml-qtquick-item.html
Example
// view.qml
import FeatherIcons
(...)
FeatherIcon {
icon: "feather"
}
FeatherIcon {
icon: "activity"
iconSize: 48
color: "white"
strokeWidth: 1.5
}
2. Icons in Qt Quick Controls
Buttons, item delegates and menu items can present an icon in addition to a text label with Qt Quick Controls. In order to use Feather icons with such components, this library exposes a FeatherIconsVault
singleton class containing a getSource
method.
For more information regarding Icons in Qt Quick Controls, please see: https://doc.qt.io/qt-6/qtquickcontrols-icons.html
getSource(featherIconName: string, strokeWidth?: number): string
Returns the source URL of a Feather icon given its featherIconName
and a strokeWidth
, which can then be passed to the icon.source
property (of a Button
, for example).
Arguments | Default value | Details |
---|---|---|
featherIconName | A valid Feather icon name. | |
strokeWidth | 2.0 | Accepted values are: 0.5, 1.0, 1.5, 2.0, 2.5, 3.0 |
Example
// view.qml
import QtQuick.Controls
import FeatherIcons
...
Button {
text: "Increase"
icon.source: FeatherIconsVault.getSource("plus")
icon.color: "green"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file PySide6_FeatherIcons_QML-0.1.2.tar.gz
.
File metadata
- Download URL: PySide6_FeatherIcons_QML-0.1.2.tar.gz
- Upload date:
- Size: 142.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c949d35df37b8a25534785d0dd026094e2dd688f052878c037b7271e2868dc2 |
|
MD5 | 205e33d2820e279b482e42830fd13f32 |
|
BLAKE2b-256 | c217f82a52914b504a47da0432d11aba5b1300286cf850c2387669368776d76e |