mirror of
https://github.com/gamecreature/QtAwesome.git
synced 2025-12-17 04:04:35 +03:00
ref #35, QML QuickImageProvider Support.
This commit is contained in:
35
README.md
35
README.md
@@ -82,6 +82,9 @@ awesome->initFontAwesome(); // This line is important as it loads the font a
|
||||
- Add an accessor to this object (i.e. a global function, member of your application object, or whatever you like).
|
||||
- Use an icon name from the [Font Awesome Library](https://fontawesome.com/icons).
|
||||
|
||||
For QML Usage please look at the embedded QtAwesomeSampleQml project.
|
||||
And the QML documentation in the readme.
|
||||
|
||||
## Examples
|
||||
|
||||
Next the icons can be accessed via the `awesome->icon` method.
|
||||
@@ -247,6 +250,38 @@ So the list of items used is:
|
||||
- style-active-off
|
||||
- style-selected-off
|
||||
|
||||
## QML Usage
|
||||
|
||||
For QML usage you can register the `QtAwesomeQuickImageProvider`.
|
||||
|
||||
```c++
|
||||
fa::QtAwesome* awesome = new fa::QtAwesome(qApp);
|
||||
awesome->initFontAwesome();
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.addImageProvider("fa", new QtAwesomeQuickImageProvider(awesome));
|
||||
```
|
||||
|
||||
After doing this it possible to access the icons via the following URL format:
|
||||
|
||||
`image://fa/type/name?options`
|
||||
|
||||
Some examples URLs
|
||||
|
||||
- image://fa/solid/user
|
||||
- image://fa/regular/thumbs-up
|
||||
- image://fa/solid/beer?color=FFFF77
|
||||
|
||||
QML Example:
|
||||
|
||||
```qml
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: "image://fa/regular/thumbs-up"
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Known Issues And Workarounds
|
||||
|
||||
On Mac OS X, placing an qtAwesome icon in QMainWindow menu, doesn't work directly.
|
||||
|
||||
Reference in New Issue
Block a user