diff --git a/QtAwesome/QtAwesome.cpp b/QtAwesome/QtAwesome.cpp index 84064e0..49a95e4 100644 --- a/QtAwesome/QtAwesome.cpp +++ b/QtAwesome/QtAwesome.cpp @@ -191,7 +191,7 @@ bool QtAwesome::initFontAwesome( ) } // intialize the map - QHash& m = namedCodepoints_; + QHash& m = namedCodepoints_; m.insert("adjust", fa::adjust); m.insert("adn", fa::adn); m.insert("aligncenter", fa::aligncenter); @@ -790,7 +790,7 @@ bool QtAwesome::initFontAwesome( ) return true; } -void QtAwesome::addNamedCodepoint( const QString& name, fa codePoint) +void QtAwesome::addNamedCodepoint( const QString& name, int codePoint) { namedCodepoints_.insert( name, codePoint); } @@ -829,7 +829,7 @@ static QVariantMap mergeOptions( const QVariantMap& defaults, const QVariantMap& /// /// awesome->icon( icon_group ) /// -QIcon QtAwesome::icon(fa character, const QVariantMap &options) +QIcon QtAwesome::icon(int character, const QVariantMap &options) { // create a merged QVariantMap to have default options and icon-specific options QVariantMap optionMap = mergeOptions( defaultOptions_, options ); diff --git a/QtAwesome/QtAwesome.h b/QtAwesome/QtAwesome.h index 4c4c399..c5f4021 100644 --- a/QtAwesome/QtAwesome.h +++ b/QtAwesome/QtAwesome.h @@ -19,7 +19,8 @@ /// 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 -enum class fa { +namespace fa { + enum icon { adjust = 0xf042, adn = 0xf170, aligncenter = 0xf037, @@ -613,7 +614,9 @@ enum class fa { youtube = 0xf167, youtubeplay = 0xf16a, youtubesquare = 0xf166 -}; + }; +} + //--------------------------------------------------------------------------------------- @@ -634,13 +637,13 @@ public: void init( const QString& fontname ); bool initFontAwesome(); - void addNamedCodepoint( const QString& name, fa codePoint ); - QHash namedCodePoints() { return namedCodepoints_; } + void addNamedCodepoint( const QString& name, int codePoint ); + QHash namedCodePoints() { return namedCodepoints_; } void setDefaultOption( const QString& name, const QVariant& value ); QVariant defaultOption( const QString& name ); - QIcon icon( fa character, const QVariantMap& options = QVariantMap() ); + 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() ); @@ -653,7 +656,7 @@ public: private: QString fontName_; ///< The font name used for this map - QHash namedCodepoints_; ///< A map with names mapped to code-points + QHash namedCodepoints_; ///< A map with names mapped to code-points QHash painterMap_; ///< A map of custom painters QVariantMap defaultOptions_; ///< The default icon options diff --git a/QtAwesome/QtAwesome.pro.user.3.2-pre1 b/QtAwesome/QtAwesome.pro.user.3.2-pre1 deleted file mode 100644 index da1058e..0000000 --- a/QtAwesome/QtAwesome.pro.user.3.2-pre1 +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - false - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - false - false - 1 - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.3 clang 64bit - Desktop Qt 5.3 clang 64bit - qt.53.clang_64_kit - 0 - 0 - 0 - - /Users/rick/bit/github/qtawesome/build-QtAwesome-Desktop_Qt_5_3_clang_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/rick/bit/github/qtawesome/build-QtAwesome-Desktop_Qt_5_3_clang_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 2 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - /opt/local/bin/valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - - - false - %{buildDir} - Custom Executable - - ProjectExplorer.CustomExecutableRunConfiguration - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.EnvironmentId - {a846ca6b-770e-4f80-9331-daae2d8c60b6} - - - ProjectExplorer.Project.Updater.FileVersion - 15 - - diff --git a/QtAwesomeSample/QtAwesomeSample.pro b/QtAwesomeSample/QtAwesomeSample.pro index 383dcf3..3f9082a 100644 --- a/QtAwesomeSample/QtAwesomeSample.pro +++ b/QtAwesomeSample/QtAwesomeSample.pro @@ -10,7 +10,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = QtAwesomeSample TEMPLATE = app -CONFIG += c++11 SOURCES += main.cpp diff --git a/README.md b/README.md index 2a6b7d4..56eaf12 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,24 @@ NOTE: Though the name is QtAwesome and currently it's very Font Awesome based, y The class can also be used to manage your own dynamic code-drawn icons, by adding named icon-painters. -Updated to FontAwesome 4 and c++11 ----------------------------------- +Updated to FontAwesome 4 +------------------------ -This library has been updated to Font Awesome version 4 and now -requires c++11 specific features. +This library has been updated to Font Awesome version 4. The current Font Awesome version is **4.3.0**. -You can find the previous FontAwesome 3 library in the [fontawesome-3 branch](https://github.com/gamecreature/QtAwesome/tree/fontawesome-3). -This branch is c++11 free! +* 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). + + +**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. Simpeler is better. + + Installation