Use icon fonts in QML.
- Add
qml-icon-fonts
as a submodule to your repository. - Include the subdirectory in the
CMakeLists.txt
and link against the plugin:add_subdirectory(thirdparty/IconFonts) qt_add_executable(app ...) target_link_libraries( icon-fonts-example PRIVATE qml-icon-fontsplugin)
- Use in QML files:
import IconFonts Text { text: FontAwesome.bell font.family: FontAwesome.fontSolid.family font.styleName: FontAwesome.fontSolid.styleName }
All icon names are written in camelCase and all names that start with digits or are reserved keywords start with an underscore:
QML | Original |
---|---|
FontAwesome.faceGrin |
face-grin |
FontAwesome._print |
print |
FontAwesome._children |
children |
FontAwesome._0 |
0 |
Font | Version |
---|---|
Font Awesome (free) | 6.4.2 |
Currently only Font Awesome is supported, but more fonts are planned for future releases.
This project was inspired by FontAwesome.pri.