diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index be60351..6152c17 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -1331,17 +1331,17 @@ double FormWell::getTrackHeight(FormTrackTop *formTrackTop) return dTrackHeight; } -//列宽改变 +//行高改变 void FormWell::onSectionResized(int logicalIndex, int oldSize, int newSize) { - if(g_iLoadingJson==1)//针对模板加载,不处理列宽改变,避免多次冲突 + if(g_iLoadingJson==1)//针对模板加载,不处理行高改变,避免多次冲突 { return; } - if(m_bSetRowHeight) //手工设置行高 + if(m_bSetRowHeight) //默认非手工设置行高,而是调用接口SetRowHeight { - m_bSetRowHeight = false; //手工设置行高 + m_bSetRowHeight = false; //切换为手工设置行高 return; } diff --git a/logPlus/formwell.h b/logPlus/formwell.h index f9e0fd5..20380d2 100644 --- a/logPlus/formwell.h +++ b/logPlus/formwell.h @@ -68,7 +68,7 @@ public: bool m_bShowTrackHead = true; //显示道头 bool m_bMultiProject = false; //多井的打开工程,使用模板的井名和slf名 - bool m_bSetRowHeight = true; //手工设置行高 + bool m_bSetRowHeight = true; //默认非手工设置行高,而是调用接口SetRowHeight // 道图形 QMap> m_mapFormDraw; diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index c95f26f..31be6d7 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -609,9 +609,32 @@ void MainWindowCurve::vertScrollBarChanged(int iValue) iHeightOfScreen = g_iHeight_MyCustom; } - double dScrollHeight = (iHeightOfScreen-g_WorkSpace_Height)/g_dPixelPerCm/100.0 * (double)m_iScale; + QRect rect2 = ui->centralwidget->geometry(); + int left, top, right, bottom; + if (ui->centralwidget->layout()) + { + ui->centralwidget->layout()->getContentsMargins(&left, &top, &right, &bottom); + } + //获取井well前2行的高度 + int iTableSize_Head = 100 + m_nObjLayerH; +// int iTableSize_Head = 0; +// getTableSize_Head(iTableSize_Head); + int iTableWellTrack_height = ui->tableWidget_2->rowHeight(0) + (5) + iTableSize_Head -1; + //可视区域高度 + int iScreenHeight = 0; + //锁头 + if(m_fixwellsectionHeaderAc->isChecked()) + { + iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; + } + else{ + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; + } + //double dScrollHeight = (iHeightOfScreen-g_WorkSpace_Height)/g_dPixelPerCm/100.0 * (double)m_iScale; double dScrollHeight_setGeometry = iHeightOfScreen/g_dPixelPerCm/100.0 * (double)m_iScale; + double dScreenHeightMi = (double)iScreenHeight/100.0; + double dScrollHeight = dScrollHeight_setGeometry - dScreenHeightMi; // double dDelta = value - upper; int iNumShow = dDelta/dScrollHeight; @@ -4426,6 +4449,9 @@ void MainWindowCurve::s_selectWell() //显示/隐藏图头 void MainWindowCurve::s_showHeadTable() { + //恢复原始数据,不然容易造成道头过大 + m_iTableSize_Head2 = 104; + //显示道头/对象头 ShowTableHead(); @@ -5996,6 +6022,42 @@ void MainWindowCurve::s_changeScale(QString strUuid, int iNewScale) m_iScale = iNewScale; + //自定义滚动条 + QRect rect2 = ui->centralwidget->geometry(); + int left, top, right, bottom; + if (ui->centralwidget->layout()) + { + ui->centralwidget->layout()->getContentsMargins(&left, &top, &right, &bottom); + } + //获取井well前2行的高度 + int iTableSize_Head = 100 + m_nObjLayerH; +// int iTableSize_Head = 0; +// getTableSize_Head(iTableSize_Head); + int iTableWellTrack_height = ui->tableWidget_2->rowHeight(0) + (5) + iTableSize_Head -1; + //可视区域高度 + int iScreenHeight = 0; + //锁头 + if(m_fixwellsectionHeaderAc->isChecked()) + { + iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; + } + else{ + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; + } + //下方滚动条高度 + int iHScrollBarHeight = 0; + if(!ui->tableWidget_2->horizontalScrollBar()->isVisible()) + { + iHScrollBarHeight = 0; + } + else + { + iHScrollBarHeight = ui->tableWidget_2->horizontalScrollBar()->height()/g_dPixelPerCm * m_iScale; + } + ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100 - iScreenHeight + iHScrollBarHeight); + //ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100); + ui->verticalScrollBar->setValue(-m_iY2*100); + double dHight = 0; dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; if(g_iShow==1) @@ -6071,6 +6133,7 @@ void MainWindowCurve::s_changeDepth(QString strUuid, QString strSlfName, QString m_iY1 = iY1; m_iY2 = iY2; + //自定义滚动条 QRect rect2 = ui->centralwidget->geometry(); int left, top, right, bottom; diff --git a/logPlus/qmytablewidget.cpp b/logPlus/qmytablewidget.cpp index 97a57af..53a9afe 100644 --- a/logPlus/qmytablewidget.cpp +++ b/logPlus/qmytablewidget.cpp @@ -234,7 +234,7 @@ void QMyTableWidget::setRowHeight(int row, int height) FormWell *parent = (FormWell *)m_parent; - parent->m_bSetRowHeight = true; //手工设置行高 + parent->m_bSetRowHeight = true; //默认非手工设置行高,而是调用接口SetRowHeight QTableWidget::setRowHeight(row, height); }