-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindow2.cpp
More file actions
46 lines (32 loc) · 849 Bytes
/
window2.cpp
File metadata and controls
46 lines (32 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "mywindow.h"
#include "mybutton.h"
#include "window2.h"
#include <QPixmap>
#include <QPainter>
#include <QTimer>
#include <QMovie>
#include <QLabel>
Window2::Window2(QWidget *parent) : QMainWindow(parent)
{
this->setFixedSize(800,600);
//返回按钮
MyButton * rbtn=new MyButton(":/returnbtn.png");
rbtn->setParent(this);
rbtn->move(50,50);
connect(rbtn,&QPushButton::clicked,this,[=](){
rbtn->down();
rbtn->up();
});
connect(rbtn,&MyButton::clicked,this,[=](){
QTimer::singleShot(200,this,[=](){
emit chooseBack(); //发送返回信号
});
});
//种植物
}
void Window2::paintEvent(QPaintEvent *){
QPainter painter(this);
QPixmap pixmap(":/background2.png");
painter.drawPixmap(0,0,this->width(),this->height(),pixmap);
//画植物
}