Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
QmitkPythonVariableStackTableModel.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 QmitkPythonVariableStackTableModel_h
14 #define QmitkPythonVariableStackTableModel_h
15 
16 #include <QAbstractTableModel>
17 #include <QVariant>
18 #include <QModelIndex>
19 #include "mitkIPythonService.h"
20 #include <MitkQtPythonExports.h>
21 #include <usServiceReference.h>
22 
27 class MITKQTPYTHON_EXPORT QmitkPythonVariableStackTableModel : public QAbstractTableModel, public mitk::PythonCommandObserver
28 {
29  Q_OBJECT
30 
31 public:
32  static const QString MITK_IMAGE_VAR_NAME;
33  static const QString MITK_SURFACE_VAR_NAME;
34 
35  QmitkPythonVariableStackTableModel(QObject *parent = nullptr);
37 
38  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
39  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
40  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
41  Qt::ItemFlags flags( const QModelIndex& index ) const override;
42  QVariant headerData(int section, Qt::Orientation orientation,
43  int role) const override;
44 
45  QStringList mimeTypes() const override;
46  bool dropMimeData ( const QMimeData *, Qt::DropAction, int, int, const QModelIndex & ) override;
47  Qt::DropActions supportedDropActions() const override;
48  //Qt::DropActions supportedDragActions() const;
49 
50  void CommandExecuted(const std::string& pythonCommand) override;
51 
52  std::vector<mitk::PythonVariable> GetVariableStack() const;
53 private:
54  std::vector<mitk::PythonVariable> m_VariableStack;
55  mitk::IPythonService* m_PythonService;
57 };
58 
59 #endif
mitk::IPythonService
Definition: mitkIPythonService.h:56
mitk::PythonCommandObserver::CommandExecuted
virtual void CommandExecuted(const std::string &pythonCommand)=0
mitk::PythonCommandObserver
Definition: mitkIPythonService.h:45
QmitkPythonVariableStackTableModel::MITK_SURFACE_VAR_NAME
static const QString MITK_SURFACE_VAR_NAME
Definition: QmitkPythonVariableStackTableModel.h:33
us::ServiceReference< mitk::IPythonService >
QmitkPythonVariableStackTableModel::MITK_IMAGE_VAR_NAME
static const QString MITK_IMAGE_VAR_NAME
Definition: QmitkPythonVariableStackTableModel.h:32
usServiceReference.h
QmitkPythonVariableStackTableModel
Definition: QmitkPythonVariableStackTableModel.h:27
mitkIPythonService.h