dridk / qfonticon Goto Github PK
View Code? Open in Web Editor NEWUse font like "awesome font" as icons for Qt application
License: MIT License
Use font like "awesome font" as icons for Qt application
License: MIT License
#include <QApplication>
#include <QtWidgets>
#include "qfonticon.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFontIcon::addFont(":/fa-solid-900.ttf"); // fontawesome free 5.6.3 solid
//QFontIcon::addFont(":/fontawesome.ttf");
QGridLayout * iconsLayout = new QGridLayout;
QWidget * iconsWidget = new QWidget;
iconsWidget->setWindowTitle("Some icons from awesome font");
iconsWidget->setLayout(iconsLayout);
int code = 0xf450; // start address
for (int x=0; x<10; x++)
{
for (int y=0;y<10; y++)
{
QPushButton * button = new QPushButton(QFontIcon::icon(code),QString::number(code));
iconsLayout->addWidget(button,x,y);
if (y == 5)
button->setDisabled(true);
code++;
}
}
iconsWidget->show();
return a.exec();
}
I am using the same file which is included with QFontIcon project.
DirectWrite: CreateFontFaceFromHDC() failed (Indicates an error in an input file such as a font file.) for QFontDef(Family="Fixedsys", pointsize=9.75, pixelsize=15, styleHint=5, weight=50, stretch=100, hintingPreference=0) LOGFONT("Fixedsys", lfWidth=0, lfHeight=-15) dpi=96
I had a segmentation fault that would have been mystifying without -fsanitize
. Please clarify this, as it's not obvious—in fact for some things (application-wide styles come to mind) you have to do them before making the QApplication instance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.