岩心图片 属性修改
This commit is contained in:
parent
382f654d52
commit
40be7bf16a
|
|
@ -14,7 +14,7 @@ extern double g_dPixelPerCm;//每厘米像素数
|
||||||
PropertyWidget::PropertyWidget(const QString &title, QWidget *parent , Qt::WindowFlags flags )
|
PropertyWidget::PropertyWidget(const QString &title, QWidget *parent , Qt::WindowFlags flags )
|
||||||
:QDockWidget(title,parent,flags)
|
:QDockWidget(title,parent,flags)
|
||||||
{
|
{
|
||||||
//
|
//1
|
||||||
m_pPropertyBrowser = new QtTreePropertyBrowser();
|
m_pPropertyBrowser = new QtTreePropertyBrowser();
|
||||||
this->setWidget(m_pPropertyBrowser);
|
this->setWidget(m_pPropertyBrowser);
|
||||||
//
|
//
|
||||||
|
|
@ -126,6 +126,128 @@ void PropertyWidget::CommonPropertyChanged( QtProperty *pProperty, const QVarian
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PropertyWidget::changedYxzpProperty(QtProperty *qtProperty, const QVariant &variant)
|
||||||
|
{
|
||||||
|
if("选择井曲线" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
QString sFilePath = variant.value<QString>();
|
||||||
|
if(sFilePath.indexOf("@")>-1)
|
||||||
|
{
|
||||||
|
int ind=sFilePath.indexOf("@");
|
||||||
|
QString strLineName = sFilePath.left(ind);
|
||||||
|
sFilePath=sFilePath.mid(ind+1);
|
||||||
|
sFilePath.trimmed();
|
||||||
|
//只支持以下名称
|
||||||
|
if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT")
|
||||||
|
{
|
||||||
|
QString strOldLineName = m_formInfo->m_strLineName;
|
||||||
|
QString strOldSlfName = m_formInfo->m_strSlfName;
|
||||||
|
//暂时不允许改变slf井次名称,不然不在同一口井绘制
|
||||||
|
if(strOldSlfName != sFilePath)
|
||||||
|
{
|
||||||
|
QMessageBox::information(nullptr,"提示","不允许改变slf井次名称");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//名称不变
|
||||||
|
if(strOldLineName == strLineName)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
m_formInfo->m_strLineName = strLineName;
|
||||||
|
//m_formInfo->m_strSlfName = sFilePath;
|
||||||
|
m_formInfo->update();
|
||||||
|
|
||||||
|
//改变固井曲线名
|
||||||
|
emit CallManage::getInstance()->sig_changeGujingLine(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, strOldLineName, strLineName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("例区高度(cm)" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWidget::changedYxzpItemProperty(QtProperty *qtProperty, const QVariant &qVariant)
|
||||||
|
{
|
||||||
|
if("顶深(m)" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
double upper = qVariant.value<double>();
|
||||||
|
m_tdImage->setUpper(-upper);
|
||||||
|
//保存
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("底深(m)" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
double lower = qVariant.value<double>();
|
||||||
|
m_tdImage->setLower(-lower);
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("图片文件" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
QString pictureFile = qVariant.value<QString>();
|
||||||
|
qDebug()<<pictureFile<<"-------------";
|
||||||
|
// m_tdImage->setLower(-lower);
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("左边距%" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
// int lower = qVariant.value<int>();
|
||||||
|
// m_tdImage->setLower(-lower);
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("宽度%" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
// double lower = qVariant.value<double>();
|
||||||
|
// m_tdImage->setLower(-lower);
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("线宽" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
// double lower = qVariant.value<double>();
|
||||||
|
// m_tdImage->setLower(-lower);
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("颜色" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
// double lower = qVariant.value<double>();
|
||||||
|
// m_tdImage->setLower(-lower);
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("线型" == m_propertyData[qtProperty])
|
||||||
|
{
|
||||||
|
if(m_tdImage)
|
||||||
|
{
|
||||||
|
// double lower = qVariant.value<double>();
|
||||||
|
// m_tdImage->setLower(-lower);
|
||||||
|
m_tdImage->mPlot->SaveToSLFImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant )
|
void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant )
|
||||||
{
|
{
|
||||||
if(m_strCurrentProperty == "")
|
if(m_strCurrentProperty == "")
|
||||||
|
|
@ -279,6 +401,13 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_strCurrentProperty == Image_Property) // 岩心照片
|
||||||
|
{
|
||||||
|
// 先处理通用属性
|
||||||
|
CommonPropertyChanged(pProperty, variant);
|
||||||
|
changedYxzpProperty(pProperty, variant);
|
||||||
|
|
||||||
|
}
|
||||||
else if (m_strCurrentProperty == SwallCore_Property)//井壁取心
|
else if (m_strCurrentProperty == SwallCore_Property)//井壁取心
|
||||||
{
|
{
|
||||||
//先处理通用属性
|
//先处理通用属性
|
||||||
|
|
@ -570,6 +699,12 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_strCurrentProperty == ImageItem_Property)
|
||||||
|
{
|
||||||
|
//先处理通用属性
|
||||||
|
CommonPropertyChanged(pProperty, variant);
|
||||||
|
changedYxzpItemProperty(pProperty, variant);
|
||||||
|
}
|
||||||
else if (m_strCurrentProperty == SwallCoreItem_Property)
|
else if (m_strCurrentProperty == SwallCoreItem_Property)
|
||||||
{
|
{
|
||||||
//先处理通用属性
|
//先处理通用属性
|
||||||
|
|
@ -2178,6 +2313,11 @@ void PropertyWidget::initProperty(FormInfo *formInfo)
|
||||||
//固井结论
|
//固井结论
|
||||||
this->initGujingProperty(formInfo);
|
this->initGujingProperty(formInfo);
|
||||||
}
|
}
|
||||||
|
if (m_strLineName == "IMAGE_DATA")
|
||||||
|
{
|
||||||
|
// 岩心图片
|
||||||
|
this->initImageProperty(formInfo);
|
||||||
|
}
|
||||||
else if (m_strLineName == "SWALL_CORE")
|
else if (m_strLineName == "SWALL_CORE")
|
||||||
{
|
{
|
||||||
//井壁取心
|
//井壁取心
|
||||||
|
|
@ -2589,6 +2729,69 @@ void PropertyWidget::initGujingItemProperty(TransparentDraggableGujing* tdGujing
|
||||||
_CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId());
|
_CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PropertyWidget::initImageProperty(FormInfo *formInfo)
|
||||||
|
{
|
||||||
|
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
|
||||||
|
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
|
||||||
|
_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_yxzpExampleAreaHeight, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool);
|
||||||
|
_CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font);
|
||||||
|
_CreateVariantPropertyItem("通常", "颜色", formInfo->m_lineColor, QVariant::Color);
|
||||||
|
|
||||||
|
_CreateVariantPropertyItem("当前项", "标注字体", formInfo->m_yxzpLabelFont, QVariant::Font);
|
||||||
|
_CreateVariantPropertyItem("当前项", "标注旋转", formInfo->m_yxzpLabelRotation, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("当前项", "两端绘制", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
|
||||||
|
_CreateVariantPropertyItem("当前项", "绘制颜色", formInfo->m_yxzpDrawColor, QVariant::Bool);
|
||||||
|
|
||||||
|
m_strCurrentProperty = Image_Property;
|
||||||
|
}
|
||||||
|
void PropertyWidget::initImageItemProperty(TransparentDraggableImage* tdImage, double lower, double upper, QString pictureFile)
|
||||||
|
{
|
||||||
|
//初始化,清空
|
||||||
|
InitCurrentViewInfo();
|
||||||
|
FormInfo* formInfo = tdImage->mPlot->m_formTrack->getFormInfoByParameters(tdImage->mPlot->m_strUuid, tdImage->mPlot->m_strWellName,
|
||||||
|
tdImage->mPlot->m_strTrackName, tdImage->mPlot->m_strLineName);
|
||||||
|
if (formInfo != NULL)
|
||||||
|
{
|
||||||
|
m_formInfo = formInfo;
|
||||||
|
|
||||||
|
m_strUuid = formInfo->m_strUuid;
|
||||||
|
m_strTrackUuid = formInfo->m_strTrackUuid;
|
||||||
|
//
|
||||||
|
m_strSlfName = formInfo->m_strSlfName;
|
||||||
|
m_strWellName = formInfo->m_strWellName;
|
||||||
|
m_strTrackName = formInfo->m_strTrackName;
|
||||||
|
m_strLineName = formInfo->m_strLineName;
|
||||||
|
|
||||||
|
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
|
||||||
|
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
|
||||||
|
_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_yxzpExampleAreaHeight, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool);
|
||||||
|
_CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font);
|
||||||
|
_CreateVariantPropertyItem("通常", "颜色", formInfo->m_lineColor, QVariant::Color);
|
||||||
|
|
||||||
|
_CreateVariantPropertyItem("当前项", "标注字体", formInfo->m_yxzpLabelFont, QVariant::Font);
|
||||||
|
_CreateVariantPropertyItem("当前项", "标注旋转", formInfo->m_yxzpLabelRotation, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("当前项", "两端绘制", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
|
||||||
|
_CreateVariantPropertyItem("当前项", "绘制颜色", formInfo->m_yxzpDrawColor, QVariant::Bool);
|
||||||
|
_CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double);
|
||||||
|
_CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double);
|
||||||
|
_CreateVariantPropertyItem("当前项", "图片文件", formInfo->m_yxzpPictureFile, VariantManager::filePathTypeId());
|
||||||
|
_CreateVariantPropertyItem("当前项", "左边距%", formInfo->m_yxzpLeftMargin, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("当前项", "宽度%", formInfo->m_yxzpWidth, QVariant::Int);
|
||||||
|
|
||||||
|
_CreateVariantPropertyItem("边框属性", "线宽", formInfo->m_yxzpLineWidth, QVariant::Int);
|
||||||
|
_CreateVariantPropertyItem("边框属性", "颜色", formInfo->m_yxzpColor, QVariant::Color);
|
||||||
|
_CreateVariantPropertyItem("边框属性", "线型", formInfo->m_yxzpLineshape, QVariant::String);
|
||||||
|
}
|
||||||
|
|
||||||
|
//当前属性类型
|
||||||
|
m_strCurrentProperty = ImageItem_Property;
|
||||||
|
m_tdImage = tdImage;
|
||||||
|
}
|
||||||
|
|
||||||
void PropertyWidget::initGeoLithProperty(FormInfo *formInfo)
|
void PropertyWidget::initGeoLithProperty(FormInfo *formInfo)
|
||||||
{
|
{
|
||||||
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
|
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include "qmytablewidget.h"
|
#include "qmytablewidget.h"
|
||||||
#include "formtracktop.h"
|
#include "formtracktop.h"
|
||||||
#include "TransparentDraggableGujing.h"
|
#include "TransparentDraggableGujing.h"
|
||||||
|
#include "transparentdraggableimage.h"
|
||||||
#include "TransparentDraggableSwallCore.h"
|
#include "TransparentDraggableSwallCore.h"
|
||||||
#include "TransparentDraggableGeoLith.h"
|
#include "TransparentDraggableGeoLith.h"
|
||||||
#include "TransparentDraggableRect.h"
|
#include "TransparentDraggableRect.h"
|
||||||
|
|
@ -43,6 +44,9 @@
|
||||||
#define Gujing_Property "Gujing_Property" //固井结论
|
#define Gujing_Property "Gujing_Property" //固井结论
|
||||||
#define GujingItem_Property "GujingItem_Property" //固井item
|
#define GujingItem_Property "GujingItem_Property" //固井item
|
||||||
|
|
||||||
|
#define Image_Property "Image_Property" // 岩心图片
|
||||||
|
#define ImageItem_Property "ImageItem_Property" // 岩心图片item
|
||||||
|
|
||||||
#define SwallCore_Property "SwallCore_Property" //井壁取心
|
#define SwallCore_Property "SwallCore_Property" //井壁取心
|
||||||
#define SwallCoreItem_Property "SwallCoreItem_Property" //井壁取心item
|
#define SwallCoreItem_Property "SwallCoreItem_Property" //井壁取心item
|
||||||
|
|
||||||
|
|
@ -124,7 +128,8 @@ public:
|
||||||
|
|
||||||
TransparentGroupResult* m_tdJieshi;
|
TransparentGroupResult* m_tdJieshi;
|
||||||
//
|
//
|
||||||
TransparentDraggableGujing* m_tdGujing;
|
TransparentDraggableGujing* m_tdGujing;
|
||||||
|
TransparentDraggableImage* m_tdImage;
|
||||||
TransparentDraggableSwallCore* m_tdSwallCore;
|
TransparentDraggableSwallCore* m_tdSwallCore;
|
||||||
TransparentDraggableGeoLith* m_tdGeoLith;
|
TransparentDraggableGeoLith* m_tdGeoLith;
|
||||||
TransparentDraggableRect* m_tdText;
|
TransparentDraggableRect* m_tdText;
|
||||||
|
|
@ -168,6 +173,10 @@ public:
|
||||||
void initGujingProperty(FormInfo *formInfo);
|
void initGujingProperty(FormInfo *formInfo);
|
||||||
void initGujingItemProperty(TransparentDraggableGujing* tdGujing, double lower, double upper, QString strResult);
|
void initGujingItemProperty(TransparentDraggableGujing* tdGujing, double lower, double upper, QString strResult);
|
||||||
|
|
||||||
|
// 岩心照片属性
|
||||||
|
void initImageProperty(FormInfo *formInfo);
|
||||||
|
void initImageItemProperty(TransparentDraggableImage* tdImage, double lower, double upper, QString strResult);
|
||||||
|
|
||||||
// 井壁取心属性
|
// 井壁取心属性
|
||||||
void initSwallCoreProperty(FormInfo *formInfo);
|
void initSwallCoreProperty(FormInfo *formInfo);
|
||||||
void initSwallCoreItemProperty(TransparentDraggableSwallCore* tdSwallCore, double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor);
|
void initSwallCoreItemProperty(TransparentDraggableSwallCore* tdSwallCore, double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor);
|
||||||
|
|
@ -195,6 +204,9 @@ public:
|
||||||
//处理通用属性
|
//处理通用属性
|
||||||
void CommonPropertyChanged(QtProperty *pProperty, const QVariant &variant);
|
void CommonPropertyChanged(QtProperty *pProperty, const QVariant &variant);
|
||||||
|
|
||||||
|
void changedYxzpProperty(QtProperty *pProperty, const QVariant &variant);
|
||||||
|
void changedYxzpItemProperty(QtProperty *pProperty, const QVariant &variant);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SlotPropertyChanged(QtProperty *property, const QVariant &variant);
|
void SlotPropertyChanged(QtProperty *property, const QVariant &variant);
|
||||||
void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle);
|
void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle);
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,30 @@ public:
|
||||||
bool m_bShowColorNum = false; // 绘制颜色号
|
bool m_bShowColorNum = false; // 绘制颜色号
|
||||||
double m_dOilZhan = 8; //含油占比
|
double m_dOilZhan = 8; //含油占比
|
||||||
|
|
||||||
|
// 岩心照片
|
||||||
|
// 例区高度
|
||||||
|
int m_yxzpExampleAreaHeight;
|
||||||
|
// 标注字体
|
||||||
|
QFont m_yxzpLabelFont;
|
||||||
|
// 标注旋转
|
||||||
|
int m_yxzpLabelRotation;
|
||||||
|
// 两端绘制
|
||||||
|
bool m_yxzpTwoEndDrawing;
|
||||||
|
// 绘制颜色
|
||||||
|
bool m_yxzpDrawColor;
|
||||||
|
// 图片文件
|
||||||
|
QString m_yxzpPictureFile;
|
||||||
|
// 左边距
|
||||||
|
QString m_yxzpLeftMargin;
|
||||||
|
// 宽度
|
||||||
|
QString m_yxzpWidth;
|
||||||
|
// 线宽
|
||||||
|
QString m_yxzpLineWidth;
|
||||||
|
// 颜色
|
||||||
|
QString m_yxzpColor;
|
||||||
|
// 线型
|
||||||
|
QString m_yxzpLineshape;
|
||||||
|
|
||||||
//气测/FMT/射孔/文本
|
//气测/FMT/射孔/文本
|
||||||
QStringList m_FieldNameList;
|
QStringList m_FieldNameList;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1715,7 +1715,7 @@ void QMyCustomPlot::onEditImage()
|
||||||
this->addImageToPlot(left_Low, right_Hight, imagePath);
|
this->addImageToPlot(left_Low, right_Hight, imagePath);
|
||||||
|
|
||||||
//保存
|
//保存
|
||||||
this->SaveToSLFImage(imagePath);
|
this->SaveToSLFImage();
|
||||||
|
|
||||||
//属性清空
|
//属性清空
|
||||||
PropertyService()->InitCurrentViewInfo();
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
|
@ -2634,7 +2634,7 @@ bool QMyCustomPlot::SaveToSLF_Gujing()
|
||||||
}
|
}
|
||||||
|
|
||||||
//保存岩心图片
|
//保存岩心图片
|
||||||
bool QMyCustomPlot::SaveToSLFImage(QString imagePath)
|
bool QMyCustomPlot::SaveToSLFImage()
|
||||||
{
|
{
|
||||||
static int isrun=false;
|
static int isrun=false;
|
||||||
if(isrun) return false;
|
if(isrun) return false;
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ public:
|
||||||
|
|
||||||
// 岩心图片
|
// 岩心图片
|
||||||
QMap<QString,QString> zoneOrderImage;
|
QMap<QString,QString> zoneOrderImage;
|
||||||
bool SaveToSLFImage(QString imagePath);
|
bool SaveToSLFImage();
|
||||||
|
|
||||||
//井壁取心
|
//井壁取心
|
||||||
QStringList liths_SWallCore;
|
QStringList liths_SWallCore;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "transparentdraggableimage.h"
|
#include "transparentdraggableimage.h"
|
||||||
|
#include "PropertyWidget.h"
|
||||||
|
|
||||||
|
|
||||||
extern double g_dPixelPerCm;//每厘米像素数
|
extern double g_dPixelPerCm;//每厘米像素数
|
||||||
|
|
@ -339,17 +340,19 @@ void TransparentDraggableImage::onMousePress(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//event->accept();
|
//event->accept();
|
||||||
|
// 显示属性
|
||||||
|
double low = mRect->topLeft->coords().x();
|
||||||
|
double hight = mRect->bottomRight->coords().x();
|
||||||
|
PropertyService()->initImageItemProperty(this, low, hight, m_Result);
|
||||||
|
|
||||||
QMenu menu(nullptr);
|
QMenu menu(nullptr);
|
||||||
QAction *delAction = menu.addAction("删除框图");
|
QAction *delAction = menu.addAction("删除框图");
|
||||||
//delAction->installEventFilter(this);
|
//delAction->installEventFilter(this);
|
||||||
connect(delAction, &QAction::triggered, this, &TransparentDraggableImage::onDelRect);
|
connect(delAction, &QAction::triggered, this, &TransparentDraggableImage::onDelRect);
|
||||||
|
|
||||||
// QAction* pItem = menu.exec(event->globalPos());
|
// QAction* pItem = menu.exec(event->globalPos());
|
||||||
// if(pItem == delAction)
|
// if(pItem == delAction)
|
||||||
// {
|
// {
|
||||||
// //event->accept();
|
// //event->accept();
|
||||||
|
|
||||||
// int ii=0;
|
// int ii=0;
|
||||||
// ii++;
|
// ii++;
|
||||||
// }
|
// }
|
||||||
|
|
@ -491,6 +494,12 @@ void TransparentDraggableImage::onMouseRelease(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||||
event->accept();
|
event->accept();
|
||||||
|
// 显示属性
|
||||||
|
double low = mRect->topLeft->coords().x();
|
||||||
|
double hight = mRect->bottomRight->coords().x();
|
||||||
|
PropertyService()->initImageItemProperty(this, low, hight, m_Result);
|
||||||
|
|
||||||
|
|
||||||
//避免二次绘制框图
|
//避免二次绘制框图
|
||||||
mPlot->m_bDrawRect = false;
|
mPlot->m_bDrawRect = false;
|
||||||
//emit rangeChanged(getRange());
|
//emit rangeChanged(getRange());
|
||||||
|
|
@ -564,3 +573,46 @@ double TransparentDraggableImage::getMyUpper()
|
||||||
|
|
||||||
return dUpper;
|
return dUpper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置顶深
|
||||||
|
void TransparentDraggableImage::setUpper(double upper)
|
||||||
|
{
|
||||||
|
QCPRange currentRange = getRange();
|
||||||
|
QCPRange newRange = currentRange;
|
||||||
|
|
||||||
|
double proposedRight = upper;
|
||||||
|
// 确保不超出轴范围且不使宽度小于最小值
|
||||||
|
newRange.upper = qBound(
|
||||||
|
currentRange.lower + mMinWidth,
|
||||||
|
proposedRight,
|
||||||
|
getMyUpper());
|
||||||
|
|
||||||
|
// 最终确保宽度不小于最小值(针对整体拖动的情况)
|
||||||
|
if(newRange.size() < mMinWidth) {
|
||||||
|
newRange.upper = newRange.lower + mMinWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRange(newRange.lower, newRange.upper);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置底深
|
||||||
|
void TransparentDraggableImage::setLower(double lower)
|
||||||
|
{
|
||||||
|
QCPRange currentRange = getRange();
|
||||||
|
QCPRange newRange = currentRange;
|
||||||
|
|
||||||
|
double proposedLeft = lower;
|
||||||
|
// 确保不超出轴范围且不使宽度小于最小值
|
||||||
|
newRange.lower = qBound(
|
||||||
|
getMyLower(),
|
||||||
|
proposedLeft,
|
||||||
|
currentRange.upper - mMinWidth);
|
||||||
|
|
||||||
|
// 最终确保宽度不小于最小值(针对整体拖动的情况)
|
||||||
|
if(newRange.size() < mMinWidth) {
|
||||||
|
// 如果是边界拖动,强制设置最小宽度
|
||||||
|
newRange.lower = newRange.upper - mMinWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRange(newRange.lower, newRange.upper);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ class TransparentDraggableImage : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
QMyCustomPlot *mPlot;
|
||||||
|
|
||||||
explicit TransparentDraggableImage(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = "");
|
explicit TransparentDraggableImage(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = "");
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -46,6 +48,9 @@ public:
|
||||||
// 删除框图
|
// 删除框图
|
||||||
void deleteRect();
|
void deleteRect();
|
||||||
|
|
||||||
|
void setUpper(double upper);
|
||||||
|
void setLower(double lower);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rangeChanged(QCPRange newRange);
|
void rangeChanged(QCPRange newRange);
|
||||||
|
|
||||||
|
|
@ -62,7 +67,7 @@ private slots:
|
||||||
double getMyUpper();
|
double getMyUpper();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMyCustomPlot *mPlot;
|
|
||||||
QCPItemRect *mRect;
|
QCPItemRect *mRect;
|
||||||
QCPItemRect *mLeftHandle;
|
QCPItemRect *mLeftHandle;
|
||||||
QCPItemRect *mRightHandle;
|
QCPItemRect *mRightHandle;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user