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 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) if(QString::compare(previousItemName, name) != 0)
{ {
canAddNewPoint = true; canAddNewPoint = true;
@ -416,7 +416,7 @@ void DialogDetail::DeleteItem()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogDetail::DetailIsValid() bool DialogDetail::DetailIsValid() const
{ {
if (ui.listWidget->count() < 3) if (ui.listWidget->count() < 3)
{ {
@ -430,10 +430,10 @@ bool DialogDetail::DetailIsValid()
} }
else 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(); const QString previousRow = ui.listWidget->item(i)->text();
QString nextRow = ui.listWidget->item(i+1)->text(); const QString nextRow = ui.listWidget->item(i+1)->text();
if (QString::compare(previousRow, nextRow) == 0) if (QString::compare(previousRow, nextRow) == 0)
{ {
@ -446,8 +446,10 @@ bool DialogDetail::DetailIsValid()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogDetail::FirstPointEqualLast() bool DialogDetail::FirstPointEqualLast() const
{ {
if (ui.listWidget->count() > 1)
{
const QString firstDetailPoint = ui.listWidget->item(0)->text(); const QString firstDetailPoint = ui.listWidget->item(0)->text();
const QString lastDetailPoint = ui.listWidget->item(ui.listWidget->count()-1)->text(); const QString lastDetailPoint = ui.listWidget->item(ui.listWidget->count()-1)->text();
@ -459,4 +461,6 @@ bool DialogDetail::FirstPointEqualLast()
{ {
return false; return false;
} }
}
return false;
} }

View File

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