37 #include <QtConcurrent> 38 #include <QDesktopWidget> 39 #include <QApplication> 41 #include "boost/bind.hpp" 43 #include <QVBoxLayout> 47 #include "vtkRenderer.h" 48 #include "vtkWindowToImageFilter.h" 49 #include "vtkRenderWindow.h" 50 #include "vtkPNGWriter.h" 51 #include "vtkUnsignedCharArray.h" 63 void saveScreenShotThreaded(QImage pixmap, QString filename)
65 pixmap.save(filename,
"png");
66 report(
"Saved screenshot to " + filename);
78 QDesktopWidget* desktop = qApp->desktop();
79 QList<QScreen*> screens = qApp->screens();
81 for (
int i=0; i<desktop->screenCount(); ++i)
83 QPixmap pm = this->
grab(i);
84 QString name = this->
getName(i);
85 this->
save(pm.toImage(), name);
91 QString ending =
"png";
93 ending =
id +
"." + ending;
94 QString path = mPatient->generateFilePath(
"Screenshots", ending);
95 QtConcurrent::run(boost::bind(&saveScreenShotThreaded, image, path));
100 QDesktopWidget* desktop = qApp->desktop();
101 QList<QScreen*> screens = qApp->screens();
103 QWidget* screenWidget = desktop->screen(screenid);
104 WId screenWinId = screenWidget->winId();
105 QRect geo = desktop->screenGeometry(screenid);
115 QPixmap pixmap = screens[screenid]->grabWindow(screenWinId, geo.left(), geo.top(), geo.width(), geo.height());
121 QDesktopWidget* desktop = qApp->desktop();
122 QList<QScreen*> screens = qApp->screens();
125 if (desktop->screenCount()>1)
127 name = screens[screenid]->name().split(
" ").join(
"");
130 name.replace(
"\\",
"");
131 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.