当前位置: 首页> 游戏> 单机 > 网络服务器品牌排名_web前端框架有哪些_2023b站免费推广入口_怎么恶意点击对手竞价

网络服务器品牌排名_web前端框架有哪些_2023b站免费推广入口_怎么恶意点击对手竞价

时间:2025/7/11 1:34:28来源:https://blog.csdn.net/m0_72595899/article/details/145538431 浏览次数:0次
网络服务器品牌排名_web前端框架有哪些_2023b站免费推广入口_怎么恶意点击对手竞价

头文件:

#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>
#include<QLabel>  //标签类头文件
#include<QPushButton>  //按钮类头文件
#include<QLineEdit>  //行编辑器类头文件QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACEclass Widget : public QWidget
{Q_OBJECTpublic slots:void clicked_slot();  //声明自定义的处理登录按钮的槽函数void QMessageBox_cancle();  //声明点击取消按钮的槽函数
signals:void jump();  //自定义跳转信号public:Widget(QWidget *parent = nullptr);~Widget();private:Ui::Widget *ui;
};
#endif // WIDGET_H
#ifndef SECOND_H
#define SECOND_H#include <QWidget>namespace Ui {
class second;
}class second : public QWidget
{Q_OBJECTpublic slots:void jump_slot();  //界面2提供一个用于接收跳转信号的槽public:explicit second(QWidget *parent = nullptr);~second();private:Ui::second *ui;
};#endif // SECOND_H

源文件:

#include "widget.h"
#include "ui_widget.h"
#include<QDebug>
#include<QMessageBox>Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);this->setFixedSize(400,560);  //设置界面固定大小//将登录按钮的clicked信号连接到自定义的槽函数中QObject::connect(ui->pushButton,&QPushButton::clicked,this,&Widget::clicked_slot);//将取消按钮的clicked信号连接到lambda表达式中/*QObject::connect(ui->pushButton_2,&QPushButton::clicked,[&](){this->close();});*/QObject::connect(ui->pushButton_2,&QPushButton::clicked,this,&Widget::QMessageBox_cancle);}Widget::~Widget()
{delete ui;
}//登录按钮的点击信号对应的槽函数
void Widget::clicked_slot()
{//获取账号和密码QString usrname=ui->lineEdit->text();  //获取账号QString pwd=ui->lineEdit_2->text();  //获取密码//判断账号和密码是否一致if(usrname==pwd&&usrname!=""){int res=QMessageBox::information(this,"信息对话框","登录成功",QMessageBox::Ok);if(res==QMessageBox::Ok){//关闭当前界面this->close();}//发射一个跳转信号emit jump();}else{int res=QMessageBox::critical(this,"错误对话框","账号和密码不匹配,是否重新登录",QMessageBox::Yes |QMessageBox::No,QMessageBox::Yes);if(res==QMessageBox::Yes){ui->lineEdit_2->clear();  //清空密码框内容}else if(res==QMessageBox::No){this->close();}}
}void Widget::QMessageBox_cancle()
{QMessageBox box(QMessageBox::Question,"问题对话框","是否退出登录",QMessageBox::Yes |QMessageBox::No,this);int res=box.exec();if(res==QMessageBox::Yes){this->close();}else if(res==QMessageBox::No){//啥也不干}
}
#include "second.h"
#include "ui_second.h"second::second(QWidget *parent) :QWidget(parent),ui(new Ui::second)
{ui->setupUi(this);
}second::~second()
{delete ui;
}//界面2的接收跳转信号的槽函数实现
void second::jump_slot()
{this->show();
}

主程序:

#include "widget.h"  //第一个界面的头文件
#include"second.h"  //第二个界面的头文件#include <QApplication>int main(int argc, char *argv[])
{QApplication a(argc, argv);Widget w;  //第一个界面的实例w.show();  //展示第一个界面second s;  //第二个界面的实例//将两个界面的信号与槽进行连接QObject::connect(&w,&Widget::jump,&s,&second::jump_slot);//以上四个参数表示:第一个界面发射信号、发射的是跳转信号、第二个界面接收信号、接收后的处理逻辑return a.exec();
}

关键字:网络服务器品牌排名_web前端框架有哪些_2023b站免费推广入口_怎么恶意点击对手竞价

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: