Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How do I change the font family in Qt android app
Forum Updated to NodeBB v4.3 + New Features

How do I change the font family in Qt android app

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 1.3k Views
  • 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.
  • VineelaV Offline
    VineelaV Offline
    Vineela
    wrote on last edited by
    #1

    When I work in code yes it does changes but when i run the app it comes to the default same font, how how can i change in app too!

    J.HilkJ 1 Reply Last reply
    0
    • VineelaV Vineela

      When I work in code yes it does changes but when i run the app it comes to the default same font, how how can i change in app too!

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Vineela

      QGuiApplication has a QGuiApplication::setFont(const QFont &font) to change the default font of your application. You can call it inside your main.cpp to set the font-family to what you want.

      However you should select a font-family that is guaranteed to be part of the andoidOS or you'll have to ship your own font with the application.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      VineelaV 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @Vineela

        QGuiApplication has a QGuiApplication::setFont(const QFont &font) to change the default font of your application. You can call it inside your main.cpp to set the font-family to what you want.

        However you should select a font-family that is guaranteed to be part of the andoidOS or you'll have to ship your own font with the application.

        VineelaV Offline
        VineelaV Offline
        Vineela
        wrote on last edited by
        #3

        @J.Hilk Nope it didn't work what if i wanted to change one of my particular heading of one page the font doesn't change .

        J.HilkJ 1 Reply Last reply
        0
        • VineelaV Vineela

          @J.Hilk Nope it didn't work what if i wanted to change one of my particular heading of one page the font doesn't change .

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @Vineela
          keep in mind, that, when you change the font of your items, via StyleSheet, QGuiApplication::setFont(const QFont &font) will have no effect on this items.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          VineelaV 1 Reply Last reply
          0
          • J.HilkJ J.Hilk

            @Vineela
            keep in mind, that, when you change the font of your items, via StyleSheet, QGuiApplication::setFont(const QFont &font) will have no effect on this items.

            VineelaV Offline
            VineelaV Offline
            Vineela
            wrote on last edited by Vineela
            #5

            @J.Hilk So if i wont give via StyleSheet will this QGuiApplication::setFont(const QFont &font) be effective?

            J.HilkJ 1 Reply Last reply
            0
            • VineelaV Vineela

              @J.Hilk So if i wont give via StyleSheet will this QGuiApplication::setFont(const QFont &font) be effective?

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by J.Hilk
              #6

              @Vineela as far as I know, yes.

              if you set the font somewhere from your quellcode, via StyleSheet or object->setFont(), then the default font won't have any effect on that object.


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              1

              • Login

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