36 #include <QtConcurrent> 37 #include <QDesktopWidget> 38 #include <QApplication> 40 #include "boost/bind.hpp" 42 #include <QVBoxLayout> 45 #include "vtkRenderer.h" 46 #include "vtkWindowToImageFilter.h" 47 #include "vtkRenderWindow.h" 48 #include "vtkPNGWriter.h" 49 #include "vtkUnsignedCharArray.h" 52 #include <QScrollArea> 59 mViewService(viewService),
62 this->setLayout(
new QVBoxLayout(
this));
63 this->layout()->setMargin(0);
64 this->setWindowTitle(
"View Layout");
69 QWidget* widget = mViewService->createLayoutWidget(
this, 1);
70 this->layout()->addWidget(widget);
72 mViewService->setActiveLayout(
"LAYOUT_OBLIQUE_3DAnyDual_x1", 1);
92 mWriter(services->patient())
100 mWriter.
save(image,
id);
107 buffer.open(QIODevice::WriteOnly);
108 image.save(&buffer,
"PNG");
114 return mWriter.
grab(screenid);
123 mTopWindow =
new QWidget;
124 mTopWindow->setLayout(
new QVBoxLayout);
125 mTopWindow->layout()->setMargin(0);
127 QScrollArea* scrollArea =
new QScrollArea;
128 scrollArea->setBackgroundRole(QPalette::Dark);
129 mTopWindow->layout()->addWidget(scrollArea);
132 scrollArea->setWidget(mSecondaryViewLayoutWindow);
133 scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
134 scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
138 this->setWidgetToNiceSizeInLowerRightCorner(size);
140 if (!layout.isEmpty())
141 mServices->view()->setActiveLayout(layout, mSecondaryViewLayoutWindow->
mSecondaryLayoutId);
148 void ScreenVideoProvider::setWidgetToNiceSizeInLowerRightCorner(QSize size)
150 QDesktopWidget* desktop = qApp->desktop();
151 QList<QScreen*> screens = qApp->screens();
153 QRect rect_s = desktop->availableGeometry(mTopWindow);
156 if (size.width()==0 || size.height()==0)
158 size = QSize(rect_s.width()/3, rect_s.height()/3);
161 QRect rect_full = QRect(QPoint(0,0), size);
164 size = QSize(std::min<int>(size.width(), rect_s.width()*0.75),
165 std::min<int>(size.height(), rect_s.height()*0.75));
168 size = QSize(size.width()+margin, size.height()+margin);
169 mTopWindow->setGeometry(QRect(QPoint(0,0), size));
172 QRect rect_t = mTopWindow->frameGeometry();
173 mTopWindow->move(rect_s.topLeft()
174 + QPoint(rect_s.width(), rect_s.height())
175 - QPoint(rect_t.width(), rect_t.height()));
178 mSecondaryViewLayoutWindow->setGeometry(rect_full);
180 qDebug() <<
"layout onscreen: " << mTopWindow->geometry();
181 qDebug() <<
"layout internal: " << mSecondaryViewLayoutWindow->geometry();
186 mSecondaryViewLayoutWindow->hide();
187 delete mSecondaryViewLayoutWindow;
202 if (!mSecondaryViewLayoutWindow)
204 QWidget* widget = mServices->view()->getLayoutWidget(mSecondaryViewLayoutWindow->
mSecondaryLayoutId);
QPixmap grab(unsigned screenid)
ScreenVideoProvider(VisServicesPtr services)
boost::shared_ptr< class VisServices > VisServicesPtr
QByteArray generatePNGEncoding(QImage image)
virtual void closeEvent(QCloseEvent *event)
QImage grabSecondaryLayout()
static QImage vtkImageData2QImage(vtkImageDataPtr input)
void closeSecondaryLayout()
Experimental class for IPad usage.
void showSecondaryLayout(QSize size, QString layout)
void save(QImage image, QString id)
class ViewCollectionWidget * getSecondaryLayoutWidget()
SecondaryViewLayoutWindow(QWidget *parent)
void saveScreenShot(QImage image, QString id)
virtual void showEvent(QShowEvent *event)
QPixmap grabScreen(unsigned screenid)
virtual void hideEvent(QCloseEvent *event)
Namespace for all CustusX production code.