Qt-interest Archive, December 2007
font size of my application
Message 1 in thread
Hello,
I have some questions in regards to font sizes in Qt.
a)
It looks like that Qt uses 9pt fonts as default. In Qt Designer everything
is 9pt and when I create for example a message box it is in 9pt as well. Is
there a way to change it to some other default?
b)
The default of 9pt is rather small, that is of course subject to the user.
Shall I leave the font size in general to 9pt and leave it to the user to
change it on OS level?
c)
I create a QMessageBox like this:
if ((lineEditName -> text()).isEmpty()){
QMessageBox::information(this, tr("No Name specified"),tr("The name field
is compulsory."));
return;
}
How can I change the text size here? I have seen that QMessageBox has a
method setFont. But then I need to create a QMessageBox via "new" to have a
pointer to it. That would make the code "much longer". Is there any more
elegant way?
d)
I've changed on my OS the font size. I'm using Suse Linux and did it in the
KDE control center. All applications changed their font size, e.g. in the
menu bar. Mine didn't.... Anyone an idea where I can learn what to do that
my application obeys the OS setting?
Thanks!
--
[ signature omitted ]
Message 2 in thread
Hi,
> a)
> It looks like that Qt uses 9pt fonts as default. In Qt Designer everything
> is 9pt and when I create for example a message box it is in 9pt as well. Is
> there a way to change it to some other default?
You may hardcode font size into your application, but I wouldn't recommend that:
QApplication::setFont()
http://doc.trolltech.com/4.3/qapplication.html#setFont
It's also possible to change the default font size of existing Qt applications
using the qtconfig utility:
http://doc.trolltech.com/4.3/qtconfig.html
How does you Qt application compare to other applications on your platform? Is
the font size different? Which exact OS and version of Qt are you using?
> b)
> The default of 9pt is rather small, that is of course subject to the user.
> Shall I leave the font size in general to 9pt and leave it to the user to
> change it on OS level?
Yes, let the user chose preferred font sizes.
--
[ signature omitted ]
Message 3 in thread
> How does you Qt application compare to other applications on your
> platform? Is the font size different? Which exact OS and version of Qt are
> you using?
>
See part d).: KDE on Suse Linux, other change their font size, mine doesn't.
Thanks!
--
[ signature omitted ]