All Projects → gamecreature → Qtawesome

gamecreature / Qtawesome

Licence: other
QtAwesome - Font Awesome support for Qt applications

Labels

Projects that are alternatives of or similar to Qtawesome

Svgtofont
Read a set of SVG icons and ouput a TTF/EOT/WOFF/WOFF2/SVG font.
Stars: ✭ 149 (-65.35%)
Mutual labels:  font, icons
Font Awesome
The iconic SVG, font, and CSS toolkit
Stars: ✭ 66,937 (+15466.74%)
Mutual labels:  font, icons
Webfont
Awesome generator of webfont
Stars: ✭ 170 (-60.47%)
Mutual labels:  font, icons
Coreui Icons
CoreUI Free Icons - Premium designed free icon set with marks in SVG, Webfont and raster formats
Stars: ✭ 1,813 (+321.63%)
Mutual labels:  font, icons
GoogleMD-Icons
Google Material Design Icons Library
Stars: ✭ 14 (-96.74%)
Mutual labels:  font, icons
Yii2 Fontawesome
Asset Bundle for Yii2 with Font Awesome http://fortawesome.github.io/Font-Awesome/
Stars: ✭ 149 (-65.35%)
Mutual labels:  font, icons
Svelte Awesome
Awesome SVG icon component for Svelte JS, built with Font Awesome icons. Based on Justineo/vue-awesome
Stars: ✭ 193 (-55.12%)
Mutual labels:  font, icons
Govicons
🇺🇸 US Government themed icons and CSS toolkit
Stars: ✭ 60 (-86.05%)
Mutual labels:  font, icons
microns
The universal icon set for user interfaces.
Stars: ✭ 58 (-86.51%)
Mutual labels:  font, icons
rofi-fontawesome
fontawesome icon list for rofi dmenu
Stars: ✭ 58 (-86.51%)
Mutual labels:  font, icons
Awesome Stock Resources
🌇 A collection of links for free stock photography, video and Illustration websites
Stars: ✭ 10,162 (+2263.26%)
Mutual labels:  font, icons
Keyrune
Magic: the Gathering set symbol pictographic font
Stars: ✭ 272 (-36.74%)
Mutual labels:  font, icons
Font Awesome Stylus
Stylus port for font-awesome 4.7.0
Stars: ✭ 77 (-82.09%)
Mutual labels:  font, icons
Simple Line Icons
Simple and Minimal Line Icons
Stars: ✭ 1,815 (+322.09%)
Mutual labels:  font, icons
Linearicons
Linearicons is the highest quality set of line icons, matching with minimalist UI designs in iOS.
Stars: ✭ 64 (-85.12%)
Mutual labels:  font, icons
Micon
Micon, The iconic windows 10 font and CSS toolkit.
Stars: ✭ 182 (-57.67%)
Mutual labels:  font, icons
Font Awesome Php
A PHP library for Font Awesome 4.7.
Stars: ✭ 47 (-89.07%)
Mutual labels:  font, icons
Swifticonfont
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon)
Stars: ✭ 1,094 (+154.42%)
Mutual labels:  font, icons
cryptofont
Cryptocurrency icon webfont and SVG
Stars: ✭ 149 (-65.35%)
Mutual labels:  font, icons
tasarimcilar-ve-yazilimcilar-icin-kaynak-arsivim
Tasarım ve yazılım ile ilgili 2017 yılından günümüze kadar geçen zamanda toplamış olduğum arşivimi sizle ile paylaşıyorum. Ne mi var her şey...
Stars: ✭ 276 (-35.81%)
Mutual labels:  font, icons

QtAwesome - Font Awesome support for Qt applications

Description

QtAwesome is a simple library that can be used to add Font Awesome icons to your Qt application.

NOTE: Though the name is QtAwesome and currently it's very Font Awesome based, you can use every other icon/glyph font you want.

The class can also be used to manage your own dynamic code-drawn icons, by adding named icon-painters.

Updated to FontAwesome 4.7.0

This library has been updated to Font Awesome version 4.7.0.

  • 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.
  • You can find the previous FontAwesome 3 library in the fontawesome-3 branch.

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

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.

Example

// 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) );

Example custom painter

This example registers a custom painter for supporting a duplicate icon (it draws 2 "plus marks"):

class DuplicateIconPainter : public QtAwesomeIconPainter
{
public:
    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 offset = rectIn.height() / 4;
        QChar chr = QChar( static_cast<int>(fa::plus) );

        painter->setFont( 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 ) );

    }
};

awesome->give("duplicate", new DuplicateIconPainter() );

Default options:

The following options are default in the QtAwesome class.

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 );

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:

  options.insert("text-selected", QString( fa::lock ) );

Color and text options have the following structure: keyname-iconmode-iconstate

Where iconmode normal is empty And iconstate On is off.

So the list of items used is:

  • color
  • color-disabled
  • color-active
  • color-selected
  • color-off
  • color-disabled-off
  • color-active-off
  • color-selected-off
  • text
  • text-disabled
  • text-active
  • text-selected
  • text-off
  • text-disabled-off
  • text-active-off
  • text-selected-off

License

MIT License. Copyright 2013 - Reliable Bits Software by Blommers IT. http://blommersit.nl/

The Font Awesome font is licensed under the SIL Open Font License - 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/ "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome"

Contact

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:

QAction* menuAction = new QAction("test");
menuAction->setIcon( awesome->icon(fa::beer).pixmap(32,32) );

Remarks

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 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 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].