Fixed issue #553. Tape.exe crash. Issue with the Search field.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-08-25 19:32:04 +03:00
parent 691da0ed3e
commit ed122a11c2
2 changed files with 30 additions and 23 deletions

View File

@ -18,7 +18,8 @@
- [#544] Error: Color Lines are black until touched. - [#544] Error: Color Lines are black until touched.
- [#543] Detail loses details. - [#543] Detail loses details.
- [#548] Bug Detail tool. Case when seam allowance is wrong. - [#548] Bug Detail tool. Case when seam allowance is wrong.
- Called the main app in console mode doesn't show opening file error in some cases. - Called the main app in console mode doesn't show opening file error in some cases.
- [#553] Tape.exe crash. Issue with the Search field.
# Version 0.4.4 April 12, 2016 # Version 0.4.4 April 12, 2016
- Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements.

View File

@ -42,17 +42,25 @@ void VTableSearch::Clear()
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr);
foreach(QTableWidgetItem *item, searchList) for(int i = 0; i < table->rowCount(); ++i)
{ {
if (item->row() % 2 != 0 && table->alternatingRowColors()) for(int j = 0; j < table->columnCount(); ++j)
{ {
item->setBackground(QPalette().alternateBase()); if (QTableWidgetItem *item = table->item(i, j))
} {
else if (item->row() % 2 != 0 && table->alternatingRowColors())
{ {
item->setBackground(QPalette().base()); item->setBackground(QPalette().alternateBase());
}
else
{
item->setBackground(QPalette().base());
}
}
} }
} }
searchList.clear();
searchIndex = -1; searchIndex = -1;
} }
@ -80,26 +88,24 @@ void VTableSearch::Find(const QString &term)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr);
const QList<QTableWidgetItem *> list = table->findItems(term, Qt::MatchContains); Clear();
if (list.isEmpty() || term.isEmpty()) if (not term.isEmpty())
{ {
Clear(); searchList = table->findItems(term, Qt::MatchContains);
}
else
{
Clear();
searchList = list; if (not searchList.isEmpty())
foreach(QTableWidgetItem *item, searchList)
{ {
item->setBackground(Qt::yellow); foreach(QTableWidgetItem *item, searchList)
} {
item->setBackground(Qt::yellow);
}
searchIndex = 0; searchIndex = 0;
QTableWidgetItem *item = searchList.at(searchIndex); QTableWidgetItem *item = searchList.at(searchIndex);
item->setBackground(Qt::red); item->setBackground(Qt::red);
table->scrollToItem(item); table->scrollToItem(item);
}
} }
} }