Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkXnatTreeModel.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkXnatTreeModel_h
14 #define QmitkXnatTreeModel_h
15 
16 // CTK includes
17 #include <ctkXnatTreeModel.h>
18 
19 // MITK includes
20 #include <MitkXNATExports.h>
21 
22 namespace mitk
23 {
24  class DataNode;
25 }
26 
40 class MITKXNAT_EXPORT QmitkXnatTreeModel : public ctkXnatTreeModel
41 {
42  Q_OBJECT
43 
44 public:
49 
61  QVariant data(const QModelIndex &index, int role) const override;
62 
77  const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
78 
79  using QAbstractItemModel::supportedDropActions;
80 
86  virtual Qt::DropActions supportedDropActions();
87 
97  Qt::ItemFlags flags(const QModelIndex &index) const override;
98 
109  ctkXnatObject *GetXnatObjectFromUrl(const QString &url);
110 
120  void fetchMore(const QModelIndex &index) override;
121 
136  QModelIndexList match(
137  const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const override;
138 
139 signals:
145  void Error(const QModelIndex &idx);
146 
154  void ResourceDropped(const QList<mitk::DataNode *> &nodes, ctkXnatObject *target, const QModelIndex &index);
155 
156 private:
157  ctkXnatObject *InternalGetXnatObjectFromUrl(const QString &xnatObjectType, const QString &url, ctkXnatObject *parent);
158 };
159 
160 #endif
#define MITKXNAT_EXPORT
Tree model for browsing the XNAT server hierarchy with MITK-specific enhancements.
Qt::ItemFlags flags(const QModelIndex &index) const override
Return item flags for the given index.
virtual Qt::DropActions supportedDropActions()
Return supported drop actions (Qt::CopyAction).
QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const override
Find model indices that do NOT match the given value (inverse matching).
void ResourceDropped(const QList< mitk::DataNode * > &nodes, ctkXnatObject *target, const QModelIndex &index)
Emitted when MITK data nodes are dropped onto an XNAT tree node.
QVariant data(const QModelIndex &index, int role) const override
Return data for the given index and role, with MITK-specific icon decoration.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Handle dropped MIME data containing MITK data node pointers.
ctkXnatObject * GetXnatObjectFromUrl(const QString &url)
Look up an XNAT object by its REST URL.
QmitkXnatTreeModel()
Default constructor.
void Error(const QModelIndex &idx)
Emitted when fetching child data for an index fails due to an HTTP error.
void fetchMore(const QModelIndex &index) override
Fetch child data for the given index, with error handling.
Find image slices visible on a given plane.