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

lokalize

  • sources
  • kde-4.14
  • kdesdk
  • lokalize
  • src
  • tm
qamodel.h
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2011-2012 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 
25 #ifndef QAMODEL_H
26 #define QAMODEL_H
27 
28 #include "rule.h"
29 #include <QAbstractListModel>
30 #include <QDomDocument>
31 
32 class QaModel: public QAbstractListModel
33 {
34  //Q_OBJECT
35 public:
36 
37  enum Columns
38  {
39  //ID = 0,
40  Source = 0,
41  FalseFriend,
42  ColumnCount
43  };
44 
45  QaModel(QObject* parent=0/*, Glossary* glossary*/);
46  ~QaModel();
47 
48  bool loadRules(const QString& filename);
49  bool saveRules(QString filename=QString());
50 
51  int rowCount(const QModelIndex& parent=QModelIndex()) const;
52  int columnCount(const QModelIndex& parent=QModelIndex()) const {return ColumnCount;}
53  QVariant headerData(int section,Qt::Orientation, int role = Qt::DisplayRole ) const;
54  Qt::ItemFlags flags(const QModelIndex&) const;
55  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
56  QVariant data(const QModelIndex&, int role=Qt::DisplayRole) const;
57 
58  QVector<Rule> toVector() const;
59 
60  QModelIndex appendRow();
61  void removeRow(const QModelIndex&);
62 
63 
64  static QaModel* instance();
65  static bool isInstantiated();
66 private:
67  static QaModel* _instance;
68  static void cleanupQaModel();
69 
70 
71 private:
72  QDomDocument m_doc;
73  QDomNodeList m_entries;
74  QString m_filename;
75 };
76 
77 
78 #endif // QAMODEL_H
QModelIndex
QaModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: qamodel.cpp:220
rule.h
QDomNodeList
QaModel::Columns
Columns
Definition: qamodel.h:37
QaModel::~QaModel
~QaModel()
Definition: qamodel.cpp:84
QaModel::QaModel
QaModel(QObject *parent=0)
Definition: qamodel.cpp:80
QaModel::appendRow
QModelIndex appendRow()
Definition: qamodel.cpp:189
QaModel::saveRules
bool saveRules(QString filename=QString())
Definition: qamodel.cpp:170
QObject
QAbstractListModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QAbstractListModel
QaModel::removeRow
void removeRow(const QModelIndex &)
Definition: qamodel.cpp:203
QaModel::Source
Definition: qamodel.h:40
QaModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: qamodel.cpp:89
QString
QaModel::flags
Qt::ItemFlags flags(const QModelIndex &) const
Definition: qamodel.cpp:215
QaModel
Definition: qamodel.h:32
QDomDocument
QaModel::data
QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: qamodel.cpp:111
QaModel::ColumnCount
Definition: qamodel.h:42
QVector< Rule >
QaModel::loadRules
bool loadRules(const QString &filename)
Definition: qamodel.cpp:145
QaModel::headerData
QVariant headerData(int section, Qt::Orientation, int role=Qt::DisplayRole) const
Definition: qamodel.cpp:96
QaModel::isInstantiated
static bool isInstantiated()
Definition: qamodel.cpp:64
QaModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: qamodel.h:52
QObject::parent
QObject * parent() const
QaModel::instance
static QaModel * instance()
Definition: qamodel.cpp:69
QaModel::FalseFriend
Definition: qamodel.h:41
QaModel::toVector
QVector< Rule > toVector() const
Definition: qamodel.cpp:125
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:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

lokalize

Skip menu "lokalize"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

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