DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DAMessageLogViewWidget.h
1#ifndef DAMESSAGELOGVIEWWIDGET_H
2#define DAMESSAGELOGVIEWWIDGET_H
3#include <QWidget>
4#include "DAGuiAPI.h"
5class QMenu;
6namespace Ui
7{
8class DAMessageLogViewWidget;
9}
10
11namespace DA
12{
13class DAMessageLogsModel;
14class DAMessageLogsSortFilterProxyModel;
18class DAGUI_API DAMessageLogViewWidget : public QWidget
19{
20 Q_OBJECT
21
22public:
23 DAMessageLogViewWidget(QWidget* parent = nullptr);
25 //是否显示debug
26 bool isEnableShowDebugMsg() const;
27 //是否显示Warning
28 bool isEnableShowWarningMsg() const;
29 //是否显示Critical
30 bool isEnableShowCriticalMsg() const;
31 //是否显示Fatal
32 bool isEnableShowFatalMsg() const;
33 //是否显示Info
34 bool isEnableShowInfoMsg() const;
35 //自动滚动到最底部
36 bool isAutoScrollToButtom() const;
37public slots:
38 //对debug的显示设置
39 void setEnableShowDebugMsg(bool on);
40 //对Warning的显示设置
41 void setEnableShowWarningMsg(bool on);
42 //对Critical的显示设置
43 void setEnableShowCriticalMsg(bool on);
44 //对Fatal的显示设置
45 void setEnableShowFatalMsg(bool on);
46 //对Info的显示设置
47 void setEnableShowInfoMsg(bool on);
48 //点击
49 void onTableViewItemClicked(const QModelIndex& index);
50 //清空所有
51 void clearAll();
52 //复制选中的消息到剪切板
53 void copySelectionMessageToClipBoard();
54 //选中所有
55 void selectAll();
56 //自动滚动到最底部
57 void setAutoScrollToButtom(bool isAutoScrollToButtom);
58
59protected:
60 //多语言切换的捕获
61 virtual void changeEvent(QEvent* event) override;
62 //所有的文本都在此函数设置
63 void retranslateUi();
64 //处理快捷键
65 virtual void keyPressEvent(QKeyEvent* event) override;
66
67public:
72 {
73 ActionInfo,
74 ActionWarning,
75 ActionCritial,
76 ActionClear,
77 ActionCopy
78 };
79 //获取action
80 QAction* getAction(MessageLogActions ac) const;
81
82protected:
83 QAction* createAction(const char* objname, const char* iconpath, bool checkable = false, bool checked = false);
84private slots:
85 //自定义菜单
86 void onCustomContextMenuRequested(const QPoint& pos);
87 //有消息插入
88 void onMessageAppended();
89
90private:
91 void buildMenu();
92
93private:
94 Ui::DAMessageLogViewWidget* ui;
95 DAMessageLogsModel* _model;
96 DAMessageLogsSortFilterProxyModel* _sortFilterModel;
97 QAction* _actionMessageLogShowInfo;
98 QAction* _actionMessageLogShowWarning;
99 QAction* _actionMessageLogShowCritical;
100 QAction* _actionMessageLogClear;
101 QAction* _actionCopySelectMessage;
102 QMenu* _menu;
103 bool mIsAutoScrollToButtom { true };
104};
105} // namespace DA
106#endif // DAMESSAGELOGVIEWWIDGET_H
用于显示全局的消息
Definition DAMessageLogViewWidget.h:19
MessageLogActions
定义了窗口的内部action,外部程序可以通过此枚举及getAction 函数获取对应的action
Definition DAMessageLogViewWidget.h:72
用于显示全局消息的model
Definition DAMessageLogsModel.h:22
对message的SortFilterProxyModel,用于进行消息过滤
Definition DAMessageLogsModel.h:64
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44