做衣服的教程网站有哪些,威海外贸网站建设怎么样,网站开发流程表,网站建设 西安1.使用手动连接#xff0c;将登录框中的取消按钮使用qt4版本的连接到自定义的槽函数中#xff0c;在自定义的槽函数中调用关闭函数 #include mainwindow.h
#include ui_mainwindow.hMainWindow::MainWindow(QWidget *parent): QMainWindow(parent), …
1.使用手动连接将登录框中的取消按钮使用qt4版本的连接到自定义的槽函数中在自定义的槽函数中调用关闭函数 #include mainwindow.h
#include ui_mainwindow.hMainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{ui-setupUi(this);
//使用qt4将右上角x设置关闭触发connect(btn2,SIGNAL(clicked()),this,SLOT(close_slot()));//使用qt5将快速登录按钮设置触发事件connect(btn1,QPushButton::clicked,this,MyWidget::log_slot);
}void MyWidget::close_slot()
{this-close();
}void MyWidget::log_slot(){//比较账号和密码if(QString::compare(admin,edt1-text())0 QString::compare(123456,edt2-text())0){qDebug()登录成功;this-close();}else {edt2-clear();qDebug()登录失败;}
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::on_closebtn_clicked()
{this-close();
}