• 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
  • editor
vocabularydelegate.h
Go to the documentation of this file.
1 /***************************************************************************
2 
3  Copyright 2006, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
4  Copyright 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
5 
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef VOCABULARYDELEGATE_H
18 #define VOCABULARYDELEGATE_H
19 
20 #include "readonlycontainermodel.h"
21 #include "../scripts/translator.h"
22 
23 #include <QItemDelegate>
24 #include <QModelIndex>
25 
26 class KEduVocDocument;
27 
28 namespace Editor
29 {
30 
31 class VocabularyDelegate : public QItemDelegate
32 {
33  Q_OBJECT
34 public:
35  enum entryColumns {
36  Translation = 0,
37  Pronunciation,
38  WordType,
39  Synonym,
40  Antonym,
41  Example,
42  Comment,
43  Paraphrase,
44 // Audio,
45 // Image,
46  EntryColumnsMAX
47  };
48 
49  VocabularyDelegate(QObject *parent = 0);
50 
51  QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
52 
53  void setEditorData(QWidget *editor, const QModelIndex &index) const;
54  void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
55  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
56  void setTranslator(Translator * translator);
57 
58  static int columnType(int column);
59 
60  bool hasAudio(const QModelIndex &index) const;
61  bool hasImage(const QModelIndex &index) const;
62  QString audioUrl(const QModelIndex &index) const;
63  QString imageUrl(const QModelIndex &index) const;
64  QPolygon audioPolygon(const QStyleOptionViewItem &option) const;
65  QPolygon imagePolygon(const QStyleOptionViewItem &option) const;
66 
67 public slots:
68  void setDocument(KEduVocDocument *doc);
69  bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index );
70 
71 private:
72  KEduVocDocument *m_doc;
73  Translator * m_translator;
74 
76  QSet<QString> getTranslations(const QModelIndex & index) const;
77 
78  // for the word type combo
79  class WordTypeBasicModel;
80 };
81 
82 class VocabularyDelegate::WordTypeBasicModel : public ReadonlyContainerModel
83 {
84 public:
85  explicit WordTypeBasicModel(QObject *parent = 0);
86 protected:
87  KEduVocContainer * rootContainer() const;
88 };
89 
90 }
91 
92 #endif
Editor::VocabularyDelegate::Paraphrase
Definition: vocabularydelegate.h:43
ReadonlyContainerModel
Model for the tree of containers (lessons, word types).
Definition: readonlycontainermodel.h:33
QModelIndex
QWidget
Editor::VocabularyDelegate::setEditorData
void setEditorData(QWidget *editor, const QModelIndex &index) const
Definition: vocabularydelegate.cpp:247
QAbstractItemView
Editor::VocabularyDelegate::Pronunciation
Definition: vocabularydelegate.h:37
Editor::VocabularyDelegate::EntryColumnsMAX
Definition: vocabularydelegate.h:46
Editor::VocabularyDelegate::hasImage
bool hasImage(const QModelIndex &index) const
Definition: vocabularydelegate.cpp:203
Editor::VocabularyDelegate::setDocument
void setDocument(KEduVocDocument *doc)
Definition: vocabularydelegate.cpp:327
Editor::VocabularyDelegate::WordTypeBasicModel::rootContainer
KEduVocContainer * rootContainer() const
Definition: vocabularydelegate.cpp:355
Editor::VocabularyDelegate::paint
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: vocabularydelegate.cpp:227
Editor::VocabularyDelegate
Definition: vocabularydelegate.h:31
Editor::VocabularyDelegate::setModelData
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: vocabularydelegate.cpp:277
Editor::VocabularyDelegate::Example
Definition: vocabularydelegate.h:41
Editor::VocabularyDelegate::imageUrl
QString imageUrl(const QModelIndex &index) const
Definition: vocabularydelegate.cpp:215
QPolygon
QObject::event
virtual bool event(QEvent *e)
Editor::VocabularyDelegate::audioUrl
QString audioUrl(const QModelIndex &index) const
Definition: vocabularydelegate.cpp:208
QStyleOptionViewItem
QObject
Editor::VocabularyDelegate::WordTypeBasicModel::WordTypeBasicModel
WordTypeBasicModel(QObject *parent=0)
Definition: vocabularydelegate.cpp:350
QPainter
Editor::VocabularyDelegate::WordType
Definition: vocabularydelegate.h:38
QItemDelegate
Editor::VocabularyDelegate::Translation
Definition: vocabularydelegate.h:36
QSet
QString
readonlycontainermodel.h
Editor::VocabularyDelegate::entryColumns
entryColumns
Definition: vocabularydelegate.h:35
Translator
Keeps the translated words.
Definition: translator.h:74
Editor::VocabularyDelegate::Synonym
Definition: vocabularydelegate.h:39
Editor::VocabularyDelegate::createEditor
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: vocabularydelegate.cpp:73
Editor::VocabularyDelegate::hasAudio
bool hasAudio(const QModelIndex &index) const
Definition: vocabularydelegate.cpp:198
Editor::VocabularyDelegate::Antonym
Definition: vocabularydelegate.h:40
QAbstractItemModel
Editor::VocabularyDelegate::setTranslator
void setTranslator(Translator *translator)
Sets the member variable m_translator to a Translator object.
Definition: vocabularydelegate.cpp:367
Editor::VocabularyDelegate::Comment
Definition: vocabularydelegate.h:42
Editor::VocabularyDelegate::VocabularyDelegate
VocabularyDelegate(QObject *parent=0)
Definition: vocabularydelegate.cpp:40
QObject::parent
QObject * parent() const
QHelpEvent
Editor::VocabularyDelegate::imagePolygon
QPolygon imagePolygon(const QStyleOptionViewItem &option) const
Definition: vocabularydelegate.cpp:188
Editor::VocabularyDelegate::audioPolygon
QPolygon audioPolygon(const QStyleOptionViewItem &option) const
Definition: vocabularydelegate.cpp:178
Editor::VocabularyDelegate::helpEvent
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
Definition: vocabularydelegate.cpp:150
Editor::VocabularyDelegate::columnType
static int columnType(int column)
Definition: vocabularydelegate.cpp:222
Editor::VocabularyDelegate::WordTypeBasicModel
Definition: vocabularydelegate.h:82
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