Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Add custom font for Quick Controls 2 in Android
Forum Updated to NodeBB v4.3 + New Features

Add custom font for Quick Controls 2 in Android

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 4 Posters 2.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Advanced
    wrote on 14 Jan 2017, 10:44 last edited by
    #1

    Dear Guys
    Is it possible to add custom font in Qt Quick Controls 2 Android Application like font face?
    In android it's possible to add custom font
    Thanks

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 14 Jan 2017, 12:45 last edited by
      #2

      @Advanced Add you custom fonts inside resource files and load them as:

      • In QML using FontLoader load and assign them to each QML component's attached property font.family
      • Use QFont and apply it globally by setting it to QGuiApplication.

      157

      1 Reply Last reply
      1
      • L Offline
        L Offline
        Lorenz
        wrote on 2 Mar 2017, 12:12 last edited by
        #3

        If you consider using V-Play, you could also set the font app-wide from QML

         import VPlayApps 1.0
         import QtQuick 2.5
        
         App {
        
           onInitTheme: {
             Theme.normalFont = arialFont
           }
        
           FontLoader {
             id: arialFont
             source: "fonts/Arial.ttf" // loaded from your assets folder
           }
        
           Page {
             AppText {
               text: "I'm in Arial"
             }
           }
         }
        

        Developer @ V-Play Engine - http://v-play.net/qt

        V-Play simplifies

        • Game Development with Qt
        • Mobile App Dev with Qt esp. iOS & Android

        What others say
        V-Play scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jpnurmi
          wrote on 2 Mar 2017, 12:27 last edited by
          #4

          With Qt Quick Controls 2, you can specify a custom font in QML:

          • ApplicationWindow::font
          • Control::font
          • Popup::font

          Qt Quick Controls 2 provides natural inheritance for fonts. Specifying a custom font at window level means that the font propagates to all child controls and popups in the window. And when specifying a custom font for a control/popup, the font propagates to its child controls.

          A 1 Reply Last reply 11 Sept 2017, 18:27
          1
          • J jpnurmi
            2 Mar 2017, 12:27

            With Qt Quick Controls 2, you can specify a custom font in QML:

            • ApplicationWindow::font
            • Control::font
            • Popup::font

            Qt Quick Controls 2 provides natural inheritance for fonts. Specifying a custom font at window level means that the font propagates to all child controls and popups in the window. And when specifying a custom font for a control/popup, the font propagates to its child controls.

            A Offline
            A Offline
            Advanced
            wrote on 11 Sept 2017, 18:27 last edited by
            #5

            @jpnurmi Thanks

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved