main.cpp
#include "widget.h"
#include "second.h"
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
//实例化第二个界面
Second s;
QObject::connect(&w, &Widget::my_jump, &s, &Second::jump_slot);
return a.exec();
}
second.cpp
#include "second.h"
#include "ui_second.h"
Second::Second(QWidget *parent) :
QWidget(parent),
ui(new Ui::Second)
{
ui->setupUi(this);
}
Second::~Second()
{
delete ui;
}
//第二个界面自定义的槽函数的实现
void Second::jump_slot()
{
this->show();
}
void Second::on_sendBtn_clicked()
{
QString msg = ui服务器托管网->msgEdit->text();
ui->msgWidget->addItem(msg);
}
widget.cpp
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
connect(ui->exit_btn, &QPushButton::clicked, this, &Widget::on_exit_btn_clicked);
connect(ui->login_btn, &QPushButton::clicked, this, &Widget::on_login_btn_clicked);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_login_btn_clicked()
{
if(ui->name_edit->text() == "admin" && ui->code_edit->text() == "123456"){
QMessageBox::information(this,
"提示",
"登录成功",
QMessageBox::Ok
);
this->close();
emit my_jump();
}else{
QMessageBox msg(
QMessageBox::Warning,
"警告",
"账号和密码不匹配,是否重新登陆",
QMessageBox::Yes | QMessageBox::No,
this);
int ret = msg.exec();
if(ret == QMessageBox::Yes){ //判断警报
t服务器托管网his->show();
ui->code_edit->clear(); //清除
}else{
this->close(); //关闭
}
}
}
void Widget::on_exit_btn_clicked()
{
this->close();
}
second.ui
widget.ui
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: HTTP的Content-type 和 responseType
场景 后端返回字节流,前端进行图片下载时遇到了问题,定位花了不少时间,本文再次记录梳理下 XMLHttpRequest XMLHttpRequest本身支持responseType 允许我们手动的设置返回数据的类型 responseType取值范围 服务器托管…