Resolved resizing tables after update.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-14 12:04:03 +03:00
parent 9284bfec9b
commit 7b0253d95e
4 changed files with 24 additions and 14 deletions

View File

@ -304,7 +304,8 @@ bool TMainWindow::LoadFile(const QString &path)
InitWindow();
RefreshData();
const bool freshCall = true;
RefreshData(freshCall);
if (ui->tableWidget->rowCount() > 0)
{
@ -2382,17 +2383,17 @@ void TMainWindow::SetDefaultSize(int value)
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::RefreshData()
void TMainWindow::RefreshData(bool freshCall)
{
VContainer::ClearUniqueNames();
data->ClearVariables(VarType::Measurement);
m->ReadMeasurements();
RefreshTable();
RefreshTable(freshCall);
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::RefreshTable()
void TMainWindow::RefreshTable(bool freshCall)
{
ui->tableWidget->blockSignals(true);
ui->tableWidget->clearContents();
@ -2478,8 +2479,11 @@ void TMainWindow::RefreshTable()
}
}
if (freshCall)
{
ui->tableWidget->resizeColumnsToContents();
ui->tableWidget->resizeRowsToContents();
}
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
ui->tableWidget->blockSignals(false);
@ -2884,7 +2888,8 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
InitWindow();
m->ClearForExport();
RefreshData();
const bool freshCall = true;
RefreshData(freshCall);
if (ui->tableWidget->rowCount() > 0)
{

View File

@ -178,8 +178,8 @@ private:
void SetDefaultHeight(int value);
void SetDefaultSize(int value);
void RefreshData();
void RefreshTable();
void RefreshData(bool freshCall = false);
void RefreshTable(bool freshCall = false);
QString GetCustomName() const;
QString ClearCustomName(const QString &name) const;

View File

@ -80,7 +80,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
qCDebug(vDialog, "Showing variables.");
ShowUnits();
FillIncrements();
const bool freshCall = true;
FillIncrements(freshCall);
FillLengthsLines();
FillLengthLinesAngles();
FillLengthsCurves();
@ -130,7 +131,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
/**
* @brief FillIncrementTable fill data for increment table
*/
void DialogIncrements::FillIncrements()
void DialogIncrements::FillIncrements(bool freshCall)
{
ui->tableWidgetIncrement->blockSignals(true);
ui->tableWidgetIncrement->clearContents();
@ -171,8 +172,12 @@ void DialogIncrements::FillIncrements()
AddCell(ui->tableWidgetIncrement, formula, currentRow, 2, Qt::AlignVCenter); // formula
}
if (freshCall)
{
ui->tableWidgetIncrement->resizeColumnsToContents();
ui->tableWidgetIncrement->resizeRowsToContents();
}
ui->tableWidgetIncrement->horizontalHeader()->setStretchLastSection(true);
ui->tableWidgetIncrement->blockSignals(false);
}

View File

@ -92,7 +92,7 @@ private:
template <typename T>
void FillTable(const QMap<QString, T> &varTable, QTableWidget *table);
void FillIncrements();
void FillIncrements(bool freshCall = false);
void FillLengthsLines();
void FillLengthLinesAngles();
void FillLengthsCurves();