站内优化主要从哪些方面进行,学生个人网页制作html动态,广州白云区房价,新洲建设投标网站题目#xff1a;
完善对话框#xff0c;点击登录对话框#xff0c;如果账号和密码匹配#xff0c;则弹出信息对话框#xff0c;给出提示”登录成功“#xff0c;提供一个Ok按钮#xff0c;用户点击Ok后#xff0c;关闭登录界面#xff0c;跳转到其他界面
如果账号和…题目
完善对话框点击登录对话框如果账号和密码匹配则弹出信息对话框给出提示”登录成功“提供一个Ok按钮用户点击Ok后关闭登录界面跳转到其他界面
如果账号和密码不匹配弹出错误对话框给出信息”账号和密码不匹配是否重新登录“,并提供两个按钮Yes|No用户点击Yes后清除密码框中的内容继续让用户进行登录如果用户点击No按钮则直接关闭登录界面
如果用户点击取消按钮则弹出一个问题对话框给出信息”您是否确定要退出登录“并给出两个按钮Yes|No用户迪纳基Yes后关闭登录界面用户点击No后关闭对话框继续执行登录功能
要求基于属性版和基于静态成员函数版至少各用一个 主函数
#include widget.h
#include speaking.h#include QApplicationint main(int argc, char *argv[])
{QApplication a(argc, argv);Widget w;w.show();speaking s;QObject::connect(w,Widget::my_jump,s,speaking::my_solt);return a.exec();
}第一个界面头文件
#ifndef WIDGET_H
#define WIDGET_H#include QWidget
#include QIcon
#include QMessageBoxQT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACEclass Widget : public QWidget
{Q_OBJECTpublic:Widget(QWidget *parent nullptr);~Widget();private slots:void on_pushButton_clicked();void on_pushButton_2_clicked();signals:void my_jump();private:Ui::Widget *ui;
};
#endif // WIDGET_H第一个界面实现文件
#include widget.h
#include ui_widget.hWidget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui-setupUi(this);this-setWindowFlag(Qt::FramelessWindowHint);this-setAttribute(Qt::WA_TranslucentBackground);this-setWindowIcon(QIcon(:/Logo/qq.png));
}Widget::~Widget()
{delete ui;
}//登录按钮相关功能
void Widget::on_pushButton_clicked()
{//判断账号和密码是否一致if(ui-usernameEdit-text() admin ui-passwordEdit-text() 123456){//跳转到另一个窗口emit this-my_jump();//基于属性版本实现对话框QMessageBox msg(QMessageBox::Information,提示信息,登录成功,QMessageBox::Ok,this);//使用exec弹出对话框int ret msg.exec();if(ret QMessageBox::Ok){this-close();}}else{//基于静态成员函数信息实现对话框int ret2 QMessageBox::information(this,提示信息,账号和密码不匹配请重新登录,QMessageBox::Yes | QMessageBox::No);//点击Yes清除重新输入if(ret2 QMessageBox::Yes){ui-passwordEdit-clear();}//点击No直接关闭登陆页面else if(ret2 QMessageBox::No){this-close();}}
}//取消按钮相关功能
void Widget::on_pushButton_2_clicked()
{//基于静态成员函数实现问题对话框int ret QMessageBox::question(this,问题,您是否确定要退出登录,QMessageBox::Yes | QMessageBox::No);if(ret QMessageBox::Yes){this-close();}
}第二个页面头文件
#ifndef SPEAKING_H
#define SPEAKING_H#include QWidgetnamespace Ui {
class speaking;
}class speaking : public QWidget
{Q_OBJECTpublic:explicit speaking(QWidget *parent nullptr);~speaking();private:Ui::speaking *ui;public slots:void my_solt();
};#endif // SPEAKING_H第二个界面实现文件
#include speaking.h
#include ui_speaking.hspeaking::speaking(QWidget *parent) :QWidget(parent),ui(new Ui::speaking)
{ui-setupUi(this);}speaking::~speaking()
{delete ui;
}void speaking::my_solt()
{this-show();
}实现界面