logplus/logPlus/transparentdraggableGuan.h
2026-03-23 10:20:20 +08:00

102 lines
2.7 KiB
C++

#ifndef TRANSPARENTDRAGGABLEGUAN_H
#define TRANSPARENTDRAGGABLEGUAN_H
#include <QObject>
#include "qmycustomplot.h"
#include <QString>
#include <QMenu>
#include "geometryutils.h"
#include <QSvgRenderer>
#pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8
class TransparentDraggableGuan : public QObject
{
Q_OBJECT
public:
explicit TransparentDraggableGuan(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = "");
~TransparentDraggableGuan();
void DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
//拉伸
void DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
//平铺
void DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
//设置最小宽度
void setMinWidth(double minWidth);
//设置标题
//void setTitle(QString strTitle);
//设置外径长
void setOin(float in);
//设置套管组件
void setResult(QString filePath);
void drawResult(double left_Low, double right_Hight, double lY1, double lY2);
// 设置矩形范围
void setRange(double left_Low, double right_Hight, bool bReplot=true);
// 获取当前范围
QCPRange getRange();
// 设置矩形颜色
void setColor(const QColor &color);
// 删除框图
void deleteRect();
signals:
void rangeChanged(QCPRange newRange);
private:
void initRect();
void updateHandles() ;
private slots:
void onDelRect(); //删除
void setItemDepthOffset(); //设置深度移动量
void onMousePress(QMouseEvent *event);
void onMouseMove(QMouseEvent *event);
void onMouseRelease(QMouseEvent *event);
double getMyLower();
double getMyUpper();
public:
QMyCustomPlot *mPlot;
QCPItemRect *mRect;
// QCPItemRect *mLeftHandle;
// QCPItemRect *mRightHandle;
QCPItemPixmap *mPixmap;
QCPItemText *mItemTitle;
QString mstrTitle="";
QCPItemText *mItemTitle2;
QString mstrTitle2="";
QString m_strUuid = "";
QString m_Result;
enum DragMode { DragNone, DragLeft, DragRight, DragRect };
DragMode mDragMode = DragNone;
//double mDragStartX = 0;
double mDragStartY = 0;
QCPRange mDragStartRange;
// 添加最小宽度成员变量
double mMinWidth;
//套管组件外径
float mIn = 123;
//套管组件高度
double mH = 0;
//鼠标形状
bool m_bArrow = false;
bool m_bMoveRect = false;
int getCursor();
//鼠标是否拖动item
bool m_bChange = false;
};
#endif // TRANSPARENTDRAGGABLEGUAN_H