CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkXnatTreeModel.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  Library: XNAT/Core
4 
5  Copyright (c) University College London,
6  Centre for Medical Image Computing
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =============================================================================*/
21 
22 #ifndef ctkXnatTreeModel_h
23 #define ctkXnatTreeModel_h
24 
25 #include "ctkXNATCoreExport.h"
26 
27 #include <QAbstractItemModel>
28 
29 class ctkXnatObject;
30 class ctkXnatDataModel;
31 class ctkXnatTreeModelPrivate;
32 
36 class CTK_XNAT_CORE_EXPORT ctkXnatTreeModel : public QAbstractItemModel
37 {
38  Q_OBJECT
39 
40 public:
41  explicit ctkXnatTreeModel();
42  virtual ~ctkXnatTreeModel();
43 
44  virtual QVariant data(const QModelIndex& index, int role) const;
45  virtual QModelIndex parent(const QModelIndex& child) const;
46  virtual QModelIndex index(int row, int column, const QModelIndex& parent) const;
47  virtual int rowCount(const QModelIndex& parent) const;
48  virtual int columnCount(const QModelIndex& parent) const;
49  virtual bool hasChildren(const QModelIndex& parent) const;
50  virtual bool canFetchMore(const QModelIndex& parent) const;
51  virtual void fetchMore(const QModelIndex& parent);
52 
57  virtual void refresh(const QModelIndex& parent = QModelIndex());
58 
59  ctkXnatObject* xnatObject(const QModelIndex& index) const;
60 
61  void addDataModel(ctkXnatDataModel* dataModel);
63 
64  bool removeAllRows(const QModelIndex& parent);
65 
66  void downloadFile (const QModelIndex& index, const QString& zipFilename);
67 
68  void addChildNode(const QModelIndex& index, ctkXnatObject *child);
69 
70 private:
71 
72  const QScopedPointer<ctkXnatTreeModelPrivate> d_ptr;
73 
74  Q_DECLARE_PRIVATE(ctkXnatTreeModel)
75 
76 };
77 
78 #endif
The ctkXnatDataModel class reprents the root object in a XNAT data hierarchy.
void addDataModel(ctkXnatDataModel *dataModel)
void addChildNode(const QModelIndex &index, ctkXnatObject *child)
virtual int columnCount(const QModelIndex &parent) const
virtual int rowCount(const QModelIndex &parent) const
virtual QVariant data(const QModelIndex &index, int role) const
virtual void refresh(const QModelIndex &parent=QModelIndex())
Convenience method for refreshing an entry of the tree model.
bool removeAllRows(const QModelIndex &parent)
virtual bool canFetchMore(const QModelIndex &parent) const
virtual void fetchMore(const QModelIndex &parent)
virtual bool hasChildren(const QModelIndex &parent) const
void downloadFile(const QModelIndex &index, const QString &zipFilename)
void removeDataModel(ctkXnatDataModel *dataModel)
ctkXnatObject * xnatObject(const QModelIndex &index) const
virtual ~ctkXnatTreeModel()
virtual QModelIndex parent(const QModelIndex &child) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const