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
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
Re: font size difference in embedded QT
hi,
Where to call "setStyle("motif")". Please specify.Thanks
omegas
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
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
Re: font size difference in embedded QT
Thanks for help. I apply this function to MainWindow and it works well:
Code:
void translateFontSize
( QWidget *ui
) {
QObjectList l;
if (!ui)
return;
font.setPointSize( (font.pointSize() *4) / 3);
ui->setFont(font);
l = ui->children();
foreach (w, l) {
QWidget *ww
= dynamic_cast<QWidget
*>
(w
);
if (ww) {
translateFonts( ww );
}
}
}
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