Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Set custom font on Windows 10 PC working but on Androird 10 not. Qt 6.4.2 C++
Forum Updated to NodeBB v4.3 + New Features

Set custom font on Windows 10 PC working but on Androird 10 not. Qt 6.4.2 C++

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 221 Views 1 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.
  • KaguroK Offline
    KaguroK Offline
    Kaguro
    wrote on last edited by Kaguro
    #1

    Hi Guys!
    I have an app and I set this custom font in this way:

    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        LoginWindow l;
    
        QFile styleFile( ":/QSS/default.qss" );
        styleFile.open( QFile::ReadOnly );
        a.setStyleSheet( styleFile.readAll() );
        
        l.show();
        //here is the setting the custom font
        QFontDatabase::addApplicationFont(":/RES/FantaisieArtistique.ttf");
        qApp->setFont(QFont("FantaisieArtistique", 11, QFont::Normal, false));
    
        return a.exec();
    }
    

    And in windows PC build its correct (the ttf file is in the qrc file and i did not install this font):
    2024-08-02_22h57_07.png
    But on android 10:
    451108104_2154699591578090_8654373426094426824_n.jpg
    Thanks for your help!

    1 Reply Last reply
    0
    • KaguroK Offline
      KaguroK Offline
      Kaguro
      wrote on last edited by
      #3

      I realized that I was careless, the qrc file didn't have the font in it normally (it was already installed on the PC). Its working now, i was so lame, sorry :D

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        Have you tried with a different Qt version? Maybe it's simply a bug.

        (Z(:^

        1 Reply Last reply
        0
        • KaguroK Offline
          KaguroK Offline
          Kaguro
          wrote on last edited by
          #3

          I realized that I was careless, the qrc file didn't have the font in it normally (it was already installed on the PC). Its working now, i was so lame, sorry :D

          1 Reply Last reply
          0
          • KaguroK Kaguro has marked this topic as solved on
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #4

            No problem at all, this kind of thing happens to all of us :-)

            (Z(:^

            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