Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkPythonSnippets.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 _QmitkPythonSnippets_H
14 #define _QmitkPythonSnippets_H
15 
16 #include <QWidget>
17 #include <QMap>
18 #include <MitkQtPythonExports.h>
19 struct QmitkPythonSnippetsData;
20 
24 {
25  Q_OBJECT
26 
27  public:
28  static const QString DEFAULT_SNIPPET_FILE;
29  static const QString SNIPPETS_ROOT_XML_ELEMENT_NAME;
30  static const QString SNIPPETS_XML_ELEMENT_NAME;
33  typedef QMap<QString, QString> QStringMap;
38  QmitkPythonSnippets( const QString& _AutoSaveFileName="", QWidget* parent=nullptr );
41  ~QmitkPythonSnippets() override;
44  static bool LoadStringMap( const QString& filename, QStringMap& oldMap );
45 
46 signals:
49  void PasteCommandRequested(const QString& command);
50 
51  protected slots:
54  void on_PasteSnippet_triggered( bool checked = false );
57  void on_RenameSnippet_triggered( bool checked = false );
60  void on_AddSnippet_triggered( bool checked = false );
63  void on_RemoveSnippet_triggered( bool checked = false );
66  void on_RestoreDefaultSnippets_triggered( bool checked = false );
69  void on_Name_currentIndexChanged( int i );
72  void on_Content_textChanged();
75  void on_SaveSnippets_triggered( bool checked = false );
78  void on_LoadSnippets_triggered( bool checked = false );
79 
80  protected:
83  void SaveStringMap( const QString& filename, const QStringMap& map ) const;
86  QString CreateUniqueName(const QString &name) const;
90  void Update(const QString &name = "");
91  private:
94  QmitkPythonSnippetsData* d;
95 };
96 
97 
98 
99 
100 #endif // _QmitkPythonSnippets_H_INCLUDED
101 
static const QString DEFAULT_SNIPPET_FILE
QMap< QString, QString > QStringMap
typedef for string map
a widget that holds snippets and serializes the snippets to a certain places
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:31
static const QString SNIPPETS_ROOT_XML_ELEMENT_NAME
static const QString SNIPPETS_XML_ELEMENT_NAME
#define MITKQTPYTHON_EXPORT