LINUX爱好者! 该文章的项目是基于LINUX下的QT。
转载请标明出处!
QT实现简单的页面跳转
以登录功能为例,本项目将默认类作为主界面(main_widgt),创建的新类(login_widget)作登录界面。
#ifndef LOGIN_WIDGET_H
#define LOGIN_WIDGET_H
#include <QObject>
#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QMessageBox>
class login_widget : public QWidget
{
Q_OBJECT
public:
login_widget();
QLabel *userLabel;
QLabel *pswLabel;
QLineEdit *luserEdit;
QLineEdit *pswEdit;
QPushButton *loginBtn;
QVBoxLayout *layout;
QWidget *mainwidget;