[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/parley/src
From: Frederik Gladhorn <frederik.gladhorn () gmx ! de>
Date: 2008-03-02 21:27:24
Message-ID: 1204493244.436256.15433.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 781441 by gladhorn:
Add some extra columns with grades to the container model. Statistics page is coming \
:) Extra cols need to be hidden in the other views.
Better flags for lesson items (selectable, enabled).
M +3 -1 statistics-dialogs/lessonstatistics.cpp
M +25 -24 vocabulary/containermodel.cpp
--- trunk/KDE/kdeedu/parley/src/statistics-dialogs/lessonstatistics.cpp \
#781440:781441 @@ -25,9 +25,11 @@
#include <KAction>
#include <KActionCollection>
+#include <QHeaderView>
+
LessonStatisticsView::LessonStatisticsView(QWidget * parent) :ContainerView(parent)
{
-
+ header()->setVisible(true);
}
--- trunk/KDE/kdeedu/parley/src/vocabulary/containermodel.cpp #781440:781441
@@ -59,21 +59,6 @@
if (doc) {
beginInsertRows(QModelIndex(), 0, 0);
- /*
- switch(m_type){
- case KEduVocLesson::Lesson:
- kDebug() << "setting root lesson";
- m_container->appendChildContainer(doc->lesson());
- break;
- case KEduVocLesson::WordType:
- m_container->appendChildContainer(doc->wordTypeContainer());
- break;
- // case KEduVocLesson::Leitner:
- // m_container
- // break;
- default:
- break;
- } */
m_doc = doc;
endInsertRows();
}
@@ -256,7 +241,7 @@
KEduVocContainer *container = \
static_cast<KEduVocContainer*>(index.internalPointer());
switch (index.column()){
- case 0:
+ case 0: // Lesson name
if (role == Qt::DisplayRole || role == Qt::EditRole) {
return container->name();
}
@@ -273,13 +258,22 @@
if (role == Qt::TextAlignmentRole) {
return Qt::AlignLeft;
}
- case 1:
+ break;
+ case 1: // Total count
if (role == Qt::DisplayRole) {
return container->entryCount(KEduVocLesson::Recursive);
}
if (role == Qt::TextAlignmentRole) {
return Qt::AlignRight;
}
+ break;
+ default: // Average grade
+ if (role == Qt::DisplayRole) {
+ return container->averageGrade(index.column()-2);
+ }
+ if (role == Qt::TextAlignmentRole) {
+ return Qt::AlignRight;
+ }
}
return QVariant();
@@ -326,10 +320,12 @@
return (Qt::ItemIsEnabled | Qt::ItemIsSelectable
| Qt::ItemIsUserCheckable | Qt::ItemIsDropEnabled );
}
- // every other element
+ // the name column
if ( index.column() == 0 ) {
return (Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable
| Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | \
Qt::ItemIsDropEnabled ); + } else { // every other element
+ return (Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled \
| Qt::ItemIsDropEnabled ); }
}
return Qt::ItemIsDropEnabled;
@@ -345,7 +341,7 @@
if(role == Qt::DisplayRole) {
return i18n("Lesson");
}
-
+ break;
case 1:
if(role == Qt::DisplayRole) {
return QVariant();
@@ -353,6 +349,11 @@
if(role == Qt::ToolTipRole) {
return i18n("Number of entries in this lesson.");
}
+ break;
+ default:
+ if(role == Qt::DisplayRole) {
+ return i18nc("Grade in language, table header", "Grade (%1)", \
m_doc->identifier(section-2).name()); + }
}
}
return QVariant();
@@ -362,12 +363,12 @@
int ContainerModel::columnCount(const QModelIndex & parent) const
{
Q_UNUSED(parent);
+ if (!m_doc) {
+ return 2;
+ }
-// if(!m_doc) {
-// return 0;
-// }
-
- return 2;
+ // for now one grade per language
+ return 2 + m_doc->identifierCount();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic