支持设置道图例区高度(cm)
This commit is contained in:
parent
34484fae27
commit
78331ea3bd
|
|
@ -584,13 +584,16 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
QFont newFont = variant.value<QFont>();
|
||||
// 设置字体
|
||||
m_fromTop->m_font = newFont;
|
||||
|
||||
}
|
||||
else if("道头字颜色" == m_propertyData[pProperty])
|
||||
{
|
||||
QColor newColor = variant.value<QColor>();
|
||||
m_fromTop->m_fontColor = newColor;
|
||||
|
||||
}
|
||||
else if("道图例区高度(cm)" == m_propertyData[pProperty])
|
||||
{
|
||||
double temp = variant.toDouble();
|
||||
m_fromTop->setTrackHeight(temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2925,6 +2928,7 @@ void PropertyWidget::initTrackProperty(FormTrackTop *fromTop, int iWidth, QMyTab
|
|||
_CreateVariantPropertyItem("通常", "道名称", m_strTrackName, QVariant::String);
|
||||
_CreateVariantPropertyItem("通常", "道头字体", fromTop->m_font, QVariant::Font);
|
||||
_CreateVariantPropertyItem("通常", "道头字颜色", fromTop->m_fontColor, QVariant::Color);
|
||||
_CreateVariantPropertyItem("通常", "道图例区高度(cm)", fromTop->getTrackHeight(), QVariant::Double);
|
||||
//
|
||||
_CreateVariantPropertyItem("网格", "水平", fromTop->m_nTrackW, QVariant::Bool);
|
||||
_CreateVariantPropertyItem("网格", "垂直", fromTop->m_nTrackW, QVariant::Bool);
|
||||
|
|
|
|||
|
|
@ -1724,3 +1724,50 @@ void FormTrack::ChangeHeadHeight(QString strLineName, double headHeight)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//设置 道图例区高度(cm)
|
||||
void FormTrack::setTrackHeight(double dTrackHeight)
|
||||
{
|
||||
int rowCount = ui->tableWidget->rowCount();
|
||||
for(int i=0; i<rowCount; i++)
|
||||
{
|
||||
if( ui->tableWidget->cellWidget(i, 0) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(i, 0);
|
||||
FormInfo *formInfo = qobject_cast<FormInfo*>(myWidget);//获得widget
|
||||
if(formInfo)
|
||||
{
|
||||
formInfo->m_headHeight = dTrackHeight / (double)rowCount;
|
||||
formInfo->setFixedHeight(formInfo->m_headHeight * g_dPixelPerCm);
|
||||
formInfo->repaint();
|
||||
//
|
||||
ui->tableWidget->setRowHeight(i, formInfo->m_headHeight * g_dPixelPerCm);
|
||||
}
|
||||
}
|
||||
}
|
||||
ui->tableWidget->update();
|
||||
//重新设置滚动条范围
|
||||
emit CallManage::getInstance()->sig_setRangeVScrollBar2(m_strUuid);
|
||||
}
|
||||
|
||||
//获取 道图例区高度(cm)
|
||||
double FormTrack::getTrackHeight()
|
||||
{
|
||||
double dTrackHeight = 0.0;
|
||||
//
|
||||
int rowCount = ui->tableWidget->rowCount();
|
||||
for(int i=0; i<rowCount; i++)
|
||||
{
|
||||
if( ui->tableWidget->cellWidget(i, 0) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(i, 0);
|
||||
FormInfo *formInfo = qobject_cast<FormInfo*>(myWidget);//获得widget
|
||||
if(formInfo)
|
||||
{
|
||||
dTrackHeight += formInfo->m_headHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dTrackHeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,12 @@ public:
|
|||
QStringList getLineList(QString strWellName, QString strTrackName);
|
||||
//展开FormIndo后,获取真正的高度最大值
|
||||
void getTableSize_Head_Biggest(int &iHight);
|
||||
|
||||
//设置 道图例区高度(cm)
|
||||
void setTrackHeight(double dTrackHeight);
|
||||
//获取 道图例区高度(cm)
|
||||
double getTrackHeight();
|
||||
|
||||
signals:
|
||||
void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}, QString strObjUuid = "");
|
||||
void sig_AddWave(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ FormTrackTop::FormTrackTop(QWidget *parent, QString strSlfName, QString strWellN
|
|||
ui(new Ui::FormTrackTop)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_parent = parent;
|
||||
//
|
||||
setAcceptDrops(true);
|
||||
|
||||
|
|
@ -289,3 +290,18 @@ void FormTrackTop::dropEvent(QDropEvent* event)
|
|||
//QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
//设置 道图例区高度(cm)
|
||||
void FormTrackTop::setTrackHeight(double dTrackHeight)
|
||||
{
|
||||
FormWell *parent = (FormWell *)m_parent;
|
||||
parent->setTrackHeight(this, dTrackHeight);
|
||||
}
|
||||
|
||||
//获取 道图例区高度(cm)
|
||||
double FormTrackTop::getTrackHeight()
|
||||
{
|
||||
double dTrackHeight = 2.0;
|
||||
FormWell *parent = (FormWell *)m_parent;
|
||||
dTrackHeight = parent->getTrackHeight(this);
|
||||
return dTrackHeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,12 +48,17 @@ public:
|
|||
QFont m_font;
|
||||
QColor m_fontColor;//颜色
|
||||
|
||||
|
||||
QWidget *m_parent;
|
||||
|
||||
public:
|
||||
|
||||
QJsonObject makeJson();
|
||||
|
||||
//设置 道图例区高度(cm)
|
||||
void setTrackHeight(double dTrackHeight);
|
||||
//获取 道图例区高度(cm)
|
||||
double getTrackHeight();
|
||||
|
||||
private:
|
||||
QPoint startPosition;
|
||||
|
||||
|
|
|
|||
|
|
@ -1231,3 +1231,72 @@ void FormWell::ShowTableHead()
|
|||
}
|
||||
}
|
||||
|
||||
//设置 道图例区高度(cm)
|
||||
void FormWell::setTrackHeight(FormTrackTop *formTrackTop, double dTrackHeight)
|
||||
{
|
||||
int columnCount = ui->tableWidget->columnCount();//总列数
|
||||
for(int i=0; i<columnCount; i++)
|
||||
{
|
||||
QJsonObject formTrackObj;
|
||||
formTrackObj["id"] = i;
|
||||
if( ui->tableWidget->cellWidget(0, i) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(0, i);
|
||||
FormTrackTop* fromTop = qobject_cast<FormTrackTop*>(myWidget);
|
||||
if(fromTop)
|
||||
{
|
||||
if(fromTop == formTrackTop)
|
||||
{
|
||||
//进一步获取FormTrack
|
||||
if( ui->tableWidget->cellWidget(1, i) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(1, i);
|
||||
FormTrack *formTrack = qobject_cast<FormTrack*>(myWidget); //获得widget
|
||||
if(formTrack)
|
||||
{
|
||||
formTrack->setTrackHeight(dTrackHeight);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取 道图例区高度(cm)
|
||||
double FormWell::getTrackHeight(FormTrackTop *formTrackTop)
|
||||
{
|
||||
double dTrackHeight = 0.0;
|
||||
|
||||
int columnCount = ui->tableWidget->columnCount();//总列数
|
||||
for(int i=0; i<columnCount; i++)
|
||||
{
|
||||
QJsonObject formTrackObj;
|
||||
formTrackObj["id"] = i;
|
||||
if( ui->tableWidget->cellWidget(0, i) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(0, i);
|
||||
FormTrackTop* fromTop = qobject_cast<FormTrackTop*>(myWidget);
|
||||
if(fromTop)
|
||||
{
|
||||
if(fromTop == formTrackTop)
|
||||
{
|
||||
//进一步获取FormTrack
|
||||
if( ui->tableWidget->cellWidget(1, i) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(1, i);
|
||||
FormTrack *formTrack = qobject_cast<FormTrack*>(myWidget); //获得widget
|
||||
if(formTrack)
|
||||
{
|
||||
dTrackHeight = formTrack->getTrackHeight();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dTrackHeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@ public:
|
|||
void HideTableHead();
|
||||
void ShowTableHead();
|
||||
|
||||
//设置 道图例区高度(cm)
|
||||
void setTrackHeight(FormTrackTop *formTrackTop, double dTrackHeight);
|
||||
//获取 道图例区高度(cm)
|
||||
double getTrackHeight(FormTrackTop *formTrackTop);
|
||||
|
||||
public slots:
|
||||
//void onTableColumnsInserted(const QModelIndex &parent, int first, int last);
|
||||
|
||||
|
|
|
|||
|
|
@ -5118,6 +5118,11 @@ void MainWindowCurve::Open(QString fileFull)
|
|||
//改变道宽
|
||||
void MainWindowCurve::s_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth)
|
||||
{
|
||||
if(strUuid != m_strUuid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int columnCount = ui->tableWidget_2->columnCount();//总列数
|
||||
for(int i=0; i<columnCount; i++)
|
||||
{
|
||||
|
|
@ -5161,6 +5166,11 @@ void MainWindowCurve::s_changeTrackProperty(QVariantList vlist)
|
|||
QString strSlfName = vlist.at(1).toString();
|
||||
QString strWellName = vlist.at(2).toString();
|
||||
|
||||
if(strUuid != m_strUuid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int columnCount = ui->tableWidget_2->columnCount();//总列数
|
||||
for(int i=0; i<columnCount; i++)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user