casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dirmodel.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 DIRMODEL_H
28 #define DIRMODEL_H
29 
30 
31 #include <graphics/X11/X_enter.h>
32 #include <QAbstractItemModel>
33 #include <QModelIndex>
34 #include <QVariant>
35 #include <QTextStream>
36 #include <QDir>
37 #include <QStringList>
38 #include <graphics/X11/X_exit.h>
39 
40 namespace casa {
41 
42 class DirItem;
43 
44 class DirModel : public QAbstractItemModel
45 {
46  Q_OBJECT
47 
48 public:
49  DirModel(QDir *data, QObject *parent = 0);
50  ~DirModel();
51 
52  const static QStringList cols;
53  const static QColor colors[24];
54 
55  QVariant data(const QModelIndex &index, int role) const;
56  Qt::ItemFlags flags(const QModelIndex &index) const;
57  QVariant headerData(int section, Qt::Orientation orientation,
58  int role = Qt::DisplayRole) const;
59  QModelIndex index(int row, int column,
60  const QModelIndex &parent = QModelIndex()) const;
61  QModelIndex parent(const QModelIndex &index) const;
62  int rowCount(const QModelIndex &parent = QModelIndex()) const;
63  int columnCount(const QModelIndex &parent = QModelIndex()) const;
64 
65  void writeData(QTextStream &os);
66  QString stringData();
67  QString stringData(int row);
68  bool insert(int, const QString&);
69  virtual bool removeRows (int row, int count,
70  const QModelIndex & parent = QModelIndex());
71  virtual bool insertRows (int row, int count,
72  const QModelIndex & parent = QModelIndex());
73  void appendData(const QString &lines);
74  QStringList fileType(const QString pathname);
75  void goTo(QDir *);
76 private:
77  QColor itemColor(const DirItem *);
78  void setupModelData(QDir *lines, DirItem *parent);
81  QString searchKey;
82 
83 public slots:
84  void searchKeyChanged(const QString &key = "");
85 };
86 
87 }
88 #endif
void appendData(const QString &lines)
QStringList fileType(const QString pathname)
QVariant data(const QModelIndex &index, int role) const
QColor itemColor(const DirItem *)
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
void writeData(QTextStream &os)
void goTo(QDir *)
Qt::ItemFlags flags(const QModelIndex &index) const
bool insert(int, const QString &)
QModelIndex parent(const QModelIndex &index) const
void setupModelData(QDir *lines, DirItem *parent)
DirModel(QDir *data, QObject *parent=0)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
void searchKeyChanged(const QString &key="")
DirItem * rootItem
Definition: dirmodel.qo.h:80
int rowCount(const QModelIndex &parent=QModelIndex()) const
static const QStringList cols
Definition: dirmodel.qo.h:52
DirItem * insertItem
Definition: dirmodel.qo.h:79
static const QColor colors[24]
Definition: dirmodel.qo.h:53
int columnCount(const QModelIndex &parent=QModelIndex()) const
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
QString searchKey
Definition: dirmodel.qo.h:81
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
QString stringData()