Results 1 to 7 of 7

Thread: font size difference in embedded QT

  1. #1
    Join Date
    Jan 2010
    Posts
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default font size difference in embedded QT

    Hi,

    I'm doing a cross platform application. Developing in QT creator on a PC and running in QT embedded.

    The font size in the embedded device is different to that in the PC. I imagine that this is due to the PC rendering a true type font in "points" being 1/72 of an inch on the PC screen and the fonts in the embedded device are in pixel heights.

    How do I make them the same ?. Can I somehow use the QPF fonts in the PC application or ...

    Thanks in advance,
    Peter Lambert

  2. #2
    Join Date
    Jan 2010
    Posts
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: font size difference in embedded QT

    Hi all,

    Rough as it is I got the windows application to match the embedded one by:

    1. Worked out that the ratio between the point size font in the PC and pixel size font in the embedded device is exactly 4:3.
    2. Called "setStyle("motif")" to set the overall style running in the PC to match the embedded device
    3. Then for each widget that has a font do

    QFont font = QFont(widget->font());
    font.setPixelSize((font.pointSize() *4) /3);
    widget->setFont(font);

    The PC application appearance matches perfectly with the embedded on. The view in the Qt Creator GUI editor is still in the windows style but this is of so little significance as to not be worth persuing.

    Cheers,
    Peter

  3. #3

    Default Re: font size difference in embedded QT

    hi,

    Where to call "setStyle("motif")". Please specify.Thanks

    omegas

  4. #4
    Join Date
    Nov 2009
    Posts
    60
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: font size difference in embedded QT

    Hi All,

    I am also facing a similar situation.

    can any one suggest a alternative to above.

    Ratheendran

  5. #5
    Join Date
    Apr 2011
    Posts
    1
    Qt products
    Qt4 Qt/Embedded

    Default Re: font size difference in embedded QT

    Hi all,
    i am facing the same problem while compiling program on X86 machine by adjusting fonts as for normal view but size is changed when running same program on Cross Platform Mini2440(ARM)

    Regards
    Girish

  6. #6
    Join Date
    Oct 2011
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: font size difference in embedded QT

    Thanks for help. I apply this function to MainWindow and it works well:

    Qt Code:
    1. void translateFontSize( QWidget *ui )
    2. {
    3. QObjectList l;
    4. QObject *w;
    5.  
    6. if (!ui)
    7. return;
    8.  
    9. QFont font = QFont(ui->font());
    10. font.setPointSize( (font.pointSize() *4) / 3);
    11. ui->setFont(font);
    12.  
    13. l = ui->children();
    14.  
    15. foreach (w, l) {
    16. QWidget *ww = dynamic_cast<QWidget *>(w);
    17. if (ww) {
    18. translateFonts( ww );
    19. }
    20. }
    21. }
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Apr 2010
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: font size difference in embedded QT

    Dear rvonau,

    I'm interesting in your solution to font resizing in embedded systems. I'd like to test your solution; I've a question about your function: what about "translateFonts"? Could you explain me this? I copy directly your function and, compiling it, TranslateFonts obvioulsy appears to be not declared.
    Could you give an idea about TranslateFonts?
    Thanks
    Paolo

Similar Threads

  1. Replies: 3
    Last Post: 9th April 2013, 15:24
  2. Font problem in Qt embedded 4.4.3 on Arm device
    By rahman.duran in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 16th April 2009, 01:30
  3. adjust font size to QLabel-size
    By hunsrus in forum Qt Programming
    Replies: 0
    Last Post: 9th July 2008, 15:33
  4. embedded font/locale problems
    By GW in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 10th October 2007, 16:42
  5. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 20:16

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.