22 #include <QHBoxLayout>
25 #include <QSpacerItem>
31 #include <QRadioButton>
32 #include <QWidgetAction>
39 #include "iconCrosshairMode.xpm"
40 #include "iconFullScreen.xpm"
42 #include "iconSettings.xpm"
44 #include "iconLeaveFullScreen.xpm"
48 #ifdef QMITK_USE_EXTERNAL_RENDERWINDOW_MENU
53 : QWidget(NULL, Qt::Tool | Qt::FramelessWindowHint),
58 mitk::BaseRenderer *b,
64 m_CrosshairMenu(NULL),
68 m_FullScreenMode(false),
74 MITK_DEBUG <<
"creating renderwindow menu on baserenderer " << b;
77 this->CreateMenuWidget();
78 this->setMinimumWidth(61);
79 this->setMaximumWidth(61);
80 this->setAutoFillBackground(
true);
88 this->setWindowOpacity(0.0f);
90 this->setVisible(
false);
106 currentCrosshairRotationMode = 0;
109 m_AutoRotationTimer.setInterval(75);
110 connect(&m_AutoRotationTimer, SIGNAL(timeout()),
this, SLOT(AutoRotateNextStep()));
111 m_HideTimer.setSingleShot(
true);
112 connect(&m_HideTimer, SIGNAL(timeout()),
this, SLOT(DeferredHideMenu()));
113 connect(m_Parent, SIGNAL(destroyed()),
this, SLOT(deleteLater()));
118 if (m_AutoRotationTimer.isActive())
119 m_AutoRotationTimer.stop();
124 QHBoxLayout *layout =
new QHBoxLayout(
this);
125 layout->setAlignment(Qt::AlignRight);
126 layout->setContentsMargins(1, 1, 1, 1);
231 SIGNAL(triggered(
bool)),
241 QPainter painter(
this);
242 QColor semiTransparentColor = Qt::black;
243 semiTransparentColor.setAlpha(255);
244 painter.fillRect(rect(), semiTransparentColor);
279 #if defined(Q_OS_MAC)
280 this->setWindowOpacity(0.0f);
282 this->setVisible(
false);
303 m_HideTimer.start(10);
418 #if defined(Q_OS_MAC)
419 this->setWindowOpacity(1.0f);
421 this->setVisible(
true);
735 #ifdef QMITK_USE_EXTERNAL_RENDERWINDOW_MENU
741 #ifdef QMITK_USE_EXTERNAL_RENDERWINDOW_MENU
742 int X = floor(
double(this->m_Parent->width() - this->width() - 8.0));
745 QPoint pos = this->m_Parent->mapToGlobal(QPoint(0, 0));
747 this->move(X + pos.x(), Y + pos.y());
751 else if (opacity > 1)
754 this->setWindowOpacity(opacity);
756 int moveX = floor(
double(this->m_Parent->width() - this->width() - 4.0));
757 this->move(moveX, 3);
769 MITK_DEBUG <<
"selected crosshair mode " << action->data().toInt();
775 if (m_Renderer.IsNotNull())
778 if (this->m_MultiWidget)
789 m_Renderer->GetRenderingManager()->RequestUpdateAll();
796 MITK_DEBUG <<
"Thickslices num: " << num <<
" on renderer " << m_Renderer.GetPointer();
798 if (m_Renderer.IsNotNull())
802 m_Renderer->GetCurrentWorldPlaneGeometryNode()->SetProperty(
"reslice.thickslices",
804 m_Renderer->GetCurrentWorldPlaneGeometryNode()->SetProperty(
"reslice.thickslices.num",
806 m_Renderer->GetCurrentWorldPlaneGeometryNode()->SetProperty(
"reslice.thickslices.showarea",
811 m_Renderer->GetCurrentWorldPlaneGeometryNode()->SetProperty(
"reslice.thickslices",
813 m_Renderer->GetCurrentWorldPlaneGeometryNode()->SetProperty(
"reslice.thickslices.num",
815 m_Renderer->GetCurrentWorldPlaneGeometryNode()->SetProperty(
"reslice.thickslices.showarea",
818 m_TSLabel->setText(QString::number(num * 2 + 1));
819 m_Renderer->SendUpdateSlice();
820 m_Renderer->GetRenderingManager()->RequestUpdateAll();
828 crosshairModesMenu->clear();
830 QAction *resetViewAction =
new QAction(crosshairModesMenu);
831 resetViewAction->setText(
"Reset view");
832 crosshairModesMenu->addAction(resetViewAction);
833 connect(resetViewAction, SIGNAL(triggered()),
this, SIGNAL(
ResetView()));
837 bool currentState =
true;
839 if (m_Renderer.IsNotNull())
869 QAction *showHideCrosshairVisibilityAction =
new QAction(crosshairModesMenu);
870 showHideCrosshairVisibilityAction->setText(
"Show crosshair");
871 showHideCrosshairVisibilityAction->setCheckable(
true);
872 showHideCrosshairVisibilityAction->setChecked(currentState);
873 crosshairModesMenu->addAction(showHideCrosshairVisibilityAction);
874 connect(showHideCrosshairVisibilityAction, SIGNAL(toggled(
bool)),
this, SLOT(
SetCrossHairVisibility(
bool)));
879 QAction *rotationGroupSeparator =
new QAction(crosshairModesMenu);
880 rotationGroupSeparator->setSeparator(
true);
881 rotationGroupSeparator->setText(
"Rotation mode");
882 crosshairModesMenu->addAction(rotationGroupSeparator);
884 QActionGroup *rotationModeActionGroup =
new QActionGroup(crosshairModesMenu);
885 rotationModeActionGroup->setExclusive(
true);
887 QAction *noCrosshairRotation =
new QAction(crosshairModesMenu);
888 noCrosshairRotation->setActionGroup(rotationModeActionGroup);
889 noCrosshairRotation->setText(
"No crosshair rotation");
890 noCrosshairRotation->setCheckable(
true);
892 noCrosshairRotation->setData(0);
893 crosshairModesMenu->addAction(noCrosshairRotation);
895 QAction *singleCrosshairRotation =
new QAction(crosshairModesMenu);
896 singleCrosshairRotation->setActionGroup(rotationModeActionGroup);
897 singleCrosshairRotation->setText(
"Crosshair rotation");
898 singleCrosshairRotation->setCheckable(
true);
900 singleCrosshairRotation->setData(1);
901 crosshairModesMenu->addAction(singleCrosshairRotation);
903 QAction *coupledCrosshairRotation =
new QAction(crosshairModesMenu);
904 coupledCrosshairRotation->setActionGroup(rotationModeActionGroup);
905 coupledCrosshairRotation->setText(
"Coupled crosshair rotation");
906 coupledCrosshairRotation->setCheckable(
true);
908 coupledCrosshairRotation->setData(2);
909 crosshairModesMenu->addAction(coupledCrosshairRotation);
911 QAction *swivelMode =
new QAction(crosshairModesMenu);
912 swivelMode->setActionGroup(rotationModeActionGroup);
913 swivelMode->setText(
"Swivel mode");
914 swivelMode->setCheckable(
true);
916 swivelMode->setData(3);
917 crosshairModesMenu->addAction(swivelMode);
926 QAction *autoRotationGroupSeparator =
new QAction(crosshairModesMenu);
927 autoRotationGroupSeparator->setSeparator(
true);
928 crosshairModesMenu->addAction(autoRotationGroupSeparator);
930 QAction *autoRotationAction = crosshairModesMenu->addAction(
"Auto Rotation");
931 autoRotationAction->setCheckable(
true);
932 autoRotationAction->setChecked(m_AutoRotationTimer.isActive());
939 QAction *thickSlicesGroupSeparator =
new QAction(crosshairModesMenu);
940 thickSlicesGroupSeparator->setSeparator(
true);
941 thickSlicesGroupSeparator->setText(
"ThickSlices mode");
942 crosshairModesMenu->addAction(thickSlicesGroupSeparator);
944 QActionGroup *thickSlicesActionGroup =
new QActionGroup(crosshairModesMenu);
945 thickSlicesActionGroup->setExclusive(
true);
950 m_Renderer->GetCurrentWorldPlaneGeometryNode()->GetProperty(
"reslice.thickslices"));
952 currentMode = m->GetValueAsId();
958 m_Renderer->GetCurrentWorldPlaneGeometryNode()->GetProperty(
"reslice.thickslices.num"));
961 currentNum = m->GetValue();
969 if (currentMode == 0)
972 QSlider *m_TSSlider =
new QSlider(crosshairModesMenu);
973 m_TSSlider->setMinimum(0);
974 m_TSSlider->setMaximum(9);
975 m_TSSlider->setValue(currentNum);
977 m_TSSlider->setOrientation(Qt::Horizontal);
979 connect(m_TSSlider, SIGNAL(valueChanged(
int)),
this, SLOT(
OnTSNumChanged(
int)));
981 QHBoxLayout *_TSLayout =
new QHBoxLayout;
982 _TSLayout->setContentsMargins(4, 4, 4, 4);
983 _TSLayout->addWidget(
new QLabel(
"TS: "));
984 _TSLayout->addWidget(m_TSSlider);
985 _TSLayout->addWidget(
m_TSLabel =
new QLabel(QString::number(currentNum * 2 + 1),
this));
987 QWidget *_TSWidget =
new QWidget;
988 _TSWidget->setLayout(_TSLayout);
990 QWidgetAction *m_TSSliderAction =
new QWidgetAction(crosshairModesMenu);
991 m_TSSliderAction->setDefaultWidget(_TSWidget);
992 crosshairModesMenu->addAction(m_TSSliderAction);
1003 if (m_AutoRotationTimer.isActive())
1005 m_AutoRotationTimer.stop();
1006 m_Renderer->GetCameraRotationController()->GetSlice()->PingPongOff();
1010 m_Renderer->GetCameraRotationController()->GetSlice()->PingPongOn();
1011 m_AutoRotationTimer.start();
1017 if (m_Renderer->GetCameraRotationController())
1018 m_Renderer->GetCameraRotationController()->GetSlice()->Next();
Data management class that handles 'was created by' relations.
void SetVisibility(bool visible, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="visible")
Convenience method for setting visibility properties (instances of BoolProperty)
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
Class for nodes of the DataTree.