CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkScreenshotDialog.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkScreenshotDialog_h
22 #define __ctkScreenshotDialog_h
23 
24 // Qt includes
25 #include <QDialog>
26 
27 // CTK includes
28 #include "ctkWidgetsExport.h"
29 
30 class ctkScreenshotDialogPrivate;
31 
46 class CTK_WIDGETS_EXPORT ctkScreenshotDialog : public QDialog
47 {
48  Q_OBJECT
49  Q_PROPERTY(QString baseFileName READ baseFileName WRITE setBaseFileName)
50  Q_PROPERTY(QString directory READ directory WRITE setDirectory)
51  Q_PROPERTY(int delay READ delay WRITE setDelay)
52 
53 public:
54  typedef QDialog Superclass;
55  ctkScreenshotDialog(QWidget* parent = 0);
57 
62  void setWidgetToGrab(QWidget* newWidgetToGrab);
63  QWidget* widgetToGrab()const;
64 
69  void setBaseFileName(const QString& newImageName);
70  QString baseFileName() const;
71 
75  void setDirectory(const QString& path);
76  QString directory()const;
77 
80  void setDelay(int seconds);
81  int delay()const;
82 
85  void enforceResolution(int width = 300, int height = 300);
86  void enforceResolution(QSize size = QSize(300,300));
87 
89  QSize widgetSize();
90 
92  void enableTransparency(bool enable = true);
93 
94 public Q_SLOTS:
99 
102 
103 protected:
104  QScopedPointer<ctkScreenshotDialogPrivate> d_ptr;
105 
106 private:
107  Q_DECLARE_PRIVATE(ctkScreenshotDialog);
108  Q_DISABLE_COPY(ctkScreenshotDialog);
109 };
110 
111 #endif
QScopedPointer< ctkScreenshotDialogPrivate > d_ptr
void setWidgetToGrab(QWidget *newWidgetToGrab)
QSize widgetSize()
Get the original widget size.
void enforceResolution(QSize size=QSize(300, 300))
virtual ~ctkScreenshotDialog()
QString baseFileName() const
void setDelay(int seconds)
void setDirectory(const QString &path)
ctkScreenshotDialog(QWidget *parent=0)
QString directory() const
void enableTransparency(bool enable=true)
Allow/Disallow transparency in the output screenshot.
QWidget * widgetToGrab() const
void saveScreenshot()
Calls instantScreenshot() after a countdown of delay seconds.
void setBaseFileName(const QString &newImageName)
void enforceResolution(int width=300, int height=300)