|
KTutorial
0.5.1
|
A ListModel that fetchs its data from a TutorialManager. More...
#include <TutorialListModel.h>
Public Member Functions | |
| TutorialListModel (const TutorialManager *tutorialManager, QObject *parent=0) | |
| Creates a new TutoriaListModel. | |
| virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| Returns the number of available tutorials. | |
| virtual QVariant | data (const QModelIndex &index, int role) const |
| Returns the name of the tutorial with the specified index. | |
| virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
| Returns the data for the given role and section in the header. | |
| const TutorialInformation * | getTutorialInformationForIndex (const QModelIndex &index) const |
| Returns the TutorialInformation associated with the specified index. | |
A ListModel that fetchs its data from a TutorialManager.
This is a very basic read-only model. It just shows the TutorialInformations registered in a TutorialManager as a list where each element is the name of a TutorialInformation.
To know the TutorialInformation associated with an index, use getTutorialInformationForIndex(const QModelIndex&).
Definition at line 43 of file TutorialListModel.h.
| ktutorial::view::TutorialListModel::TutorialListModel | ( | const TutorialManager * | tutorialManager, |
| QObject * | parent = 0 |
||
| ) | [inline, explicit] |
Creates a new TutoriaListModel.
It gets the data from the specified TutorialManager.
| tutorialManager | The TutorialManager to get the data from. |
| parent | The parent QObject, defaults to null. |
Definition at line 54 of file TutorialListModel.h.
| QVariant ktutorial::view::TutorialListModel::data | ( | const QModelIndex & | index, |
| int | role | ||
| ) | const [virtual] |
Returns the name of the tutorial with the specified index.
If the index isn't valid or the role isn't DisplayRole, an empty message is returned.
| index | The index to get its data. |
| role | The role of the data. |
Definition at line 37 of file TutorialListModel.cpp.
References getTutorialInformationForIndex(), and ktutorial::TutorialInformation::name().
| const TutorialInformation * ktutorial::view::TutorialListModel::getTutorialInformationForIndex | ( | const QModelIndex & | index | ) | const |
Returns the TutorialInformation associated with the specified index.
If the index is invalid, a null pointer is returned.
| index | The index to get its associatted TutorialInformation. |
Definition at line 64 of file TutorialListModel.cpp.
References ktutorial::TutorialManager::tutorialInformations().
Referenced by data().
| QVariant ktutorial::view::TutorialListModel::headerData | ( | int | section, |
| Qt::Orientation | orientation, | ||
| int | role = Qt::DisplayRole |
||
| ) | const [virtual] |
Returns the data for the given role and section in the header.
"Tutorials name" is returned for first section of DisplayRole, and an empty message for other sections and roles.
| section | The section of the header data. |
| orientation | Ignored. |
| role | The role of the header data. |
Definition at line 51 of file TutorialListModel.cpp.
| int ktutorial::view::TutorialListModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
Returns the number of available tutorials.
| parent | Ignored. |
Definition at line 33 of file TutorialListModel.cpp.
References ktutorial::TutorialManager::tutorialInformations().
1.8.0