Results 1 to 2 of 2

Thread: Disable text size auto-scaling

  1. #1
    Join Date
    Apr 2019
    Posts
    3
    Qt products
    Qt5

    Default Disable text size auto-scaling

    Hello,

    I have Qt Widget application and on some computers the text size is scaled automatically and it looks awful (not same, some labels too large, some labels too small). How can I disable it?
    testscaling.jpg

    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Disable text size auto-scaling

    If the OS is Windows 7 or 10 and the user has turned on text scaling in the Display settings, there probably isn't much you can do about it. This will affect all text, everywhere, though.

    In the case of the text you have selected in the table, if your model's flags for this item allow editing, this font is probably instantiated by the QLineEdit delegate that is created when the cell is open for editing. For this, you can implement handling for the Qt:: FontRole in your model's data() method to return an appropriate font. The default font looks like it scales so as much of the cell text as possible can fit into the edit widget. If you don't want this, you can return the QFont of the table itself.

    If you want a uniform font for everything in the widget you have posted, then you can set a QFont for that widget. All children of the QWidget will inherit that font. I usually this in Qt Designer when I lay out a composite widget. If you want all widgets in the app to inherit the same font, you can set the font at the app level (QCoreApplication::setFont()) before any widgets are created.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 8
    Last Post: 22nd March 2016, 05:39
  2. Auto-scaling not enabled
    By kulsekarr in forum Qwt
    Replies: 1
    Last Post: 5th June 2014, 09:38
  3. Plot auto-scaling
    By ccbaci in forum Qwt
    Replies: 3
    Last Post: 14th September 2013, 11:59
  4. Y axis not auto scaling
    By pkj in forum Qwt
    Replies: 0
    Last Post: 12th May 2011, 17:05
  5. QLabel - auto font scaling possible?
    By Byngl in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2007, 17:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.