-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrechargewindow.cpp
More file actions
59 lines (50 loc) · 1.96 KB
/
Copy pathrechargewindow.cpp
File metadata and controls
59 lines (50 loc) · 1.96 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "rechargewindow.h"
RechargeWindow::RechargeWindow(QWidget *parent) : QDialog(parent)
{
this->setGeometry(400*dpi,200*dpi,400*dpi,100*dpi);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:#ebf2fa");
closeBtn= new ToolButton(this,QColor(0,0,0,0),QColor(0,153,255,255));
closeBtn->setEnterColor("#ff6666");
closeBtn->setGeometry(this->width()-30*dpi,1*dpi,29*dpi,29*dpi);
QPixmap closePix=style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
closeBtn->setIcon(closePix);
connect(closeBtn,SIGNAL(clicked()),this,SLOT(close()));
confirmBtn=new ToolButton(this,QColor(153,204,255,255),QColor(0,153,255,255));
confirmBtn->setPlainColor(QColor(153,204,255,255));
confirmBtn->setGeometry(this->width()/3,70*dpi,100*dpi,20*dpi);
confirmBtn->setText("确定");
connect(confirmBtn,SIGNAL(clicked()),this,SLOT(emitChargeRequest()));
getMoney=new QSpinBox(this);
getMoney->setMaximum(2000);
getMoney->setMinimum(0);
getMoney->setGeometry(200*dpi,30*dpi,100*dpi,30*dpi);\
getMoney->setStyleSheet(
"QSpinBox{background-color:transparent;border:1px;border-color:gray;border-style:solid;border-radius: 4px}"
"QSpinBox::down-button{width:30px;height:30px;image:url(:/Images/Icons/DownArrow.png);}"
"QSpinBox::up-button{width:30px;height:30px;image:url(:/Images/Icons/UpArrow.png);}}"
);
getMoney->setFont(QFont("微软雅黑",12));
}
RechargeWindow::~RechargeWindow()
{
delete getMoney;
delete closeBtn;
delete confirmBtn;
}
void RechargeWindow::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
QFont titleFont("微软雅黑",15);
titleFont.setBold(true);
painter.setFont(titleFont);
painter.drawText(30*dpi,50*dpi,"请输入充值金额");
}
void RechargeWindow::emitChargeRequest()
{
emit chargeRequest();
}
int RechargeWindow::getValue()
{
return getMoney->value();
}