Results 1 to 4 of 4

Thread: Cross-platform Windows & Mac: Font size problem

  1. #1

    Default Cross-platform Windows & Mac: Font size problem

    Hello

    I'm developing an application on Windows and Mac.
    The problem is that I have manually set up the font size for some widgets (in the ui designer).
    Under windows, the fonts are perfect, but on osx, they are too big.
    Indeed, the font families are converted (MS Shell Dlg 2 to Lucida Grande), but not the font size, if they have been manually set.

    So I decided to decrease the font size in the code, with some #ifdef, like this for example:
    Qt Code:
    1. #ifdef Q_OS_MAC
    2. QFont font = ui->button->font();
    3. font.setPixelSize(12);
    4. ui->button->setFont(font);
    5. #endif
    To copy to clipboard, switch view to plain text mode 

    It's working but it's a bite annoying when you have a lot of widgets, so I'm open for any other ideas.

    I have also a qtextedit which has this problem, and this solution doesn't works, cause it's the html code which need to be adjusted.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cross-platform Windows & Mac: Font size problem

    Instead of manipulating the font for each widget (be it for windows or mac), you can just set the default application font. Then you'll just have to perform the changes in one place.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: Cross-platform Windows & Mac: Font size problem

    Are you talking about the family font or the size font ?
    Only the adjusted fonts in windows need to be adjusted on osx too.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cross-platform Windows & Mac: Font size problem

    I'm talking about QApplication::setFont().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Font Size Problem on Qt 4.7 on Embedded Linux Platform
    By samueleforconi in forum Qt Programming
    Replies: 0
    Last Post: 21st May 2012, 17:52
  2. Replies: 1
    Last Post: 30th March 2012, 17:46
  3. How to handle cross platform font sizes
    By Berryblue031 in forum Qt Programming
    Replies: 2
    Last Post: 27th June 2011, 15:55
  4. Windows Mobile VGA Screen font size problem
    By LordG in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 25th November 2010, 10:13
  5. Replies: 1
    Last Post: 11th November 2010, 01:31

Tags for this Thread

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.