[Qt-interest] QFont crashes?

Anatoly Burakov burakov.anatoly at googlemail.com
Sat Jul 18 14:04:04 CEST 2009


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).

I would be grateful for any help. Using the latest QT and QtCreator
(1.2.1 and 2009.03).

Regards,
Anatoly



More information about the Qt-interest-old mailing list