16 #include <QtConcurrent> 17 #include <QDesktopWidget> 18 #include <QApplication> 20 #include "boost/bind.hpp" 22 #include <QVBoxLayout> 26 #include "vtkRenderer.h" 27 #include "vtkWindowToImageFilter.h" 28 #include "vtkRenderWindow.h" 29 #include "vtkPNGWriter.h" 30 #include "vtkUnsignedCharArray.h" 42 void saveScreenShotThreaded(QImage pixmap, QString filename)
44 pixmap.save(filename,
"png");
45 report(
"Saved screenshot to " + filename);
57 QDesktopWidget* desktop = qApp->desktop();
58 QList<QScreen*> screens = qApp->screens();
60 for (
int i=0; i<desktop->screenCount(); ++i)
62 QPixmap pm = this->
grab(i);
63 QString name = this->
getName(i);
64 this->
save(pm.toImage(), name);
70 QString ending =
"png";
72 ending =
id +
"." + ending;
73 QString path = mPatient->generateFilePath(
"Screenshots", ending);
74 QtConcurrent::run(boost::bind(&saveScreenShotThreaded, image, path));
79 QDesktopWidget* desktop = qApp->desktop();
80 QList<QScreen*> screens = qApp->screens();
82 QWidget* screenWidget = desktop->screen(screenid);
83 WId screenWinId = screenWidget->winId();
84 QRect geo = desktop->screenGeometry(screenid);
94 QPixmap pixmap = screens[screenid]->grabWindow(screenWinId, geo.left(), geo.top(), geo.width(), geo.height());
100 QDesktopWidget* desktop = qApp->desktop();
101 QList<QScreen*> screens = qApp->screens();
104 if (desktop->screenCount()>1)
106 name = screens[screenid]->name().split(
" ").join(
"");
109 name.replace(
"\\",
"");
110 name.replace(
".",
"");
QString getName(unsigned screenid)
ScreenShotImageWriter(PatientModelServicePtr patient)
QPixmap grab(unsigned screenid)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void grabAllScreensToFile()
void save(QImage image, QString id)
Namespace for all CustusX production code.