69 lines
1.7 KiB
C++
69 lines
1.7 KiB
C++
#ifndef MAINWINDOW_H
|
||
#define MAINWINDOW_H
|
||
|
||
#include <QMainWindow>
|
||
#include "EventModule.h"
|
||
#include "WebEngineView.h"
|
||
#include "QFramelessHelper.h"
|
||
|
||
class WebEngineView;
|
||
class DataManager;
|
||
class SettingDialog;
|
||
/**
|
||
* @brief 主窗体控件
|
||
*/
|
||
class MainWindow : public QMainWindow
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
MainWindow(QWidget* parent = nullptr);
|
||
~MainWindow();
|
||
/**
|
||
* @brief 设置当前鼠标所在区域是否为为标题栏
|
||
* @param beOn true为标题栏,false表示离开了标题栏
|
||
*/
|
||
void changeMaximize();
|
||
/**
|
||
*/
|
||
void openSettingDialog();
|
||
/**
|
||
* @brief 通知WEB端当前主窗口的最大化状态
|
||
* @param beMax true为已经最大化 false当前为正常窗口。
|
||
*/
|
||
/**
|
||
* @brief 在主窗口上方显示用户消息
|
||
* @param message 消息内容
|
||
* @param type 消息类型,0为成功消息、1为警告消息、2为错误消息、3为一般消息
|
||
*/
|
||
void message(const QString& message, int type = 0);
|
||
/**
|
||
* @brief 初始程序,在页面加载完成后调用。
|
||
*/
|
||
void initalApplication();
|
||
/**
|
||
* @brief 切换功能模块
|
||
* @param moduleName 切换功能模块的名称
|
||
*/
|
||
void changeModule(const std::string& moduleName);
|
||
bool DBConnect(json& parameter);
|
||
void Close();
|
||
// DataManager* getDataRoot() { return _pDataRoot; }
|
||
protected:
|
||
bool onMessage(const std::string& eventName, json& parameter);
|
||
void changeEvent(QEvent* event);
|
||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
||
bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result);
|
||
#else
|
||
bool nativeEvent(const QByteArray& eventType, void* message, long* result);
|
||
#endif
|
||
public slots:
|
||
private:
|
||
WebEngineView* _webView;
|
||
std::unique_ptr<SettingDialog> _settingDialog;
|
||
std::unique_ptr<QFramelessHelper> _frameless;
|
||
SignalEventModule* _eventModule;
|
||
// DataManager* _pDataRoot;
|
||
};
|
||
|
||
#endif // MAINWINDOW_H
|