Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLScreenShotDialog.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) 2010 Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Julien Finet, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLScreenShotDialog_h
22 #define __qMRMLScreenShotDialog_h
23 
24 // Qt includes
25 #include <QDialog>
26 #include <QMetaType>
27 #include <QString>
28 
29 // qMRMLWidget includes
30 #include "qMRMLWidgetsExport.h"
31 #include "qMRMLLayoutManager.h"
32 
33 class vtkImageData;
34 
35 class qMRMLScreenShotDialogPrivate;
36 
37 class QMRML_WIDGETS_EXPORT qMRMLScreenShotDialog : public QDialog
38 {
39  Q_OBJECT
40  Q_ENUMS(WidgetType)
41  Q_PROPERTY(WidgetType widgetType READ widgetType WRITE setWidgetType)
42  Q_PROPERTY(QString nameEdit READ nameEdit WRITE setNameEdit)
43  Q_PROPERTY(double scaleFactor READ scaleFactor WRITE setScaleFactor)
44  Q_PROPERTY(bool showScaleFactorSpinBox READ showScaleFactorSpinBox WRITE setShowScaleFactorSpinBox)
45 public:
46  typedef QDialog Superclass;
47 
48  enum WidgetType{
49  ThreeD = 0,
50  Red = 1,
51  Yellow = 2,
52  Green = 3,
53  FullLayout = 4
54  };
55 
56  qMRMLScreenShotDialog(QWidget *parent = nullptr);
57  ~qMRMLScreenShotDialog() override;
58 
60  Q_INVOKABLE void setLayoutManager(qMRMLLayoutManager* newlayoutManager);
61  Q_INVOKABLE qMRMLLayoutManager* layoutManager()const;
62 
63  void setNameEdit(const QString& newName);
64  QString nameEdit()const;
65 
66  void setDescription(const QString& description);
67  QString description()const;
68 
71  void setData(const QVariant& newData);
72  QVariant data()const;
73 
74  void setWidgetType(WidgetType newType);
75  WidgetType widgetType()const;
76 
77  void setScaleFactor(const double& newScaleFactor);
78  double scaleFactor()const;
79 
80  void setShowScaleFactorSpinBox(const bool& state);
81  bool showScaleFactorSpinBox()const;
82 
84  void setImageData(vtkImageData* screenshot);
85  vtkImageData* imageData()const;
86 
87 protected slots:
88 
92  void grabScreenShot(int screenshotWindow);
93  void grabScreenShot();
94  void setLastWidgetType(int id);
96  void resetDialog();
97 
99  void saveAs();
100 
101 
102 private:
103  QString enumToString(int type);
104 
105 protected:
106  QScopedPointer<qMRMLScreenShotDialogPrivate> d_ptr;
107 
108 private:
109  Q_DECLARE_PRIVATE(qMRMLScreenShotDialog);
110  Q_DISABLE_COPY(qMRMLScreenShotDialog);
111 };
112 
114 
115 #endif
Q_DECLARE_METATYPE(qSlicerExtensionsManagerModel::ServerAPI)
QScopedPointer< qMRMLScreenShotDialogPrivate > d_ptr