feat:初始化wuhan_QT界面代码
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifndef BASEPAGE_H
|
||||
#define BASEPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QEvent>
|
||||
#include "appcontext.h"
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
|
||||
// ===================== 页面基类 =====================
|
||||
// 所有页面继承此基类,持有应用上下文,统一提供页面跳转信号与控件构造助手
|
||||
class BasePage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BasePage(AppContext* ctx, QWidget* parent = nullptr);
|
||||
|
||||
AppContext* ctx() const { return m_ctx; }
|
||||
|
||||
// 控件构造助手
|
||||
static QLabel* label(const QString& text, int px, const QString& color = C::TEXT,
|
||||
bool bold = false, QWidget* parent = nullptr);
|
||||
static QPushButton* button(const QString& text, const QString& variant = "",
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void navigate(PageId id); // 请求切换到指定页面
|
||||
|
||||
protected:
|
||||
AppContext* m_ctx = nullptr;
|
||||
};
|
||||
|
||||
#endif // BASEPAGE_H
|
||||
Reference in New Issue
Block a user