Beginner problems with QML and glyphs
-
Hi,
I'm new to QT. At the moment I'm playing around for testing with qml and i encountered a strange problem:
I started to use the material fonts as icons.For this i added the Font in cpp:
QFontDatabase::addApplicationFont(":/Ressources/MaterialSymbolsOutlined.ttf");then i try to use it in QML:
ToolButton {
font.family: "MaterialSymbolsOutlined"
font.pixelSize: 24
text: "\ue900"
}here i get a totaly wrong icon displayed, while "\ue8ff" as example works just well.
Do you have got any idea what i'm doing wrong here?
Thanks
Edit:
• Which Qt version are you using? QT 6.10.1
• Which version of QtCreator are you using? 18.01
• Which platform? Windows 11
• How did you install it? Installer -
I would recommend using icons as .svg instead of iconfonts
Buttons support icon themes : https://doc.qt.io/qt-6/qtquickcontrols-icons.html .
Write anicon.themefile pointing to a folder with your icons then you could do the following in your code:ToolButton { icon.name: "zoom_out" } -
Thank you,
I will take look at it.