【无标题】

该代码实现了一个使用Qt框架创建的登录界面,包括设置窗口图标、标题、背景色,以及添加QQ号码/手机/邮箱输入框、密码输入框、自动登录和记住密码复选框,登录按钮,并实现了点击登录按钮时触发相应信号槽功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 my.cpp

#include "my.h"
#include "ui_my.h"


my::my(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::my)
{
    ui->setupUi(this);
    this->setFixedSize(600,400);
    this->setWindowIcon(QIcon(":/icon_z8w8m9orsdk/xx.png"));
    this->setWindowTitle("XX");
    this->setWindowOpacity(1);
   this->setStyleSheet("background-color: white");

    label = new QLabel(this);
    label->setPixmap(QPixmap(":/icon/11.jpg"));
    label->resize(600,150);
    label->setScaledContents(true);



     label1 = new QLabel(this);
    label1->setPixmap(QPixmap(":/icon/logo1.webp"));
    label1->resize(50,50);
    label1->setScaledContents(true);
    label1->move(5,5);



     label2 = new QLabel(this);
    label2->setPixmap(QPixmap(":/icon_z8w8m9orsdk/denglu.png"));
    label2->resize(20,20);
    label2->setScaledContents(true);
    label2->move(150,210);


     label3 = new QLabel(this);
    label3->setPixmap(QPixmap(":/icon_z8w8m9orsdk/denglumima.png"));
    label3->resize(20,20);
    label3->setScaledContents(true);
    label3->move(150,260);

     label4 = new QLabel("找回密码",this);
    label4->resize(100,20);
    label4->move(450,300);

    label4->setStyleSheet("boder:none;");


     edit = new QLineEdit(this);
    edit->move(180,210);
    edit->setEchoMode(QLineEdit::Normal);
    edit->resize(300,20);
    edit->setPlaceholderText("QQ号码/手机/邮箱");
    edit->setStyleSheet("border:none;border-bottom: 1px solid black;");

     edit1 = new QLineEdit(this);
    edit1->move(180,260);
    edit1->setEchoMode(QLineEdit::PasswordEchoOnEdit);
    edit1->resize(edit->size());
    edit1->setPlaceholderText("密码");
    edit1->setStyleSheet("border:none;border-bottom: 1px solid black;");

     box = new QCheckBox(this);
    box->move(150,300);
    box->resize(100,20);
    box->setText("自动登录");

    box1 = new QCheckBox(this);
    box1->move(300,300);
    box1->resize(100,20);
    box1->setText("记住密码");

    button = new QPushButton("登录",this);
    button->move(150,330);
    button->resize(350,30);
    button->setStyleSheet("border-radius: 5px;background-color:skyblue;");


    connect(this->button,&QPushButton::clicked,this,&my::slots_jump);




};



my::~my()
{
    delete ui;
}

void my::slots_jump()
{
    emit my_signal();
    this->close();
}




logn.cpp

#ifndef LOGN_H
#define LOGN_H

#include <QWidget>

namespace Ui {
class logn;
}

class logn : public QWidget
{
    Q_OBJECT

public:
    explicit logn(QWidget *parent = nullptr);
    ~logn();

private:
    Ui::logn *ui;

public slots:
    void slots_logn();
};

#endif // LOGN_H

main.cpp

#include "my.h"
#include "logn.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    my w;
    w.show();

    logn i;
    QObject::connect(&w,&my::my_signal,&i,&logn::slots_logn);

    return a.exec();
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值