Font Awesome 6

This commit is contained in:
Rick Blommers 2022-12-27 17:15:12 +01:00
commit 5364094fb6
26 changed files with 8521 additions and 2009 deletions

8
.gitignore vendored
View File

@ -1,3 +1,7 @@
.DS_Store
.*
*.pro.user
/*build*
*.pro.user*
/*build*
# never include pro files
QtAwesome/fonts/pro/

View File

@ -1,7 +1,7 @@
MIT License
===========
Copyright 2013-2015 [Reliable Bits Software by Blommers IT](http://blommersit.nl). All Rights Reserved.
Copyright 2013-2022 [Reliable Bits Software by Blommers IT](https://blommersit.nl). All Rights Reserved.
Author [Rick Blommers](mailto:rick@blommersit.nl)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@ -17,13 +17,21 @@ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Font Awesome License
Font Awesome License
====================
[https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome)
The Font Awesome font is licensed under the SIL Open Font License - [http://scripts.sil.org/OFL](http://scripts.sil.org/OFL)
The Font Awesome pictograms are licensed under the CC BY 3.0 License - [http://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/)
"Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome"
Font Awesome Free is free, open source, and GPL friendly. You can use it for commercial projects,
open source projects, or really almost whatever you want.
- Icons — CC BY 4.0 License
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons packaged as .svg and .js files types.
- Fonts — SIL OFL 1.1 License
In the Font Awesome Free download, the SIL OLF license applies to all icons packaged as web and desktop font files.
- Code — MIT License
In the Font Awesome Free download, the MIT license applies to all non-font and non-icon files.
Attribution is required by MIT, SIL OLF, and CC BY licenses. Downloaded Font Awesome Free files already contain embedded comments with sufficient attribution, so you shouldn't need to do anything additional when using these files normally.
We've kept attribution comments terse, so we ask that you do not actively work to remove them from files,
especially code. They're a great way for folks to learn about Font Awesome.

File diff suppressed because it is too large Load Diff

View File

@ -3,821 +3,71 @@
*
* MIT Licensed
*
* Copyright 2013-2015 - Reliable Bits Software by Blommers IT. All Rights Reserved.
* Copyright 2013-2022 - Reliable Bits Software by Blommers IT. All Rights Reserved.
* Author Rick Blommers
*/
#ifndef QTAWESOME_H
#define QTAWESOME_H
#include "QtAwesomeAnim.h"
#include <QIcon>
#include <QIconEngine>
#include <QPainter>
#include <QRect>
#include <QVariantMap>
#include "QtAwesomeAnim.h"
/// A list of all icon-names with the codepoint (unicode-value) on the right
/// You can use the names on the page http://fortawesome.github.io/Font-Awesome/design.html
#include "QtAwesomeEnumGenerated.h"
namespace fa {
enum icon {
fa_500px = 0xf26e,
addressbook = 0xf2b9,
addressbooko = 0xf2ba,
addresscard = 0xf2bb,
addresscardo = 0xf2bc,
adjust = 0xf042,
adn = 0xf170,
aligncenter = 0xf037,
alignjustify = 0xf039,
alignleft = 0xf036,
alignright = 0xf038,
amazon = 0xf270,
ambulance = 0xf0f9,
americansignlanguageinterpreting = 0xf2a3,
anchor = 0xf13d,
android = 0xf17b,
angellist = 0xf209,
angledoubledown = 0xf103,
angledoubleleft = 0xf100,
angledoubleright = 0xf101,
angledoubleup = 0xf102,
angledown = 0xf107,
angleleft = 0xf104,
angleright = 0xf105,
angleup = 0xf106,
apple = 0xf179,
archive = 0xf187,
areachart = 0xf1fe,
arrowcircledown = 0xf0ab,
arrowcircleleft = 0xf0a8,
arrowcircleodown = 0xf01a,
arrowcircleoleft = 0xf190,
arrowcircleoright = 0xf18e,
arrowcircleoup = 0xf01b,
arrowcircleright = 0xf0a9,
arrowcircleup = 0xf0aa,
arrowdown = 0xf063,
arrowleft = 0xf060,
arrowright = 0xf061,
arrowup = 0xf062,
arrows = 0xf047,
arrowsalt = 0xf0b2,
arrowsh = 0xf07e,
arrowsv = 0xf07d,
aslinterpreting = 0xf2a3,
assistivelisteningsystems = 0xf2a2,
asterisk = 0xf069,
at = 0xf1fa,
audiodescription = 0xf29e,
automobile = 0xf1b9,
backward = 0xf04a,
balancescale = 0xf24e,
ban = 0xf05e,
bandcamp = 0xf2d5,
bank = 0xf19c,
barchart = 0xf080,
barcharto = 0xf080,
barcode = 0xf02a,
bars = 0xf0c9,
bath = 0xf2cd,
bathtub = 0xf2cd,
battery = 0xf240,
battery0 = 0xf244,
battery1 = 0xf243,
battery2 = 0xf242,
battery3 = 0xf241,
battery4 = 0xf240,
batteryempty = 0xf244,
batteryfull = 0xf240,
batteryhalf = 0xf242,
batteryquarter = 0xf243,
batterythreequarters = 0xf241,
bed = 0xf236,
beer = 0xf0fc,
behance = 0xf1b4,
behancesquare = 0xf1b5,
bell = 0xf0f3,
bello = 0xf0a2,
bellslash = 0xf1f6,
bellslasho = 0xf1f7,
bicycle = 0xf206,
binoculars = 0xf1e5,
birthdaycake = 0xf1fd,
bitbucket = 0xf171,
bitbucketsquare = 0xf172,
bitcoin = 0xf15a,
blacktie = 0xf27e,
blind = 0xf29d,
bluetooth = 0xf293,
bluetoothb = 0xf294,
bold = 0xf032,
bolt = 0xf0e7,
bomb = 0xf1e2,
book = 0xf02d,
bookmark = 0xf02e,
bookmarko = 0xf097,
braille = 0xf2a1,
briefcase = 0xf0b1,
btc = 0xf15a,
bug = 0xf188,
building = 0xf1ad,
buildingo = 0xf0f7,
bullhorn = 0xf0a1,
bullseye = 0xf140,
bus = 0xf207,
buysellads = 0xf20d,
cab = 0xf1ba,
calculator = 0xf1ec,
calendar = 0xf073,
calendarchecko = 0xf274,
calendarminuso = 0xf272,
calendaro = 0xf133,
calendarpluso = 0xf271,
calendartimeso = 0xf273,
camera = 0xf030,
cameraretro = 0xf083,
car = 0xf1b9,
caretdown = 0xf0d7,
caretleft = 0xf0d9,
caretright = 0xf0da,
caretsquareodown = 0xf150,
caretsquareoleft = 0xf191,
caretsquareoright = 0xf152,
caretsquareoup = 0xf151,
caretup = 0xf0d8,
cartarrowdown = 0xf218,
cartplus = 0xf217,
cc = 0xf20a,
ccamex = 0xf1f3,
ccdinersclub = 0xf24c,
ccdiscover = 0xf1f2,
ccjcb = 0xf24b,
ccmastercard = 0xf1f1,
ccpaypal = 0xf1f4,
ccstripe = 0xf1f5,
ccvisa = 0xf1f0,
certificate = 0xf0a3,
chain = 0xf0c1,
chainbroken = 0xf127,
check = 0xf00c,
checkcircle = 0xf058,
checkcircleo = 0xf05d,
checksquare = 0xf14a,
checksquareo = 0xf046,
chevroncircledown = 0xf13a,
chevroncircleleft = 0xf137,
chevroncircleright = 0xf138,
chevroncircleup = 0xf139,
chevrondown = 0xf078,
chevronleft = 0xf053,
chevronright = 0xf054,
chevronup = 0xf077,
child = 0xf1ae,
chrome = 0xf268,
circle = 0xf111,
circleo = 0xf10c,
circleonotch = 0xf1ce,
circlethin = 0xf1db,
clipboard = 0xf0ea,
clocko = 0xf017,
clone = 0xf24d,
close = 0xf00d,
cloud = 0xf0c2,
clouddownload = 0xf0ed,
cloudupload = 0xf0ee,
cny = 0xf157,
code = 0xf121,
codefork = 0xf126,
codepen = 0xf1cb,
codiepie = 0xf284,
coffee = 0xf0f4,
cog = 0xf013,
cogs = 0xf085,
columns = 0xf0db,
comment = 0xf075,
commento = 0xf0e5,
commenting = 0xf27a,
commentingo = 0xf27b,
comments = 0xf086,
commentso = 0xf0e6,
compass = 0xf14e,
compress = 0xf066,
connectdevelop = 0xf20e,
contao = 0xf26d,
copy = 0xf0c5,
copyright = 0xf1f9,
creativecommons = 0xf25e,
creditcard = 0xf09d,
creditcardalt = 0xf283,
crop = 0xf125,
crosshairs = 0xf05b,
css3 = 0xf13c,
cube = 0xf1b2,
cubes = 0xf1b3,
cut = 0xf0c4,
cutlery = 0xf0f5,
dashboard = 0xf0e4,
dashcube = 0xf210,
database = 0xf1c0,
deaf = 0xf2a4,
deafness = 0xf2a4,
dedent = 0xf03b,
delicious = 0xf1a5,
desktop = 0xf108,
deviantart = 0xf1bd,
diamond = 0xf219,
digg = 0xf1a6,
dollar = 0xf155,
dotcircleo = 0xf192,
download = 0xf019,
dribbble = 0xf17d,
driverslicense = 0xf2c2,
driverslicenseo = 0xf2c3,
dropbox = 0xf16b,
drupal = 0xf1a9,
edge = 0xf282,
edit = 0xf044,
eercast = 0xf2da,
eject = 0xf052,
ellipsish = 0xf141,
ellipsisv = 0xf142,
empire = 0xf1d1,
envelope = 0xf0e0,
envelopeo = 0xf003,
envelopeopen = 0xf2b6,
envelopeopeno = 0xf2b7,
envelopesquare = 0xf199,
envira = 0xf299,
eraser = 0xf12d,
etsy = 0xf2d7,
eur = 0xf153,
euro = 0xf153,
exchange = 0xf0ec,
exclamation = 0xf12a,
exclamationcircle = 0xf06a,
exclamationtriangle = 0xf071,
expand = 0xf065,
expeditedssl = 0xf23e,
externallink = 0xf08e,
externallinksquare = 0xf14c,
eye = 0xf06e,
eyeslash = 0xf070,
eyedropper = 0xf1fb,
fa = 0xf2b4,
facebook = 0xf09a,
facebookf = 0xf09a,
facebookofficial = 0xf230,
facebooksquare = 0xf082,
fastbackward = 0xf049,
fastforward = 0xf050,
fax = 0xf1ac,
feed = 0xf09e,
female = 0xf182,
fighterjet = 0xf0fb,
file = 0xf15b,
filearchiveo = 0xf1c6,
fileaudioo = 0xf1c7,
filecodeo = 0xf1c9,
fileexcelo = 0xf1c3,
fileimageo = 0xf1c5,
filemovieo = 0xf1c8,
fileo = 0xf016,
filepdfo = 0xf1c1,
filephotoo = 0xf1c5,
filepictureo = 0xf1c5,
filepowerpointo = 0xf1c4,
filesoundo = 0xf1c7,
filetext = 0xf15c,
filetexto = 0xf0f6,
filevideoo = 0xf1c8,
filewordo = 0xf1c2,
filezipo = 0xf1c6,
fileso = 0xf0c5,
film = 0xf008,
filter = 0xf0b0,
fire = 0xf06d,
fireextinguisher = 0xf134,
firefox = 0xf269,
firstorder = 0xf2b0,
flag = 0xf024,
flagcheckered = 0xf11e,
flago = 0xf11d,
flash = 0xf0e7,
flask = 0xf0c3,
flickr = 0xf16e,
floppyo = 0xf0c7,
folder = 0xf07b,
foldero = 0xf114,
folderopen = 0xf07c,
folderopeno = 0xf115,
font = 0xf031,
fontawesome = 0xf2b4,
fonticons = 0xf280,
fortawesome = 0xf286,
forumbee = 0xf211,
forward = 0xf04e,
foursquare = 0xf180,
freecodecamp = 0xf2c5,
frowno = 0xf119,
futbolo = 0xf1e3,
gamepad = 0xf11b,
gavel = 0xf0e3,
gbp = 0xf154,
ge = 0xf1d1,
gear = 0xf013,
gears = 0xf085,
genderless = 0xf22d,
getpocket = 0xf265,
gg = 0xf260,
ggcircle = 0xf261,
gift = 0xf06b,
git = 0xf1d3,
gitsquare = 0xf1d2,
github = 0xf09b,
githubalt = 0xf113,
githubsquare = 0xf092,
gitlab = 0xf296,
gittip = 0xf184,
glass = 0xf000,
glide = 0xf2a5,
glideg = 0xf2a6,
globe = 0xf0ac,
google = 0xf1a0,
googleplus = 0xf0d5,
googlepluscircle = 0xf2b3,
googleplusofficial = 0xf2b3,
googleplussquare = 0xf0d4,
googlewallet = 0xf1ee,
graduationcap = 0xf19d,
gratipay = 0xf184,
grav = 0xf2d6,
group = 0xf0c0,
hsquare = 0xf0fd,
hackernews = 0xf1d4,
handgrabo = 0xf255,
handlizardo = 0xf258,
handodown = 0xf0a7,
handoleft = 0xf0a5,
handoright = 0xf0a4,
handoup = 0xf0a6,
handpapero = 0xf256,
handpeaceo = 0xf25b,
handpointero = 0xf25a,
handrocko = 0xf255,
handscissorso = 0xf257,
handspocko = 0xf259,
handstopo = 0xf256,
handshakeo = 0xf2b5,
hardofhearing = 0xf2a4,
hashtag = 0xf292,
hddo = 0xf0a0,
header = 0xf1dc,
headphones = 0xf025,
heart = 0xf004,
hearto = 0xf08a,
heartbeat = 0xf21e,
history = 0xf1da,
home = 0xf015,
hospitalo = 0xf0f8,
hotel = 0xf236,
hourglass = 0xf254,
hourglass1 = 0xf251,
hourglass2 = 0xf252,
hourglass3 = 0xf253,
hourglassend = 0xf253,
hourglasshalf = 0xf252,
hourglasso = 0xf250,
hourglassstart = 0xf251,
houzz = 0xf27c,
html5 = 0xf13b,
icursor = 0xf246,
idbadge = 0xf2c1,
idcard = 0xf2c2,
idcardo = 0xf2c3,
ils = 0xf20b,
image = 0xf03e,
imdb = 0xf2d8,
inbox = 0xf01c,
indent = 0xf03c,
industry = 0xf275,
info = 0xf129,
infocircle = 0xf05a,
inr = 0xf156,
instagram = 0xf16d,
institution = 0xf19c,
internetexplorer = 0xf26b,
intersex = 0xf224,
ioxhost = 0xf208,
italic = 0xf033,
joomla = 0xf1aa,
jpy = 0xf157,
jsfiddle = 0xf1cc,
key = 0xf084,
keyboardo = 0xf11c,
krw = 0xf159,
language = 0xf1ab,
laptop = 0xf109,
lastfm = 0xf202,
lastfmsquare = 0xf203,
leaf = 0xf06c,
leanpub = 0xf212,
legal = 0xf0e3,
lemono = 0xf094,
leveldown = 0xf149,
levelup = 0xf148,
lifebouy = 0xf1cd,
lifebuoy = 0xf1cd,
lifering = 0xf1cd,
lifesaver = 0xf1cd,
lightbulbo = 0xf0eb,
linechart = 0xf201,
link = 0xf0c1,
linkedin = 0xf0e1,
linkedinsquare = 0xf08c,
linode = 0xf2b8,
fa_linux = 0xf17c,
list = 0xf03a,
listalt = 0xf022,
listol = 0xf0cb,
listul = 0xf0ca,
locationarrow = 0xf124,
lock = 0xf023,
longarrowdown = 0xf175,
longarrowleft = 0xf177,
longarrowright = 0xf178,
longarrowup = 0xf176,
lowvision = 0xf2a8,
magic = 0xf0d0,
magnet = 0xf076,
mailforward = 0xf064,
mailreply = 0xf112,
mailreplyall = 0xf122,
male = 0xf183,
map = 0xf279,
mapmarker = 0xf041,
mapo = 0xf278,
mappin = 0xf276,
mapsigns = 0xf277,
mars = 0xf222,
marsdouble = 0xf227,
marsstroke = 0xf229,
marsstrokeh = 0xf22b,
marsstrokev = 0xf22a,
maxcdn = 0xf136,
meanpath = 0xf20c,
medium = 0xf23a,
medkit = 0xf0fa,
meetup = 0xf2e0,
meho = 0xf11a,
mercury = 0xf223,
microchip = 0xf2db,
microphone = 0xf130,
microphoneslash = 0xf131,
minus = 0xf068,
minuscircle = 0xf056,
minussquare = 0xf146,
minussquareo = 0xf147,
mixcloud = 0xf289,
mobile = 0xf10b,
mobilephone = 0xf10b,
modx = 0xf285,
money = 0xf0d6,
moono = 0xf186,
mortarboard = 0xf19d,
motorcycle = 0xf21c,
mousepointer = 0xf245,
music = 0xf001,
navicon = 0xf0c9,
neuter = 0xf22c,
newspapero = 0xf1ea,
objectgroup = 0xf247,
objectungroup = 0xf248,
odnoklassniki = 0xf263,
odnoklassnikisquare = 0xf264,
opencart = 0xf23d,
openid = 0xf19b,
opera = 0xf26a,
optinmonster = 0xf23c,
outdent = 0xf03b,
pagelines = 0xf18c,
paintbrush = 0xf1fc,
paperplane = 0xf1d8,
paperplaneo = 0xf1d9,
paperclip = 0xf0c6,
paragraph = 0xf1dd,
paste = 0xf0ea,
pause = 0xf04c,
pausecircle = 0xf28b,
pausecircleo = 0xf28c,
paw = 0xf1b0,
paypal = 0xf1ed,
pencil = 0xf040,
pencilsquare = 0xf14b,
pencilsquareo = 0xf044,
percent = 0xf295,
phone = 0xf095,
phonesquare = 0xf098,
photo = 0xf03e,
pictureo = 0xf03e,
piechart = 0xf200,
piedpiper = 0xf2ae,
piedpiperalt = 0xf1a8,
piedpiperpp = 0xf1a7,
pinterest = 0xf0d2,
pinterestp = 0xf231,
pinterestsquare = 0xf0d3,
plane = 0xf072,
play = 0xf04b,
playcircle = 0xf144,
playcircleo = 0xf01d,
plug = 0xf1e6,
plus = 0xf067,
pluscircle = 0xf055,
plussquare = 0xf0fe,
plussquareo = 0xf196,
podcast = 0xf2ce,
poweroff = 0xf011,
print = 0xf02f,
producthunt = 0xf288,
puzzlepiece = 0xf12e,
qq = 0xf1d6,
qrcode = 0xf029,
question = 0xf128,
questioncircle = 0xf059,
questioncircleo = 0xf29c,
quora = 0xf2c4,
quoteleft = 0xf10d,
quoteright = 0xf10e,
ra = 0xf1d0,
random = 0xf074,
ravelry = 0xf2d9,
rebel = 0xf1d0,
recycle = 0xf1b8,
reddit = 0xf1a1,
redditalien = 0xf281,
redditsquare = 0xf1a2,
refresh = 0xf021,
registered = 0xf25d,
remove = 0xf00d,
renren = 0xf18b,
reorder = 0xf0c9,
repeat = 0xf01e,
reply = 0xf112,
replyall = 0xf122,
resistance = 0xf1d0,
retweet = 0xf079,
rmb = 0xf157,
road = 0xf018,
rocket = 0xf135,
rotateleft = 0xf0e2,
rotateright = 0xf01e,
rouble = 0xf158,
rss = 0xf09e,
rsssquare = 0xf143,
rub = 0xf158,
ruble = 0xf158,
rupee = 0xf156,
s15 = 0xf2cd,
safari = 0xf267,
save = 0xf0c7,
scissors = 0xf0c4,
scribd = 0xf28a,
search = 0xf002,
searchminus = 0xf010,
searchplus = 0xf00e,
sellsy = 0xf213,
send = 0xf1d8,
sendo = 0xf1d9,
server = 0xf233,
share = 0xf064,
sharealt = 0xf1e0,
sharealtsquare = 0xf1e1,
sharesquare = 0xf14d,
sharesquareo = 0xf045,
shekel = 0xf20b,
sheqel = 0xf20b,
shield = 0xf132,
ship = 0xf21a,
shirtsinbulk = 0xf214,
shoppingbag = 0xf290,
shoppingbasket = 0xf291,
shoppingcart = 0xf07a,
shower = 0xf2cc,
signin = 0xf090,
signlanguage = 0xf2a7,
signout = 0xf08b,
signal = 0xf012,
signing = 0xf2a7,
simplybuilt = 0xf215,
sitemap = 0xf0e8,
skyatlas = 0xf216,
skype = 0xf17e,
slack = 0xf198,
sliders = 0xf1de,
slideshare = 0xf1e7,
smileo = 0xf118,
snapchat = 0xf2ab,
snapchatghost = 0xf2ac,
snapchatsquare = 0xf2ad,
snowflakeo = 0xf2dc,
soccerballo = 0xf1e3,
sort = 0xf0dc,
sortalphaasc = 0xf15d,
sortalphadesc = 0xf15e,
sortamountasc = 0xf160,
sortamountdesc = 0xf161,
sortasc = 0xf0de,
sortdesc = 0xf0dd,
sortdown = 0xf0dd,
sortnumericasc = 0xf162,
sortnumericdesc = 0xf163,
sortup = 0xf0de,
soundcloud = 0xf1be,
spaceshuttle = 0xf197,
spinner = 0xf110,
spoon = 0xf1b1,
spotify = 0xf1bc,
square = 0xf0c8,
squareo = 0xf096,
stackexchange = 0xf18d,
stackoverflow = 0xf16c,
star = 0xf005,
starhalf = 0xf089,
starhalfempty = 0xf123,
starhalffull = 0xf123,
starhalfo = 0xf123,
staro = 0xf006,
steam = 0xf1b6,
steamsquare = 0xf1b7,
stepbackward = 0xf048,
stepforward = 0xf051,
stethoscope = 0xf0f1,
stickynote = 0xf249,
stickynoteo = 0xf24a,
stop = 0xf04d,
stopcircle = 0xf28d,
stopcircleo = 0xf28e,
streetview = 0xf21d,
strikethrough = 0xf0cc,
stumbleupon = 0xf1a4,
stumbleuponcircle = 0xf1a3,
subscript = 0xf12c,
subway = 0xf239,
suitcase = 0xf0f2,
suno = 0xf185,
superpowers = 0xf2dd,
superscript = 0xf12b,
support = 0xf1cd,
table = 0xf0ce,
tablet = 0xf10a,
tachometer = 0xf0e4,
tag = 0xf02b,
tags = 0xf02c,
tasks = 0xf0ae,
taxi = 0xf1ba,
telegram = 0xf2c6,
television = 0xf26c,
tencentweibo = 0xf1d5,
terminal = 0xf120,
textheight = 0xf034,
textwidth = 0xf035,
th = 0xf00a,
thlarge = 0xf009,
thlist = 0xf00b,
themeisle = 0xf2b2,
thermometer = 0xf2c7,
thermometer0 = 0xf2cb,
thermometer1 = 0xf2ca,
thermometer2 = 0xf2c9,
thermometer3 = 0xf2c8,
thermometer4 = 0xf2c7,
thermometerempty = 0xf2cb,
thermometerfull = 0xf2c7,
thermometerhalf = 0xf2c9,
thermometerquarter = 0xf2ca,
thermometerthreequarters = 0xf2c8,
thumbtack = 0xf08d,
thumbsdown = 0xf165,
thumbsodown = 0xf088,
thumbsoup = 0xf087,
thumbsup = 0xf164,
ticket = 0xf145,
times = 0xf00d,
timescircle = 0xf057,
timescircleo = 0xf05c,
timesrectangle = 0xf2d3,
timesrectangleo = 0xf2d4,
tint = 0xf043,
toggledown = 0xf150,
toggleleft = 0xf191,
toggleoff = 0xf204,
toggleon = 0xf205,
toggleright = 0xf152,
toggleup = 0xf151,
trademark = 0xf25c,
train = 0xf238,
transgender = 0xf224,
transgenderalt = 0xf225,
trash = 0xf1f8,
trasho = 0xf014,
tree = 0xf1bb,
trello = 0xf181,
tripadvisor = 0xf262,
trophy = 0xf091,
truck = 0xf0d1,
fa_try = 0xf195,
tty = 0xf1e4,
tumblr = 0xf173,
tumblrsquare = 0xf174,
turkishlira = 0xf195,
tv = 0xf26c,
twitch = 0xf1e8,
twitter = 0xf099,
twittersquare = 0xf081,
umbrella = 0xf0e9,
underline = 0xf0cd,
undo = 0xf0e2,
universalaccess = 0xf29a,
university = 0xf19c,
unlink = 0xf127,
unlock = 0xf09c,
unlockalt = 0xf13e,
unsorted = 0xf0dc,
upload = 0xf093,
usb = 0xf287,
usd = 0xf155,
user = 0xf007,
usercircle = 0xf2bd,
usercircleo = 0xf2be,
usermd = 0xf0f0,
usero = 0xf2c0,
userplus = 0xf234,
usersecret = 0xf21b,
usertimes = 0xf235,
users = 0xf0c0,
vcard = 0xf2bb,
vcardo = 0xf2bc,
venus = 0xf221,
venusdouble = 0xf226,
venusmars = 0xf228,
viacoin = 0xf237,
viadeo = 0xf2a9,
viadeosquare = 0xf2aa,
videocamera = 0xf03d,
vimeo = 0xf27d,
vimeosquare = 0xf194,
vine = 0xf1ca,
vk = 0xf189,
volumecontrolphone = 0xf2a0,
volumedown = 0xf027,
volumeoff = 0xf026,
volumeup = 0xf028,
warning = 0xf071,
wechat = 0xf1d7,
weibo = 0xf18a,
weixin = 0xf1d7,
whatsapp = 0xf232,
wheelchair = 0xf193,
wheelchairalt = 0xf29b,
wifi = 0xf1eb,
wikipediaw = 0xf266,
windowclose = 0xf2d3,
windowcloseo = 0xf2d4,
windowmaximize = 0xf2d0,
windowminimize = 0xf2d1,
windowrestore = 0xf2d2,
windows = 0xf17a,
won = 0xf159,
wordpress = 0xf19a,
wpbeginner = 0xf297,
wpexplorer = 0xf2de,
wpforms = 0xf298,
wrench = 0xf0ad,
xing = 0xf168,
xingsquare = 0xf169,
ycombinator = 0xf23b,
ycombinatorsquare = 0xf1d4,
yahoo = 0xf19e,
yc = 0xf23b,
ycsquare = 0xf1d4,
yelp = 0xf1e9,
yen = 0xf157,
yoast = 0xf2b1,
youtube = 0xf167,
youtubeplay = 0xf16a,
youtubesquare = 0xf166
};
}
/// A list of all style-names
enum fa_styles {
fa_solid = 0,
fa_regular = 1,
#ifdef FONT_AWESOME_PRO
fa_light = 3,
fa_thin = 4,
fa_duotone = 5,
fa_sharp_solid = 6,
#endif
fa_brands = 2
};
//---------------------------------------------------------------------------------------
struct QtAwesomeNamedIcon {
const char *name;
ushort icon;
};
class QtAwesomeIconPainter;
class QtAwesomeFontData
{
public:
QtAwesomeFontData() : QtAwesomeFontData(QString()) {}
QtAwesomeFontData(const QString &fontFileName, QFont::Weight fontWeight = QFont::Normal);
const QString& fontFamily() const;
void setFontFamily(const QString &family);
const QString& fontFilename() const;
int fontId() const;
void setFontId(int id);
QFont::Weight fontWeight() const;
void setFontWeight(QFont::Weight weight);
private:
QString _fontFamily;
QString _fontFilename;
int _fontId;
QFont::Weight _fontWeight;
};
//---------------------------------------------------------------------------------------
/// The main class for managing icons
/// This class requires a 2-phase construction. You must first create the class and then initialize it via an init* method
class QtAwesome : public QObject
@ -825,52 +75,77 @@ class QtAwesome : public QObject
Q_OBJECT
public:
static const QString FA_BRANDS_FONT_FILENAME; // fa-brands
static const QString FA_REGULAR_FONT_FILENAME; // fa-regular
static const QString FA_SOLID_FONT_FILENAME; // fa-solid
static const QFont::Weight FA_BRANDS_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_SOLID_FONT_WEIGHT = QFont::Black;
explicit QtAwesome(QObject *parent = QTAWESOME_NULL);
#ifdef FONT_AWESOME_PRO
static const QString FA_LIGHT_FONT_FILENAME; // fa-light
static const QString FA_DUOTONE_FONT_FILENAME; // fa-duotone
static const QString FA_THIN_FONT_FILENAME; // fa-thin
static const QString FA_SHARP_SOLID_FONT_FILENAME; // fa-sharp fa-solid
static const int DUOTONE_HEX_ICON_VALUE = 0x100000;
static const QFont::Weight FA_LIGHT_FONT_WEIGHT = QFont::Light;
static const QFont::Weight FA_THIN_FONT_WEIGHT = QFont::ExtraLight;
static const QFont::Weight FA_DUOTONE_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_SHARP_SOLID_FONT_WEIGHT = QFont::Black;
#endif
public:
explicit QtAwesome(QObject* parent = nullptr);
virtual ~QtAwesome();
void init( const QString& fontname );
bool initFontAwesome();
virtual bool initFontAwesome();
void addNamedCodepoint( const QString& name, int codePoint );
QHash<QString,int> namedCodePoints() { return namedCodepoints_; }
virtual const QHash<QString, int> namedCodePoints(int style) const;
void setDefaultOption( const QString& name, const QVariant& value );
QVariant defaultOption( const QString& name );
void setDefaultOption(const QString& name, const QVariant& value);
QVariant defaultOption(const QString& name);
QIcon icon( int character, const QVariantMap& options = QVariantMap() );
QIcon icon( const QString& name, const QVariantMap& options = QVariantMap() );
QIcon icon(QtAwesomeIconPainter* painter, const QVariantMap& optionMap = QVariantMap() );
QIcon icon(int style, int character, const QVariantMap& options = QVariantMap());
QIcon icon(const QString& name, const QVariantMap& options = QVariantMap());
QIcon icon(QtAwesomeIconPainter* painter, const QVariantMap& optionMap = QVariantMap());
void give( const QString& name, QtAwesomeIconPainter* painter );
void give(const QString& name, QtAwesomeIconPainter* painter);
QFont font( int size );
QFont font(int style, int size) const;
/// Returns the font-name that is used as icon-map
QString fontName() { return fontName_ ; }
QString fontName(int style) const;
protected:
int stringToStyleEnum(const QString style) const;
const QString styleEnumToString(int style) const;
void addToNamedCodePoints(int style, const fa::QtAwesomeNamedIcon* faCommonIconArray, int size);
private:
QString fontName_; ///< The font name used for this map
QHash<QString,int> namedCodepoints_; ///< A map with names mapped to code-points
QHash<int, QtAwesomeFontData> _fontDetails; ///< The fonts name used for each style
QHash<int, QHash<QString, int>*> _namedCodepointsByStyle; ///< A map with names mapped to code-points for each style
QList<QHash<QString, int>*> _namedCodepointsList; ///< The list of all created named-codepoints
QHash<QString, QtAwesomeIconPainter*> painterMap_; ///< A map of custom painters
QVariantMap defaultOptions_; ///< The default icon options
QtAwesomeIconPainter* fontIconPainter_; ///< A special painter fo painting codepoints
QHash<QString, QtAwesomeIconPainter*> _painterMap; ///< A map of custom painters
QVariantMap _defaultOptions; ///< The default icon options
QtAwesomeIconPainter* _fontIconPainter; ///< A special painter fo painting codepoints
};
//---------------------------------------------------------------------------------------
/// The QtAwesomeIconPainter is a specialized painter for painting icons
/// your can implement an iconpainter to create custom font-icon code
class QtAwesomeIconPainter
{
public:
virtual ~QtAwesomeIconPainter() {}
virtual void paint( QtAwesome* awesome, QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state, const QVariantMap& options ) = 0;
virtual ~QtAwesomeIconPainter();
virtual void paint(QtAwesome* awesome, QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state,
const QVariantMap& options) = 0;
};
Q_DECLARE_METATYPE(QtAwesomeAnimation*)
} // fa
Q_DECLARE_METATYPE(fa::QtAwesomeAnimation*)
#endif // QTAWESOME_H

View File

@ -1,12 +1,33 @@
defineReplace( resourcesForConfig ){
return($$PWD/QtAwesome$$eval($$1).qrc)
}
options = $$find(CONFIG, fontAwesomePro) $$find(CONFIG, fontAwesomeFree)
count(options, 0) { error("fontAwesomePro or fontAwesomeFree should be defined") }
count(options, 2) { error("fontAwesomePro and fontAwesomeFree were defined, only one config is accepted") }
INCLUDEPATH += $$PWD
SOURCES += $$PWD/QtAwesome.cpp \
SOURCES += $$PWD/QtAwesome.cpp \
$$PWD/QtAwesomeAnim.cpp
HEADERS += $$PWD/QtAwesome.h \
$$PWD/QtAwesomeAnim.h
RESOURCES += $$PWD/QtAwesome.qrc
HEADERS += $$PWD/QtAwesome.h \
$$PWD/QtAwesomeAnim.h \
$$PWD/QtAwesomeEnumGenerated.h \
$$PWD/QtAwesomeStringGenerated.h
CONFIG( fontAwesomePro ){
config = Pro
RESOURCES += $$resourcesForConfig(config)
DEFINES += FONT_AWESOME_PRO=1
!build_pass:message(using font awesome pro)
}
CONFIG( fontAwesomeFree ){
config = Free
RESOURCES += $$resourcesForConfig(config)
!build_pass:message(using font awesome free)
}

View File

@ -9,8 +9,10 @@ TEMPLATE = lib
CONFIG += staticlib c++11
QT += widgets
SOURCES += QtAwesome.cpp QtAwesomeAnim.cpp
HEADERS += QtAwesome.h QtAwesomeAnim.h
# only one option must be enabled
#CONFIG += fontAwesomePro
CONFIG += fontAwesomeFree
include(QtAwesome.pri)
isEmpty(PREFIX) {
unix {
@ -24,6 +26,3 @@ install_headers.files = QtAwesome.h QtAwesomeAnim.h
install_headers.path = $$PREFIX/include
target.path = $$PREFIX/lib
INSTALLS += install_headers target
RESOURCES += \
QtAwesome.qrc

View File

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/">
<file>fonts/fontawesome-4.7.0.ttf</file>
</qresource>
</RCC>

View File

@ -6,21 +6,22 @@
#include <QTimer>
#include <QWidget>
namespace fa {
QtAwesomeAnimation::QtAwesomeAnimation(QWidget *parentWidget, int interval, int step)
: parentWidgetRef_( parentWidget )
, timer_( QTAWESOME_NULL )
, interval_( interval )
, step_( step )
, angle_( 0.0f )
: parentWidgetRef_(parentWidget)
, timer_(nullptr)
, interval_(interval)
, step_(step)
, angle_(0.0f)
{
}
void QtAwesomeAnimation::setup( QPainter &painter, const QRect &rect)
void QtAwesomeAnimation::setup(QPainter &painter, const QRect &rect)
{
// first time set the timer
if( !timer_ )
if (!timer_)
{
timer_ = new QTimer();
connect(timer_,SIGNAL(timeout()), this, SLOT(update()) );
@ -31,9 +32,9 @@ void QtAwesomeAnimation::setup( QPainter &painter, const QRect &rect)
//timer, angle, self.step = self.info[self.parent_widget]
float x_center = rect.width() * 0.5f;
float y_center = rect.height() * 0.5f;
painter.translate(x_center, y_center);
painter.rotate(angle_);
painter.translate(-x_center, -y_center);
painter.translate(static_cast<qreal>(x_center), static_cast<qreal>(y_center));
painter.rotate(static_cast<qreal>(angle_));
painter.translate(static_cast<qreal>(-x_center), -static_cast<qreal>(y_center));
}
}
@ -41,6 +42,8 @@ void QtAwesomeAnimation::setup( QPainter &painter, const QRect &rect)
void QtAwesomeAnimation::update()
{
angle_ += step_;
angle_ = std::fmod( angle_, 360);
angle_ = std::fmod( static_cast<float>(angle_), 360.0f);
parentWidgetRef_->update();
}
} // namespace fa

View File

@ -1,12 +1,6 @@
#ifndef QTAWESOMEANIMATION_H
#define QTAWESOMEANIMATION_H
#if __cplusplus <= 199711L
#define QTAWESOME_NULL NULL
#else
#define QTAWESOME_NULL nullptr
#endif
#include <QObject>
class QPainter;
@ -14,29 +8,29 @@ class QRect;
class QTimer;
class QWidget;
///
/// Basic Animation Support for QtAwesome (Inspired by https://github.com/spyder-ide/qtawesome)
///
class QtAwesomeAnimation : public QObject
{
Q_OBJECT
namespace fa {
///
/// Basic Animation Support for QtAwesome (Inspired by https://github.com/spyder-ide/qtawesome)
///
class QtAwesomeAnimation : public QObject
{
Q_OBJECT
public:
QtAwesomeAnimation( QWidget* parentWidget, int interval=10, int step=1);
public:
QtAwesomeAnimation(QWidget* parentWidget, int interval = 10, int step = 1);
void setup(QPainter& painter, const QRect& rect);
void setup( QPainter& painter, const QRect& rect );
public slots:
void update();
public slots:
void update();
private:
QWidget* parentWidgetRef_;
QTimer* timer_;
int interval_;
int step_;
float angle_;
};
private:
QWidget* parentWidgetRef_;
QTimer* timer_;
int interval_;
int step_;
float angle_;
};
} // namespace fa
#endif // QTAWESOMEANIMATION_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/">
<file>fonts/Font Awesome 6 Brands-Regular-400.otf</file>
<file>fonts/Font Awesome 6 Free-Regular-400.otf</file>
<file>fonts/Font Awesome 6 Free-Solid-900.otf</file>
</qresource>
</RCC>

View File

@ -0,0 +1,11 @@
<RCC>
<qresource prefix="/">
<file>fonts/Font Awesome 6 Brands-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 6 Duotone-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Light-300.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp-Solid-900.otf</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -11,10 +11,18 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QtAwesomeSample
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp
SOURCES += main.cpp
HEADERS += \
mainwindow.h
HEADERS +=
# only one option must be enabled
#CONFIG += fontAwesomePro
CONFIG += fontAwesomeFree
include(../QtAwesome/QtAwesome.pri)
FORMS += \
mainwindow.ui

View File

@ -1,7 +1,7 @@
/**
* MIT Licensed
*
* Copyright 2011-2015 - Reliable Bits Software by Blommers IT. All Rights Reserved.
* Copyright 2011-2022 - Reliable Bits Software by Blommers IT. All Rights Reserved.
* Author Rick Blommers
*/
@ -12,52 +12,13 @@
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow w;
MainWindow w;
QtAwesome* awesome = new QtAwesome(&w);
awesome->initFontAwesome();
QVBoxLayout* layout = new QVBoxLayout();
// a simple beer button
//=====================
{
QPushButton* beerButton = new QPushButton( "Cheers!");
QVariantMap options;
options.insert("anim", qVariantFromValue( new QtAwesomeAnimation(beerButton) ) );
beerButton->setIcon( awesome->icon( fa::beer, options ) );
layout->addWidget(beerButton);
}
// a simple beer checkbox button
//==============================
{
QPushButton* toggleButton = new QPushButton("Toggle Me");
toggleButton->setCheckable(true);
QVariantMap options;
options.insert("color", QColor(Qt::green) );
options.insert("text-off", QString(fa::squareo) );
options.insert("color-off", QColor(Qt::red) );
toggleButton->setIcon( awesome->icon( fa::checksquareo, options ));
layout->addWidget(toggleButton);
}
// add the samples
QWidget* samples = new QWidget();
samples->setLayout(layout);
w.setCentralWidget(samples);
w.show();
w.show();
return app.exec();
}

View File

@ -0,0 +1,83 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QtAwesome.h"
#include <QStandardItemModel>
#include <QMap>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
awesome = new fa::QtAwesome(this);
awesome->initFontAwesome();
ui->comboBox->addItem("Solid", fa::fa_solid);
ui->comboBox->addItem("Brands", fa::fa_brands);
ui->comboBox->addItem("Regular", fa::fa_regular);
#ifdef FONT_AWESOME_PRO
ui->comboBox->addItem("Light", fa::fa_light);
ui->comboBox->addItem("Thin", fa::fa_thin);
ui->comboBox->addItem("Duotone", fa::fa_duotone);
ui->comboBox->addItem("Sharp Solid", fa::fa_sharp_solid);
#endif
// a simple beer button
//=====================
{
QPushButton* beerButton = ui->beerButton;
QVariantMap options;
options.insert("anim", QVariant::fromValue(new fa::QtAwesomeAnimation(beerButton)));
// below are the possible variation to show thi icon
beerButton->setIcon(awesome->icon(fa::fa_solid, fa::fa_beer_mug_empty, options));
// beerButton->setIcon(awesome->icon("fa-solid fa-beer-mug-empty", options));
// beerButton->setIcon(awesome->icon("beer-mug-empty", options));
// beerButton->setIcon(awesome->icon("solid beer-mug-empty", options));
}
// a simple checkbox button
//=========================
{
QPushButton* toggleButton = ui->toggleButton;
toggleButton->setCheckable(true);
QVariantMap options;
options.insert("color", QColor(Qt::yellow));
options.insert("text-off", QString(fa::fa_square));
options.insert("color-off", QColor(Qt::darkBlue));
toggleButton->setIcon( awesome->icon("fa_solid square-check", options));
}
QStandardItemModel* model = new QStandardItemModel(this);
ui->listView->setModel(model);
connect(ui->comboBox, SIGNAL(activated(int)), this, SLOT(styleChanged(int)));
styleChanged(fa::fa_solid);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::styleChanged(int index)
{
Q_UNUSED(index)
QVariant styleValue = ui->comboBox->currentData();
int style = styleValue.toInt();
QHash<QString, int> iconset = awesome->namedCodePoints(style);
QStandardItemModel *model = dynamic_cast<QStandardItemModel*>(ui->listView->model());
model->clear();
for (QHash<QString, int>::iterator i=iconset.begin(); i != iconset.end(); ++i) {
QString name = i.key();
int ic = i.value();
model->appendRow(new QStandardItem(awesome->icon(style, ic), name));
}
model->sort(0);
}

View File

@ -0,0 +1,27 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "QtAwesome.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
public slots:
void styleChanged(int index);
private:
Ui::MainWindow *ui;
fa::QtAwesome* awesome;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>750</width>
<height>433</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QFrame" name="verticalFrame">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
<item>
<widget class="QListView" name="listView">
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="gridSize">
<size>
<width>128</width>
<height>96</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="gridFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="beerButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Cheers!</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="toggleButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Toggle Me!</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

363
README.md
View File

@ -1,162 +1,207 @@
QtAwesome - Font Awesome support for Qt applications
====================================================
# QtAwesome - Font Awesome support for Qt applications
> **Warning**
> Please don't use the master branch anymore.
> - Font Awesome 4 support, use the [fontawesome-4 branch](https://github.com/gamecreature/QtAwesome/tree/fontawesome-4) (this is the previous master branch)
> - Font Awesome 5 support, use the [fontawesome-5 branch](https://github.com/gamecreature/QtAwesome/tree/fontawesome-4)
> - For the latest release (Font Awesome 6) , use the [main branch](https://github.com/gamecreature/QtAwesome/)
QtAwesome is a library to add [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
icons to your [Qt application](http://qt-project.org/).
Description
-----------
## Table of Contents
QtAwesome is a simple library that can be used to add [Font Awesome](https://fontawesome.com/) icons to your [Qt application](http://qt-project.org/).
- [Latest Release - Font Awesome 6](#latest-release---font-awesome-6)
- [Installation Free Version](#installation-free-version)
- [Installation Pro version](#installation-pro-version)
- [Basic Usage](#basic-usage)
- [Examples](#examples)
- [Example custom painter](#example-custom-painter)
- [Default options](#default-options)
- [Known Issues And Workarounds](#known-issues-and-workarounds)
- [Summary Of Changes](#summary-of-changes)
- [Thanks](#thanks)
- [Contact](#contact)
- [License](#license)
NOTE: Though the name is QtAwesome and currently it's very Font Awesome based, you can use every other icon/glyph font you want.
## Latest Release - Font Awesome 6
The class can also be used to manage your own dynamic code-drawn icons, by adding named icon-painters.
This is the Font Awesome 6 release. It replaces the main branch, which still was a Font Awesome 4 version.
(There's also a Font Awesome 5 branch, but was never merged to the main/master branch.)
This release is **not** completely backwards compatible with the 4 and 5 releases.
The decision was made for a new clean version which better suited for the future.
(A compatibility layer is in development).
Updated to FontAwesome 4.7.0
----------------------------
Previous versions used a hand-crafted icon list, this version has a generated list.
This library has been updated to Font Awesome version **4.7.0**.
Having troubles with this new release?
* In the 4.5.0 version the _linux name has been changed to fa_linux. (Makes the naming of conflicting/invalid names more consistent, like fa_try and fa_500px)
* You can find the previous FontAwesome 4 c++11 library in the [c++11 branch](https://github.com/gamecreature/QtAwesome/tree/c++11).
* You can find the previous FontAwesome 3 library in the [fontawesome-3 branch](https://github.com/gamecreature/QtAwesome/tree/fontawesome-3).
- You can find the previous `master` branch in the [fontawesome-4](https://github.com/gamecreature/QtAwesome/tree/fontawesome-4) branch. (`master` is dropped in favour of `main`)
- The [fontawesome-5](https://github.com/gamecreature/QtAwesome/tree/fontawesome-5) branch contains the Font Awesome 5 version.
- The new [main](https://github.com/gamecreature/QtAwesome/) branch contains the latest Font Awesome 6 version.
- Open a github issue if you'v found a bug or have a suggestion
**Note about previous c++11**
I removed the C++11 requirement. And moved the c++11 code to a c++11 branch.
It's not that I don't like c++11, but the typed enum made the code less flexible then it is now.
Just integers it is. Simpler is better.
Installation
------------
## Installation Free Version
The easiest way to include QtAweome in your project is to copy the QtAwesome directory to your
project tree and add the following `include()` to your Qt project file:
include(QtAwesome/QtAwesome.pri)
Now you are good to go!
Usage
-----
You probably want to create a single QtAwesome object for your whole application:
````
QtAwesome* awesome = new QtAwesome( qApp )
awesome->initFontAwesome(); // This line is important as it loads the font and initializes the named icon map
````
* 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 Cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/).
Example
--------
```c++
// You should create a single object of QtAwesome.
QtAwesome* awesome = new QtAwesome( qApp );
awesome->initFontAwesome();
// Next create your icon with the help of the icon-enumeration (no dashes):
QPushButton* beerButton = new QPushButton( awesome->icon( fa::beer ), "Cheers!" );
// You can also use 'string' names to access the icons. (The string version omits the 'fa-' or 'icon-' prefix and has no dashes )
QPushButton* coffeeButton = new QPushButton( awesome->icon( "coffee" ), "Black please!" );
// When you create an icon you can supply some options for your icons:
// The available options can be found at the "Default options"-section
QVariantMap options;
options.insert( "color" , QColor(255,0,0) );
QPushButton* musicButton = new QPushButton( awesome->icon( fa::music, options ), "Music" );
// You can also change the default options.
// for example if you always would like to have green icons you could call)
awesome->setDefaultOption( "color-disabled", QColor(0,255,0) );
// You can also directly render a label with this font
QLabel* label = new QLabel( QChar( fa::group ) );
label->setFont( awesome->font(16) );
```bash
CONFIG+=fontAwesomeFree
include(QtAwesome/QtAwesome.pri)
```
Example custom painter
----------------------
Now you are good to go! The free fonts are included in this project.
This example registers a custom painter for supporting a duplicate icon (it draws 2 "plus marks"):
## Installation Pro version
To activate the pro version, the following teh `fontAwesomePro` config should be defined.
```bash
CONFIG+=fontAwesomePro
include(QtAwesome/QtAwesome.pri)
```
The pro font files need to be copied to the `QtAwesome/fonts/pro` folder.
(ex, Font Awesome 6 Brands-Regular-400.otf, etc... )
## Basic Usage
You probably want to create a single QtAwesome object for your whole application.
```c++
fa::QtAwesome* awesome = new fa::QtAwesome(qApp)
awesome->initFontAwesome(); // This line is important as it loads the font and initializes the named icon map
```
- 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).
## Examples
Next the icons can be accessed via the `awesome->icon` method.
```c++
// The most performant operation the get an icon
QPushButton* btn = new QPushButton(awesome->icon(fa::fa_solid, fa::fa_wine_glass), "Cheers!");
// You can also use 'string' names to access the icons.
QPushButton* btn = new QPushButton(awesome->icon("fa-solid fa-coffee" ), "Black please!");
// The string items passed to the icon method can be used without the 'fa-' prefix
QPushButton* btn = new QPushButton(awesome->icon("solid coffee" ), "Black please!");
// The style is also optional and will fallback to the 'solid' style
QPushButton* btn = new QPushButton(awesome->icon("coffee" ), "Black please!");
```
For shorter syntax (more Font Aweseome like) is possible to bring the fa namespace into the curren scope:
```c++
using namespace fa;
QPushButton* btn = new QPushButton(awesome->icon(fa_solid, fa_wine_glass), "Cheers!");
```
It is possible to create some extra options for the icons.
The available options can be found in the [Default options list](#default-options)
```c++
QVariantMap options;
options.insert("color" , QColor(255, 0 ,0));
QPushButton* musicButton = new QPushButton(awesome->icon(fa::fa_solid, fa::music, options), "Music");
```
The defaults option can also be adjusted via the `setDefaultOption` method.\
For example having green disabled icons, it is possible to call:
```c++
awesome->setDefaultOption("color-disabled", QColor(0, 255, 0));
```
It also possible to render a label directly with this font
```c++
QLabel* label = new QLabel(QChar(fa::fa_github));
label->setFont(awesome->font(fa::fa_brands, 16));
```
## Example custom painter
This example registers a custom painter for supporting an custom icon named 'duplicate'
It simply draws 2 "plus marks".
```c++
class DuplicateIconPainter : public QtAwesomeIconPainter
{
public:
virtual void paint( QtAwesome* awesome, QPainter* painter, const QRect& rectIn, QIcon::Mode mode, QIcon::State state, const QVariantMap& options )
virtual void paint(QtAwesome* awesome, QPainter* painter, const QRect& rectIn, QIcon::Mode mode, QIcon::State state, const QVariantMap& options)
{
int drawSize = qRound(rectIn.height()*0.5);
int drawSize = qRound(rectIn.height() * 0.5);
int offset = rectIn.height() / 4;
QChar chr = QChar( static_cast<int>(fa::plus) );
QChar chr = QChar(static_cast<int>(fa::plus));
int st = fa::fa_solid;
painter->setFont( awesome->font( drawSize ) );
painter->setFont(st, awesome->font(drawSize));
painter->setPen( QColor(100,100,100) );
painter->drawText( QRect( QPoint(offset*2, offset*2), QSize(drawSize, drawSize) ), chr , QTextOption( Qt::AlignCenter|Qt::AlignVCenter ) );
painter->setPen( QColor(50,50,50) );
painter->drawText( QRect( QPoint(rectIn.width()-drawSize-offset, rectIn.height()-drawSize-offset), QSize(drawSize, drawSize) ), chr , QTextOption( Qt::AlignCenter|Qt::AlignVCenter ) );
painter->setPen(QColor(100,100,100));
painter->drawText(QRect(QPoint(offset * 2, offset * 2),
QSize(drawSize, drawSize)), chr ,
QTextOption(Qt::AlignCenter|Qt::AlignVCenter));
painter->setPen(QColor(50,50,50));
painter->drawText(QRect(QPoint(rectIn.width() - drawSize-offset, rectIn.height() - drawSize - offset),
QSize(drawSize, drawSize) ), chr ,
QTextOption(Qt::AlignCenter | Qt::AlignVCenter));
}
};
awesome->give("duplicate", new DuplicateIconPainter() );
awesome->give("duplicate", new DuplicateIconPainter());
```
Default options:
----------------
The following options are default in the QtAwesome class.
After this, this icon can be used with the given string name:
```c++
setDefaultOption( "color", QColor(50,50,50) );
setDefaultOption( "color-disabled", QColor(70,70,70,60));
setDefaultOption( "color-active", QColor(10,10,10));
setDefaultOption( "color-selected", QColor(10,10,10));
setDefaultOption( "text", QString() ); // internal option
setDefaultOption( "text-disabled", QString() );
setDefaultOption( "text-active", QString() );
setDefaultOption( "text-selected", QString() );
setDefaultOption( "scale-factor", 0.9 );
awesome->icon("duplicate")
```
When creating an icon, it first populates the options-map with the default options from the QtAwesome object.
After that the options are expanded/overwritten by the options supplied to the icon.
## Default options
It is possible to use another glyph per icon-state. For example to make an icon-unlock symbol switch to locked when selected,
you could supply the following option:
The following options are the defaults in the QtAwesome class.
```c++
options.insert("text-selected", QString( fa::lock ) );
setDefaultOption("color", QApplication::palette().color(QPalette::Normal, QPalette::Text));
setDefaultOption("color-disabled", QApplication::palette().color(QPalette::Disabled, QPalette::Text));
setDefaultOption("color-active", QApplication::palette().color(QPalette::Active, QPalette::Text));
setDefaultOption("color-selected", QApplication::palette().color(QPalette::Active, QPalette::Text));
setDefaultOption("text", QString()); // internal option
setDefaultOption("text-disabled", QString());
setDefaultOption("text-active", QString());
setDefaultOption("text-selected", QString());
setDefaultOption("scale-factor", 0.9);
```
Extra items for the pro version
```c++
setDefaultOption("duotone-color", QApplication::palette().color(QPalette::Normal, QPalette::BrightText));
setDefaultOption("duotone-color-disabled", QApplication::palette().color(QPalette::Disabled, QPalette::BrightText));
setDefaultOption("duotone-color-active", QApplication::palette().color(QPalette::Active, QPalette::BrightText));
setDefaultOption("duotone-color-selected", QApplication::palette().color(QPalette::Active, QPalette::BrightText));
```
When creating an icon, it first populates the options-map with the default options from the QtAwesome object.
After that the options are expanded/overwritten by the options supplied to the icon.
It is possible to use another glyph per icon-state. For example to make an icon-unlock symbol switch to locked when selected,
you could supply the following option:
```c++
options.insert("text-selected", QString(fa::fa_lock));
```
Color and text options have the following structure:
`keyname-iconmode-iconstate`
Where iconmode normal is empty
And iconstate On is off.
When iconmode normal is empty\
And iconstate on is blank
So the list of items used is:
@ -168,6 +213,14 @@ So the list of items used is:
- color-disabled-off
- color-active-off
- color-selected-off
- duotone-color (pro)
- duotone-color-disabled (pro)
- duotone-color-active (pro)
- duotone-color-selected (pro)
- duotone-color-off (pro)
- duotone-color-disabled-off (pro)
- duotone-color-active-off (pro)
- duotone-color-selected-off (pro)
- text
- text-disabled
- text-active
@ -176,61 +229,63 @@ So the list of items used is:
- text-disabled-off
- text-active-off
- text-selected-off
- style
- style-disabled
- style-active
- style-selected
- style-off
- style-disabled-off
- style-active-off
- style-selected-off
License
-------
MIT License. Copyright 2013 - Reliable Bits Software by Blommers IT. [http://blommersit.nl/](http://blommersit.nl)
The Font Awesome font is licensed under the SIL Open Font License - [http://scripts.sil.org/OFL](http://scripts.sil.org/OFL)
The Font Awesome pictograms are licensed under the CC BY 3.0 License - [http://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/)
"Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome"
Contact
-------
* email: <rick@blommersit.nl>
* twitter: [https://twitter.com/gamecreature](https://twitter.com/gamecreature)
* website: [http://blommersit.nl](http://blommersit.nl) (warning Dutch content ahead)
* github: [https://github.com/gamecreature/QtAwesome](https://github.com/gamecreature/QtAwesome)
Known issues and workarounds
----------------------------
## Known Issues And Workarounds
On Mac OS X, placing an qtAwesome icon in QMainWindow menu, doesn't work directly.
See the following issue: [https://github.com/gamecreature/QtAwesome/issues/10]
A workaround for this problem is converting it to a Pixmap icon like this:
A workaround for this problem is converting it to a Pixmap icon:
```c++
QAction* menuAction = new QAction("test");
menuAction->setIcon( awesome->icon(fa::beer).pixmap(32,32) );
menuAction->setIcon(awesome->icon(fa::fa_heart).pixmap(32,32));
```
## Summary Of Changes
Remarks
-------
- The complete icons set is renewed and is generated
- Everything is namespaced in the `fa` namespace
- Icon name enumerations are changed so the full Font Aweomse name is used: `fa::user` => `fa::fa_user`.
With the dashes replaced by underscores.
- Font Awesome 6 full stylenames, like `fa::fa_regular`, `fa::fa_solid`
- This release has been tested with Qt 5 and Qt 6.
I've created this project because I needed some nice icons for my own Qt project. After doing a lot of
css/html5 work and being spoiled by the ease of twitter bootstrap with Font Awesome,
I thought it would be nice to be able to use these icons for my Qt project.
I've slightly changed the code from the original, added some more documentation, but it's still
a work in progress. So feel free to drop me an e-mail for your suggestions and improvements!
There are still some things todo, like:
* document the usage of another icon font
* add some tests
* do some code cleanup
## Thanks
Thanks go to the contributors of this project!
And of course last but not least,
Many thanks go to Dave Gandy an the other Font Awesome contributors!! [http://fortawesome.github.com/Font-Awesome](http://fortawesome.github.com/Font-Awesome)
And of course to the Qt team/contributors for supplying this great cross-platform c++ library.
Contributions are welcome! Feel free to fork and send a pull request through Github.
<a href="https://github.com/gamecreature/qtawesome/graphs/contributors">
<img src="https://contrib.rocks/image?repo=gamecreature/qtawesome" />
</a>
<small>*Contribution list made with [contrib.rocks](https://contrib.rocks).*</small>
## Contact
- email: <rick@blommersit.nl>
- mastedon: [https://ruby.social/@rick](https://ruby.social/@rick)
- twitter: [https://twitter.com/gamecreature](https://twitter.com/gamecreature)
- website: [https://gamecreatures.com](http://gamecreatures.com)
- github: [https://github.com/gamecreature/QtAwesome](https://github.com/gamecreature/QtAwesome)
## License
MIT License. Copyright 2013-2022 - Reliable Bits Software by Blommers IT. [http://blommersit.nl/](http://blommersit.nl)
The Font Awesome font is licensed under the SIL Open Font License - [http://scripts.sil.org/OFL](http://scripts.sil.org/OFL)
The Font Awesome pictograms are licensed under the CC BY 3.0 License - [http://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/)
"Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome"

View File

@ -0,0 +1,22 @@
namespace fa {
enum fa_common_icons : uint16_t {
<% icons_common.each_with_index do |(name, unicode), index| -%>
<%= id_name(name) %> = <%= "0x#{unicode}" -%><%= index < icons_common.length - 1 ? ',' : '' %>
<% end %>
};
enum fa_brand_icons : uint16_t {
<% icons_brands.each_with_index do |(name, unicode), index| -%>
<%= id_name(name) %> = <%= "0x#{unicode}" -%><%= index < icons_brands.length - 1 ? ',' : '' %>
<% end %>
};
#ifdef FONT_AWESOME_PRO
enum fa_pro_icons : uint16_t {
<% icons_pro.each_with_index do |(name, unicode), index| -%>
<%= id_name(name) %> = <%= "0x#{unicode}" -%><%= index < icons_pro.length - 1 ? ',' : '' %>
<% end %>
};
#endif
}

View File

@ -0,0 +1,26 @@
static const fa::QtAwesomeNamedIcon faCommonIconArray[] = {
<% icons_common.each_with_index do |(name, _unicode), index| -%>
{ <%= string_name(name) %>, <%= namespaced_id_name(name) %> } <%= index < icons_common.length - 1 ? ',' : '' %>
<% end %>
};
static const fa::QtAwesomeNamedIcon faBrandsIconArray[] = {
<% icons_brands.each_with_index do |(name, _unicode), index| -%>
{ <%= string_name(name) %>, <%= namespaced_id_name(name) %> } <%= index < icons_brands.length - 1 ? ',' : '' %>
<% end %>
};
#ifdef FONT_AWESOME_PRO
static const fa::QtAwesomeNamedIcon faProIconArray[] = {
<% icons_pro.each_with_index do |(name, _unicode), index| -%>
{ <%= string_name(name) %>, <%= namespaced_id_name(name) %> } <%= index < icons_pro.length - 1 ? ',' : '' %>
<% end %>
};
#else
static const fa::QtAwesomeNamedIcon faRegularFreeIconArray[] = {
<% icons_regular_free.each_with_index do |(name, _unicode), index| -%>
{ <%= string_name(name) %>, <%= namespaced_id_name(name) %> } <%= index < icons_pro.length - 1 ? ',' : '' %>
<% end %>
};
#endif

78
tools/build_headers.rb Executable file
View File

@ -0,0 +1,78 @@
#!/usr/bin/env ruby
# This script is used to extract the font information from the FontAwesome icons.json file
# It extracts all font definitions/names and generated the included header files,
# automating the process for generating the font names
#
# It generates the following files:
# - QtAwesomEnumGenerated.h
# - QtAwesomeGenerated.h
#
# To use it make sure the fontawesome icons.json is place in the the QtAwesome/fonts/pro/metadata folder
require 'erb'
require 'json'
class Icons
attr_reader :icons_common,
:icons_brands,
:icons_pro,
:icons_regular_free
def initialize(icon_file)
@icons_common = {}
@icons_brands = {}
@icons_pro = {}
@icons_regular_free = {}
build_maps(JSON.parse(File.read(icon_file)))
end
def id_name(str)
"fa_#{str.downcase.gsub(/[^a-z0-9_]/, '_')}"
end
def namespaced_id_name(str)
"fa::#{id_name(str)}"
end
def string_name(str)
name = str.gsub("\"", "\\\"")
"\"#{name}\""
end
def build_maps(icons)
icons.each do |key, data|
if data['free'].length > 0
if data['free'].first == 'brands'
@icons_brands[key] = data['unicode']
else
@icons_regular_free[key] = data['unicode'] if data['free'].include?('regular')
@icons_common[key] = data['unicode']
end
end
if data['free'].length == 0
@icons_pro[key] = data['unicode']
end
end
end
def generate(template)
ERB.new(template, trim_mode: '-').result(binding)
end
end
icon_file = ARGV[1] || "#{__dir__}/../QtAwesome/fonts/pro/metadata/icons.json"
output_path = "#{__dir__}/../QtAwesome"
source_names = [
'QtAwesomeEnumGenerated.h',
'QtAwesomeStringGenerated.h'
]
icons = Icons.new(icon_file)
# generate the templates
source_names.each do |source_name|
result = icons.generate(File.read("#{__dir__}/#{source_name}.erb"))
File.write("#{output_path}/#{source_name}", result)
end