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

cantor/src/lib

  • sources
  • kde-4.14
  • kdeedu
  • cantor
  • src
  • lib
defaultvariablemodel.h
Go to the documentation of this file.
1 /*
2  This program is free software; you can redistribute it and/or
3  modify it under the terms of the GNU General Public License
4  as published by the Free Software Foundation; either version 2
5  of the License, or (at your option) any later version.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor,
15  Boston, MA 02110-1301, USA.
16 
17  ---
18  Copyright (C) 2010 Miha Čančula <miha.cancula@gmail.com>
19  */
20 
21 #ifndef CANTOR_DEFAULTVARIABLEMODEL_H
22 #define CANTOR_DEFAULTVARIABLEMODEL_H
23 
24 #include <QAbstractTableModel>
25 #include "session.h"
26 #include "expression.h"
27 
28 namespace Cantor {
29 
30 class DefaultVariableModelPrivate;
31 
47 class CANTOR_EXPORT DefaultVariableModel : public QAbstractTableModel
48 {
49  Q_OBJECT
50  Q_PROPERTY(Session* session READ session)
51 
52 public:
53 
57  struct Variable
58  {
62  QString name;
66  QString value;
67  };
68 
78  explicit DefaultVariableModel(Session* session);
79  virtual ~DefaultVariableModel();
80 
85  Session* session() const;
86 
87 public Q_SLOTS:
94  void addVariable(const QString& name, const QString& value);
99  void addVariable(const Variable& variable);
105  void removeVariable(const QString& name);
110  void removeVariable(const Variable& variable);
114  void clearVariables();
115 
116 
117 protected:
118  virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
119  virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
120 
121  virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
122  virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
123  virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
124  virtual Qt::ItemFlags flags(const QModelIndex& index) const;
125 
126  enum Column
127  {
128  NameColumn = 0,
129  ValueColumn = 1,
130  ColumnCount = 2
131  };
132 
133 private:
134 
135  DefaultVariableModelPrivate* const d_ptr;
136  Q_DECLARE_PRIVATE(DefaultVariableModel)
137 };
138 
139 bool operator==(const Cantor::DefaultVariableModel::Variable& one, const Cantor::DefaultVariableModel::Variable& other);
140 
141 }
142 
143 #endif // CANTOR_DEFAULTVARIABLEMODEL_H
QModelIndex
CANTOR_EXPORT
#define CANTOR_EXPORT
Definition: cantor_export.h:33
Cantor::DefaultVariableModel
This DefaultVariableModel class is an implementation of QAbstractItemModel that can be used with the ...
Definition: defaultvariablemodel.h:47
QAbstractTableModel
session.h
Cantor::DefaultVariableModel::Variable
A structure representing a variable.
Definition: defaultvariablemodel.h:57
Cantor::DefaultVariableModel::Column
Column
Definition: defaultvariablemodel.h:126
Cantor::operator==
bool operator==(const Cantor::DefaultVariableModel::Variable &one, const Cantor::DefaultVariableModel::Variable &other)
Definition: defaultvariablemodel.cpp:194
expression.h
QString
Cantor::DefaultVariableModel::Variable::name
QString name
The variable's name.
Definition: defaultvariablemodel.h:62
QVariant
Qt::ItemFlags
typedef ItemFlags
Cantor::DefaultVariableModel::Variable::value
QString value
The variable's value, represented as a string.
Definition: defaultvariablemodel.h:66
Cantor::Session
The Session object is the main class used to interact with a Backend.
Definition: session.h:50
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

cantor/src/lib

Skip menu "cantor/src/lib"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

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