X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVTKViewer%2FVTKViewer_ViewWindow.cxx;h=f088c2e9451f58a1c52f51ebad1a2e6e8ffb96cc;hb=HEAD;hp=b82a8a44fcac3cd163269f40447590b2d8ed610a;hpb=449b56fee4cfc04c516a6d34f2eadbf5474a53c7;p=modules%2Fgui.git diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx old mode 100755 new mode 100644 index b82a8a44f..f088c2e94 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -191,91 +191,98 @@ void VTKViewer_ViewWindow::createActions() aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ), tr( "MNU_DUMP_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_DUMP_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onDumpView())); myActionsMap[ DumpId ] = aAction; //! \li FitAll aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ), tr( "MNU_FITALL" ), 0, this); aAction->setStatusTip(tr("DSC_FITALL")); - connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onFitAll())); myActionsMap[ FitAllId ] = aAction; //! \li FitRect aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ), tr( "MNU_FITRECT" ), 0, this); aAction->setStatusTip(tr("DSC_FITRECT")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateWindowFit())); myActionsMap[ FitRectId ] = aAction; + //! \li FitSelection + aAction = new QtxAction(tr("MNU_FITSELECTION"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITSELECTION" ) ), + tr( "MNU_FITSELECTION" ), 0, this); + aAction->setStatusTip(tr("DSC_FITSELECTION")); + connect(aAction, SIGNAL(triggered()), this, SLOT(onFitSelection())); + myActionsMap[ FitSelectionId ] = aAction; + //! \li Zoom aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ), tr( "MNU_ZOOM_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_ZOOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateZoom())); myActionsMap[ ZoomId ] = aAction; //! \li Panning aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ), tr( "MNU_PAN_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activatePanning())); myActionsMap[ PanId ] = aAction; //! \li Global Panning aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ), tr( "MNU_GLOBALPAN_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateGlobalPanning())); myActionsMap[ GlobalPanId ] = aAction; //! \li Rotation aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ), tr( "MNU_ROTATE_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_ROTATE_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateRotation())); myActionsMap[ RotationId ] = aAction; //! \li Projections aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ), tr( "MNU_FRONT_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_FRONT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onFrontView())); myActionsMap[ FrontId ] = aAction; //! \li Back view aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ), tr( "MNU_BACK_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_BACK_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onBackView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onBackView())); myActionsMap[ BackId ] = aAction; //! \li Top view aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ), tr( "MNU_TOP_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_TOP_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onTopView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onTopView())); myActionsMap[ TopId ] = aAction; //! \li Bottom view aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ), tr( "MNU_BOTTOM_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_BOTTOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onBottomView())); myActionsMap[ BottomId ] = aAction; //! \li Left view aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ), tr( "MNU_LEFT_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_LEFT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onLeftView())); myActionsMap[ LeftId ] = aAction; //! \li Right view aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ), tr( "MNU_RIGHT_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_RIGHT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onRightView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onRightView())); myActionsMap[ RightId ] = aAction; // \li Rotate anticlockwise @@ -296,14 +303,14 @@ void VTKViewer_ViewWindow::createActions() aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ), tr( "MNU_RESET_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_RESET_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onResetView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onResetView())); myActionsMap[ ResetId ] = aAction; //! \li Trihedron shown aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ), tr( "MNU_SHOW_TRIHEDRON" ), 0, this); aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON")); - connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onTrihedronShow())); myActionsMap[ TrihedronShowId ] = aAction; } @@ -316,6 +323,7 @@ void VTKViewer_ViewWindow::createToolBar() QtxMultiAction* aScaleAction = new QtxMultiAction( this ); aScaleAction->insertAction( myActionsMap[FitAllId] ); aScaleAction->insertAction( myActionsMap[FitRectId] ); + aScaleAction->insertAction( myActionsMap[FitSelectionId] ); aScaleAction->insertAction( myActionsMap[ZoomId] ); myToolBar->addAction( aScaleAction ); @@ -447,6 +455,13 @@ void VTKViewer_ViewWindow::onFitAll() Repaint(); } +/*!On fit selection slot.*/ +void VTKViewer_ViewWindow::onFitSelection() +{ + myRWInteractor->GetInteractorStyle()->ViewFitSelection(); + Repaint(); +} + /*!Set background color of the viewport [obsolete]*/ void VTKViewer_ViewWindow::setBackgroundColor( const QColor& c ) { @@ -538,7 +553,7 @@ void VTKViewer_ViewWindow::setBackground( const Qtx::BackgroundData& bgData ) aReader = vtkMetaImageReader::New(); if ( aReader ) { // create texture - aReader->SetFileName( fi.absoluteFilePath().toLatin1().constData() ); + aReader->SetFileName( fi.absoluteFilePath().toUtf8().constData() ); aReader->Update(); VTKViewer_Texture* aTexture = VTKViewer_Texture::New();