fix #67, Update to Font Awesome 7, added Pro+ icon support

This commit is contained in:
Rick Blommers
2025-08-28 15:59:34 +02:00
parent c197c2a272
commit e8230650d5
25 changed files with 8649 additions and 4980 deletions

View File

@@ -1,5 +1,6 @@
# Changes
- (2025-08-28) #67, Update to Font Awesome 7, added Pro+ icon support
- (2025-07-15) #66, Style name parsing (stringToStyleEnum) not working properly (contribution by @samapico)
- (2025-05-08) #65, Support for Qt 6.9. Fix the CMakelist example
- (2025-04-07) Update to 6.7.2 (Updated OTF files)

View File

@@ -1,7 +1,6 @@
MIT License
===========
# MIT License
Copyright 2013-2025 [Blommers IT](https://blommersit.nl). All Rights Reserved.
Copyright 2013-2025 [Ribit 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
@@ -16,9 +15,7 @@ THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRI
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
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)

View File

@@ -3,7 +3,7 @@
*
* MIT Licensed
*
* Copyright 2013-2024 - Reliable Bits Software by Blommers IT. All Rights Reserved.
* Copyright 2013-2025 - Ribit Software by Blommers IT. All Rights Reserved.
* Author Rick Blommers
*/
@@ -27,7 +27,9 @@
// Initializing namespaces need to happen outside a namespace
static void qtawesome_init_resources()
{
#ifdef FONT_AWESOME_PRO
#if defined(FONT_AWESOME_PRO_PLUS)
Q_INIT_RESOURCE(QtAwesomeProPlus);
#elif defined(FONT_AWESOME_PRO)
Q_INIT_RESOURCE(QtAwesomePro);
#else
Q_INIT_RESOURCE(QtAwesomeFree);
@@ -211,31 +213,49 @@ private:
//---------------------------------------------------------------------------------------
const QString QtAwesome::FA_BRANDS_FONT_FILENAME = "Font Awesome 6 Brands-Regular-400.otf";
#ifdef FONT_AWESOME_PRO
const QString QtAwesome::FA_DUOTONE_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Solid-900.otf"; // DEPRECATED, use FA_DUOTONE_SOLID_FONT_FILENAME
const QString QtAwesome::FA_DUOTONE_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Solid-900.otf";
const QString QtAwesome::FA_DUOTONE_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Regular-400.otf";
const QString QtAwesome::FA_DUOTONE_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Light-300.otf";
const QString QtAwesome::FA_DUOTONE_THIN_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Thin-100.otf";
const QString QtAwesome::FA_BRANDS_FONT_FILENAME = "Font Awesome 7 Brands-Regular-400.otf";
const QString QtAwesome::FA_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Pro-Solid-900.otf";
const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Pro-Regular-400.otf";
const QString QtAwesome::FA_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Pro-Light-300.otf";
const QString QtAwesome::FA_THIN_FONT_FILENAME = "pro/Font Awesome 6 Pro-Thin-100.otf";
#if defined(FONT_AWESOME_PRO)
const QString QtAwesome::FA_DUOTONE_FONT_FILENAME = "pro/Font Awesome 7 Duotone-Solid-900.otf"; // DEPRECATED, use FA_DUOTONE_SOLID_FONT_FILENAME
const QString QtAwesome::FA_DUOTONE_SOLID_FONT_FILENAME = "pro/Font Awesome 7 Duotone-Solid-900.otf";
const QString QtAwesome::FA_DUOTONE_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Duotone-Regular-400.otf";
const QString QtAwesome::FA_DUOTONE_LIGHT_FONT_FILENAME = "pro/Font Awesome 7 Duotone-Light-300.otf";
const QString QtAwesome::FA_DUOTONE_THIN_FONT_FILENAME = "pro/Font Awesome 7 Duotone-Thin-100.otf";
const QString QtAwesome::FA_SHARP_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Solid-900.otf";
const QString QtAwesome::FA_SHARP_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Regular-400.otf";
const QString QtAwesome::FA_SHARP_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Light-300.otf";
const QString QtAwesome::FA_SHARP_THIN_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Thin-100.otf";
const QString QtAwesome::FA_SOLID_FONT_FILENAME = "pro/Font Awesome 7 Pro-Solid-900.otf";
const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Pro-Regular-400.otf";
const QString QtAwesome::FA_LIGHT_FONT_FILENAME = "pro/Font Awesome 7 Pro-Light-300.otf";
const QString QtAwesome::FA_THIN_FONT_FILENAME = "pro/Font Awesome 7 Pro-Thin-100.otf";
const QString QtAwesome::FA_SHARP_SOLID_FONT_FILENAME = "pro/Font Awesome 7 Sharp-Solid-900.otf";
const QString QtAwesome::FA_SHARP_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Sharp-Regular-400.otf";
const QString QtAwesome::FA_SHARP_LIGHT_FONT_FILENAME = "pro/Font Awesome 7 Sharp-Light-300.otf";
const QString QtAwesome::FA_SHARP_THIN_FONT_FILENAME = "pro/Font Awesome 7 Sharp-Thin-100.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_SOLID_FONT_FILENAME = "pro/Font Awesome 7 Sharp Duotone-Solid-900.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Sharp Duotone-Regular-400.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_LIGHT_FONT_FILENAME = "pro/Font Awesome 7 Sharp Duotone-Light-300.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_THIN_FONT_FILENAME = "pro/Font Awesome 7 Sharp Duotone-Thin-100.otf";
#ifdef FONT_AWESOME_PRO_PLUS
const QString QtAwesome::FA_CHISEL_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Chisel-Regular-400";
const QString QtAwesome::FA_ETCH_SOLID_FONT_FILENAME = "pro/Font Awesome 7 Etch-Solid-900.otf";
const QString QtAwesome::FA_JELLY_DUOTONE_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Jelly Duo-Regular-400.otf";
const QString QtAwesome::FA_JELLY_FILL_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Jelly Fill-Regular-400";
const QString QtAwesome::FA_JELLY_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Jelly-Regular-400.otf";
const QString QtAwesome::FA_NOTDOG_DUOTONE_SOLID_FONT_FILENAME = "pro/Font Awesome 7 Notdog Duo-Solid-900.otf";
const QString QtAwesome::FA_NOTDOG_SOLID_FONT_FILENAME = "pro/Font Awesome 7 Notdog-Solid-900.otf";
const QString QtAwesome::FA_SLAB_PRESS_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Slab Press-Regular-400.otf";
const QString QtAwesome::FA_SLAB_REGULAR_FONT_FILENAME = "pro/Font Awesome 7 Slab-Regular-400.otf";
const QString QtAwesome::FA_THUMBPRINT_LIGHT_FONT_FILENAME = "pro/Font Awesome 7 Thumbprint-Light-300.otf";
const QString QtAwesome::FA_WHITEBOARD_SEMIBOLD_FONT_FILENAME = "pro/Font Awesome 7 Whiteboard-Semibold-600.otf";
#endif
const QString QtAwesome::FA_SHARP_DUOTONE_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Solid-900.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Regular-400.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Light-300.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_THIN_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Thin-100.otf";
#else
const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "Font Awesome 6 Free-Regular-400.otf";
const QString QtAwesome::FA_SOLID_FONT_FILENAME = "Font Awesome 6 Free-Solid-900.otf";
const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "Font Awesome 7 Free-Regular-400.otf";
const QString QtAwesome::FA_SOLID_FONT_FILENAME = "Font Awesome 7 Free-Solid-900.otf";
#endif
/// The default icon colors
@@ -270,6 +290,20 @@ QtAwesome::QtAwesome(QObject* parent)
_fontDetails.insert(fa::fa_sharp_duotone_thin, QtAwesomeFontData(FA_SHARP_DUOTONE_THIN_FONT_FILENAME, FA_SHARP_DUOTONE_THIN_FONT_WEIGHT));
#endif
#ifdef FONT_AWESOME_PRO_PLUS
_fontDetails.insert(fa::fa_chisel_regular, QtAwesomeFontData(FA_CHISEL_REGULAR_FONT_FILENAME, FA_CHISEL_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_etch_solid, QtAwesomeFontData(FA_ETCH_SOLID_FONT_FILENAME, FA_ETCH_SOLID_FONT_WEIGHT));
_fontDetails.insert(fa::fa_jelly_regular, QtAwesomeFontData(FA_JELLY_REGULAR_FONT_FILENAME, FA_JELLY_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_jelly_duotone_regular, QtAwesomeFontData(FA_JELLY_DUOTONE_REGULAR_FONT_FILENAME, FA_JELLY_DUOTONE_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_jelly_fill_regular, QtAwesomeFontData(FA_JELLY_FILL_REGULAR_FONT_FILENAME, FA_JELLY_FILL_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_notdog_duotone_solid, QtAwesomeFontData(FA_NOTDOG_DUOTONE_SOLID_FONT_FILENAME, FA_NOTDOG_DUOTONE_SOLID_FONT_WEIGHT));
_fontDetails.insert(fa::fa_notdog_solid, QtAwesomeFontData(FA_NOTDOG_SOLID_FONT_FILENAME, FA_NOTDOG_SOLID_FONT_WEIGHT));
_fontDetails.insert(fa::fa_slab_press_regular, QtAwesomeFontData(FA_SLAB_PRESS_REGULAR_FONT_FILENAME, FA_SLAB_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_slab_regular, QtAwesomeFontData(FA_SLAB_REGULAR_FONT_FILENAME, FA_SLAB_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_thumbprint_light, QtAwesomeFontData(FA_THUMBPRINT_LIGHT_FONT_FILENAME, FA_THUMBPRINT_LIGHT_FONT_WEIGHT));
_fontDetails.insert(fa::fa_whiteboard_semibold, QtAwesomeFontData(FA_WHITEBOARD_SEMIBOLD_FONT_FILENAME, FA_WHITEBOARD_SEMIBOLD_FONT_WEIGHT));
#endif
#ifdef USE_COLOR_SCHEME
// support dark/light mode
QObject::connect(QApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this](Qt::ColorScheme colorScheme){
@@ -311,8 +345,8 @@ QtAwesome::~QtAwesome()
qDeleteAll(_namedCodepointsList);
}
/// a specialized init function so font-awesome is loaded and initialized
/// this method return true on success, it will return false if the fnot cannot be initialized
/// A specialized init function so font-awesome is loaded and initialized
/// This method return true on success, it will return false if the font cannot be initialized
/// To initialize QtAwesome with font-awesome you need to call this method
bool QtAwesome::initFontAwesome()
{
@@ -320,9 +354,9 @@ bool QtAwesome::initFontAwesome()
// The macro below internally calls "qInitResources_QtAwesome()". this initializes
// the resource system. For a .pri project this isn't required, but when building and using a
// static library the resource need to initialized first.
///
// I've checked th qInitResource_* code and calling this method mutliple times shouldn't be any problem
// (More info about this subject: http://qt-project.org/wiki/QtResources)
//
// I've checked th qInitResource_* code and calling this method multiple times shouldn't be any problem
// (More info about this subject: <http://qt-project.org/wiki/QtResources>)
qtawesome_init_resources();
for (QtAwesomeFontData &fd : _fontDetails) {
@@ -376,6 +410,20 @@ bool QtAwesome::initFontAwesome()
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_light, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_thin, _namedCodepointsByStyle.value(fa::fa_solid));
#ifdef FONT_AWESOME_PRO_PLUS
_namedCodepointsByStyle.insert(fa::fa_chisel_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_etch_solid, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_jelly_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_jelly_duotone_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_jelly_fill_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_notdog_duotone_solid, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_notdog_solid, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_slab_press_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_slab_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_thumbprint_light, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_whiteboard_semibold, _namedCodepointsByStyle.value(fa::fa_solid));
#endif
#else
addToNamedCodePoints(fa::fa_regular, faRegularFreeIconArray, sizeof(faRegularFreeIconArray)/sizeof(QtAwesomeNamedIcon));
#endif
@@ -560,7 +608,23 @@ int QtAwesome::stringToStyleEnum(const QString style) const
else if (style == "fa-sharp-duotone-regular") return fa::fa_sharp_duotone_regular;
else if (style == "fa-sharp-duotone-light") return fa::fa_sharp_duotone_light;
else if (style == "fa-sharp-duotone-thin") return fa::fa_sharp_duotone_thin;
#ifdef FONT_AWESOME_PRO_PLUS
else if (style == "fa-chisel") return fa::fa_chisel_regular;
else if (style == "fa-etch") return fa::fa_etch_solid;
else if (style == "fa-jelly") return fa::fa_jelly_regular;
else if (style == "fa-jelly-duo") return fa::fa_jelly_duotone_regular;
else if (style == "fa-jelly-fill") return fa::fa_jelly_fill_regular;
else if (style == "fa-notdog") return fa::fa_notdog_solid;
else if (style == "fa-notdog-duo") return fa::fa_notdog_duotone_solid;
else if (style == "fa-slab") return fa::fa_slab_regular;
else if (style == "fa-slab-press") return fa::fa_slab_press_regular;
else if (style == "fa-thumbprint") return fa::fa_thumbprint_light;
else if (style == "fa-whiteboard") return fa::fa_whiteboard_semibold;
#endif
#endif
return fa::fa_solid;
}
@@ -586,7 +650,21 @@ const QString QtAwesome::styleEnumToString(int style) const
case fa::fa_sharp_duotone_regular: return "fa-sharp-duotone-regular";
case fa::fa_sharp_duotone_light: return "fa-sharp-duotone-light";
case fa::fa_sharp_duotone_thin: return "fa-sharp-duotone-thin";
#ifdef FONT_AWESOME_PRO_PLUS
case fa::fa_etch_solid: return "fa-chisel";
case fa::fa_jelly_regular: return "fa-jelly";
case fa::fa_jelly_duotone_regular: return "fa-jelly-duo";
case fa::fa_jelly_fill_regular: return "fa-jelly-fill";
case fa::fa_notdog_solid: return "fa-notdog";
case fa::fa_notdog_duotone_solid: return "fa-notdog-duo";
case fa::fa_slab_regular: return "fa-slab";
case fa::fa_slab_press_regular: return "fa-slab-press";
case fa::fa_thumbprint_light: return "fa-thumbprint";
case fa::fa_whiteboard_semibold: return "fa-whiteboard";
#endif
#endif
}
return "fa-solid";
}

View File

@@ -3,7 +3,7 @@
*
* MIT Licensed
*
* Copyright 2013-2024 - Reliable Bits Software by Blommers IT. All Rights Reserved.
* Copyright 2013-2025 - Ribit Software by Blommers IT. All Rights Reserved.
* Author Rick Blommers
*/
@@ -16,18 +16,25 @@
#include <QRect>
#include <QVariantMap>
// Having font awesome pro+ also means the usage of Font awesome pro
#ifdef FONT_AWESOME_PRO_PLUS
#define FONT_AWESOME_PRO
#endif
#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 {
/// 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,
@@ -48,6 +55,27 @@ enum fa_styles {
fa_sharp_duotone_light = 15,
fa_sharp_duotone_thin = 16,
#endif
#ifdef FONT_AWESOME_PRO_PLUS
fa_chisel_regular = 17,
fa_etch_solid = 18,
fa_jelly_regular = 19,
fa_jelly_duotone_regular = 20,
fa_jelly_fill_regular = 21,
fa_notdog_duotone_solid = 22,
fa_notdog_solid = 23,
fa_slab_press_regular = 24,
fa_slab_regular = 25,
fa_thumbprint_light = 26,
fa_whiteboard_semibold = 27,
#endif
fa_brands = 2
};
@@ -137,6 +165,34 @@ public:
static const QFont::Weight FA_SHARP_DUOTONE_THIN_FONT_WEIGHT = QFont::ExtraLight;
#endif
#ifdef FONT_AWESOME_PRO_PLUS
static const QString FA_CHISEL_REGULAR_FONT_FILENAME; // fa-chisel fa-regular
static const QString FA_ETCH_SOLID_FONT_FILENAME; // fa-etch fa-solid
static const QString FA_JELLY_REGULAR_FONT_FILENAME; // fa-jelly fa-regular
static const QString FA_JELLY_DUOTONE_REGULAR_FONT_FILENAME; // fa-jelly-duo fa-regular
static const QString FA_JELLY_FILL_REGULAR_FONT_FILENAME; // fa-jelly-fill fa-regular
static const QString FA_NOTDOG_DUOTONE_SOLID_FONT_FILENAME; // fa-notdog-duo fa-solid
static const QString FA_NOTDOG_SOLID_FONT_FILENAME; // fa-notdog fa-solid
static const QString FA_SLAB_PRESS_REGULAR_FONT_FILENAME; // fa-slab-press fa-regular
static const QString FA_SLAB_REGULAR_FONT_FILENAME; // fa-slab fa-regular
static const QString FA_THUMBPRINT_LIGHT_FONT_FILENAME; // fa-thumbprint fa-light
static const QString FA_WHITEBOARD_SEMIBOLD_FONT_FILENAME; // fa-whiteboard fa-semibold
static const QFont::Weight FA_CHISEL_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_ETCH_SOLID_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_JELLY_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_JELLY_DUOTONE_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_JELLY_FILL_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_NOTDOG_DUOTONE_SOLID_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_NOTDOG_SOLID_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_SLAB_PRESS_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_SLAB_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_THUMBPRINT_LIGHT_FONT_WEIGHT = QFont::Light;
static const QFont::Weight FA_WHITEBOARD_SEMIBOLD_FONT_WEIGHT = QFont::DemiBold;
#endif
public:
explicit QtAwesome(QObject* parent = nullptr);

View File

@@ -2,8 +2,8 @@ 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") }
options = $$find(CONFIG, fontAweomeProPlus) $$find(CONFIG, fontAwesomePro) $$find(CONFIG, fontAwesomeFree)
count(options, 0) { error("fontAwesomeProPlus, fontAwesomePro or fontAwesomeFree should be defined") }
count(options, 2) { error("fontAwesomePro and fontAwesomeFree were defined, only one config is accepted") }
INCLUDEPATH += $$PWD
@@ -18,6 +18,13 @@ HEADERS += $$PWD/QtAwesome.h \
$$PWD/QtAwesomeStringGenerated.h
CONFIG( fontAwesomeProPlus ){
config = ProPlus
RESOURCES += $$resourcesForConfig(config)
DEFINES += FONT_AWESOME_PRO_PLUS=1
!build_pass:message(using font awesome pro+)
}
CONFIG( fontAwesomePro ){
config = Pro
RESOURCES += $$resourcesForConfig(config)

View File

@@ -10,6 +10,7 @@ CONFIG += staticlib c++11
QT += widgets
# only one option must be enabled
#CONFIG += fontAwesomeProPlus
#CONFIG += fontAwesomePro
CONFIG += fontAwesomeFree
include(QtAwesome.pri)

View File

@@ -15,7 +15,6 @@ QtAwesomeAnimation::QtAwesomeAnimation(QWidget *parentWidget, int interval, int
, step_(step)
, angle_(0.0f)
{
}
void QtAwesomeAnimation::setup(QPainter &painter, const QRect &rect)
@@ -38,7 +37,6 @@ void QtAwesomeAnimation::setup(QPainter &painter, const QRect &rect)
}
}
void QtAwesomeAnimation::update()
{
angle_ += step_;

View File

@@ -29,7 +29,6 @@ namespace fa {
int interval_;
int step_;
float angle_;
};
} // namespace fa

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +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>
<file>fonts/Font Awesome 7 Brands-Regular-400.otf</file>
<file>fonts/Font Awesome 7 Free-Regular-400.otf</file>
<file>fonts/Font Awesome 7 Free-Solid-900.otf</file>
</qresource>
</RCC>

View File

@@ -1,21 +1,21 @@
<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 Duotone-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 6 Duotone-Light-300.otf</file>
<file>fonts/pro/Font Awesome 6 Duotone-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Light-300.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp-Light-300.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp Duotone-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp Duotone-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp Duotone-Light-300.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp Duotone-Thin-100.otf</file>
<file>fonts/Font Awesome 7 Brands-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Thin-100.otf</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,32 @@
<RCC>
<qresource prefix="/">
<file>fonts/Font Awesome 7 Brands-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Chisel-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Duotone-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 7 Etch-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Jelly Duo-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Jelly Fill-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Jelly-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Notdog Duo-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Notdog-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Pro-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp Duotone-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 7 Sharp-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 7 Slab Press-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Slab-Regular-400.otf</file>
<file>fonts/pro/Font Awesome 7 Thumbprint-Light-300.otf</file>
<file>fonts/pro/Font Awesome 7 Whiteboard-Semibold-600.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

@@ -19,7 +19,8 @@ HEADERS += \
# only one option must be enabled
#CONFIG += fontAwesomePro
# CONFIG += fontAwesomeProPlus
# CONFIG += fontAwesomePro
CONFIG += fontAwesomeFree
include(../QtAwesome/QtAwesome.pri)

View File

@@ -1,7 +1,7 @@
/**
* MIT Licensed
*
* Copyright 2011-2022 - Reliable Bits Software by Blommers IT. All Rights Reserved.
* Copyright 2011-2025 - Ribit Software by Blommers IT. All Rights Reserved.
* Author Rick Blommers
*/

View File

@@ -17,7 +17,7 @@ MainWindow::MainWindow(QWidget *parent) :
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
#if defined(FONT_AWESOME_PRO)
ui->comboBox->addItem("Light", fa::fa_light);
ui->comboBox->addItem("Thin", fa::fa_thin);
// ui->comboBox->addItem("Duotone", fa::fa_duotone); // DEPRECATED
@@ -35,6 +35,20 @@ MainWindow::MainWindow(QWidget *parent) :
ui->comboBox->addItem("Sharp Duotone Thin", fa::fa_sharp_duotone_thin);
#endif
#if defined(FONT_AWESOME_PRO_PLUS)
ui->comboBox->addItem("Chisel Regular", fa::fa_chisel_regular);
ui->comboBox->addItem("Etch Solid", fa::fa_etch_solid);
ui->comboBox->addItem("Jelly Regular", fa::fa_jelly_regular);
ui->comboBox->addItem("Jelly Duotone Regular", fa::fa_jelly_duotone_regular);
ui->comboBox->addItem("Jelly Fill Regular", fa::fa_jelly_fill_regular);
ui->comboBox->addItem("Notdog Duotone Solid", fa::fa_notdog_duotone_solid);
ui->comboBox->addItem("Notdog Solid", fa::fa_notdog_solid);
ui->comboBox->addItem("Slab Press Regular", fa::fa_slab_press_regular);
ui->comboBox->addItem("Slab Regular", fa::fa_slab_regular);
ui->comboBox->addItem("Thumbprint Light", fa::fa_thumbprint_light);
ui->comboBox->addItem("Whiteboard Semibold", fa::fa_whiteboard_semibold);
#endif
// a simple beer button
//=====================
{

View File

@@ -1,54 +1,43 @@
# QtAwesome - Font Awesome for Qt Applications
QtAwesome is a library to add [Font Awesome](https://fontawesome.com)
icons to your [Qt application](http://qt-project.org/).
QtAwesome is a library to add [Font Awesome](https://fontawesome.com) icons to your [Qt application](http://qt-project.org/).
## Table of Contents
- [Latest Release 6.7.2](#latest-release-672)
- [Font Awesome 6 Release](#font-awesome-6-release)
- [Latest Release 7](#latest-release-7)
- [Installation Free Version](#installation-free-version)
- [Installation Pro version](#installation-pro-version)
- [Installation Pro Plus version](#installation-pro-plus-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)
## Latest Release 6.7.2
## Latest Release 7
Update of font files to 6.7.2
Updated to Font Awesome 7
When using Pro+, the extra styles Chisel, Etch, Jelly, Notdog, Slab, Thumbprint and Whiteboard are available.
[View changelog](CHANGES.md)
## Font Awesome 6 Release
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).
Previous versions used a hand-crafted icon list, this version has a generated list.
Having troubles with this new release?
- 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 [main](https://github.com/gamecreature/QtAwesome/) branch contains the latest Font Awesome 7 version.
- The [fontawesome-6](https://github.com/gamecreature/QtAwesome/tree/fontawesome-6) branch contains the Font Awesome 6 version
- 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
- 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`)
- Open a github issue if you've found a bug or have a suggestion
## 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:
You can include QtAweome to your project by copying the QtAwesome directory to
your project tree and add the following `include()` to your Qt project file:
```bash
```sh
CONFIG+=fontAwesomeFree
include(QtAwesome/QtAwesome.pri)
```
@@ -59,17 +48,31 @@ Now you are good to go! The free fonts are included in this project.
To activate the pro version, `fontAwesomePro` config should be defined.
```bash
```sh
CONFIG+=fontAwesomePro
include(QtAwesome/QtAwesome.pri)
```
And the pro font files need to be copied to the `QtAwesome/fonts/pro` folder.
(ex, Font Awesome 6 Brands-Regular-400.otf, etc... )
## Installation Pro Plus version
To activate the pro+ version, `fontAwesomePro` config should be defined.
```sh
CONFIG+=fontAwesomePro
include(QtAwesome/QtAwesome.pri)
```
Using the fontAwesomePro config, implies the definition of
FONT_AWESOME_PRO, and FONT_AWESOME_PRO_PLUS)
Place the pro+ font files to the `QtAwesome/fonts/pro` folder.
## Basic Usage
You probably want to create a single QtAwesome object for your whole application.
Create a single QtAwesome object for your whole application.
```c++
fa::QtAwesome* awesome = new fa::QtAwesome(qApp)
@@ -97,7 +100,7 @@ QPushButton* btn = new QPushButton(awesome->icon("solid coffee" ), "Black please
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:
For shorter syntax (more Font Awesome like) is possible to bring the fa namespace into the current scope:
```c++
using namespace fa;
@@ -113,7 +116,7 @@ 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.\
The defaults option can also be adjusted via the `setDefaultOption` method.
For example having green disabled icons, it is possible to call:
```c++
@@ -193,7 +196,7 @@ setDefaultOption("duotone-color-active", QApplication::palette().color(QPalette:
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.
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,
@@ -256,26 +259,17 @@ QAction* menuAction = new QAction("test");
menuAction->setIcon(awesome->icon(fa::fa_heart).pixmap(32,32));
```
## Summary of Changes
- 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 style names, like `fa::fa_regular`, `fa::fa_solid`
- This release has been tested with Qt 5 and Qt 6.
## Thanks
Thanks go to the contributors of this project!
Many thanks go to Dave Gandy an the other Font Awesome contributors!! [https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome)
Many thanks go to Dave Gandy and the other Font Awesome contributors!! [https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/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" />
<img src="https://contrib.rocks/image?repo=gamecreature/qtawesome" />
</a>
<small>*Contribution list made with [contrib.rocks](https://contrib.rocks).*</small>
@@ -290,8 +284,8 @@ Contributions are welcome! Feel free to fork and send a pull request through Git
## License
MIT License. Copyright 2013-2022 - Reliable Bits Software by Blommers IT. [https://blommersit.nl/](https://blommersit.nl)
MIT License. Copyright 2013-2025 - Ribit Software by Blommers IT. [https://blommersit.nl/](https://blommersit.nl)
The Font Awesome font is licensed under the SIL Open Font License - [https://scripts.sil.org/OFL](http://scripts.sil.org/OFL)
The Font Awesome pictograms are licensed under the CC BY 3.0 License - [https://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/)
"Font Awesome by Dave Gandy - https://github.com/FortAwesome/Font-Awesome"
"Font Awesome by Dave Gandy - <https://github.com/FortAwesome/Font-Awesome>"

View File

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

View File

@@ -10,12 +10,22 @@ static const fa::QtAwesomeNamedIcon faBrandsIconArray[] = {
<% end %>
};
#ifdef FONT_AWESOME_PRO
#if defined(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 %>
};
#elif defined(FONT_AWESOME_PRO_PLUS)
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[] = {