Qt-interest Archive, December 2006
custom QPushButton painting
Message 1 in thread
I'm curious if anyone here has devled into customizing QPushButton
painting? I'm interested in a native looking push button, and thus I'm
still interested in using Qt's style engine to paint the button, but
I'dlike to customize hte text displayed. Specially, instead of drawing
"Some Text ->" I'd like to paint the arrow nicely perhaps using
painter pathes and anti aliasing. Unfortunately overloading
QPushButton's paintEvent like so results in nothing showing up on the
screen...
void RightArrowButton::paintEvent(QPaintEvent* e)
{
QStylePainter painter(this);
QStyleOptionButton option;
option.initFrom(this);
p.drawControl(QStyle::CE_PushButton, option );
p.end();
}
Calling the base class version of paintEvent gets button to show up
again but I get the text dispalyed for me so I'm back to square one.
Anyone know what I'm doing wrong? Ultimatley I was hoping to pass
QStyle::CE_PushButtonBevel to drwControl to just the button itself was
painted, then I'd paint the text and a nice right arrow icon myself.
-Will
--
[ signature omitted ]