DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DAStandardItemPlot.h
1#ifndef DASTANDARDITEMPLOT_H
2#define DASTANDARDITEMPLOT_H
3#include "DAFigureAPI.h"
4#include <QStandardItem>
5#include <QPointer>
6class QwtPlot;
7namespace DA
8{
9class DAFIGURE_API DAStandardItemPlot : public QStandardItem
10{
11public:
12 enum
13 {
14 Type = QStandardItem::UserType + 1 // 任意 >= UserType 的值
15 };
20 {
23 PlotProperty
24 };
25 explicit DAStandardItemPlot(QwtPlot* plot, ItemType plotType);
27 QVariant data(int role = Qt::UserRole + 1) const override;
28 QVariant handleItemTextType(int role) const;
29 QVariant handleItemVisibleType(int role) const;
30 QVariant handleScalePropertyType(int role) const;
31 int type() const override
32 {
33 return Type;
34 }
35 // 获取关联的PlotItem
36 QwtPlot* plot() const
37 {
38 return m_plot;
39 }
40
41 // 获取Item类型
42 ItemType itemType() const
43 {
44 return m_itemType;
45 }
46
47 bool isValid() const
48 {
49 return (m_plot != nullptr);
50 }
51
52private:
53 QwtPlot* m_plot { nullptr };
54 ItemType m_itemType { PlotText };
55};
56} // end DA
57#endif // DASTANDARDITEMPLOT_H
Definition DAStandardItemPlot.h:10
ItemType
指定这个item的类型
Definition DAStandardItemPlot.h:20
@ PlotVisible
显示QwtPlot的可见性,一般用于第二列
Definition DAStandardItemPlot.h:22
@ PlotText
只显示QwtPlot的文字和图标,用于树形第一列
Definition DAStandardItemPlot.h:21
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44