35 #include <QResizeEvent> 36 #include <QApplication> 37 #include <QDesktopWidget> 38 #include "vtkRenderWindow.h" 53 this->setContextMenuPolicy(Qt::CustomContextMenu);
57 connect(
this, SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(customContextMenuRequestedSlot(
const QPoint &)));
59 this->SetRenderWindow(renderWindow);
60 mView->getRenderWindow()->GetInteractor()->EnableRenderOff();
62 disableGLHiDPI(this->winId());
65 void ViewWidget::customContextMenuRequestedSlot(
const QPoint& point)
67 QWidget* sender =
dynamic_cast<QWidget*
>(this->sender());
68 QPoint pointGlobal = sender->mapToGlobal(point);
84 return this->
getView()->getRenderer();
91 unsigned long hash = mView->computeTotalMTime();
93 if (hash != mMTimeHash)
98 QString msg(
"During rendering of view: " + this->
getView()->getName());
103 void ViewWidget::resizeEvent(QResizeEvent * event)
105 inherited::resizeEvent(event);
106 QSize
size =
event->size();
107 vtkRenderWindowInteractor* iren = mView->getRenderWindow()->GetInteractor();
109 iren->UpdateSize(size.width(), size.height());
113 void ViewWidget::mouseMoveEvent(QMouseEvent* event)
115 inherited::mouseMoveEvent(event);
116 emit
mouseMove(event->x(),
event->y(),
event->buttons());
119 void ViewWidget::mousePressEvent(QMouseEvent* event)
124 if ((this->contextMenuPolicy() == Qt::CustomContextMenu) && event->buttons().testFlag(Qt::RightButton))
127 inherited::mousePressEvent(event);
128 emit
mousePress(event->x(),
event->y(),
event->buttons());
131 void ViewWidget::mouseReleaseEvent(QMouseEvent* event)
133 inherited::mouseReleaseEvent(event);
134 emit
mouseRelease(event->x(),
event->y(),
event->buttons());
137 void ViewWidget::focusInEvent(QFocusEvent* event)
139 inherited::focusInEvent(event);
140 emit
focusChange(event->gotFocus(),
event->reason());
143 void ViewWidget::wheelEvent(QWheelEvent* event)
145 inherited::wheelEvent(event);
146 emit
mouseWheel(event->x(),
event->y(),
event->delta(),
event->orientation(),
event->buttons());
149 void ViewWidget::showEvent(QShowEvent* event)
151 inherited::showEvent(event);
155 void ViewWidget::paintEvent(QPaintEvent* event)
157 mView->setModified();
158 inherited::paintEvent(event);
163 if (
similar(factor, mZoomFactor))
167 mZoomFactor = factor;
184 double scale = mZoomFactor / this->
mmPerPix();
202 QDesktopWidget* desktop =
dynamic_cast<QApplication*
>(QApplication::instance())->desktop();
203 QWidget* screen = desktop->screen(desktop->screenNumber(
this));
204 double r_h = (double) screen->heightMM() / (double) screen->geometry().height();
205 double r_w = (double) screen->widthMM() / (double) screen->geometry().width();
206 double retval = (r_h + r_w) / 2.0;
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
Transform3D createTransformScale(const Vector3D &scale_)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
cstring_cast_Placeholder cstring_cast(const T &val)
#define report_gl_error_text(text)
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
Transform3D createTransformTranslate(const Vector3D &translation)
boost::shared_ptr< class ViewRepCollection > ViewRepCollectionPtr
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
boost::shared_ptr< class RenderWindowFactory > RenderWindowFactoryPtr
Namespace for all CustusX production code.