1
by Philip Muškovac
Import upstream version 4.6.90+repack1 |
1 |
/*************************************************************************************
|
2 |
* Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org> *
|
|
3 |
* *
|
|
4 |
* This program is free software; you can redistribute it and/or *
|
|
5 |
* modify it under the terms of the GNU General Public License *
|
|
6 |
* as published by the Free Software Foundation; either version 2 *
|
|
7 |
* of the License, or (at your option) any later version. *
|
|
8 |
* *
|
|
9 |
* This program is distributed in the hope that it will be useful, *
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
12 |
* GNU General Public License for more details. *
|
|
13 |
* *
|
|
14 |
* You should have received a copy of the GNU General Public License *
|
|
15 |
* along with this program; if not, write to the Free Software *
|
|
16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
|
17 |
*************************************************************************************/
|
|
18 |
||
19 |
#ifndef VARIABLESMODEL_H
|
|
20 |
#define VARIABLESMODEL_H
|
|
21 |
||
22 |
#include <QAbstractTableModel> |
|
23 |
#include "analitzaguiexport.h" |
|
24 |
||
25 |
namespace Analitza |
|
26 |
{
|
|
27 |
class Variables; |
|
28 |
class Expression; |
|
29 |
}
|
|
30 |
||
31 |
/** Variables model is a model class that has a relation of all operators string with their VariableType. */
|
|
32 |
class ANALITZAGUI_EXPORT VariablesModel : public QAbstractTableModel |
|
33 |
{
|
|
34 |
Q_OBJECT
|
|
35 |
public: |
|
36 |
/** Constructor. Creates a new Variable Model. */
|
|
37 |
explicit VariablesModel(Analitza::Variables* v, QObject *parent=0); |
|
38 |
||
39 |
virtual QFlags< Qt::ItemFlag > flags(const QModelIndex& index) const; |
|
40 |
bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole); |
|
41 |
QVariant data( const QModelIndex &index, int role=Qt::DisplayRole) const; |
|
42 |
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const; |
|
43 |
int rowCount(const QModelIndex &parent) const; |
|
44 |
int columnCount(const QModelIndex &) const { return 2; } |
|
45 |
||
46 |
void insertVariable(const QString& name, const Analitza::Expression& value); |
|
47 |
void setEditable(bool ed) { m_editable=ed; } |
|
48 |
||
49 |
Analitza::Variables* variables() const { return m_vars; } |
|
50 |
public slots: |
|
51 |
/** Updates the variables information */
|
|
52 |
void updateInformation(); |
|
53 |
||
54 |
private: |
|
55 |
Analitza::Variables *m_vars; |
|
56 |
bool m_editable; |
|
57 |
};
|
|
58 |
||
59 |
#endif
|