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();
void setWidgetToGrab(QWidget *newWidgetToGrab)
See also
ctkScreenshotDialog::setWidgetToGrab, QDialog

Definition at line 46 of file ctkScreenshotDialog.h.

Member Typedef Documentation

◆ Superclass

Definition at line 54 of file ctkScreenshotDialog.h.

Constructor & Destructor Documentation

◆ ctkScreenshotDialog()

ctkScreenshotDialog::ctkScreenshotDialog ( QWidget *  parent = 0)

◆ ~ctkScreenshotDialog()

virtual ctkScreenshotDialog::~ctkScreenshotDialog ( )
virtual

Member Function Documentation

◆ baseFileName()

QString ctkScreenshotDialog::baseFileName ( ) const

◆ delay()

int ctkScreenshotDialog::delay ( ) const

◆ directory()

QString ctkScreenshotDialog::directory ( ) const

◆ enableTransparency()

void ctkScreenshotDialog::enableTransparency ( bool  enable = true)

Allow/Disallow transparency in the output screenshot.

◆ enforceResolution() [1/2]

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)

◆ enforceResolution() [2/2]

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

◆ instantScreenshot

void ctkScreenshotDialog::instantScreenshot ( )
slot

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

◆ saveScreenshot

void ctkScreenshotDialog::saveScreenshot ( )
slot

Calls instantScreenshot() after a countdown of delay seconds.

◆ setBaseFileName()

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

◆ setDelay()

void ctkScreenshotDialog::setDelay ( int  seconds)

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

◆ setDirectory()

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.

◆ setWidgetToGrab()

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

◆ widgetSize()

QSize ctkScreenshotDialog::widgetSize ( )

Get the original widget size.

◆ widgetToGrab()

QWidget* ctkScreenshotDialog::widgetToGrab ( ) const

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkScreenshotDialogPrivate> ctkScreenshotDialog::d_ptr
protected

Definition at line 104 of file ctkScreenshotDialog.h.

Property Documentation

◆ baseFileName

QString ctkScreenshotDialog::baseFileName
readwrite

Definition at line 1 of file ctkScreenshotDialog.h.

◆ delay

int ctkScreenshotDialog::delay
readwrite

Definition at line 1 of file ctkScreenshotDialog.h.

◆ directory

QString ctkScreenshotDialog::directory
readwrite

Definition at line 1 of file ctkScreenshotDialog.h.


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