View Full Version : Subclassing qbutton class
jingbo
5th October 2006, 19:56
I need to implement a custom button widget class which subclasses qbutton class.
I think that I need to reimplement drawButton method in qbutton class. Can someone tell me how to reimplement drawButton menthod in order to draw a real button on screen?
Thanks,
Jing Bo
wysota
5th October 2006, 20:07
Which Qt version do you use? Which button class do you mean? What do you mean by "real button"? In general you need to subclass and reimplement the paintEvent.
jingbo
5th October 2006, 20:31
I use Qt 3.3.6.
My custom class is like this:
class KIconButton : public QButton
QButton class is an abstract base class, which doesn't draw a button in Qt designer.
So I have to reimplement drawButton method.
The question is What I need to do in drawButton mentod in order for my KIconButton class to be able to draw button in Qt designer.
wysota
5th October 2006, 21:15
Well... you should..... draw your button :) Use the QPainter parameter as the painter - use its methods to draw on it.If you have doubts, maybe you should look at the sourcecode of QPushButton.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.