PDA

View Full Version : Font



sonuani
23rd April 2008, 12:24
hi,
I have a exe in which there is a button.If i click on that button then stylesheet should be applied to the same exe.
Everything is working fine.But the exe's font size alone changes .I want the font size whatever i have assigned for that module(exe) to be constant.How to do that?
Thanx

sonuani
23rd April 2008, 12:52
After i applied stylesheet the font size changed.In the trolltect doc --They have given like this
Warning: If the value of the Qt property changes after the style sheet has been set, it might be necessary to force a style sheet recomputation. One way to achieve this is to unset the style sheet and set it again.

but how to unset the stylesheet and set it?
Plz help.

momesana
23rd April 2008, 14:21
I guess something like


qApp->setStyleSheet(QString());
qApp->setStyleSheet(myStyleSheet); // myStyleSheet stands for your custom stylesheet stringwould do it. I assume Qt will compare the passed string to it's current stylesheet string and drop out of the function if they are identical in order to avoid unneccesary stylesheet recalculations, so passing any string that is different from your current style would do it. Yet I think, this is not what you are looking for.What the qt documentation refers to is changing properties that influence the style after the stylesheet has already been applied. This means, Qt respects certain properties when it "calculates the look" whenever you call setStyleSheet. If you change the properties later Qt will not automatically recalculate those. I don't think that is the case for you.

sonuani
24th April 2008, 05:44
My problem is "Even after applying stylesheet whatever font i have set for the application shouldnt change."

mchara
24th April 2008, 06:39
hi, maybe you simply shouldn't have font entries in your styleSheet?

sonuani
24th April 2008, 08:18
i dont have any such entry.But still the font size is changing.
Plz help.