Make variable const.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-03 01:44:44 +03:00
parent f607e37168
commit b5000e5fae
2 changed files with 25 additions and 24 deletions

View File

@ -683,7 +683,7 @@ void TMainWindow::Remove()
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), 0);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), 0);
m->Remove(nameField->data(Qt::UserRole).toString());
MeasurementsWasSaved(false);
@ -752,7 +752,7 @@ void TMainWindow::MoveUp()
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
m->MoveUp(nameField->data(Qt::UserRole).toString());
MeasurementsWasSaved(false);
RefreshData();
@ -770,7 +770,7 @@ void TMainWindow::MoveDown()
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
m->MoveDown(nameField->data(Qt::UserRole).toString());
MeasurementsWasSaved(false);
RefreshData();
@ -859,7 +859,7 @@ void TMainWindow::AddCustom()
else
{
currentRow = ui->tableWidget->currentRow()+1;
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
m->AddEmptyAfter(nameField->data(Qt::UserRole).toString(), name);
}
@ -901,7 +901,7 @@ void TMainWindow::AddKnown()
else
{
currentRow = ui->tableWidget->currentRow() + list.size();
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QString after = nameField->data(Qt::UserRole).toString();
for (int i = 0; i < list.size(); ++i)
{
@ -996,7 +996,7 @@ void TMainWindow::ImportFromPattern()
else
{
currentRow = ui->tableWidget->currentRow() + measurements.size();
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QString after = nameField->data(Qt::UserRole).toString();
for (int i = 0; i < measurements.size(); ++i)
{
@ -1041,7 +1041,7 @@ void TMainWindow::ShowMData()
{
MFields(true);
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); // name
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); // name
QSharedPointer<VMeasurement> meash;
try
@ -1162,7 +1162,7 @@ void TMainWindow::SaveMName()
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
@ -1216,7 +1216,7 @@ void TMainWindow::SaveMValue()
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
// Replace line return character with spaces for calc if exist
QString text = ui->plainTextEditFormula->toPlainText();
@ -1294,7 +1294,7 @@ void TMainWindow::SaveMBaseValue(double value)
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
@ -1340,7 +1340,7 @@ void TMainWindow::SaveMSizeIncrease(double value)
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
@ -1387,7 +1387,7 @@ void TMainWindow::SaveMHeightIncrease(double value)
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
@ -1432,7 +1432,7 @@ void TMainWindow::SaveMDescription()
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
m->SetMDescription(nameField->data(Qt::UserRole).toString(), ui->plainTextEditDescription->toPlainText());
MeasurementsWasSaved(false);
@ -1459,7 +1459,7 @@ void TMainWindow::SaveMFullName()
return;
}
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
@ -2190,7 +2190,7 @@ void TMainWindow::MeasurementReadOnly(bool ro)
{
if (ro == false)
{
if (QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName))
if (const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName))
{
if (nameField->text().indexOf(CustomMSign) == 0) // Check if custom
{

View File

@ -456,7 +456,7 @@ void DialogIncrements::AddIncrement()
else
{
currentRow = ui->tableWidgetIncrement->currentRow()+1;
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(ui->tableWidgetIncrement->currentRow(), 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(ui->tableWidgetIncrement->currentRow(), 0);
doc->AddEmptyIncrementAfter(nameField->text(), name);
}
@ -477,7 +477,7 @@ void DialogIncrements::RemoveIncrement()
return;
}
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
doc->RemoveIncrement(nameField->text());
FullUpdateTree(Document::LiteParse);
@ -502,7 +502,7 @@ void DialogIncrements::MoveUp()
return;
}
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
doc->MoveUpIncrement(nameField->text());
FullUpdateTree(Document::LiteParse);
ui->tableWidgetIncrement->selectRow(row-1);
@ -518,7 +518,7 @@ void DialogIncrements::MoveDown()
return;
}
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
doc->MoveDownIncrement(nameField->text());
FullUpdateTree(Document::LiteParse);
ui->tableWidgetIncrement->selectRow(row+1);
@ -534,7 +534,7 @@ void DialogIncrements::SaveIncrName()
return;
}
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QString newName = CustomIncrSign + ui->lineEditName->text();
if (data->IsUnique(newName))
{
@ -560,7 +560,7 @@ void DialogIncrements::SaveIncrDescription()
return;
}
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
doc->SetIncrementDescription(nameField->text(), ui->plainTextEditDescription->toPlainText());
FullUpdateTree(Document::LiteParse);
@ -582,7 +582,7 @@ void DialogIncrements::SaveIncrFormula()
return;
}
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
// Replace line return character with spaces for calc if exist
QString text = ui->plainTextEditFormula->toPlainText();
@ -671,7 +671,7 @@ void DialogIncrements::Fx()
return;
}
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0);
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(nameField->text());
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(incr->GetData(), NULL_ID, this);
@ -711,7 +711,8 @@ void DialogIncrements::ShowIncrementDetails()
{
EnableDetails(true);
QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(ui->tableWidgetIncrement->currentRow(), 0); // name
// name
const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(ui->tableWidgetIncrement->currentRow(), 0);
QSharedPointer<VIncrement> incr;
try