Changed some methods to be const

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2015-11-11 21:46:36 +02:00
parent e323afc4e6
commit c6577675e7
2 changed files with 21 additions and 17 deletions

View File

@ -179,7 +179,7 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
}
else
{
QString previousItemName = ui.listWidget->item(ui.listWidget->count()-1)->text();
const QString previousItemName = ui.listWidget->item(ui.listWidget->count()-1)->text();
if(QString::compare(previousItemName, name) != 0)
{
canAddNewPoint = true;
@ -416,7 +416,7 @@ void DialogDetail::DeleteItem()
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogDetail::DetailIsValid()
bool DialogDetail::DetailIsValid() const
{
if (ui.listWidget->count() < 3)
{
@ -430,10 +430,10 @@ bool DialogDetail::DetailIsValid()
}
else
{
for (int i=0; i<ui.listWidget->count()-1; i++)
for (int i=0, sz = ui.listWidget->count()-1; i<sz; ++i)
{
QString previousRow = ui.listWidget->item(i)->text();
QString nextRow = ui.listWidget->item(i+1)->text();
const QString previousRow = ui.listWidget->item(i)->text();
const QString nextRow = ui.listWidget->item(i+1)->text();
if (QString::compare(previousRow, nextRow) == 0)
{
@ -446,17 +446,21 @@ bool DialogDetail::DetailIsValid()
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogDetail::FirstPointEqualLast()
bool DialogDetail::FirstPointEqualLast() const
{
const QString firstDetailPoint = ui.listWidget->item(0)->text();
const QString lastDetailPoint = ui.listWidget->item(ui.listWidget->count()-1)->text();
if (ui.listWidget->count() > 1)
{
const QString firstDetailPoint = ui.listWidget->item(0)->text();
const QString lastDetailPoint = ui.listWidget->item(ui.listWidget->count()-1)->text();
if (QString::compare(firstDetailPoint, lastDetailPoint) == 0)
{
return true;
}
else
{
return false;
if (QString::compare(firstDetailPoint, lastDetailPoint) == 0)
{
return true;
}
else
{
return false;
}
}
return false;
}

View File

@ -74,8 +74,8 @@ private:
/** @brief closed keep option about equdistant (closed or not) */
bool closed;
bool flagWidth;
bool DetailIsValid();
bool FirstPointEqualLast();
bool DetailIsValid() const;
bool FirstPointEqualLast() const;
void NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
qreal mx = 0, qreal my = 0, bool reverse = false);