From 98784bda60ac4b1143525b89b817df8368b4c635 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 11 Apr 2023 16:20:18 +0200 Subject: [PATCH] Show/Hide center axes --- src/SPV3D/SPV3D_ViewWindow.cxx | 18 +++++++++++++++++- src/SPV3D/SPV3D_ViewWindow.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/SPV3D/SPV3D_ViewWindow.cxx b/src/SPV3D/SPV3D_ViewWindow.cxx index c23fe69cd..78deddd8e 100644 --- a/src/SPV3D/SPV3D_ViewWindow.cxx +++ b/src/SPV3D/SPV3D_ViewWindow.cxx @@ -52,6 +52,7 @@ #include #include +#include #include "SALOME_ListIO.hxx" #include "SPV3D_Prs.h" @@ -89,7 +90,22 @@ void SPV3D_ViewWindow::init() false ); QAction* resetCenterAction = toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqResetCamera.svg"), tr( "MNU_FITALL" ) ); - new pqCameraReaction(resetCenterAction, pqCameraReaction::RESET_CAMERA); + new pqCameraReaction(resetCenterAction, pqCameraReaction::RESET_CAMERA); + QAction *showCenterAction = + toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqShowCenterAxes.svg"), tr( "DSC_SHOW_TRIHEDRON" ) ); + showCenterAction->setCheckable(true); + QObject::connect(showCenterAction, &QAction::toggled, this, &SPV3D_ViewWindow::showCenterAxes); +} + +void SPV3D_ViewWindow::showCenterAxes(bool show_axes) +{ + if(!myModel) + return; + pqRenderView* renderView = qobject_cast(myModel->getView()); + if (!renderView) + return; + renderView->setCenterAxesVisibility(show_axes); + renderView->render(); } SPV3D_Prs *SPV3D_ViewWindow::findOrCreatePrs( const char* entry ) diff --git a/src/SPV3D/SPV3D_ViewWindow.h b/src/SPV3D/SPV3D_ViewWindow.h index aa03d100b..706e666c0 100644 --- a/src/SPV3D/SPV3D_ViewWindow.h +++ b/src/SPV3D/SPV3D_ViewWindow.h @@ -131,6 +131,7 @@ class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow //SUIT_ViewWi public slots: virtual void showEvent( QShowEvent * ); virtual void hideEvent( QHideEvent * ); + void showCenterAxes(bool); protected slots: void onKeyPressed(QKeyEvent* event); -- 2.39.2