
#include <qapplication.h>
#include <qpushbutton.h>
#include <qpainter.h>
 

/**
	A little custom button
*/
class MyHelloButton : public QPushButton
{
	// This is required to use signals and slots
	Q_OBJECT

public:
	// constructor and destructor
	MyHelloButton( QWidget *parent = 0 ) : QPushButton ( parent ) {}
	virtual ~MyHelloButton() {}

	virtual void drawButtonLabel( QPainter * );
};

void MyHelloButton::drawButtonLabel( QPainter *painter )
{
	QRect r;
	
	r.setX( width() / 4 );
	r.setY( height() / 4 );
	r.setWidth( width() / 2 );
	r.setHeight( height() / 2 );

	painter->drawEllipse( r );
	painter->drawText( r, AlignCenter, text() );
}

 
int main( int argc, char **argv )
{
    QApplication a( argc, argv );
 
    MyHelloButton hello;
    hello.setText( "Hello World" );
 
    a.setMainWidget( &hello );
    QObject::connect( &hello, SIGNAL(clicked()), &a, SLOT(quit()) );

    hello.show();
    return a.exec();
} 

#include"custom.moc"
