logplus/logPlus/PropertyWidget.cpp

906 lines
30 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "PropertyWidget.h"
#include <QScrollBar>
#include <QDateTime>
#include <QDebug>
#include <QSvgRenderer>
#include <QLabel>
#include "CallManage.h"
extern int g_iScale;
extern double g_dPixelPerCm;//每厘米像素数
extern int g_iY1;
extern int g_iY2;
PropertyWidget::PropertyWidget(const QString &title, QWidget *parent , Qt::WindowFlags flags )
:QDockWidget(title,parent,flags)
{
//
m_pPropertyBrowser = new QtTreePropertyBrowser();
this->setWidget(m_pPropertyBrowser);
//
m_pVariantManager = new VariantManager();//new QtVariantPropertyManager();
QtVariantEditorFactory *variantFactory = new VariantFactory();//new QtVariantEditorFactory();
m_pPropertyBrowser->setFactoryForManager(m_pVariantManager, variantFactory);
//
m_pPropertyBrowser->setPropertiesWithoutValueMarked(true);
m_pPropertyBrowser->setRootIsDecorated(true);
m_pPropertyBrowser->setIndentation(8);
connect( m_pVariantManager,SIGNAL(valueChanged(QtProperty *, const QVariant &)),
this,SLOT(SlotPropertyChanged(QtProperty *, const QVariant &)) );
}
PropertyWidget::~PropertyWidget()
{
QVector<QtTreePropertyBrowser*> aa;
aa.append(m_pPropertyBrowser);
qDeleteAll(aa);
}
PropertyWidget* PropertyService()
{
static PropertyWidget* singleInstance= new PropertyWidget("", nullptr, 0);
return singleInstance;
}
QWidget* PropertyWidget::GetPropertyWidget()
{
return m_pPropertyBrowser;
}
//初始化,清空
void PropertyWidget::InitCurrentViewInfo()
{
QList<QtProperty*> propertyList = m_pPropertyBrowser->properties();
m_pPropertyBrowser->clear();
foreach(QtProperty *property, propertyList)
{
if (property)
{
delete property;
}
}
//map清空
m_propertyData.clear();
m_mapGroupItem.clear();
m_strUuid = "";
m_strSlfName = "";
m_strWellName = "";
m_strTrackName = "";
m_strLineName = "";
//
m_strCurrentProperty = "";
}
void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant )
{
if("深度比例尺" == m_propertyData[pProperty])
{
//qDebug() << "深度比例尺->改变";
//当前属性类型
if(m_strCurrentProperty == Widget_Property)
{
int iScale = 200;
QString newScale = pProperty->valueText();
//qDebug() << "深度比例尺->" << newScale;
//
int pos = newScale.indexOf(":");
if(pos>-1)
{
newScale = newScale.mid(pos+1);
iScale = atoi(newScale.toStdString().c_str());
}
else
{
iScale = 200;
}
//
g_iScale = iScale;
//清空自定义比例尺,防止混淆
for (auto it = m_propertyData.constBegin(); it != m_propertyData.constEnd(); ++it)
{
if(it.value()=="自定义比例尺")
{
m_bSelfChange=true;
QtVariantProperty *tempProperty = (QtVariantProperty*)it.key();
tempProperty->setValue("");
}
}
//通知界面缩放
emit CallManage::getInstance()->sig_changeScale(g_iScale);
}
}
else if("自定义比例尺" == m_propertyData[pProperty])
{
if(m_bSelfChange==true)
{
m_bSelfChange=false;
return;
}
//qDebug() << "自定义比例尺->改变";
//当前属性类型
if(m_strCurrentProperty == Widget_Property)
{
int iScale = 200;
QString newScale = variant.value<QString>();
//qDebug() << "自定义比例尺->" << newScale;
newScale.replace("",":");
//
int pos = newScale.indexOf(":");
if(pos>-1)
{
QString leftScale = newScale.mid(0, pos);
double ileftScale = atof(leftScale.toStdString().c_str());
if(ileftScale<=0)
{
//不合规
return;
}
//
QString rightScale = newScale.mid(pos+1);
double iRightScale = atof(rightScale.toStdString().c_str());
if(iRightScale<=0)
{
//不合规
return;
}
iScale = iRightScale/ileftScale;
}
else
{
//不合规
return;
}
//
g_iScale = iScale;
//通知界面缩放
emit CallManage::getInstance()->sig_changeScale(g_iScale);
}
}
else if("开始深度(m)" == m_propertyData[pProperty])
{
//qDebug() << "开始深度(m)->改变";
//当前属性类型
if(m_strCurrentProperty == Well_Property)
{
double newStartDepth = variant.value<double>();
g_iY2 = 0 - newStartDepth;
if(g_iY2 < g_iY1)
{
return;
}
//通知界面缩放
emit CallManage::getInstance()->sig_changeScale(g_iScale);
}
}
else if("终止深度(m)" == m_propertyData[pProperty])
{
//qDebug() << "终止深度(m)->改变";
//当前属性类型
if(m_strCurrentProperty == Well_Property)
{
double newEndDepth = variant.value<double>();
g_iY1 = 0 - newEndDepth;
if(g_iY2 < g_iY1)
{
return;
}
//通知界面缩放
emit CallManage::getInstance()->sig_changeScale(g_iScale);
}
}
else if("左刻度" == m_propertyData[pProperty])
{
//qDebug() << "左刻度->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
double newLeftScale = variant.value<double>();
emit CallManage::getInstance()->sig_ChangeLeftScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newLeftScale);
//更新填充
ChangFillProperty();
}
}
else if("右刻度" == m_propertyData[pProperty])
{
//qDebug() << "右刻度->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
double newRightScale = variant.value<double>();
emit CallManage::getInstance()->sig_ChangeRightScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newRightScale);
//更新填充
ChangFillProperty();
}
}
else if("刻度类型" == m_propertyData[pProperty])
{
//qDebug() << "刻度类型->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
QString newScaleType = pProperty->valueText();
emit CallManage::getInstance()->sig_ChangeScaleType(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newScaleType);
//更新填充
ChangFillProperty();
}
}
else if("颜色" == m_propertyData[pProperty])
{
//qDebug() << "颜色->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
//曲线颜色
// 假设variant已经被设置为包含QColor
QColor newColor = variant.value<QColor>();
emit CallManage::getInstance()->sig_ChangeLineColor(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newColor);
}
}
else if("线宽" == m_propertyData[pProperty])
{
//qDebug() << "线宽->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
double newWidth = variant.value<double>();
emit CallManage::getInstance()->sig_ChangeLineWidth(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newWidth);
}
}
else if("线型" == m_propertyData[pProperty])
{
//qDebug() << "线型->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
Qt::PenStyle newStyle = Qt::SolidLine;
int iStyle = variant.value<int>();
switch(iStyle)
{
case 0:
//实线
newStyle = Qt::SolidLine;
break;
case 1:
//虚线
newStyle = Qt::DashLine;
break;
case 2:
//点线
newStyle = Qt::DotLine;
break;
case 3:
//虚点线
newStyle = Qt::DashDotLine;
break;
case 4:
//虚点点线
newStyle = Qt::DashDotDotLine;
break;
default:
break;
}
emit CallManage::getInstance()->sig_ChangeLineStyle(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newStyle);
}
}
else if("填充模式" == m_propertyData[pProperty])
{
//qDebug() << "填充模式->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("填充类型" == m_propertyData[pProperty])
{
//qDebug() << "填充类型->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("目标曲线" == m_propertyData[pProperty])
{
//qDebug() << "目标曲线->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("填充颜色" == m_propertyData[pProperty])
{
//qDebug() << "填充颜色->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("填充岩性" == m_propertyData[pProperty])
{
//qDebug() << "填充岩性->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("岩性前景色" == m_propertyData[pProperty])
{
//qDebug() << "岩性前景色->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("岩性背景色" == m_propertyData[pProperty])
{
//qDebug() << "岩性背景色->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("头部图例" == m_propertyData[pProperty])
{
//qDebug() << "头部图例->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
//图头---------------------------
else if("图例" == m_propertyData[pProperty])
{
//qDebug() << "图例->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
QString newSvg = variant.value<QString>();
m_item->setData(Qt::UserRole+1, newSvg); // 图片路径
//图头项改变
ChangHeadItemProperty();
}
}
else if("图例宽(cm)" == m_propertyData[pProperty])
{
//qDebug() << "图例宽(cm)->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
double newWidth = variant.value<double>();
m_item->setData(Qt::UserRole+2, newWidth); // 图片路径
m_colWidth = newWidth;
//图头项改变
ChangHeadItemProperty();
}
}
else if("图例高(cm)" == m_propertyData[pProperty])
{
//qDebug() << "图例高(cm)->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
double newHight = variant.value<double>();
m_item->setData(Qt::UserRole+3, newHight); // 图片路径
m_rowHeight = newHight;
//图头项改变
ChangHeadItemProperty();
}
}
else if("内容" == m_propertyData[pProperty])
{
//qDebug() << "内容->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
QString newText = variant.value<QString>();
m_formHead->m_bRefresh=false;
m_item->setText(newText);
}
}
else if("方向" == m_propertyData[pProperty])
{
//qDebug() << "方向->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
QString newDirection = pProperty->valueText();
if(newDirection=="垂直")
{
}
else{
//m_item->
}
}
}
else if("字体颜色" == m_propertyData[pProperty])
{
//qDebug() << "字体颜色->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
//字体颜色
// 假设variant已经被设置为包含QColor
QColor newColor = variant.value<QColor>();
// 设置字体颜色
QBrush brush(newColor); // 使用Qt::red预定义颜色
m_formHead->m_bRefresh=false;
m_item->setForeground(brush);
}
}
else if("字体" == m_propertyData[pProperty])
{
//qDebug() << "字体->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
//字体
// 假设variant已经被设置为包含QColor
QFont newFont = variant.value<QFont>();
// 设置字体
m_formHead->m_bRefresh=false;
m_item->setFont(newFont);
}
}
}
void PropertyWidget::ChangHeadItemProperty()
{
//清空
m_tableWidget->setCellWidget(m_iRow, m_iCol, nullptr);
//---------------------------
QString imagePath = ""; //"./image/胜利符号库/解释结论符号/油层.svg"
QVariant bgData = m_item->data(Qt::UserRole+1); // 我们约定用这个角色存储图片路径
if (bgData.isValid()) {
imagePath = bgData.toString();
}
if(imagePath=="")
{
return;
}
if(imagePath!="")
{
if(imagePath.size()>4)
{
int colWidth = m_colWidth*g_dPixelPerCm;
int rowHeight = m_rowHeight*g_dPixelPerCm;
//
QString strLast = imagePath.right(4);
if(strLast.toLower()==".svg")
{
//
QSvgRenderer* svgRender = new QSvgRenderer();
svgRender->load(imagePath);
//
QPixmap* pixmap = new QPixmap(colWidth-1, rowHeight-1);
pixmap->fill(Qt::transparent);//设置背景透明
QPainter p(pixmap);
svgRender->render(&p);
//1.直接采用控件显示
QLabel* label = new QLabel;
label->setPixmap(*pixmap);
label->setAlignment(Qt::AlignHCenter);
label->show();
//
m_formHead->m_bRefresh=false;
m_tableWidget->setCellWidget(m_iRow, m_iCol, label);
//m_item->setIcon(QIcon(*pixmap));
// 设置背景刷
//QBrush brush(*pixmap);
//m_item->setBackground(brush);
//m_tableWidget->setItem(m_iRow, m_iCol, new QTableWidgetItem(QIcon(*pixmap),tr("")));
}
else if(strLast.toLower()==".png")
{
// 加载图片
QPixmap pixmap(imagePath);
//pixmap.scaled(colWidth-1, rowHeight-1, Qt::KeepAspectRatio, Qt::SmoothTransformation);//缩放
//1.直接采用控件显示
QLabel* label = new QLabel;
label->setPixmap(pixmap.scaled(colWidth-1, rowHeight-1, Qt::KeepAspectRatio, Qt::SmoothTransformation));//pixmap
label->setAlignment(Qt::AlignHCenter);
label->show();
//
m_formHead->m_bRefresh=false;
m_tableWidget->setCellWidget(m_iRow, m_iCol, label);
}
}
}
}
void PropertyWidget::ChangFillProperty()
{
QString newFillMode = "无填充";
QString newFillType = "岩性模式";
QString newTargetLine = "左界道";
QColor newColor;//填充颜色
QString newLithosImage = "";//岩性图片
QString newHeadFill = "不绘制";
float vMax = 0.0;
float vMin = 0.0;
QString strOtherScaleType = "线性";
QColor frontColor;//岩性前景色
QColor backColor;//岩性背景色
for (auto it = m_propertyData.constBegin(); it != m_propertyData.constEnd(); ++it)
{
if(it.value()=="填充模式")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newFillMode = pProperty->valueText();
//qDebug() << "填充模式->" << newFillMode;
}
}
else if(it.value()=="填充类型")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newFillType = pProperty->valueText();
//qDebug() << "填充类型->" << newFillType;
}
}
else if(it.value()=="目标曲线")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newTargetLine = pProperty->valueText();
//qDebug() << "目标曲线->" << newTargetLine;
//
if(newTargetLine=="左界道" || newTargetLine=="右界道" || newTargetLine=="对称线")
{
}
else
{
for(int i=0; i<m_strListOtherLine.size(); i++)
{
QString strTmp = m_strListOtherLine[i];
if(strTmp==newTargetLine)
{
vMax = m_listMax[i];
vMin = m_listMin[i];
strOtherScaleType = m_strListOtherScaleType[i];
}
}
}
}
}
else if(it.value()=="填充颜色")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newColor = pProperty->value().value<QColor>();
}
//qDebug() << "填充颜色->";
}
else if(it.value()=="填充岩性")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newLithosImage = pProperty->valueText();
}
//qDebug() << "填充岩性->" << newLithosImage;
}
else if(it.value()=="岩性前景色")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
frontColor = pProperty->value().value<QColor>();
}
//qDebug() << "岩性前景色->";
}
else if(it.value()=="岩性背景色")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
backColor = pProperty->value().value<QColor>();
}
//qDebug() << "岩性背景色->";
}
else if(it.value()=="头部图例")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newHeadFill = pProperty->valueText();
//qDebug() << "头部图例->" << newHeadFill;
}
}
}
//
if(newFillMode=="无填充")
{
emit CallManage::getInstance()->sig_ClearFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName);
}
else //if(newFillMode=="填充")
{
emit CallManage::getInstance()->sig_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
newFillType, newTargetLine, newColor, newLithosImage, newHeadFill,
vMin, vMax, strOtherScaleType, frontColor, backColor, newFillMode, true);
}
}
void PropertyWidget::_CreateVariantPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int propertyType)
{
QtProperty *pGroupItem =NULL;
{
QMap<QString,QtProperty *>::Iterator it = m_mapGroupItem.find( strGroup );
if( it != m_mapGroupItem.end() )
{
pGroupItem = it.value();
}else
{
pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup);
m_mapGroupItem[strGroup] = pGroupItem ;
m_pPropertyBrowser->addProperty( pGroupItem );
}
}
QtVariantProperty *item = m_pVariantManager->addProperty(propertyType, strPropertyCaption);
item->setValue(vtPropertyValue);
m_propertyData[item] = strPropertyCaption;
pGroupItem->addSubProperty(item);
}
void PropertyWidget::_CreateVariantPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int propertyType, double dMin, double dMax)
{
QtProperty *pGroupItem =NULL;
{
QMap<QString,QtProperty *>::Iterator it = m_mapGroupItem.find( strGroup );
if( it != m_mapGroupItem.end() )
{
pGroupItem = it.value();
}else
{
pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup);
m_mapGroupItem[strGroup] = pGroupItem ;
m_pPropertyBrowser->addProperty( pGroupItem );
}
}
QtVariantProperty *item = m_pVariantManager->addProperty(propertyType, strPropertyCaption);
item->setValue(vtPropertyValue);
item->setAttribute("minimum", dMin);
item->setAttribute("maximum", dMax);
m_propertyData[item] = strPropertyCaption;
pGroupItem->addSubProperty(item);
}
void PropertyWidget::_CreateEnumPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, QStringList listValue)
{
QtProperty *pGroupItem =NULL;
{
QMap<QString,QtProperty *>::Iterator it = m_mapGroupItem.find( strGroup );
if( it != m_mapGroupItem.end() )
{
pGroupItem = it.value();
}else
{
pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup);
m_mapGroupItem[strGroup] = pGroupItem ;
m_pPropertyBrowser->addProperty( pGroupItem );
}
}
QtVariantProperty *item = m_pVariantManager->addProperty(QtVariantPropertyManager::enumTypeId(), strPropertyCaption);
m_pVariantManager->setAttribute(item, "enumNames", listValue);
item->setValue(vtPropertyValue);
m_propertyData[item] = strPropertyCaption;
pGroupItem->addSubProperty(item);
}
void PropertyWidget::initWidgetProperty()
{
//初始化,清空
InitCurrentViewInfo();
//当前属性类型
m_strCurrentProperty = Widget_Property;
QStringList listSize;
listSize.append("1:10");
listSize.append("1:20");
listSize.append("1:50");
listSize.append("1:100");
listSize.append("1:200");
listSize.append("1:500");
listSize.append("1:1000");
listSize.append("1:2000");
listSize.append("1:3000");
listSize.append("1:4000");
listSize.append("1:5000");
listSize.append("1:10000");
listSize.append("1:20000");
listSize.append("1:1");
QString strScale = "1:" + QString::number(g_iScale);
int iIndex = listSize.indexOf(strScale);
if(iIndex<0)
{
_CreateEnumPropertyItem("通常", "深度比例尺", 0, listSize);
//
_CreateVariantPropertyItem("通常", "自定义比例尺", strScale, QVariant::String);
}
else {
_CreateEnumPropertyItem("通常", "深度比例尺", iIndex, listSize);
_CreateVariantPropertyItem("通常", "自定义比例尺", "", QVariant::String);
}
//
_CreateVariantPropertyItem("水平格线", "粗格线间隔(m)", 10.0, QVariant::Double);
_CreateVariantPropertyItem("水平格线", "中格线间隔(m)", 2.0, QVariant::Double);
}
void PropertyWidget::initWellProperty()
{
//初始化,清空
InitCurrentViewInfo();
//当前属性类型
m_strCurrentProperty = Well_Property;
//
_CreateVariantPropertyItem("通常", "开始深度(m)", 0-g_iY2, QVariant::Double);
_CreateVariantPropertyItem("通常", "终止深度(m)", 0-g_iY1, QVariant::Double);
}
void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType)
{
//初始化,清空
InitCurrentViewInfo();
m_strUuid = formInfo->m_strUuid;
//
m_strSlfName = formInfo->m_strSlfName;
m_strWellName = formInfo->m_strWellName;
m_strTrackName = formInfo->m_strTrackName;
m_strLineName = formInfo->m_strLineName;
//其他曲线
m_strListOtherLine.clear();
m_listMin.clear();
m_listMax.clear();
m_strListOtherScaleType.clear();
//
m_strListOtherLine.append(strListOtherLine);
m_listMin.append(listMin);
m_listMax.append(listMax);
m_strListOtherScaleType.append(strListOtherScaleType);
//当前属性类型
m_strCurrentProperty = Curve_Property;
QStringList listStyle;
listStyle.append("");
listStyle.append("实线");
listStyle.append("虚线");
listStyle.append("点线");
listStyle.append("虚点线");
listStyle.append("虚点点线");
//
QStringList listHeadFill;
listHeadFill.append("不绘制");
listHeadFill.append("绘制");
//
QStringList listTargetLine;
listTargetLine.append("左界道");
listTargetLine.append("右界道");
listTargetLine.append("对称线");
listTargetLine.append(strListOtherLine);//其他曲线
//
QStringList listFillType;
listFillType.append("岩性模式");
listFillType.append("颜色模式");
//listFillType.append("成像化");
//
QStringList listFillMode;
listFillMode.append("无填充");
listFillMode.append("左填充");
listFillMode.append("右填充");
listFillMode.append("左右填充");
//
QStringList listScaleType;
listScaleType.append("线性");
listScaleType.append("对数");
//
_CreateVariantPropertyItem("通常", "井曲线", m_strLineName + "@"+m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示单位", formInfo->m_strUnit, QVariant::String);
//
_CreateVariantPropertyItem("刻度设置", "左刻度", formInfo->m_vmin, QVariant::Double);
_CreateVariantPropertyItem("刻度设置", "右刻度", formInfo->m_vmax, QVariant::Double);
_CreateEnumPropertyItem("刻度设置", "刻度类型", listScaleType.indexOf(formInfo->m_strScaleType), listScaleType);
//
_CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_dWidth, QVariant::Double, 1, 20);
_CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_lineColor, QVariant::Color);
_CreateEnumPropertyItem("曲线线型", "线型", (int)formInfo->m_lineStyle, listStyle);
//
_CreateEnumPropertyItem("岩性填充", "头部图例", listHeadFill.indexOf(formInfo->m_newHeadFill), listHeadFill);
_CreateEnumPropertyItem("岩性填充", "目标曲线", listTargetLine.indexOf(formInfo->m_newTargetLine), listTargetLine);
_CreateEnumPropertyItem("岩性填充", "填充类型", listFillType.indexOf(formInfo->m_newFillType), listFillType);
_CreateEnumPropertyItem("岩性填充", "填充模式", listFillMode.indexOf(formInfo->m_newFillMode), listFillMode);
_CreateVariantPropertyItem("岩性填充", "填充颜色", formInfo->m_newColor, QVariant::Color);
_CreateVariantPropertyItem("岩性填充", "填充岩性", formInfo->m_newLithosImage, VariantManager::filePathTypeId()); //"./image/胜利符号库/岩性符号/砂岩.png"
_CreateVariantPropertyItem("岩性填充", "岩性前景色", formInfo->m_frontColor, QVariant::Color);
_CreateVariantPropertyItem("岩性填充", "岩性背景色", formInfo->m_backColor, QVariant::Color);
}
void PropertyWidget::initHeadProperty(FormHead *formHead, QTableWidget *tableWidget, QTableWidgetItem* item, int row, int col)
{
//初始化,清空
InitCurrentViewInfo();
m_formHead = formHead;
m_tableWidget = tableWidget;
m_item = item;
m_iRow = row;
m_iCol = col;
//当前属性类型
m_strCurrentProperty = Head_Property;
QStringList listDirection;
listDirection.append("水平");
listDirection.append("垂直");
QString imagePath = "";//"./image/胜利符号库/解释结论符号/油层.svg"
QVariant bgData = m_item->data(Qt::UserRole+1); // 我们约定用这个角色存储图片路径
if (bgData.isValid()) {
imagePath = bgData.toString();
}
//图例宽
QVariant colWidthData = m_item->data(Qt::UserRole+2);
if (colWidthData.isValid()) {
m_colWidth = colWidthData.toDouble();
}
//图例高
QVariant rowHeightData = m_item->data(Qt::UserRole+3);
if (rowHeightData.isValid()) {
m_rowHeight = rowHeightData.toDouble();
}
_CreateVariantPropertyItem("单元格", "图例", imagePath, VariantManager::filePathTypeId()); //"./image/胜利符号库/岩性符号/砂岩.png"
_CreateVariantPropertyItem("单元格", "图例宽(cm)", m_colWidth, QVariant::Double, 0, 100);
_CreateVariantPropertyItem("单元格", "图例高(cm)", m_rowHeight, QVariant::Double, 0, 100);
_CreateVariantPropertyItem("文本", "内容", item->text(), QVariant::String);
_CreateVariantPropertyItem("文本", "字体", m_item->font(), QVariant::Font);
_CreateEnumPropertyItem("文本", "方向", 0, listDirection);
_CreateVariantPropertyItem("文本", "字体颜色", m_item->foreground().color(), QVariant::Color);
}