QT--2

 Qt界面设计

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


Widget::Widget(QWidget *parent)
    : QWidget(parent)
{

    //=======窗口相关设置======
    this->resize(680,520);
    this->setFixedSize(680,520);
    this->setWindowTitle("Tim");
    this->setWindowFlag(Qt::FramelessWindowHint);
    this->setStyleSheet("background-color:rgb(255,255,255)");
    //=======标签相关设置======
    QLabel *lab1 = new QLabel(this);
    lab1->resize(400,520);
    lab1->setPixmap(QPixmap(":/pictrue/tim.png"));



    //=======行编辑器相关设置=======
    edit1 = new QLineEdit(this);
    edit1->resize(220,50);
    edit1->move(430,270-50);
    edit1->setPlaceholderText("QQ号码/手机号/邮箱");

    edit2 = new QLineEdit(this);
    edit2->resize(220,50);
    edit2->move(430,270);
    edit2->setPlaceholderText("密码");
    edit2->setEchoMode(QLineEdit::Password);



    //=======按钮相关设置=====
    QPushButton *btn1 = new QPushButton(this);
    btn1->resize(64,64);
    btn1->move(500-32,120-32);
    btn1->setStyleSheet("background-color:rgb(17,145,255);border-radius:32px");
    btn1->setIcon(QIcon(":\\pictrue\\qie.png"));

    QPushButton *btn2 = new QPushButton(this);
    btn2->resize(64,64);
    btn2->move(580-32,120-32);
    btn2->setStyleSheet("background-color:rgb(245,245,245);border-radius:32px");
    btn2->setIcon(QIcon(":\\pictrue\\wechat.png"));

    QPushButton *btn3 = new QPushButton("记住密码",this);
    btn3->resize(74,25);
    btn3->move(430,440);
    btn3->setIcon(QIcon(":\\pictrue\\kuang.png"));

    QPushButton *btn4 = new QPushButton("自动登陆",this);
    btn4->resize(74,25);
    btn4->move(430,470);
    btn4->setIcon(QIcon(":\\pictrue\\kuang.png"));

    QPushButton *btn5 = new QPushButton("找回密码",this);
    btn5->resize(74,25);
    btn5->move(600,440);

    QPushButton *btn6 = new QPushButton("注册密码",this);
    btn6->resize(74,25);
    btn6->move(600,470);

    btn7 = new QPushButton(this);
    btn7->resize(25,25);
    btn7->move(640,12);
    btn7->setIcon(QIcon(":\\pictrue\\x.png"));

    QPushButton *btn8 = new QPushButton(this);
    btn8->resize(25,25);
    btn8->move(605,12);
    btn8->setIcon(QIcon(":\\pictrue\\set.png"));

    btn9 = new QPushButton("登录",this);
    btn9->resize(220,50);
    btn9->move(430,270+80);

    btn9->setStyleSheet("background-color:red;border-radius:5px");
    connect(edit1, &QLineEdit::textChanged, this, &Widget::mySlots);
    connect(edit2, &QLineEdit::textChanged, this, &Widget::mySlots);
    connect(btn7, &QPushButton::clicked, this, &Widget::clicked);
}
Widget::~Widget()
{
    delete ui;
}
void Widget::clicked()
{
    this->close();
}
void Widget::mySlots()
{
    if(edit1->text().size()>=6&&edit2->text().size()>=6)
    {
        btn9->setStyleSheet("background-color:green;border-radius:5px");
    }
    else
    {
        btn9->setStyleSheet("background-color:red;border-radius:5px");
    }
}

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值