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

parley

  • sources
  • kde-4.14
  • kdeedu
  • parley
  • src
  • collection
vocabularymodel.h
Go to the documentation of this file.
1 /***************************************************************************
2 
3  Copyright 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
4 
5  ***************************************************************************/
6 
7 /***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef VOCABULARYMODEL_H
16 #define VOCABULARYMODEL_H
17 
18 #include <keduvocexpression.h>
19 #include <keduvoctranslation.h>
20 #include <QAbstractTableModel>
21 
22 class KEduVocDocument;
23 class KEduVocLesson;
24 
25 
29 class VocabularyModel : public QAbstractTableModel
30 {
31  Q_OBJECT
32 public:
33  enum entryColumns {
34  Translation = 0,
35  Pronunciation,
36  WordClass,
37  Synonym,
38  Antonym,
39  Example,
40  Comment,
41  Paraphrase,
42 // Audio,
43 // Image,
44  EntryColumnsMAX
45 
46  };
47 
48  enum roles {
49  TranslationRole = Qt::UserRole,
50  EntryRole,
51  LocaleRole,
52  AudioRole,
53  ImageRole
54  };
55 
56  VocabularyModel(QObject *parent = 0);
57 
58  ~VocabularyModel();
59 
60 
61  int rowCount(const QModelIndex&) const;
62  int columnCount(const QModelIndex&) const;
63  QVariant data(const QModelIndex&, int) const;
64  bool setData(const QModelIndex &index, const QVariant &value, int role);
65  Qt::ItemFlags flags(const QModelIndex &index) const;
66 
67  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
68 
72  static QString columnTitle(KEduVocDocument *document, int translation, int column);
73 
78  static int translation(int column);
79 
84  static int columnType(int column);
85 
86  QModelIndex appendEntry(KEduVocExpression *expression = 0);
87 
88  bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
89 
90  QStringList mimeTypes() const;
91  QMimeData * mimeData(const QModelIndexList &indexes) const;
92 // bool dropMimeData(const QMimeData *data, Qt::DropAction action,
93 // int row, int column, const QModelIndex &parent);
94 
95  void resetLanguages();
96 
97 public slots:
98  void setDocument(KEduVocDocument *doc);
99 
104  void showContainer(KEduVocContainer *container);
105 
110  void setLesson(KEduVocLesson *lessonContainer);
111 
112  KEduVocLesson * lesson();
113 
118  void showEntriesOfSubcontainers(bool show);
119 
124  void automaticTranslation(bool enabled);
125 
126 
127 private:
128  KEduVocContainer *m_container;
129  KEduVocLesson *m_lesson;
130 
131  KEduVocDocument *m_document;
132  KEduVocContainer::EnumEntriesRecursive m_recursive;
133 };
134 
135 Q_DECLARE_METATYPE(KEduVocExpression*)
136 
137 #endif
VocabularyModel::setLesson
void setLesson(KEduVocLesson *lessonContainer)
Definition: vocabularymodel.cpp:85
VocabularyModel::~VocabularyModel
~VocabularyModel()
Definition: vocabularymodel.cpp:44
VocabularyModel::TranslationRole
Definition: vocabularymodel.h:49
VocabularyModel::Antonym
Definition: vocabularymodel.h:38
QModelIndex
VocabularyModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: vocabularymodel.cpp:245
VocabularyModel::columnCount
int columnCount(const QModelIndex &) const
Definition: vocabularymodel.cpp:108
VocabularyModel::entryColumns
entryColumns
Definition: vocabularymodel.h:33
QAbstractTableModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QAbstractTableModel
VocabularyModel::WordClass
Definition: vocabularymodel.h:36
VocabularyModel::Translation
Definition: vocabularymodel.h:34
VocabularyModel::mimeData
QMimeData * mimeData(const QModelIndexList &indexes) const
Definition: vocabularymodel.cpp:366
VocabularyModel::rowCount
int rowCount(const QModelIndex &) const
Definition: vocabularymodel.cpp:95
QMimeData
VocabularyModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role)
Definition: vocabularymodel.cpp:208
VocabularyModel::showEntriesOfSubcontainers
void showEntriesOfSubcontainers(bool show)
Show the entries of child lessons in selected lessons.
Definition: vocabularymodel.cpp:386
VocabularyModel::VocabularyModel
VocabularyModel(QObject *parent=0)
Definition: vocabularymodel.cpp:34
VocabularyModel::Comment
Definition: vocabularymodel.h:40
VocabularyModel::Pronunciation
Definition: vocabularymodel.h:35
VocabularyModel::data
QVariant data(const QModelIndex &, int) const
Definition: vocabularymodel.cpp:116
VocabularyModel::removeRows
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Definition: vocabularymodel.cpp:343
VocabularyModel::columnType
static int columnType(int column)
Returns the type of the column specified.
Definition: vocabularymodel.cpp:315
QObject
VocabularyModel::Synonym
Definition: vocabularymodel.h:37
VocabularyModel::EntryRole
Definition: vocabularymodel.h:50
QString
VocabularyModel::LocaleRole
Definition: vocabularymodel.h:51
VocabularyModel::Example
Definition: vocabularymodel.h:39
QStringList
VocabularyModel
Definition: vocabularymodel.h:29
VocabularyModel::Paraphrase
Definition: vocabularymodel.h:41
VocabularyModel::mimeTypes
QStringList mimeTypes() const
Definition: vocabularymodel.cpp:361
VocabularyModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: vocabularymodel.cpp:264
VocabularyModel::resetLanguages
void resetLanguages()
Definition: vocabularymodel.cpp:397
VocabularyModel::showContainer
void showContainer(KEduVocContainer *container)
Whatever the contents, the model will now display it.
Definition: vocabularymodel.cpp:66
VocabularyModel::automaticTranslation
void automaticTranslation(bool enabled)
Set automatic translation to enabled/disabled.
Definition: vocabularymodel.cpp:403
VocabularyModel::translation
static int translation(int column)
Returns which translation this column matches.
Definition: vocabularymodel.cpp:310
VocabularyModel::columnTitle
static QString columnTitle(KEduVocDocument *document, int translation, int column)
Returns the name of the entryColumns column.
Definition: vocabularymodel.cpp:283
VocabularyModel::ImageRole
Definition: vocabularymodel.h:53
VocabularyModel::AudioRole
Definition: vocabularymodel.h:52
VocabularyModel::appendEntry
QModelIndex appendEntry(KEduVocExpression *expression=0)
Definition: vocabularymodel.cpp:320
VocabularyModel::roles
roles
Definition: vocabularymodel.h:48
VocabularyModel::EntryColumnsMAX
Definition: vocabularymodel.h:44
QObject::parent
QObject * parent() const
VocabularyModel::lesson
KEduVocLesson * lesson()
Definition: vocabularymodel.cpp:90
VocabularyModel::setDocument
void setDocument(KEduVocDocument *doc)
Definition: vocabularymodel.cpp:48
QVariant
Qt::ItemFlags
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

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

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal