Qtday2

#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)

{
    ui->setupUi(this);
    this->setWindowTitle("氪金小游戏");
    this->setWindowIcon(QIcon("C:\\Users\\DELL\\Documents\\Tencent Files\\346966007\\FileRecv\\pictrue\\pictrue\\zhan.jpg"));



    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);



      this->setFixedSize(535,410);

      QPushButton *btn1 =new QPushButton;
      btn1->setParent(this);
      btn1->setText("登录");
     // btn1->setStyleSheet("pink");
       btn1->move(120,330);
       btn1->resize(130,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);"
                           "}");
 connect(btn1,SIGNAL(clicked()),this,SLOT(my_slot2()));

       QPushButton *btn2 =new QPushButton;
       btn2->setParent(this);
       btn2->setText("取消");
       connect(btn2,SIGNAL(clicked()),this,SLOT(my_slot()));
      // btn2->setStyleSheet("pink");
        btn2->move(280,330);
        btn2->resize(130,50);
        btn2->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);"
                            "}");




     edit3 =new QLineEdit(this);
      edit3->move(120,220);//移动
       edit3->resize(330,37);
      edit3->setPlaceholderText("手机号/QQ号:");
      edit3->setStyleSheet ("background:transparent;border-width:0;border-style:outset");

       edit4 =new QLineEdit(this);
      edit4->move(120,270);
      edit4->setPlaceholderText("密码:"); //设置占位
      edit4->resize(330,37);
      edit4->setStyleSheet ("background:transparent;border-width:0;border-style:outset");
      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(); //让动图动起来
}



Widget::~Widget()
{

    delete ui;
}

void Widget::my_slot(){
    this->close();
}
void Widget::my_slot2() {

    if(edit4->text()!="123456" || edit3->text()!="admin")
    {
    edit4->home(true);
    edit4->del();
    QMessageBox::information(NULL, "错误","你输入的账户名或密码不正确,原因可能是:\n1、账号名输入有误;\n2、忘记密码;\n3、未区分字母大小写;\n4、未开启小键盘;\n", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);


    }
    if(edit4->text()=="123456"&& edit3->text()=="admin"){
        qDebug("success");
     QMessageBox::information(NULL, "登陆成功","登陆成功!;\n", QMessageBox::Yes );


}
}

QQ录屏20240615170553

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值