#include "mywidget.h"
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
this->setWindowTitle("氪金小游戏");
this->setWindowIcon(QIcon("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\zhan.jpg"));
// this->setAutoFillBackground(true);
// QPalette palette;
// QPixmap pixmap("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\qq2.gif");
// palette.setBrush(QPalette::Window, QBrush(pixmap));
// this->setPalette(palette);
// this->show();
QPixmap pixmap = QPixmap("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\78011.jpg").scaled(this->size());
QPalette palette(this->palette());
palette.setBrush(QPalette::Background, QBrush(pixmap));
this->setPalette(palette);
// setStyleSheet(
// //正常状态样式
// "QPushButton{"
// "background-color:rgba(100,225,100,100);"//背景色(也可以设置图片)
// "border-style:outset;" //边框样式(inset/outset)
// "border-width:4px;" //边框宽度像素
// "border-radius:14px;" //边框圆角半径像素
// "border-color:rgba(255,255,255,30);" //边框颜色
// "font:bold 20px;" //字体,字体大小
// "color:rgba(0,0,0,100);" //字体颜色
// //"padding:6px;" //填衬
// "}"
// //鼠标按下样式
// "QPushButton:pressed{"
// "background-color:rgba(100,255,100,200);"
// "border-color:rgba(255,255,255,30);"
// "border-style:inset;"
// "color:rgba(0,0,0,100);"
// "}"
// //鼠标悬停样式
// "QPushButton:hover{"
// "background-color:rgba(100,255,100,100);"
// "border-color:rgba(255,255,255,200);"
// "color:rgba(0,0,0,200);"
// "}");
// this->setStyleSheet("background-color:white");
//this->setStyleSheet("background-color:rgb(184,41,124)");
// this->resize(535,410);
//this->setWindowFlag(Qt::FramelessWindowHint,true);
this->setFixedSize(535,410);
QPushButton *btn1 =new QPushButton;
btn1->setParent(this);
btn1->setText("登录");
// btn1->setStyleSheet("pink");
btn1->move(120,330);
btn1->resize(300,50);
btn1->setStyleSheet("QPushButton{"
"background-color:rgba(78,79,79,100);"//背景色(也可以设置图片)
"border-style:outset;" //边框样式(inset/outset)
"border-width:4px;" //边框宽度像素
"border-radius:14px;" //边框圆角半径像素
"border-color:rgba(255,255,255,30);" //边框颜色
"font:bold 20px;" //字体,字体大小
"color:rgba(0,0,0,100);" //字体颜色
//"padding:6px;" //填衬
"}"
//鼠标按下样式
"QPushButton:pressed{"
"background-color:rgba(100,255,100,200);"
"border-color:rgba(255,255,255,30);"
"border-style:inset;"
"color:rgba(0,0,0,100);"
"}"
//鼠标悬停样式
"QPushButton:hover{"
"background-color:rgba(100,255,100,100);"
"border-color:rgba(255,255,255,200);"
"color:rgba(0,0,0,200);"
"}");
// btn1->setStyleSheet();
//正常状态样式
// QPushButton *btn2 =new QPushButton("注册账号",this);
// btn2->move(10,400);
// btn2->setIcon(QIcon("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\login.png"));
// btn2->resize(100,67);
// // btn2->setEnabled(false);//设置不可用状态
// QLineEdit *edit1 =new QLineEdit;
// edit1->setParent(this);
// edit1->resize(150,75);
// QLineEdit *edit2 =new QLineEdit("张三",this);
// edit2->move(200,200);
QLineEdit *edit3 =new QLineEdit(this);
edit3->move(120,220);//移动
edit3->resize(330,37);
edit3->setPlaceholderText("手机号/QQ号:");
QLineEdit *edit4 =new QLineEdit(this);
edit4->move(120,270);
edit4->setPlaceholderText("密码:"); //设置占位
edit4->resize(330,37);
edit4->setEchoMode(QLineEdit::Password); //设置显示模式
QLabel *label1 =new QLabel("注册",this);
label1->move(20,350);
label1->resize(80,30);
QLabel *label2 =new QLabel(this);
label2->move(90,275);
label2->resize(27,27);
label2->setPixmap(QPixmap("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\passwd.jpg"));
label2->setScaledContents(true);
QLabel *label4 =new QLabel(this);
label4->move(90,223);
label4->resize(27,27);
label4->setPixmap(QPixmap("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\780.jfif"));
//设置图片
label4->setScaledContents(true);
QLabel *label3 =new QLabel(this);
label3->move(0,0);
label3->resize(535,230);
QMovie *mv =new QMovie("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\login.gif");
//设置一个动图对象接受动图 QMovie
label3->setMovie(mv); //将动图设置到label中
label3->setScaledContents(true);//让图片自动适应
mv->start(); //让动图动起来
}
MyWidget::~MyWidget()
{
}
氪金小游戏 2024-06-13 22-10-16