[Interest] Drawing push button

Igor Mironchik igor.mironchik at gmail.com
Thu Sep 24 10:23:51 CEST 2015


Hi,

After some research I found that font draws correct on my button if I 
don't set any graphics effects on it...

But if I set:

QGraphicsDropShadowEffect *eff = new QGraphicsDropShadowEffect();
eff->setBlurRadius(20);
eff->setColor(QColor(100, 100, 100, 200));
eff->setOffset(0,0);

setGraphicsEffect(eff);

Then font draws ugly...

9/24/2015 10:49 AM, Igor Mironchik пишет:
> Hi,
>
> in my app on iOS fonts looks correct enstead of on QMenuBar and on my 
> custom button. I wrote about problem with QMenuBar before (look at my 
> previous letter).
>
> But now I want to ask about QStylePainter. My custom button class uses 
> following drawing code:
>
> QStylePainter p(this);
> QStyleOptionButton opt;
>
> opt.initFrom(this);
>
> if (isFlat())
>     opt.features |= QStyleOptionButton::Flat;
>
> opt.text = text();
>
> p.drawControl(QStyle::CE_PushButton, opt);
>
> But font looks as ugly as on QMenuBar. How to fix it? Thank you.




More information about the Interest mailing list