CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Public Member Functions | Protected Attributes | Properties | List of all members
ctkScreenshotDialog Class Reference

#include <Libs/Widgets/ctkScreenshotDialog.h>

Inheritance diagram for ctkScreenshotDialog:
Inheritance graph
[legend]
Collaboration diagram for ctkScreenshotDialog:
Collaboration graph
[legend]

Public Types

typedef QDialog Superclass
 

Public Slots

void instantScreenshot ()
 
void saveScreenshot ()
 Calls instantScreenshot() after a countdown of delay seconds. More...
 

Public Member Functions

QString baseFileName () const
 
 ctkScreenshotDialog (QWidget *parent=0)
 
int delay () const
 
QString directory () const
 
void enableTransparency (bool enable=true)
 Allow/Disallow transparency in the output screenshot. More...
 
void enforceResolution (int width=300, int height=300)
 
void enforceResolution (QSize size=QSize(300, 300))
 
void setBaseFileName (const QString &newImageName)
 
void setDelay (int seconds)
 
void setDirectory (const QString &path)
 
void setWidgetToGrab (QWidget *newWidgetToGrab)
 
QSize widgetSize ()
 Get the original widget size. More...
 
QWidget * widgetToGrab () const
 
virtual ~ctkScreenshotDialog ()
 

Protected Attributes

QScopedPointer< ctkScreenshotDialogPrivate > d_ptr
 

Properties

QString baseFileName
 
int delay
 
QString directory
 

Detailed Description

ctkScreenshotDialog is simple dialog allowing to grab the content of any widget and save it into a PNG file. It can be used as a tool and can take screenshots without being opened nor executed.

screenshot.setWidgetToGrab(myWidget);
screenshot.instantScreenshot();
See also
ctkScreenshotDialog::setWidgetToGrab, QDialog

Definition at line 46 of file ctkScreenshotDialog.h.

Member Typedef Documentation

Definition at line 54 of file ctkScreenshotDialog.h.

Constructor & Destructor Documentation

ctkScreenshotDialog::ctkScreenshotDialog ( QWidget *  parent = 0)
virtual ctkScreenshotDialog::~ctkScreenshotDialog ( )
virtual

Member Function Documentation

QString ctkScreenshotDialog::baseFileName ( ) const
int ctkScreenshotDialog::delay ( ) const
QString ctkScreenshotDialog::directory ( ) const
void ctkScreenshotDialog::enableTransparency ( bool  enable = true)

Allow/Disallow transparency in the output screenshot.

void ctkScreenshotDialog::enforceResolution ( int  width = 300,
int  height = 300 
)

Disable scaling or output resolution control and take a fixed resolution screenshot. Default output resolution is (300,300)

void ctkScreenshotDialog::enforceResolution ( QSize  size = QSize(300, 300))
void ctkScreenshotDialog::instantScreenshot ( )
slot

Instantanely grabs the content of widgetToGrag. Generates a png file into directory. It automatically increments the image name index suffix.

void ctkScreenshotDialog::saveScreenshot ( )
slot

Calls instantScreenshot() after a countdown of delay seconds.

void ctkScreenshotDialog::setBaseFileName ( const QString &  newImageName)

Set screenshot base name used to generate unique file names to save the screenshot images. The base name doesn't contain the file extension (automatically set to ".png") "Untitled" by default

void ctkScreenshotDialog::setDelay ( int  seconds)

Set the delay in seconds before the screenshot is taken. 0 seconds by default.

void ctkScreenshotDialog::setDirectory ( const QString &  path)

Set directory where screenshot files are saved. If path is empty, the program's working directory, ("."), is used. Current working directory by default.

void ctkScreenshotDialog::setWidgetToGrab ( QWidget *  newWidgetToGrab)

Get widget to grab content from. If no widget is set, no screenshot will be taken. 0 by default. TODO: if widgetToGrab -> screenshot the entire application

QSize ctkScreenshotDialog::widgetSize ( )

Get the original widget size.

QWidget* ctkScreenshotDialog::widgetToGrab ( ) const

Member Data Documentation

QScopedPointer<ctkScreenshotDialogPrivate> ctkScreenshotDialog::d_ptr
protected

Definition at line 104 of file ctkScreenshotDialog.h.

Property Documentation

QString ctkScreenshotDialog::baseFileName
readwrite

Definition at line 49 of file ctkScreenshotDialog.h.

int ctkScreenshotDialog::delay
readwrite

Definition at line 51 of file ctkScreenshotDialog.h.

QString ctkScreenshotDialog::directory
readwrite

Definition at line 50 of file ctkScreenshotDialog.h.


The documentation for this class was generated from the following file: