casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
logmodel.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 //# $Id: $
26 
27 #ifndef LOGMODEL_H
28 #define LOGMODEL_H
29 
30 
31 #include <graphics/X11/X_enter.h>
32 #include <QAbstractItemModel>
33 #include <QModelIndex>
34 #include <QVariant>
35 #include <QTextStream>
36 #include <graphics/X11/X_exit.h>
37 
38 namespace casa {
39 
40 class LogItem;
41 
42 class LogModel : public QAbstractItemModel
43 {
44  Q_OBJECT
45 
46 public:
47  LogModel(const QString &data, QObject *parent = 0);
48  ~LogModel();
49 
50  QVariant data(const QModelIndex &index, int role) const;
51  Qt::ItemFlags flags(const QModelIndex &index) const;
52  QVariant headerData(int section, Qt::Orientation orientation,
53  int role = Qt::DisplayRole) const;
54  QModelIndex index(int row, int column,
55  const QModelIndex &parent = QModelIndex()) const;
56  QModelIndex parent(const QModelIndex &index) const;
57  int rowCount(const QModelIndex &parent = QModelIndex()) const;
58  int columnCount(const QModelIndex &parent = QModelIndex()) const;
59 
60  void writeData(QTextStream &os);
61  QString stringData();
62  QString stringData(int row);
63  bool insert(int, const QString&);
64  virtual bool removeRows (int row, int count,
65  const QModelIndex & parent = QModelIndex());
66  virtual bool insertRows (int row, int count,
67  const QModelIndex & parent = QModelIndex());
68  void appendData(const QString &data);
69  void changeFont(int);
70  int getFontSize();
71 
72 private:
73  void setupModelData(const QString &lines, LogItem *parent);
76  QString searchKey;
77  int fontSize;
78 
79 public slots:
80  void searchKeyChanged(const QString &key = "");
81 };
82 
83 }
84 #endif
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
bool insert(int, const QString &)
void appendData(const QString &data)
QModelIndex parent(const QModelIndex &index) const
QString searchKey
Definition: logmodel.qo.h:76
int columnCount(const QModelIndex &parent=QModelIndex()) const
QString stringData()
int rowCount(const QModelIndex &parent=QModelIndex()) const
void searchKeyChanged(const QString &key="")
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
LogItem * insertItem
Definition: logmodel.qo.h:74
LogModel(const QString &data, QObject *parent=0)
void writeData(QTextStream &os)
LogItem * rootItem
Definition: logmodel.qo.h:75
void changeFont(int)
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Qt::ItemFlags flags(const QModelIndex &index) const
QVariant data(const QModelIndex &index, int role) const
void setupModelData(const QString &lines, LogItem *parent)