|
OpenHantek
|
#include <QtAwesome.h>
Public Member Functions | |
| QtAwesome (QObject *parent=nullptr) | |
| The default icon colors. More... | |
| virtual | ~QtAwesome () |
| void | init (const QString &fontname) |
| initializes the QtAwesome icon factory with the given fontname More... | |
| bool | initFontAwesome () |
| void | addNamedCodepoint (const QString &name, int codePoint) |
| QHash< QString, int > | namedCodePoints () |
| void | setDefaultOption (const QString &name, const QVariant &value) |
| Sets a default option. These options are passed on to the icon painters. More... | |
| QVariant | defaultOption (const QString &name) |
| Returns the default option for the given name. More... | |
| 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()) |
| void | give (const QString &name, QtAwesomeIconPainter *painter) |
| QFont | font (int size) |
| QString | fontName () |
| Returns the font-name that is used as icon-map. More... | |
Private Attributes | |
| QString | fontName_ |
| The font name used for this map. More... | |
| QHash< QString, int > | namedCodepoints_ |
| A map with names mapped to code-points. More... | |
| QHash< QString, QtAwesomeIconPainter * > | painterMap_ |
| A map of custom painters. More... | |
| QVariantMap | defaultOptions_ |
| The default icon options. More... | |
| QtAwesomeIconPainter * | fontIconPainter_ |
| A special painter fo painting codepoints. More... | |
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
|
explicit |
The default icon colors.
|
virtual |
| void QtAwesome::addNamedCodepoint | ( | const QString & | name, |
| int | codePoint | ||
| ) |
| QVariant QtAwesome::defaultOption | ( | const QString & | name | ) |
Returns the default option for the given name.
| QFont QtAwesome::font | ( | int | size | ) |
Creates/Gets the icon font with a given size in pixels. This can be usefull to use a label for displaying icons Example:
QLabel* label = new QLabel( QChar( icon_group ) ); label->setFont( awesome->font(16) )
|
inline |
Returns the font-name that is used as icon-map.
| void QtAwesome::give | ( | const QString & | name, |
| QtAwesomeIconPainter * | painter | ||
| ) |
| QIcon QtAwesome::icon | ( | int | character, |
| const QVariantMap & | options = QVariantMap() |
||
| ) |
Creates an icon with the given code-point awesome->icon( icon_group )
| QIcon QtAwesome::icon | ( | const QString & | name, |
| const QVariantMap & | options = QVariantMap() |
||
| ) |
Creates an icon with the given name
You can use the icon names as defined on http://fortawesome.github.io/Font-Awesome/design.html withour the 'icon-' prefix
| name | the name of the icon |
| options | extra option to pass to the icon renderer |
| QIcon QtAwesome::icon | ( | QtAwesomeIconPainter * | painter, |
| const QVariantMap & | optionMap = QVariantMap() |
||
| ) |
Create a dynamic icon by simlpy supplying a painter object The ownership of the painter is NOT transfered.
| painter | a dynamic painter that is going to paint the icon |
| optionmap | the options to pass to the painter |
| void QtAwesome::init | ( | const QString & | fontname | ) |
initializes the QtAwesome icon factory with the given fontname
| bool QtAwesome::initFontAwesome | ( | ) |
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 To initialize QtAwesome with font-awesome you need to call this method
|
inline |
| void QtAwesome::setDefaultOption | ( | const QString & | name, |
| const QVariant & | value | ||
| ) |
Sets a default option. These options are passed on to the icon painters.
|
private |
The default icon options.
|
private |
A special painter fo painting codepoints.
|
private |
The font name used for this map.
|
private |
A map with names mapped to code-points.
|
private |
A map of custom painters.