#include "mywidget.h"
MyWidget::MyWidget(QWidget *parent)
: QMainWindow(parent)
{
this->setWindowTitle("MARS TECHNOLOGY"); //设置窗口名称
this->setWindowIcon(QIcon("C:\\Users\\PC\\Desktop\\图片\\2.jpg"));//设置标题图标
//this->setStyleSheet("background-color:blue");//设置窗口背景色
this->resize(1600,1200);//重设窗口大小
this->setFixedSize(1600,1200);//固定窗口大小
// this->setWindowFlag(Qt::FramelessWindowHint);
QLabel* lab1 = new QLabel(this);
lab1->resize(1600,1200);
lab1->setPixmap(QPixmap("C:\\Users\\PC\\Desktop\\图片\\3.jpg"));
lab1->setScaledContents(true);
// QLabel* lab2 = new QLabel(this);
// lab2->resize(450,50);
// lab2->move(550,550);
// lab2->setStyleSheet("background-color:rgba(150,150,150,0.5)");
// QLabel* lab3 = new QLabel(this);
// lab3->resize(450,50);
// lab3->move(550,650);
// lab3->setStyleSheet("background-color:rgba(150,150,150,0.5)");
QLabel* lab4 = new QLabel(this);
lab4->resize(1000,100);
lab4->move(350,200);
lab4->setText("MARS TECHNOLOGY");
lab4->setStyleSheet("QLabel { color: white; font-size: 30pt; font-family: Arial;font-weight: bold;background-color:rgba(150,150,150,0.05) }");
QPushButton *btn1 = new QPushButton("登录",this);
btn1->move(550, 700);
btn1->resize(450,45);
btn1->setStyleSheet("background-color:rgb(50,103,163);color:white;border-radius:5px");
QLineEdit* edit1 = new QLineEdit(this);
edit1->move(550,450);
edit1->resize(450,50);
edit1->setPlaceholderText("手机\\邮箱");
QLineEdit* edit2 = new QLineEdit(this);
edit2->move(550,550);
edit2->resize(450,50);
edit2->setPlaceholderText("密码");
edit2->setEchoMode(QLineEdit::Password);
}
MyWidget::~MyWidget()
{
}
void Widget::on_login_clicked()
{
QString userName = ui->edit1->text();
QString passWord = ui->edit2->text();
if(userName=="admin" && passWord == "1234")
{
QMessageBox msg(QMessageBox::Information,
"登录",
"登录成功",
QMessageBox::Ok,
this
);
int ret = msg.exec();
}
QT
于 2024-09-06 21:11:16 首次发布