[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/qt training_widget.cpp
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot/qt training_widget.cpp |
Date: |
Sun, 11 Jul 2010 20:58:03 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 10/07/11 20:58:03
Modified files:
qt : training_widget.cpp
Log message:
Color in red the line if the word corresponds to the best score
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/training_widget.cpp?cvsroot=eliot&r1=1.15&r2=1.16
Patches:
Index: training_widget.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/training_widget.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- training_widget.cpp 6 Mar 2010 16:54:20 -0000 1.15
+++ training_widget.cpp 11 Jul 2010 20:58:03 -0000 1.16
@@ -147,6 +147,10 @@
return;
const Results &results = m_game->trainingGetResults();
+ // Find the highest score
+ int bestScore = -1;
+ if (results.size() != 0)
+ bestScore = results.get(0).getPoints();
for (unsigned int i = 0; i < results.size(); ++i)
{
const Round &r = results.get(i);
@@ -158,6 +162,16 @@
m_model->setData(m_model->index(rowNum, 2), r.getPoints());
m_model->setData(m_model->index(rowNum, 3),
r.getBonus() ? "*": "");
+ // Color the line in red if this is the top score
+ if (r.getPoints() == bestScore)
+ {
+ const QBrush redBrush(Qt::red);
+ for (int j = 0; j < 5; ++j)
+ {
+ m_model->setData(m_model->index(rowNum, j),
+ redBrush, Qt::ForegroundRole);
+ }
+ }
// Hidden data, used to handle proper sorting in the tree view
m_model->setData(m_model->index(rowNum, 5), i);
}
- [Eliot-dev] eliot/qt training_widget.cpp,
Olivier Teulière <=