|
DAWorkbench 0.0.1
DAWorkbench API
|
绘图窗口 更多...
#include <DAFigureWidget.h>
类 | |
| class | PrivateData |
信号 | |
| void | chartAdded (DA::DAChartWidget *c) |
| 添加了chart | |
| void | chartRemoved (DA::DAChartWidget *c) |
| 绘图移除信号 | |
| void | currentChartChanged (DA::DAChartWidget *c) |
| 当前的绘图发生了变更 | |
Public 成员函数 | |
| DAFigureWidget (QWidget *parent=nullptr) | |
| QwtFigure * | figure () const |
| 获取绘图窗口 | |
| QString | getFigureId () const |
| void | setFigureId (const QString &id) |
| DAChartFactory * | getChartFactory () const |
| void | setupChartFactory (DAChartFactory *fac) |
| 设置ChartFactory | |
| DAChartWidget * | createChart () |
| 添加一个chart | |
| DAChartWidget * | createChart (const QRectF &versatileSize) |
| 创建绘图 | |
| DAChartWidget * | createChart (float xVersatile, float yVersatile, float wVersatile, float hVersatile) |
| 添加一个chart,指定位置占比 | |
| DAChartWidget * | createChart_ () |
| 支持redo/undo的createchart | |
| DAChartWidget * | createChart_ (const QRectF &versatileSize) |
| 支持redo/undo的createchart | |
| void | removeChart (DAChartWidget *chart) |
| 移除chart,但不会delete | |
| void | removeChart_ (DAChartWidget *chart) |
| void | addChart (DAChartWidget *chart, qreal xVersatile, qreal yVersatile, qreal wVersatile, qreal hVersatile) |
| 添加一个chart,指定位置占比 | |
| void | addChart (DAChartWidget *chart, const QRectF &versatileSize) |
| QList< DAChartWidget * > | getCharts () const |
| 获取所有的绘图 | |
| DAChartWidget * | getCurrentChart () const |
| 当前的图表的指针 | |
| DAChartWidget * | gca () const |
| like matlab/matplotlib api gca | |
| void | setCurrentChart (QwtPlot *p) |
| 设置当前的chart | |
| DAChartWidget * | currentChart () |
| 获取当前的chart,如果没有current chart,或figure不存在chart, 则创建一个新chart,此函数不返回nullptr | |
| QWidget * | getUnderCursorWidget () const |
| 返回当前光标下的widget | |
| DAChartWidget * | getUnderCursorChart () const |
| 返回在当前光标下的2D图 | |
| void | clear () |
| 清空同时删除 | |
| void | setBackgroundColor (const QBrush &brush) |
| 设置figure背景 | |
| void | setBackgroundColor (const QColor &clr) |
| 设置figure背景 | |
| const QBrush & | getBackgroundColor () const |
| 获取背景颜色 | |
| DAChartWidget * | findChartFromItem (QwtPlotItem *item) const |
| 通过item查找对应的SAChart2D,如果没有返回nullptr | |
| void | setSubChartEditorEnable (bool enable=true) |
| 是否开始子窗口编辑模式 | |
| DAFigureWidgetOverlay * | getSubChartEditor () const |
| 获取子窗口编辑器指针,若没有此编辑器,返回nullptr | |
| bool | isEnableSubChartEditor () const |
| SAFigureWindow::isSubWindowEditingMode | |
| int | getChartCount () const |
| 获取图表的数量 | |
| virtual QColor | getDefaultColor () const |
| 获取默认的绘图颜色 | |
| bool | hasPlot (QwtPlot *chart, bool includeParasite=true) const |
| 是否存在这个绘图 | |
| bool | bindAxisRange (QwtPlot *source, QwtPlot *follower, QwtAxisId axisid) |
| 绑定坐标轴的范围 | |
| bool | bindAxisRange (QwtPlot *source, QwtAxisId sourceAxisid, QwtPlot *follower, QwtAxisId followerAxisid) |
| 绑定坐标轴的范围 | |
| bool | unbindAxisRange (QwtPlot *source, QwtPlot *follower, QwtAxisId axisid) |
| bool | unbindAxisRange (QwtPlot *source, QwtAxisId sourceAxisid, QwtPlot *follower, QwtAxisId followerAxisid) |
| QList< DAChartAxisRangeBinder * > | getBindAxisRangeInfos () const |
| 获取坐标轴绑定信息 | |
| void | setDataPickerGroupEnabled (bool on) |
| 设置联动数据拾取,联动数据拾取会让当前所有绘图的QwtPlotSeriesDataPicker建立分组,进行联动 | |
| bool | isDataPickerGroupEnabled () const |
| QwtPlotSeriesDataPickerGroup * | getDataPickerGroup () const |
| QwtPlot * | findPlotById (const QString &id, bool findParasite=true) const |
| 通过id查找plot | |
| void | setColorTheme (const DAColorTheme &th) |
| DAColorTheme | getColorTheme () const |
| const DAColorTheme & | colorTheme () const |
| DAColorTheme & | colorTheme () |
| void | copyToClipboard () |
| QRectF | axesNormRect (QwtPlot *plot) const |
| QRectF | widgetNormRect (QWidget *w) const |
| void | addWidget (QWidget *widget, qreal left, qreal top, qreal width, qreal height) |
| void | addWidget (QWidget *widget, int rowCnt, int colCnt, int row, int col, int rowSpan=1, int colSpan=1, qreal wspace=0.0, qreal hspace=0.0) |
| void | setWidgetNormPos (QWidget *widget, const QRectF &rect) |
| QwtPlot * | plotUnderPos (const QPoint &pos) const |
| 获取在此坐标下的绘图,如果此坐标下没有,则返回nullptr,存在寄生轴情况只返回宿主轴 | |
| void | setFaceBrush (const QBrush &brush) |
| QBrush | getFaceBrush () const |
| bool | addItem_ (QwtPlotItem *item) |
| 支持redo/undo的添加item | |
| void | addItem_ (DAChartWidget *chart, QwtPlotItem *item) |
| 支持redo/undo的添加item | |
| QwtPlotCurve * | addCurve_ (const QVector< QPointF > &xyDatas) |
| 支持redo/undo的addCurve,等同于gca()->addCurve | |
| QwtPlotCurve * | addScatter_ (const QVector< QPointF > &xyDatas) |
| 支持redo/undo的addScatter,等同于gca()->addCurve | |
| QwtPlotBarChart * | addBar_ (const QVector< QPointF > &xyDatas) |
| 支持redo/undo的addBar,等同于gca()->addBar | |
| QwtPlotIntervalCurve * | addErrorBar_ (const QVector< double > &values, const QVector< double > &mins, const QVector< double > &maxs) |
| 支持redo/undo的addBar,等同于gca()->addBar | |
| void | push (QUndoCommand *cmd) |
| 推入一个命令 | |
| QUndoStack * | getUndoStack () |
| 获取内部的undoStack | |
Protected 成员函数 | |
| void | keyPressEvent (QKeyEvent *e) |
| void | showEvent (QShowEvent *e) |
绘图窗口
| QwtPlotBarChart * DA::DAFigureWidget::addBar_ | ( | const QVector< QPointF > & | xyDatas | ) |
支持redo/undo的addBar,等同于gca()->addBar
| xyDatas |
| void DA::DAFigureWidget::addChart | ( | DAChartWidget * | chart, |
| qreal | xVersatile, | ||
| qreal | yVersatile, | ||
| qreal | wVersatile, | ||
| qreal | hVersatile | ||
| ) |
添加一个chart,指定位置占比
| chart | 绘图 |
| xPresent | |
| yPresent | |
| wVersatile | |
| hPresent |
| QwtPlotCurve * DA::DAFigureWidget::addCurve_ | ( | const QVector< QPointF > & | xyDatas | ) |
支持redo/undo的addCurve,等同于gca()->addCurve
| xyDatas |
| QwtPlotIntervalCurve * DA::DAFigureWidget::addErrorBar_ | ( | const QVector< double > & | values, |
| const QVector< double > & | mins, | ||
| const QVector< double > & | maxs | ||
| ) |
支持redo/undo的addBar,等同于gca()->addBar
| xyDatas |
| void DA::DAFigureWidget::addItem_ | ( | DAChartWidget * | chart, |
| QwtPlotItem * | item | ||
| ) |
支持redo/undo的添加item
| chart | |
| item |
| bool DA::DAFigureWidget::addItem_ | ( | QwtPlotItem * | item | ) |
支持redo/undo的添加item
等同addItem_(gca(),item)
| item |
| QwtPlotCurve * DA::DAFigureWidget::addScatter_ | ( | const QVector< QPointF > & | xyDatas | ) |
支持redo/undo的addScatter,等同于gca()->addCurve
| xyDatas |
| bool DA::DAFigureWidget::bindAxisRange | ( | QwtPlot * | source, |
| QwtAxisId | sourceAxisid, | ||
| QwtPlot * | follower, | ||
| QwtAxisId | followerAxisid | ||
| ) |
绑定坐标轴的范围
| source | 主坐标轴绘图 |
| sourceAxisid | 主坐标轴绘图绑定的轴id |
| follower | 跟随坐标轴绘图 |
| followerAxisid | 跟随坐标轴绘图绑定的轴id |
| bool DA::DAFigureWidget::bindAxisRange | ( | QwtPlot * | source, |
| QwtPlot * | follower, | ||
| QwtAxisId | axisid | ||
| ) |
绑定坐标轴的范围
| source | 主坐标轴绘图 |
| follower | 跟随坐标轴绘图 |
| axisid | 绑定的轴id |
|
signal |
添加了chart
| chart指针 |
|
signal |
绘图移除信号
| c |
| DAChartWidget * DA::DAFigureWidget::createChart | ( | ) |
添加一个chart
默认的位置占比为0.05f, 0.05f, 0.9f, 0.9f
| DAChartWidget * DA::DAFigureWidget::createChart | ( | const QRectF & | versatileSize | ) |
创建绘图
| versatileSize | |
| relativePos |
| DAChartWidget * DA::DAFigureWidget::createChart | ( | float | xVersatile, |
| float | yVersatile, | ||
| float | wVersatile, | ||
| float | hVersatile | ||
| ) |
添加一个chart,指定位置占比
| xVersatile | |
| yPresent | |
| wPresent | |
| hPresent |
| DAChartWidget * DA::DAFigureWidget::createChart_ | ( | ) |
支持redo/undo的createchart
| DAChartWidget * DA::DAFigureWidget::createChart_ | ( | const QRectF & | versatileSize | ) |
支持redo/undo的createchart
| versatileSize | |
| yPresent | |
| wVersatile | |
| hPresent |
| DAChartWidget * DA::DAFigureWidget::currentChart | ( | ) |
获取当前的chart,如果没有current chart,或figure不存在chart, 则创建一个新chart,此函数不返回nullptr
|
signal |
当前的绘图发生了变更
当前窗口是figure的默认窗口,任何对figure的动作会作用于当前绘图
| w |
| QwtFigure * DA::DAFigureWidget::figure | ( | ) | const |
获取绘图窗口
| DAChartWidget * DA::DAFigureWidget::findChartFromItem | ( | QwtPlotItem * | item | ) | const |
通过item查找对应的SAChart2D,如果没有返回nullptr
| item |
| QwtPlot * DA::DAFigureWidget::findPlotById | ( | const QString & | id, |
| bool | findParasite = true |
||
| ) | const |
通过id查找plot
| id | |
| findParasite | 是否查找寄生绘图 |
| DAChartWidget * DA::DAFigureWidget::gca | ( | ) | const |
like matlab/matplotlib api gca
| const QBrush & DA::DAFigureWidget::getBackgroundColor | ( | ) | const |
获取背景颜色
| QList< DAChartAxisRangeBinder * > DA::DAFigureWidget::getBindAxisRangeInfos | ( | ) | const |
获取坐标轴绑定信息
| int DA::DAFigureWidget::getChartCount | ( | ) | const |
获取图表的数量
| QList< DAChartWidget * > DA::DAFigureWidget::getCharts | ( | ) | const |
获取所有的绘图
| DAChartWidget * DA::DAFigureWidget::getCurrentChart | ( | ) | const |
当前的图表的指针
|
virtual |
获取默认的绘图颜色
每次调用figure的绘图相关函数,会调用getDefaultColor获取默认颜色为曲线填充, 默认会根据颜色主题来变换颜色,也可以继承此函数,让figure每次给出自定义的颜色
| DAFigureWidgetOverlay * DA::DAFigureWidget::getSubChartEditor | ( | ) | const |
获取子窗口编辑器指针,若没有此编辑器,返回nullptr
此指针的管理权在SAFigureWindow上,不要在外部对此指针进行释放
| DAChartWidget * DA::DAFigureWidget::getUnderCursorChart | ( | ) | const |
返回在当前光标下的2D图
| QWidget * DA::DAFigureWidget::getUnderCursorWidget | ( | ) | const |
返回当前光标下的widget
| QUndoStack * DA::DAFigureWidget::getUndoStack | ( | ) |
获取内部的undoStack
| bool DA::DAFigureWidget::hasPlot | ( | QwtPlot * | chart, |
| bool | includeParasite = true |
||
| ) | const |
是否存在这个绘图
| chart | 绘图 |
| includeParasite | 是否包括寄生绘图 |
| bool DA::DAFigureWidget::isEnableSubChartEditor | ( | ) | const |
SAFigureWindow::isSubWindowEditingMode
| QwtPlot * DA::DAFigureWidget::plotUnderPos | ( | const QPoint & | pos | ) | const |
获取在此坐标下的绘图,如果此坐标下没有,则返回nullptr,存在寄生轴情况只返回宿主轴
| pos | 相对于DAFigureWidget的位置 |
| void DA::DAFigureWidget::push | ( | QUndoCommand * | cmd | ) |
推入一个命令
| cmd |
| void DA::DAFigureWidget::removeChart | ( | DAChartWidget * | chart | ) |
移除chart,但不会delete
| chart |
| void DA::DAFigureWidget::setBackgroundColor | ( | const QBrush & | brush | ) |
设置figure背景
| brush |
| void DA::DAFigureWidget::setBackgroundColor | ( | const QColor & | clr | ) |
设置figure背景
| clr |
| void DA::DAFigureWidget::setCurrentChart | ( | QwtPlot * | p | ) |
设置当前的chart
| p | 如果p和当前的currentChart一样,不做任何动作 |
| void DA::DAFigureWidget::setDataPickerGroupEnabled | ( | bool | on | ) |
设置联动数据拾取,联动数据拾取会让当前所有绘图的QwtPlotSeriesDataPicker建立分组,进行联动
| on |
| void DA::DAFigureWidget::setSubChartEditorEnable | ( | bool | enable = true | ) |
是否开始子窗口编辑模式
| enable | |
| ptr | 通过此参数可以指定自定义的编辑器,若为nullptr,将使用默认的编辑器,此指针的管理权将移交SAFigureWindow |
| void DA::DAFigureWidget::setupChartFactory | ( | DAChartFactory * | fac | ) |
设置ChartFactory
| fac |