新建一个Qt的窗口类,默认命名:
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
QPixmap paintWidget();
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
protected slots:
void timerTimeOut();
private:
Ui::Widget *ui;
QTimer *timer;
QPoint point;
int i_diameter=0;
double d_angle=0;
QList<QPixmap> list_pixmap;
};
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
this->setStyleSheet("background-color:black");//设置窗口背景色为黑色
timer = new QTimer();
connect(timer,SIGNAL(timeout()),this,SLOT(timerTimeOut()));
timer->start(10);
}