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

View File

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