Results 1 to 5 of 5

Thread: Restrict Win display text size appearance?

  1. #1
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Restrict Win display text size appearance?

    Hi,

    In Windows 7 (and others) you can set the display text size appearance to Smaller(default), Medium and Larger.

    I've written my application to suit Smaller appearance. If a user changes to Larger appearance, most buttons, checkboxes etc text don't fit.

    Is there a way to make the text fit the same for all display text size appearances?

    I have tried collecting the following for larger and smaller:

    Qt Code:
    1. spinbox1->setValue( QApplication::font().pointSize() ); // result was 8 for Smaller and Larger.
    2. spinbox2->setValue( QApplication::font().pixelSize() ); // result was -1 for Smaller and Larger.
    To copy to clipboard, switch view to plain text mode 

    Both gave the same results

    Thanks in advance
    Brendan

  2. #2
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Restrict Win display text size appearance?

    You can use the setFont method of QApplication in main function.

    Qt Code:
    1. set your own font
    2. // QApplication::setFont(const QFont & font, const char * className = 0);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Restrict Win display text size appearance?

    Unfortunately that didn't work for me.

    This is what I tried:
    Qt Code:
    1. QFont newFont("MS Shell Dlg 2", 10, QFont::Normal, false);
    2. QApplication::setFont(newFont);
    To copy to clipboard, switch view to plain text mode 

    Ok for smaller, text too big in larger mode.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Restrict Win display text size appearance?

    The Qt layout system should be adjusting to suit. If you have fixed the size of UI elements (or are not using the layout system) then there is nothing the Qt layout system can do to accommodate the increased size. Can you show a small, self-contained example code and the on-screen result?

  5. #5
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Restrict Win display text size appearance?

    Thanks,

    I do remember the form size and position, so thats probably the problem then.

    I wonder if there is a simple way of knowing which mode is selected?

    The only thing I can think is checking the text width.

Similar Threads

  1. change text size and window size - qmessagebox
    By smemamian in forum Newbie
    Replies: 3
    Last Post: 4th July 2013, 08:38
  2. How to display text from a file to a text browser
    By ironmantis7x in forum Newbie
    Replies: 11
    Last Post: 14th June 2012, 16:23
  3. Replies: 3
    Last Post: 29th December 2008, 17:54
  4. Restrict size of QLineEdit
    By bruccutler in forum Newbie
    Replies: 2
    Last Post: 19th March 2007, 17:31
  5. Replies: 1
    Last Post: 24th October 2006, 17:40

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.