一思维导图
二.练习
widget.h
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_bt1_clicked()
{
QString number=ui->lineEdit->text();
QString password=ui->lineEdit_2->text();
if(number == "111111"&& password=="000000")
{
//QMessageBox::information(this,"提示","登陆成功");
emit my_signal();
this->close();
}else {
QMessageBox::information(this,"提示","手机号或密码输入错误");
ui->lineEdit->clear();
ui->lineEdit_2->clear();
}
}
main.cpp
#include "widget.h"
#include"form.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
Form f;//实例化第二个界面
QObject::connect(&w,&Widget::my_signal,&f,&Form::jump_slots);
return a.exec();
}