15 #include <QtConcurrent>
16 #include <QDesktopWidget>
17 #include <QApplication>
19 #include "boost/bind.hpp"
21 #include <QVBoxLayout>
24 #include "vtkRenderer.h"
25 #include "vtkWindowToImageFilter.h"
26 #include "vtkRenderWindow.h"
27 #include "vtkPNGWriter.h"
28 #include "vtkUnsignedCharArray.h"
31 #include <QScrollArea>
38 mViewService(viewService),
41 this->setLayout(
new QVBoxLayout(
this));
42 this->layout()->setMargin(0);
43 this->setWindowTitle(
"View Layout");
48 QWidget* widget = mViewService->createLayoutWidget(
this, 1);
49 this->layout()->addWidget(widget);
51 mViewService->setActiveLayout(
"LAYOUT_OBLIQUE_3DAnyDual_x1", 1);
71 mWriter(services->patient())
79 mWriter.
save(image,
id);
86 buffer.open(QIODevice::WriteOnly);
87 image.save(&buffer,
"PNG");
93 return mWriter.
grab(screenid);
102 mTopWindow =
new QWidget;
103 mTopWindow->setLayout(
new QVBoxLayout);
104 mTopWindow->layout()->setMargin(0);
106 QScrollArea* scrollArea =
new QScrollArea;
107 scrollArea->setBackgroundRole(QPalette::Dark);
108 mTopWindow->layout()->addWidget(scrollArea);
111 scrollArea->setWidget(mSecondaryViewLayoutWindow);
112 scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
113 scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
117 this->setWidgetToNiceSizeInLowerRightCorner(size);
119 if (!layout.isEmpty())
120 mServices->view()->setActiveLayout(layout, mSecondaryViewLayoutWindow->
mSecondaryLayoutId);
127 void ScreenVideoProvider::setWidgetToNiceSizeInLowerRightCorner(QSize size)
129 QDesktopWidget* desktop = qApp->desktop();
130 QList<QScreen*> screens = qApp->screens();
132 QRect rect_s = desktop->availableGeometry(mTopWindow);
135 if (size.width()==0 || size.height()==0)
137 size = QSize(rect_s.width()/3, rect_s.height()/3);
140 QRect rect_full = QRect(QPoint(0,0), size);
143 size = QSize(std::min<int>(size.width(), rect_s.width()*0.75),
144 std::min<int>(size.height(), rect_s.height()*0.75));
147 size = QSize(size.width()+margin, size.height()+margin);
148 mTopWindow->setGeometry(QRect(QPoint(0,0), size));
151 QRect rect_t = mTopWindow->frameGeometry();
152 mTopWindow->move(rect_s.topLeft()
153 + QPoint(rect_s.width(), rect_s.height())
154 - QPoint(rect_t.width(), rect_t.height()));
157 mSecondaryViewLayoutWindow->setGeometry(rect_full);
159 qDebug() <<
"layout onscreen: " << mTopWindow->geometry();
160 qDebug() <<
"layout internal: " << mSecondaryViewLayoutWindow->geometry();
165 mSecondaryViewLayoutWindow->hide();
166 delete mSecondaryViewLayoutWindow;
181 if (!mSecondaryViewLayoutWindow)
183 QWidget* widget = mServices->view()->getLayoutWidget(mSecondaryViewLayoutWindow->
mSecondaryLayoutId);