• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

parley

KVTLessonModel Class Reference

#include <kvtlessonmodel.h>

Inheritance diagram for KVTLessonModel:

Inheritance graph
[legend]

List of all members.


Detailed Description

Model for the list of lessons.

This is a list model for now. It obtains its data from the kvtml document. QStringListModel is a bit simpler, but I want to handle the m_doc interface here to keep it simple from the outside.

Definition at line 36 of file kvtlessonmodel.h.


Public Types

enum  SplitLessonOrder { sorted, random }

Public Member Functions

 KVTLessonModel (QObject *parent=0)
void setDocument (KEduVocDocument *doc)
KEduVocDocument * document () const
int rowCount (const QModelIndex &parent=QModelIndex()) const
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Qt::ItemFlags flags (const QModelIndex &index) const
QVariant data (const QModelIndex &index, int role) const
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
int currentLesson () const
void setCurrentLesson (int index)
void setModified (bool modified)
void setAllLessonsInPractice ()
void setNoLessonsInPractice ()
int addLesson (const QString &lessonName=QString())
bool deleteLesson (int lessonIndex, KEduVocDocument::LessonDeletion mode)
Qt::DropActions supportedDropActions () const
bool removeRows (int row, int count, const QModelIndex &parent)
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
void splitLesson (int lessonIndex, int entriesPerLesson, SplitLessonOrder order)

Member Enumeration Documentation

enum KVTLessonModel::SplitLessonOrder

When splitting a lesson into smaller ones - how to sort the entries into lessons.

Enumerator:
sorted  The order of the entries in the document.
random  Randomized.

Definition at line 42 of file kvtlessonmodel.h.


Constructor & Destructor Documentation

KVTLessonModel::KVTLessonModel ( QObject *  parent = 0  )  [inline]

Definition at line 47 of file kvtlessonmodel.h.


Member Function Documentation

void KVTLessonModel::setDocument ( KEduVocDocument *  doc  ) 

Set the new source kvtml file.

Parameters:
doc the new file
Todo:
the old clean up code is homeless right now:

Definition at line 109 of file kvtlessonmodel.cpp.

KEduVocDocument* KVTLessonModel::document (  )  const [inline]

Definition at line 54 of file kvtlessonmodel.h.

int KVTLessonModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const

The number of Lessons.

Parameters:
parent will always be QModelIndex() as long as we only have a list here
Returns:
number of lessons

Definition at line 115 of file kvtlessonmodel.cpp.

QVariant KVTLessonModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

Header of the treeview.

Definition at line 121 of file kvtlessonmodel.cpp.

Qt::ItemFlags KVTLessonModel::flags ( const QModelIndex &  index  )  const

flags of the items - see model/view

Parameters:
index item
Returns:
flags

Definition at line 135 of file kvtlessonmodel.cpp.

QVariant KVTLessonModel::data ( const QModelIndex &  index,
int  role 
) const

Get the data of an entry.

Parameters:
index index of an entry
role Qt::DisplayRole = lesson name, Qt::CheckStateRole = checkbox state
Returns:
data

checkboxes

Definition at line 150 of file kvtlessonmodel.cpp.

bool KVTLessonModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)

Change the name or checkbox of a lesson.

Parameters:
index which lesson
value new name
role 
Returns:
bool true it worked

rename a lesson

checkboxes

Definition at line 171 of file kvtlessonmodel.cpp.

int KVTLessonModel::currentLesson (  )  const [inline]

Definition at line 82 of file kvtlessonmodel.h.

void KVTLessonModel::setCurrentLesson ( int  index  )  [inline]

Definition at line 86 of file kvtlessonmodel.h.

void KVTLessonModel::setModified ( bool  modified  )  [inline]

Definition at line 91 of file kvtlessonmodel.h.

void KVTLessonModel::setAllLessonsInPractice (  ) 

Make all lessons checked for query.

Definition at line 200 of file kvtlessonmodel.cpp.

void KVTLessonModel::setNoLessonsInPractice (  ) 

Make all lessons UNchecked for query.

Definition at line 212 of file kvtlessonmodel.cpp.

int KVTLessonModel::addLesson ( const QString &  lessonName = QString()  ) 

Definition at line 223 of file kvtlessonmodel.cpp.

bool KVTLessonModel::deleteLesson ( int  lessonIndex,
KEduVocDocument::LessonDeletion  mode 
)

Definition at line 240 of file kvtlessonmodel.cpp.

Qt::DropActions KVTLessonModel::supportedDropActions (  )  const

Definition at line 144 of file kvtlessonmodel.cpp.

bool KVTLessonModel::removeRows ( int  row,
int  count,
const QModelIndex &  parent 
)

Todo:
either really use this or remove it

Definition at line 250 of file kvtlessonmodel.cpp.

bool KVTLessonModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)

Definition at line 308 of file kvtlessonmodel.cpp.

void KVTLessonModel::splitLesson ( int  lessonIndex,
int  entriesPerLesson,
SplitLessonOrder  order 
)

Divide a lesson into smaller ones.

Tip: If you create a lesson that is >= the original one and use random order, you get your lesson reshuffled. Maybe that is sometimes useful. For now the lessons are appended at the end.

Parameters:
lessonIndex lesson to split
entriesPerLesson number of entries in each new lesson
order one of SplitLessonOrder

lesson which receives the entries until full

number entries in the lesson that is being filled

next entry to be assigned to one of the new lessons

Todo:
random from 0 to entryList.count() -1;

Todo:
check the entire function

Definition at line 263 of file kvtlessonmodel.cpp.


The documentation for this class was generated from the following files:
  • kvtlessonmodel.h
  • kvtlessonmodel.cpp

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal