Hi, I am a real beginnner in qt and I have trouble creating a simple qt widget.
#include <QtGui/QWidget>
#ifndef simple_MYWIDGET_H
#define simple_MYWIDGET_H
//namespace simple
/************************************************** ***************************
** Interface [MainWindow]
************************************************** ***************************/
/**
* @brief Qt central, all operations relating to the view part here.
*/
class MyWidget : public QWidget
{
public:
MyWidget(QWidget *parent = 0);
~MyWidget();
public slots:
protected:
void paintEvent(QPaintEvent *event);
private:
};
#endif
#include "../include/simple/mywidget.h"
#include <qpainter.h>
MyWidget::MyWidget( QWidget *parent )
{
}
MyWidget::~MyWidget()
{
}
void MyWidget:aintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, 12, Qt:ashDotLine, Qt::RoundCap));
painter.setBrush(QBrush(Qt::green, Qt::SolidPattern));
painter.drawEllipse(80, 80, 400, 240);
}
When I run my qt4 designer all i see is a blank screen even though I have promoted my qwidget.
Screenshot from 2013-09-17 10:19:29.jpg
Bookmarks