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. Unset the font of application
QtWS25 Last Chance

Unset the font of application

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 3.8k 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.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #1

    Hi

    I have a problem with translation process. When translating the application to Persian I changed font to "Tahoma". It should be set to default font when program is translated to English. I'm looking for a way to clear or unset font of application.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Where did you change the font?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • S Offline
        S Offline
        soroush
        wrote on last edited by
        #3

        [quote author="peppe" date="1317052182"]Where did you change the font?[/quote]

        @void MainWindow::translateToPersian()
        {
        this->translateTo("fa");
        qApp->setFont(QFont("Tahoma",10));
        }@

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          What does happen if you pass an empty QFont()?
          Have you considered setting your application-wide font using an stylesheet an QApplication::setStyleSheet()?

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dangelog
            wrote on last edited by
            #5

            Save the font you were using before then set it back.

            [quote]
            What does happen if you pass an empty QFont()?
            [/quote]

            QFont() returns the font set with QApplication::setFont.

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            1 Reply Last reply
            0
            • S Offline
              S Offline
              soroush
              wrote on last edited by
              #6

              [quote author="Lukas Geyer" date="1317058590"]What does happen if you pass an empty QFont()?
              Have you considered setting your application-wide font using an stylesheet an QApplication::setStyleSheet()?[/quote]

              Nothing happens.
              I don't want to deal with fonting things. Just removed Tahoma for Persian interface. But it will be nice if there were some mean for resetting UI fonts :-/

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lgeyer
                wrote on last edited by
                #7

                Using style sheets is no option for you? They can be changed easily.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mlong
                  wrote on last edited by
                  #8

                  You could query the qApplication->font(); at the start of the program, and save the font that is returned originally. Then you can keep it on hand for when you want to revert back to it.

                  Software Engineer
                  My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                  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