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. how to make text size auto scale with size of window as window size changes
Forum Updated to NodeBB v4.3 + New Features

how to make text size auto scale with size of window as window size changes

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 594 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.
  • C Offline
    C Offline
    Citabria
    wrote on last edited by
    #1

    Hi, I had seen a YouTube video in which I think only layouts were used and then the text inside of widgets changed sizes as the widgets changed sizes. But now I can't find it and everything I have read since says there is no automatic way to do this and so code is needed to manually change font sizes. Is there a way to scale fonts automatically ? If not, my new question is this. Is there a way to change the font of 25 buttons with one line of code as in something like Button 1-20 font size = X, or do I need to do it with 20 lines of code ?

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

      Hi,

      One way to do it is to create a custom QPushButton and reimplement its resizeEvent. In there you can calculate the size you want for your font and apply it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • C Offline
        C Offline
        Citabria
        wrote on last edited by
        #3

        Thank you

        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