[Qt-interest] QFont crashes?
Frank Hemer
frank at hemer.org
Sat Jul 18 14:11:52 CEST 2009
On Saturday 18 July 2009 14:04:04 Anatoly Burakov wrote:
> Hi all.
>
> I am trying to change font in QLineEdit. I get the font from QLineEdit,
> change its height and put it back to QLineEdit like this:
>
> lineEdit = new QLineEdit;
> QFont font = lineEdit->font();
> font.setPointSize(15);
> font.setBold(true);
> lineEdit->setFont(font);
>
>
>
> this piece of code works perfectly.
>
> However, when i try to change the point size with a value from some
> variable - program just exits with code 0:
>
> lineEdit = new QLineEdit;
> int fontSize = 15;
> QFont font = lineEdit->font();
> font.setPointSize(fontSize);
> font.setBold(true);
> lineEdit->setFont(font);
>
> This code doesn't illustrate the need for a variable, but in reality i
> am going to read that variable from an object holding application's
> current settings (that is, change font size at user's preference).
Hmm - have you verified that:
1. The font supports pointSize (in oposite to pixelSize)?
2. Does the font support the fontSize you try to set ...
Frank
More information about the Qt-interest-old
mailing list