PDA

View Full Version : CE_PushButton



panduro
18th June 2008, 14:42
Hi

I’m using “drawControl” case “CE_PushButton:” to draw a button and now I want to show the button text and align it to the right, but I can’t…

I hope somebody can help me, thanks




case CE_PushButton:
... some code ...
painter->setRenderHint(QPainter::Antialiasing, true);
if(option->state & State_HasFocus)
painter->setPen(QPen(QColor::QColor(204,255,0),1,Qt::SolidL ine, Qt::RoundCap));
else
painter->setPen(Qt::NoPen);
painter->setBrush(gradient);
painter->drawRoundRect(roundRect, cx, cy);

break;

jpn
18th June 2008, 14:56
There are a few overloads of QPainter::drawText(). Some of them support alignment flags. The button text is passed within QStyleOptionButton.

panduro
19th June 2008, 09:41
Thanks.

Just what I needed.