diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index e551853..db8c7de 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -478,7 +478,7 @@ void MainWindowCurve::resizeEvent(QResizeEvent *event) iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; } else{ - iScreenHeight = (double)(rect2.height()-10- top -bottom)/g_dPixelPerCm * m_iScale; + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; } ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100 - iScreenHeight); @@ -585,9 +585,31 @@ 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 = 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; @@ -597,7 +619,7 @@ void MainWindowCurve::vertScrollBarChanged(int iValue) } if(m_iCurPage == iNumShow) { - double iCurValue = dDelta - (iNumShow-1)*dScrollHeight; + double iCurValue = dDelta - (double)(iNumShow-1)*dScrollHeight; //锁头 if(m_fixwellsectionHeaderAc->isChecked()) { @@ -617,32 +639,6 @@ void MainWindowCurve::vertScrollBarChanged(int iValue) emit CallManage::getInstance()->sig_vertScrollBarChanged_setGeometry(m_strUuid, iCurValue, dScrollHeight_setGeometry, 0, value); } } -// int columnCount = ui->tableWidget_2->columnCount();//总列数 -// for(int i=0; itableWidget_2->cellWidget(1, i) != nullptr ) -// { -// auto myWidget = ui->tableWidget_2->cellWidget(1, i); -// if(myWidget) -// { -// // -// FormWell *widgetWell = (FormWell*)myWidget;//获得widget -// if(widgetWell) -// { -// widgetWell->vertScrollBarChanged_setGeometry(iCurValue, dScrollHeight_setGeometry, 0); -// } -// } -// } -// } } else if(iNumShow>0) { @@ -658,19 +654,26 @@ void MainWindowCurve::vertScrollBarChanged(int iValue) { //隐藏道头/对象头 HideTableHead(); + + //通过原始的滚动条归位,不然下方容易出现空白 + ui->tableWidget_2->verticalScrollBar()->setValue(0); } else { //显示道头/对象头 ShowTableHead(); ShowTableHead_All(); + + double iCurValueTmp = dDelta - (double)(iNumShow-1)*dScrollHeight; + //通过原始的滚动条,整体滚动 + ui->tableWidget_2->verticalScrollBar()->setValue(iCurValueTmp*100.0/(double)m_iScale * g_dPixelPerCm); } } //通知界面重设范围 - double iCurValue = (iNumShow-1)*dScrollHeight + upper; + double iCurValue = (double)(iNumShow-1)*dScrollHeight + upper; emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, iCurValue, -m_iY1, -m_iY2);//(iNumShow-1)*dScrollHeight_setGeometry // 修复滚动跳动: 翻页时同步发送 setGeometry 信号 - double iCurValue_setGeom = dDelta - (iNumShow-1)*dScrollHeight; + double iCurValue_setGeom = dDelta - (double)(iNumShow-1)*dScrollHeight; emit CallManage::getInstance()->sig_vertScrollBarChanged_setGeometry(m_strUuid, iCurValue_setGeom, dScrollHeight_setGeometry, 0, value); } else if(value==upper) @@ -691,7 +694,7 @@ void MainWindowCurve::vertScrollBarChanged(int iValue) } //通知界面重设范围 double iCurValue = upper; - emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, iCurValue, -m_iY1, -m_iY2);//(iNumShow-1)*dScrollHeight_setGeometry + emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, iCurValue, -m_iY1, -m_iY2);//(double)(iNumShow-1)*dScrollHeight_setGeometry // 修复滚动跳动: 顶部复位时同步发送 setGeometry emit CallManage::getInstance()->sig_vertScrollBarChanged_setGeometry(m_strUuid, 0, dScrollHeight_setGeometry, 0, value); } @@ -3448,7 +3451,7 @@ void MainWindowCurve::ZoomIn(float fNewZoom) iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; } else{ - iScreenHeight = (double)(rect2.height()-10- top -bottom)/g_dPixelPerCm * m_iScale; + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; } ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100 - iScreenHeight); } @@ -4410,7 +4413,7 @@ void MainWindowCurve::s_showHeadTable() iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; } else{ - iScreenHeight = (double)(rect2.height()-10- top -bottom)/g_dPixelPerCm * m_iScale; + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; } ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100 - iScreenHeight); ui->verticalScrollBar->setValue(-m_iY2*100); @@ -4483,7 +4486,7 @@ void MainWindowCurve::s_showHeadTable() iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; } else{ - iScreenHeight = (double)(rect2.height()-10- top -bottom)/g_dPixelPerCm * m_iScale; + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; } ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100 - iScreenHeight); ui->verticalScrollBar->setValue(-m_iY2*100); @@ -5718,7 +5721,7 @@ void MainWindowCurve::Open(QString fileFull) iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; } else{ - iScreenHeight = (double)(rect2.height()-10- top -bottom)/g_dPixelPerCm * m_iScale; + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; } ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100 - iScreenHeight); //ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100); @@ -6003,7 +6006,7 @@ void MainWindowCurve::s_changeDepth(QString strUuid, QString strSlfName, QString iScreenHeight = (double)(rect2.height()-10- top -bottom - iTableWellTrack_height)/g_dPixelPerCm * m_iScale; } else{ - iScreenHeight = (double)(rect2.height()-10- top -bottom)/g_dPixelPerCm * m_iScale; + iScreenHeight = (double)(rect2.height()-10- top -bottom - 4)/g_dPixelPerCm * m_iScale; } ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100 - iScreenHeight);