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. can I change default fontsize?
Forum Updated to NodeBB v4.3 + New Features

can I change default fontsize?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 361 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.
  • D Offline
    D Offline
    django.Reinhard
    wrote on last edited by django.Reinhard
    #1

    Hi,

    I'm using Qt6.2 (binary edition) on debian 11.

    The window with the black titlebar is my app created with Qt. Afaik kde is built with Qt too, so I expect the default styles follow KDE-styles in use.

    But thats not the case:
    Qt6.2_Fontsizes_03.png

    Red boxes 1 and 2 show default font of kde windows.
    Green boxes 3 and 4 show default gnome fonts on kde. Ok, I admit, that gnome is not well supported in kde systems ...
    But imho Qt should follow kde rules ...

    Even more strange is blue box 5 - that's an editor build following the sample qt code from editor with line numbers. I changed the font of QPlainTextEdit (the source view). That changed font is not respected by the QPainter build on every call of paintLineNumbers.

    I had to add a line like:

    painter.setFont(font());
    

    to get the line numbers of same size as displayed code.

    I had to increase the font sizes by 4 points to get same visual impression than compiled with Qt5.15 ...

    Is there a way to change default fontsize once (at application startup or so)?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Yes
      you can set on Application

      QApplication a(argc, argv);
      a.setFont(QFont("Arial",25));
      

      But you cant have stylesheets that set fonts also as then it wont override.

      1 Reply Last reply
      2
      • D Offline
        D Offline
        django.Reinhard
        wrote on last edited by
        #3

        Hi,

        thank you very much for the hint! Works great!

        TweakedFonts05.png
        The elements where I manually change font continue to work as before.
        ... and the elements, I don't want to use bother with font size use the new application font. Great!

        Thanks again - that's exactly what I was looking for :)

        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