打印出图时,针对图头和成果表,优化行高列宽。
This commit is contained in:
parent
dd52707155
commit
3d0dc7fc4f
|
|
@ -2353,6 +2353,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
//图头项改变
|
||||
m_tableWidget->setColumnWidth(m_iCol, m_colWidth*g_dPixelPerCm);
|
||||
m_tableWidget->update();
|
||||
//设置列宽
|
||||
m_formHead->setColumnWidth_Property(m_iCol, m_colWidth);
|
||||
m_formHead->resizeWindow();
|
||||
}
|
||||
else if("行高(cm)" == m_propertyData[pProperty])
|
||||
|
|
@ -2365,6 +2367,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
//图头项改变
|
||||
m_tableWidget->setRowHeight(m_iRow, m_rowHeight*g_dPixelPerCm);
|
||||
m_tableWidget->update();
|
||||
//设置行高
|
||||
m_formHead->setRowHeight_Property(m_iRow, m_rowHeight);
|
||||
m_formHead->resizeWindow();
|
||||
}
|
||||
else if("内容" == m_propertyData[pProperty])
|
||||
|
|
@ -3293,8 +3297,8 @@ void PropertyWidget::initHeadProperty(FormHead *formHead, QTableWidget *tableWid
|
|||
//图例高
|
||||
m_rowHeight_Img = m_item->m_rowHeight_Img;
|
||||
//行高、列宽
|
||||
m_colWidth = tableWidget->columnWidth(col)/g_dPixelPerCm;
|
||||
m_rowHeight = tableWidget->rowHeight(row)/g_dPixelPerCm;
|
||||
m_colWidth = m_item->m_colWidth;//tableWidget->columnWidth(col)/g_dPixelPerCm;
|
||||
m_rowHeight = m_item->m_rowHeight;//tableWidget->rowHeight(row)/g_dPixelPerCm;
|
||||
//公式
|
||||
m_strFormulaText = m_item->m_strFormulaText;
|
||||
//公式操作类型
|
||||
|
|
|
|||
|
|
@ -1419,6 +1419,58 @@ void FormHead::getTableSize_Biggest(int &iWidth, int &iHight)
|
|||
else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
iWidth += columnCount;
|
||||
iHight += rowCount;
|
||||
|
||||
iWidth = iWidth + ui->tableWidget->verticalScrollBar()->width();
|
||||
iHight = iHight + ui->tableWidget->horizontalScrollBar()->height();
|
||||
}
|
||||
|
||||
//设置列宽
|
||||
void FormHead::setColumnWidth_Property(int column, double width)
|
||||
{
|
||||
int rowCount = ui->tableWidget->rowCount();//总行数
|
||||
for(int row=0; row<rowCount; row++)
|
||||
{
|
||||
FormTableItem* formTableItemTmp = nullptr;
|
||||
auto myWidget = ui->tableWidget->cellWidget(row, column);
|
||||
if(myWidget)
|
||||
{
|
||||
formTableItemTmp = (FormTableItem*)myWidget;//获得widget
|
||||
if(!formTableItemTmp)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
formTableItemTmp->m_colWidth = width;
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//设置行高
|
||||
void FormHead::setRowHeight_Property(int row, double height)
|
||||
{
|
||||
int columnCount = ui->tableWidget->columnCount();//总列数
|
||||
for(int col=0; col<columnCount; col++)
|
||||
{
|
||||
FormTableItem* formTableItemTmp = nullptr;
|
||||
auto myWidget = ui->tableWidget->cellWidget(row, col);
|
||||
if(myWidget)
|
||||
{
|
||||
formTableItemTmp = (FormTableItem*)myWidget;//获得widget
|
||||
if(!formTableItemTmp)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
formTableItemTmp->m_rowHeight = height;
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ public:
|
|||
|
||||
//获取表格的实际大小
|
||||
void getTableSize_Biggest(int &iWidth, int &iHight);
|
||||
//设置列宽
|
||||
void setColumnWidth_Property(int column, double width);
|
||||
//设置行高
|
||||
void setRowHeight_Property(int row, double height);
|
||||
|
||||
public slots:
|
||||
void resizeWindow(bool bDelete=false);
|
||||
|
|
|
|||
|
|
@ -439,4 +439,7 @@ void FormMultiHeads::getTableSize_Biggest(int &iWidth_Big, int &iHight_Big)
|
|||
|
||||
iWidth_Big = iWidth_Big + left + right;
|
||||
iHight_Big = iHight_Big + top + bottom;//Margin上方
|
||||
|
||||
iWidth_Big = iWidth_Big + ui->tableWidget->verticalScrollBar()->width();
|
||||
iHight_Big = iHight_Big + ui->tableWidget->horizontalScrollBar()->height();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user