[Qt-interest] problems changing application font when stylesheet is set

Carsten Breuer CarstenBreuerQt at textwork.de
Thu Jul 15 23:04:07 CEST 2010


Hi Savesh,
hi all,

> a.setStyleSheet(“**here tree widget and group box is styled**”);
> void MyMainWindow::on_action_Font_triggered()
> {
> QFont font = QFontDialog::getFont(
> ...

You create a font object that is deleted when the function
exits. The font class is so kind to say by by to the MainWindow,
so your app doesn't crash.

Create a QFont member variable in MainWindow and set the font
there or use new to create the QFont class.

BTW:
I find it very convenient to hold the stylesheet stuff
in a file and embed it within the QT resource system.


Best Regards,



Carsten



More information about the Qt-interest-old mailing list