Code Monkey home page Code Monkey logo

font-awesome-qml's Introduction

font-awesome-qml

font-awesome-qml provides the Font Awesome web fonts to Qt Quick/QML engine.

How to use

  1. Add the file FontAwesome.qml and controls folder to your project.

  2. If necessary import FontAwesome types

import "controls" as Awesome
  1. Using Font Awesome:
// main.qml

import "controls" as Awesome

Window {

  FontAwesome {
    id: awesome
    // resource: "qrc:///resource/fontawesome-webfont.ttf"
    resource: "http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/fonts/fontawesome-webfont.ttf"
  }

  Text {
      id: text
      font.pointSize: 180
      font.family: awesome.family
      text: awesome.loaded ? awesome.icons.fa_money : ""
  }

  Awesome.Text {
    icon: awesome.icons.fa_money
    text: "fa_money"
  }

  Awesome.Button {
    icon: awesome.icons.fa_money
    text: "fa_money"
  }
}

Avaliable Properties

// Alias to acess individual font-awesome variables (icons)
property alias icons:

// Property to chech if the Font Loader it is ready, if it is using the remote
// font-awesome CDN it is necessary to check and wait for to be true.
property alias loaded: false

// Set font-awesome Font Loader source
property alias resource

// Return font family name
readonly property string family: "FontAwesome"

Considerations

I needed to replace the "-" character, from Font Awesome icons name, to "_", because QML/JS doesn't accept minus character at variables name.

You can see all availables icons at controls/Variables.qml file.

Versions Tested

Qt Version   : 5.9
Font Awesome : 4.7.0

Screenshot

screenshot

Thanks

Font Awesome - The iconic font and CSS toolkit.

Qt Project - True cross-platform framework.

"Using Fonts Awesome in QML" by markg85.

Credits

Created by Ricardo do Valle.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

font-awesome-qml's People

Contributors

ricardodovalle avatar li3p avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.