You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmPlot/nmPlotView.h

65 lines
1.9 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <QPointer>
#include "tCurvePlotView.h"
#include "nmPlot_global.h"
class nmPlotScene;
class nmObjToolBase;
// 数值试井绘图 View
class NM_PLOT_EXPORT nmPlotView : public tCurvePlotView
{
Q_OBJECT
ZX_DECLARE_DYNAMIC
public:
nmPlotView();
// 工具仅登记本次松手后的光标刷新,由视图在框架收尾后统一执行。
void requestHoverCursorRefresh(nmObjToolBase* tool);
// 登记当前可取消的工具;仅由主动支持 Esc 的绘制、编辑操作调用。
void setCancellableTool(nmObjToolBase* tool);
// 显示当前创建操作的检查提示,鼠标移动时与坐标一起显示;空串表示清除。
void setCreationHint(const QString& hint);
public:
// 准备右键菜单
virtual void onPrepareContextMenu(QMenu* pMenu,
const QPointF& pos) override;
public slots:
signals:
// 鼠标在绘图区内的位置,使用模型坐标。
void sigPointerPos(double x, double y);
protected:
// 拖拽支持
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent* event);
void mouseMoveEvent(QMouseEvent* e);
// 框架完成松手收尾后,恢复本次编辑工具在当前位置的悬停光标。
void mouseReleaseEvent(QMouseEvent* e) override;
// 在框架过滤“鼠标按住时的键盘事件”之前处理 Esc,其余按键沿用框架。
void keyPressEvent(QKeyEvent* e) override;
void focusOutEvent(QFocusEvent *);
void leaveEvent(QEvent *);
private:
QString m_sCreationHint; // 创建失败的原因;下一次有效选点、完成、取消或切换工具时清除。
QPointer<nmObjToolBase> m_cancellableTool; // 最近开始的可取消操作;工具销毁后自动置空。
QPointer<nmObjToolBase> m_pendingCursorTool; // 本次松手请求刷新的工具;销毁后自动置空。
};