mirror of
https://github.com/gamecreature/QtAwesome.git
synced 2025-12-16 19:57:03 +03:00
Merge pull request #68 from gamecreature/main
Pull the latest fontawesome-6 related changes
This commit is contained in:
52
.github/workflows/cmake.yml
vendored
Normal file
52
.github/workflows/cmake.yml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: CMake
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
tags:
|
||||
- "*"
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
name: ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-12, macos-13, macos-14, windows-2019, windows-2022]
|
||||
qt_version: [5.12.12, 5.15.2, 6.4.0, 6.5.0, 6.6.0, 6.7.0]
|
||||
shared: [ON, OFF]
|
||||
exclude:
|
||||
- os: macos-14
|
||||
qt_version: 5.12.12
|
||||
- os: macos-14
|
||||
qt_version: 5.15.2
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: git fetch --tags --force
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ matrix.qt_version }}
|
||||
cache: 'true'
|
||||
cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ matrix.qt_version }}
|
||||
dir: ${{ github.workspace }}/Qt
|
||||
|
||||
- name: Configure (${{ matrix.configuration }})
|
||||
run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DBUILD_SHARED_LIBS=${{ matrix.shared }} -B "${{github.workspace}}/build"
|
||||
|
||||
- name: Build with ${{ matrix.compiler }}
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target package
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,7 +1,8 @@
|
||||
.*
|
||||
*.pro.user
|
||||
*.pro.user*
|
||||
/*build*
|
||||
CMakeLists.txt.user
|
||||
**/build
|
||||
|
||||
# never include pro files
|
||||
QtAwesome/fonts/pro/
|
||||
|
||||
19
CHANGES.md
Normal file
19
CHANGES.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Changes
|
||||
|
||||
- (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)
|
||||
- (2024-11-21) Update to 6.7.1, Extra Duotone styles
|
||||
- Expand Duotone to support Solid, Regular, Light and Thin
|
||||
- Add Sharp Duotone styles
|
||||
- Deprecated Duotone (without style)
|
||||
- (2024-04-23) Support for dark/light colorSchema mode, (contribution by @hanjianqiao(Lanchitour))
|
||||
- (2023-12-07) Update to 6.5.1, Sharp Thin Pro font
|
||||
- (2023-08-16) Update to 6.4.2, Fix issue missing pro icons in namedCodePoints
|
||||
- (2023-03-28) Update to 6.4.0, Sharp Light Pro font
|
||||
- (2023-02-09) Update to 6.3.0, Aliases and Sharp Regular Pro font
|
||||
- Aliases are now included in the icon list names
|
||||
- Support for font style "Font Awesome Sharp Regular" (Pro)
|
||||
- Update generator to include all alias names
|
||||
- Update free font files to latest release
|
||||
- (2013-04-19) Initial release
|
||||
143
CMakeLists.txt
Normal file
143
CMakeLists.txt
Normal file
@@ -0,0 +1,143 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
#Set The Current Version Number to use as fallback if GIT Fails.
|
||||
set(QTAWESOME_VERSION_MAJOR 6)
|
||||
set(QTAWESOME_VERSION_MINOR 5)
|
||||
set(QTAWESOME_VERSION_PATCH 1)
|
||||
set(QTAWESOME_VERSION_TWEAK 0)
|
||||
# Get the version from git if it's a git repository
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --tags --long --match "font-awesome-*" --always
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GITREV
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(FIND ${GITREV} "font-awesome-" isRev)
|
||||
if(NOT ifRev EQUAL -1)
|
||||
string(REGEX MATCH [0-9]+ MAJOR ${GITREV})
|
||||
string(REGEX MATCH \\.[0-9]+ MINOR ${GITREV})
|
||||
string(REPLACE "." "" MINOR "${MINOR}")
|
||||
string(REGEX MATCH [0-9]+\- PATCH ${GITREV})
|
||||
string(REPLACE "-" "" PATCH "${PATCH}")
|
||||
string(REGEX MATCH \-[0-9]+\- TWEAK ${GITREV})
|
||||
string(REPLACE "-" "" TWEAK "${TWEAK}")
|
||||
set(QTAWESOME_VERSION_MAJOR ${MAJOR})
|
||||
set(QTAWESOME_VERSION_MINOR ${MINOR})
|
||||
set(QTAWESOME_VERSION_PATCH ${PATCH})
|
||||
set(QTAWESOME_VERSION_TWEAK ${TWEAK})
|
||||
elseif(NOT ${GITREV} STREQUAL "")
|
||||
set(QTAWESOME_VERSION_TWEAK ${GITREV})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(QTAWESOME_VERSION "${QTAWESOME_VERSION_MAJOR}.${QTAWESOME_VERSION_MINOR}.${QTAWESOME_VERSION_PATCH}.${QTAWESOME_VERSION_TWEAK}")
|
||||
message(STATUS "Building QTAWESOME: ${QTAWESOME_VERSION}")
|
||||
|
||||
project(QtAwesome VERSION ${QTAWESOME_VERSION} DESCRIPTION "Add Font Awesome icons to your Qt application")
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
set(QtAwesome_HEADERS
|
||||
QtAwesome/QtAwesome.h
|
||||
QtAwesome/QtAwesomeAnim.h
|
||||
QtAwesome/QtAwesomeEnumGenerated.h
|
||||
QtAwesome/QtAwesomeStringGenerated.h
|
||||
)
|
||||
|
||||
add_library(QtAwesome
|
||||
QtAwesome/QtAwesome.cpp
|
||||
QtAwesome/QtAwesomeAnim.cpp
|
||||
QtAwesome/QtAwesomeFree.qrc
|
||||
${QtAwesome_HEADERS}
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
target_include_directories(QtAwesome
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/QtAwesome>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
target_link_libraries(QtAwesome PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
)
|
||||
|
||||
set_target_properties(QtAwesome PROPERTIES
|
||||
PUBLIC_HEADER "${QtAwesome_HEADERS}"
|
||||
)
|
||||
|
||||
install(TARGETS QtAwesome EXPORT QtAwesomeConfig
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QtAwesome
|
||||
)
|
||||
|
||||
install (FILES "${PROJECT_SOURCE_DIR}/LICENSE.md" DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/${PROJECT_NAME} RENAME LICENSE)
|
||||
|
||||
install(EXPORT QtAwesomeConfig
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QtAwesome/
|
||||
NAMESPACE QtAwesome::
|
||||
)
|
||||
|
||||
export(EXPORT QtAwesomeConfig NAMESPACE QtAwesome::)
|
||||
|
||||
## PACKAGES
|
||||
#Generic Info
|
||||
set(CPACK_PACKAGE_CONTACT "rick@blommersit.nl")
|
||||
set(CPACK_STRIP_FILES TRUE)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.md")
|
||||
set(CPACK_PACKAGE_NAME "QtAwesome")
|
||||
set(CPACK_PACKAGE_VENDOR "gamecreature")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/gamecreature/QtAwesome")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMAKE_PROJECT_DESCRIPTION})
|
||||
|
||||
## SET OS NAME
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
set(OS_STRING "macos")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(OS_STRING "win64")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OS_STRING "win32")
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
set(OS_STRING "linux_${CMAKE_SYSTEM_PROCESSOR}")
|
||||
else()
|
||||
set(OS_STRING ${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
if (NOT CPACK_PACKAGE_VERSION)
|
||||
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${OS_STRING}")
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-static-${OS_STRING}")
|
||||
endif()
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
|
||||
|
||||
#Set base Name And Generator Based on the system
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
set(CPACK_GENERATOR "7Z")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
@@ -1,7 +1,7 @@
|
||||
MIT License
|
||||
===========
|
||||
|
||||
Copyright 2013-2022 [Reliable Bits Software by Blommers IT](https://blommersit.nl). All Rights Reserved.
|
||||
Copyright 2013-2025 [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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT Licensed
|
||||
*
|
||||
* Copyright 2013-2022 - Reliable Bits Software by Blommers IT. All Rights Reserved.
|
||||
* Copyright 2013-2024 - Reliable Bits Software by Blommers IT. All Rights Reserved.
|
||||
* Author Rick Blommers
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
#include <QString>
|
||||
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
#define USE_COLOR_SCHEME
|
||||
#include <QStyleHints>
|
||||
#endif
|
||||
|
||||
// Initializing namespaces need to happen outside a namespace
|
||||
static void qtawesome_init_resources()
|
||||
{
|
||||
@@ -102,7 +107,7 @@ public:
|
||||
painter->save();
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
painter->setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
#endif
|
||||
|
||||
@@ -208,12 +213,26 @@ 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";
|
||||
const QString QtAwesome::FA_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Pro-Light-300.otf";
|
||||
const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Pro-Regular-400.otf";
|
||||
const QString QtAwesome::FA_THIN_FONT_FILENAME = "pro/Font Awesome 6 Pro-Thin-100.otf";
|
||||
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_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";
|
||||
|
||||
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_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";
|
||||
@@ -225,36 +244,64 @@ QtAwesome::QtAwesome(QObject* parent)
|
||||
, _namedCodepointsByStyle()
|
||||
, _namedCodepointsList()
|
||||
{
|
||||
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)); // TODO: check how to get the correct highlighted color
|
||||
setDefaultOption("scale-factor", 1.0 );
|
||||
|
||||
resetDefaultOptions();
|
||||
|
||||
_fontIconPainter = new QtAwesomeCharIconPainter();
|
||||
|
||||
_fontDetails.insert(fa::fa_brands, QtAwesomeFontData(FA_BRANDS_FONT_FILENAME, FA_BRANDS_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_solid, QtAwesomeFontData(FA_SOLID_FONT_FILENAME, FA_SOLID_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_regular, QtAwesomeFontData(FA_REGULAR_FONT_FILENAME, FA_REGULAR_FONT_WEIGHT));
|
||||
#ifdef FONT_AWESOME_PRO
|
||||
_fontDetails.insert(fa::fa_light, QtAwesomeFontData(FA_LIGHT_FONT_FILENAME, FA_LIGHT_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_thin, QtAwesomeFontData(FA_THIN_FONT_FILENAME, FA_THIN_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_duotone, QtAwesomeFontData(FA_DUOTONE_FONT_FILENAME, FA_DUOTONE_FONT_WEIGHT)); // DEPRECATED
|
||||
_fontDetails.insert(fa::fa_duotone_solid, QtAwesomeFontData(FA_DUOTONE_SOLID_FONT_FILENAME, FA_DUOTONE_SOLID_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_duotone_regular, QtAwesomeFontData(FA_DUOTONE_REGULAR_FONT_FILENAME, FA_DUOTONE_REGULAR_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_duotone_light, QtAwesomeFontData(FA_DUOTONE_LIGHT_FONT_FILENAME, FA_DUOTONE_LIGHT_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_duotone_thin, QtAwesomeFontData(FA_DUOTONE_THIN_FONT_FILENAME, FA_DUOTONE_THIN_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_solid, QtAwesomeFontData(FA_SHARP_SOLID_FONT_FILENAME, FA_SHARP_SOLID_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_regular, QtAwesomeFontData(FA_SHARP_REGULAR_FONT_FILENAME, FA_SHARP_REGULAR_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_light, QtAwesomeFontData(FA_SHARP_LIGHT_FONT_FILENAME, FA_SHARP_LIGHT_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_thin, QtAwesomeFontData(FA_SHARP_THIN_FONT_FILENAME, FA_SHARP_THIN_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_duotone_solid, QtAwesomeFontData(FA_SHARP_DUOTONE_SOLID_FONT_FILENAME, FA_SHARP_DUOTONE_SOLID_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_duotone_regular, QtAwesomeFontData(FA_SHARP_DUOTONE_REGULAR_FONT_FILENAME, FA_SHARP_DUOTONE_REGULAR_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_duotone_light, QtAwesomeFontData(FA_SHARP_DUOTONE_LIGHT_FONT_FILENAME, FA_SHARP_DUOTONE_LIGHT_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_duotone_thin, QtAwesomeFontData(FA_SHARP_DUOTONE_THIN_FONT_FILENAME, FA_SHARP_DUOTONE_THIN_FONT_WEIGHT));
|
||||
#endif
|
||||
|
||||
#ifdef USE_COLOR_SCHEME
|
||||
// support dark/light mode
|
||||
QObject::connect(QApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this](Qt::ColorScheme colorScheme){
|
||||
Q_UNUSED(colorScheme);
|
||||
resetDefaultOptions();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void QtAwesome::resetDefaultOptions(){
|
||||
_defaultOptions.clear();
|
||||
|
||||
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)); // TODO: check how to get the correct highlighted color
|
||||
setDefaultOption("scale-factor", 1.0 );
|
||||
|
||||
|
||||
#ifdef FONT_AWESOME_PRO
|
||||
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));
|
||||
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));
|
||||
#endif
|
||||
setDefaultOption("text", QVariant());
|
||||
setDefaultOption("text-disabled", QVariant());
|
||||
setDefaultOption("text-active", QVariant());
|
||||
setDefaultOption("text-selected", QVariant());
|
||||
|
||||
_fontIconPainter = new QtAwesomeCharIconPainter();
|
||||
|
||||
_fontDetails.insert(fa::fa_solid, QtAwesomeFontData(FA_SOLID_FONT_FILENAME, FA_SOLID_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_regular, QtAwesomeFontData(FA_REGULAR_FONT_FILENAME, FA_REGULAR_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_brands, QtAwesomeFontData(FA_BRANDS_FONT_FILENAME, FA_BRANDS_FONT_WEIGHT));
|
||||
#ifdef FONT_AWESOME_PRO
|
||||
_fontDetails.insert(fa::fa_light, QtAwesomeFontData(FA_LIGHT_FONT_FILENAME, FA_LIGHT_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_duotone, QtAwesomeFontData(FA_DUOTONE_FONT_FILENAME, FA_DUOTONE_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_thin, QtAwesomeFontData(FA_THIN_FONT_FILENAME, FA_THIN_FONT_WEIGHT));
|
||||
_fontDetails.insert(fa::fa_sharp_solid, QtAwesomeFontData(FA_SHARP_SOLID_FONT_FILENAME, FA_SHARP_SOLID_FONT_WEIGHT));
|
||||
#endif
|
||||
Q_EMIT defaultOptionsReset();
|
||||
}
|
||||
|
||||
QtAwesome::~QtAwesome()
|
||||
@@ -311,11 +358,24 @@ bool QtAwesome::initFontAwesome()
|
||||
|
||||
//initialize others code icons maps
|
||||
#ifdef FONT_AWESOME_PRO
|
||||
addToNamedCodePoints(fa::fa_solid, faProIconArray, sizeof(faProIconArray)/sizeof(QtAwesomeNamedIcon));
|
||||
|
||||
_namedCodepointsByStyle.insert(fa::fa_regular, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_light, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_thin, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_duotone, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_duotone, _namedCodepointsByStyle.value(fa::fa_solid)); // DEPRECATED
|
||||
_namedCodepointsByStyle.insert(fa::fa_duotone_solid, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_duotone_regular, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_duotone_light, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_duotone_thin, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_sharp_solid, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_sharp_regular, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_sharp_light, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_sharp_thin, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_solid, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
_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));
|
||||
#else
|
||||
addToNamedCodePoints(fa::fa_regular, faRegularFreeIconArray, sizeof(faRegularFreeIconArray)/sizeof(QtAwesomeNamedIcon));
|
||||
#endif
|
||||
@@ -402,7 +462,7 @@ QIcon QtAwesome::icon(const QString& name, const QVariantMap& options)
|
||||
|
||||
if( spaceIndex > 0) {
|
||||
QString styleName = name.left(spaceIndex);
|
||||
style = stringToStyleEnum(name.startsWith("fa-") ? name.mid(3) : name);
|
||||
style = stringToStyleEnum(styleName.startsWith("fa-") ? styleName : "fa-" + styleName);
|
||||
iconName = name.mid(spaceIndex + 1);
|
||||
} else {
|
||||
iconName = name;
|
||||
@@ -487,8 +547,19 @@ int QtAwesome::stringToStyleEnum(const QString style) const
|
||||
#ifdef FONT_AWESOME_PRO
|
||||
else if (style == "fa-light") return fa::fa_light;
|
||||
else if (style == "fa-thin") return fa::fa_thin;
|
||||
else if (style == "fa-duotone") return fa::fa_duotone;
|
||||
else if (style == "fa-duotone") return fa::fa_duotone; // DEPRECATED
|
||||
else if (style == "fa-duotone-solid") return fa::fa_duotone_solid;
|
||||
else if (style == "fa-duotone-regular") return fa::fa_duotone_regular;
|
||||
else if (style == "fa-duotone-light") return fa::fa_duotone_light;
|
||||
else if (style == "fa-duotone-thin") return fa::fa_duotone_thin;
|
||||
else if (style == "fa-sharp-solid") return fa::fa_sharp_solid;
|
||||
else if (style == "fa-sharp-regular") return fa::fa_sharp_regular;
|
||||
else if (style == "fa-sharp-light") return fa::fa_sharp_light;
|
||||
else if (style == "fa-sharp-thin") return fa::fa_sharp_thin;
|
||||
else if (style == "fa-sharp-duotone-solid") return fa::fa_sharp_duotone_solid;
|
||||
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;
|
||||
#endif
|
||||
return fa::fa_solid;
|
||||
}
|
||||
@@ -501,12 +572,23 @@ const QString QtAwesome::styleEnumToString(int style) const
|
||||
case fa::fa_brands: return "fa-brands";
|
||||
#ifdef FONT_AWESOME_PRO
|
||||
case fa::fa_light: return "fa-light";
|
||||
case fa::fa_thin: return "fa=thin";
|
||||
case fa::fa_duotone: return "fa-duotone";
|
||||
case fa::fa_thin: return "fa-thin";
|
||||
// case fa::fa_duotone: return "fa-duotone"; // DEPRECATED
|
||||
case fa::fa_duotone_solid: return "fa-duotone-solid";
|
||||
case fa::fa_duotone_regular: return "fa-duotone-regular";
|
||||
case fa::fa_duotone_light: return "fa-duotone-light";
|
||||
case fa::fa_duotone_thin: return "fa-duotone-thin";
|
||||
case fa::fa_sharp_solid: return "fa-sharp-solid";
|
||||
case fa::fa_sharp_regular: return "fa-sharp-regular";
|
||||
case fa::fa_sharp_light: return "fa-sharp-light";
|
||||
case fa::fa_sharp_thin: return "fa-sharp-thin";
|
||||
case fa::fa_sharp_duotone_solid: return "fa-sharp-duotone-solid";
|
||||
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";
|
||||
#endif
|
||||
}
|
||||
return "fa_solid";
|
||||
return "fa-solid";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT Licensed
|
||||
*
|
||||
* Copyright 2013-2022 - Reliable Bits Software by Blommers IT. All Rights Reserved.
|
||||
* Copyright 2013-2024 - Reliable Bits Software by Blommers IT. All Rights Reserved.
|
||||
* Author Rick Blommers
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,22 @@ enum fa_styles {
|
||||
#ifdef FONT_AWESOME_PRO
|
||||
fa_light = 3,
|
||||
fa_thin = 4,
|
||||
fa_duotone = 5,
|
||||
fa_sharp_solid = 6,
|
||||
|
||||
fa_duotone = 5, // DEPRECATED, use fa_duotone_solid
|
||||
fa_duotone_solid = 5,
|
||||
fa_duotone_regular = 6,
|
||||
fa_duotone_light = 7,
|
||||
fa_duotone_thin = 8,
|
||||
|
||||
fa_sharp_solid = 9,
|
||||
fa_sharp_regular = 10,
|
||||
fa_sharp_light = 11,
|
||||
fa_sharp_thin = 12,
|
||||
|
||||
fa_sharp_duotone_solid = 13,
|
||||
fa_sharp_duotone_regular = 14,
|
||||
fa_sharp_duotone_light = 15,
|
||||
fa_sharp_duotone_thin = 16,
|
||||
#endif
|
||||
fa_brands = 2
|
||||
};
|
||||
@@ -84,14 +98,43 @@ public:
|
||||
|
||||
#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_DUOTONE_FONT_FILENAME; // fa-duotone / DEPRECATED
|
||||
static const QString FA_DUOTONE_SOLID_FONT_FILENAME; // fa-duotone fa-solid
|
||||
static const QString FA_DUOTONE_REGULAR_FONT_FILENAME; // fa-duotone fa-regular
|
||||
static const QString FA_DUOTONE_LIGHT_FONT_FILENAME; // fa-duotone fa-light
|
||||
static const QString FA_DUOTONE_THIN_FONT_FILENAME; // fa-duotone fa-thin
|
||||
|
||||
static const QString FA_SHARP_SOLID_FONT_FILENAME; // fa-sharp fa-solid
|
||||
static const QString FA_SHARP_REGULAR_FONT_FILENAME; // fa-sharp fa-regular
|
||||
static const QString FA_SHARP_LIGHT_FONT_FILENAME; // fa-sharp fa-light
|
||||
static const QString FA_SHARP_THIN_FONT_FILENAME; // fa-sharp fa-thin
|
||||
|
||||
static const QString FA_SHARP_DUOTONE_SOLID_FONT_FILENAME; // fa-sharp-duotone fa-solid
|
||||
static const QString FA_SHARP_DUOTONE_REGULAR_FONT_FILENAME; // fa-sharp-duotone fa-regular
|
||||
static const QString FA_SHARP_DUOTONE_LIGHT_FONT_FILENAME; // fa-sharp-duotone fa-light
|
||||
static const QString FA_SHARP_DUOTONE_THIN_FONT_FILENAME; // fa-sharp-duotone fa-thin
|
||||
|
||||
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_DUOTONE_FONT_WEIGHT = QFont::Black; // DEPRECATED: use FA_DUOTONE_FONT_SOLID_WEIGHT
|
||||
static const QFont::Weight FA_DUOTONE_SOLID_FONT_WEIGHT = QFont::Black;
|
||||
static const QFont::Weight FA_DUOTONE_REGULAR_FONT_WEIGHT = QFont::Normal;
|
||||
static const QFont::Weight FA_DUOTONE_LIGHT_FONT_WEIGHT = QFont::Light;
|
||||
static const QFont::Weight FA_DUOTONE_THIN_FONT_WEIGHT = QFont::ExtraLight;
|
||||
|
||||
static const QFont::Weight FA_SHARP_SOLID_FONT_WEIGHT = QFont::Black;
|
||||
static const QFont::Weight FA_SHARP_REGULAR_FONT_WEIGHT = QFont::Normal;
|
||||
static const QFont::Weight FA_SHARP_LIGHT_FONT_WEIGHT = QFont::Light;
|
||||
static const QFont::Weight FA_SHARP_THIN_FONT_WEIGHT = QFont::ExtraLight;
|
||||
|
||||
static const QFont::Weight FA_SHARP_DUOTONE_SOLID_FONT_WEIGHT = QFont::Black;
|
||||
static const QFont::Weight FA_SHARP_DUOTONE_REGULAR_FONT_WEIGHT = QFont::Normal;
|
||||
static const QFont::Weight FA_SHARP_DUOTONE_LIGHT_FONT_WEIGHT = QFont::Light;
|
||||
static const QFont::Weight FA_SHARP_DUOTONE_THIN_FONT_WEIGHT = QFont::ExtraLight;
|
||||
#endif
|
||||
|
||||
public:
|
||||
@@ -122,6 +165,14 @@ protected:
|
||||
const QString styleEnumToString(int style) const;
|
||||
void addToNamedCodePoints(int style, const fa::QtAwesomeNamedIcon* faCommonIconArray, int size);
|
||||
|
||||
Q_SIGNALS:
|
||||
// signal about default options being reset
|
||||
void defaultOptionsReset();
|
||||
|
||||
public Q_SLOTS:
|
||||
// (re)set default options according to current QApplication::palette()
|
||||
void resetDefaultOptions();
|
||||
|
||||
private:
|
||||
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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,20 @@
|
||||
<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 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>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
20
QtAwesomeSample/CMakeLists.txt
Normal file
20
QtAwesomeSample/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(QtAwesomeSample)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
add_subdirectory(../ QtAwesome)
|
||||
|
||||
add_executable(QtAwesomeSample
|
||||
mainwindow.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(QtAwesomeSample
|
||||
PUBLIC QtAwesome
|
||||
)
|
||||
37
QtAwesomeSample/LICENSE.md
Normal file
37
QtAwesomeSample/LICENSE.md
Normal file
@@ -0,0 +1,37 @@
|
||||
MIT License
|
||||
===========
|
||||
|
||||
Copyright 2013-2025 [Rick Blommers](mailto:rick@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
|
||||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
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
|
||||
====================
|
||||
|
||||
[https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/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.
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
#include <QtCore/qtypes.h>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
@@ -19,8 +20,19 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
#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("Duotone", fa::fa_duotone); // DEPRECATED
|
||||
ui->comboBox->addItem("Duotone Solid", fa::fa_duotone);
|
||||
ui->comboBox->addItem("Duotone Regular", fa::fa_duotone_regular);
|
||||
ui->comboBox->addItem("Duotone Light", fa::fa_duotone_light);
|
||||
ui->comboBox->addItem("Duotone Thin", fa::fa_duotone_thin);
|
||||
ui->comboBox->addItem("Sharp Solid", fa::fa_sharp_solid);
|
||||
ui->comboBox->addItem("Sharp Regular", fa::fa_sharp_regular);
|
||||
ui->comboBox->addItem("Sharp Light", fa::fa_sharp_light);
|
||||
ui->comboBox->addItem("Sharp Thin", fa::fa_sharp_thin);
|
||||
ui->comboBox->addItem("Sharp Duotone Solid", fa::fa_sharp_duotone_solid);
|
||||
ui->comboBox->addItem("Sharp Duotone Regular", fa::fa_sharp_duotone_regular);
|
||||
ui->comboBox->addItem("Sharp Duotone Light", fa::fa_sharp_duotone_light);
|
||||
ui->comboBox->addItem("Sharp Duotone Thin", fa::fa_sharp_duotone_thin);
|
||||
#endif
|
||||
|
||||
// a simple beer button
|
||||
@@ -46,7 +58,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
QVariantMap options;
|
||||
options.insert("color", QColor(Qt::yellow));
|
||||
options.insert("text-off", QString(fa::fa_square));
|
||||
options.insert("text-off", QString(QChar(static_cast<quint16>(fa::fa_square))));
|
||||
options.insert("color-off", QColor(Qt::darkBlue));
|
||||
toggleButton->setIcon( awesome->icon("fa_solid square-check", options));
|
||||
}
|
||||
|
||||
25
README.md
25
README.md
@@ -1,11 +1,12 @@
|
||||
# QtAwesome - Font Awesome for Qt Applications
|
||||
|
||||
QtAwesome is a library to add [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
|
||||
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 - Font Awesome 6](#latest-release---font-awesome-6)
|
||||
- [Latest Release 6.7.2](#latest-release-672)
|
||||
- [Font Awesome 6 Release](#font-awesome-6-release)
|
||||
- [Installation Free Version](#installation-free-version)
|
||||
- [Installation Pro version](#installation-pro-version)
|
||||
- [Basic Usage](#basic-usage)
|
||||
@@ -18,7 +19,13 @@ icons to your [Qt application](http://qt-project.org/).
|
||||
- [Contact](#contact)
|
||||
- [License](#license)
|
||||
|
||||
## Latest Release - Font Awesome 6
|
||||
## Latest Release 6.7.2
|
||||
|
||||
Update of font files to 6.7.2
|
||||
|
||||
[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.)
|
||||
@@ -262,7 +269,7 @@ menuAction->setIcon(awesome->icon(fa::fa_heart).pixmap(32,32));
|
||||
|
||||
Thanks go to the contributors of this project!
|
||||
|
||||
Many thanks go to Dave Gandy an the other Font Awesome contributors!! [http://fortawesome.github.com/Font-Awesome](http://fortawesome.github.com/Font-Awesome)
|
||||
Many thanks go to Dave Gandy an 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.
|
||||
@@ -278,13 +285,13 @@ Contributions are welcome! Feel free to fork and send a pull request through Git
|
||||
- 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)
|
||||
- website: [https://gamecreatures.com](https://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)
|
||||
MIT License. Copyright 2013-2022 - Reliable Bits Software by Blommers IT. [https://blommersit.nl/](https://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"
|
||||
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"
|
||||
|
||||
@@ -42,17 +42,37 @@ class Icons
|
||||
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
|
||||
build_map_free(key, data)
|
||||
else
|
||||
build_map_pro(key, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if data['free'].length == 0
|
||||
@icons_pro[key] = data['unicode']
|
||||
def build_map_free(key, data)
|
||||
if data['free'].first == 'brands'
|
||||
@icons_brands[key] = data['unicode']
|
||||
add_aliasses(@icons_brands, data)
|
||||
else
|
||||
if data['free'].include?('regular')
|
||||
@icons_regular_free[key] = data['unicode']
|
||||
add_aliasses(@icons_regular_free, data)
|
||||
end
|
||||
@icons_common[key] = data['unicode']
|
||||
add_aliasses(@icons_common, data)
|
||||
end
|
||||
end
|
||||
|
||||
def build_map_pro(key, data)
|
||||
@icons_pro[key] = data['unicode']
|
||||
add_aliasses(@icons_pro, data)
|
||||
end
|
||||
|
||||
def add_aliasses(hash, data)
|
||||
data.dig('aliases', 'names')&.each do |alias_key|
|
||||
raise "Duplicatie key found for alias!" if hash.key?(alias_key)
|
||||
|
||||
hash[alias_key] = data['unicode']
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user