From 79ee1307a14ac46104b31e80cd63f2e5af6a4bb4 Mon Sep 17 00:00:00 2001 From: CHEMIN Sebastien Date: Tue, 19 Mar 2024 09:25:53 +0100 Subject: [PATCH] Some cleaning --- src/GraphicsView/GraphicsView_Object.h | 2 +- src/GraphicsView/GraphicsView_ViewFrame.cxx | 10 --------- src/GraphicsView/GraphicsView_ViewFrame.h | 2 +- src/GraphicsView/GraphicsView_ViewManager.h | 2 -- src/GraphicsView/GraphicsView_ViewPort.h | 11 +++++----- src/GraphicsView/GraphicsView_Viewer.cxx | 24 +++++++++++++++++++++ 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/GraphicsView/GraphicsView_Object.h b/src/GraphicsView/GraphicsView_Object.h index 06bb2f4b4..cece03705 100644 --- a/src/GraphicsView/GraphicsView_Object.h +++ b/src/GraphicsView/GraphicsView_Object.h @@ -31,7 +31,7 @@ class SUIT_DataOwner; class GRAPHICSVIEW_API GraphicsView_Object : public QGraphicsItem { public: - GraphicsView_Object( QGraphicsItem* theParent = 0 ); + GraphicsView_Object( QGraphicsItem* theParent = nullptr ); ~GraphicsView_Object(); const QString& getName() const { return myName; } diff --git a/src/GraphicsView/GraphicsView_ViewFrame.cxx b/src/GraphicsView/GraphicsView_ViewFrame.cxx index 9c40eaad3..b92a144c3 100644 --- a/src/GraphicsView/GraphicsView_ViewFrame.cxx +++ b/src/GraphicsView/GraphicsView_ViewFrame.cxx @@ -147,16 +147,6 @@ void GraphicsView_ViewFrame::createActions() anAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) ); connect( anAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewGlobalPan() ) ); toolMgr()->registerAction( anAction, GlobalPanId ); - - // Reset (obsolete) - /* - anAction = new QtxAction( tr( "MNU_RESET_VIEW" ), - aResMgr->loadPixmap( "GraphicsView", tr( "ICON_GV_RESET" ) ), - tr( "MNU_RESET_VIEW" ), 0, this ); - anAction->setStatusTip( tr( "DSC_RESET_VIEW" ) ); - connect( anAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewReset() ) ); - toolMgr()->registerAction( anAction, ResetId ); - */ } //================================================================ diff --git a/src/GraphicsView/GraphicsView_ViewFrame.h b/src/GraphicsView/GraphicsView_ViewFrame.h index 4cb25ba43..8109d18e5 100644 --- a/src/GraphicsView/GraphicsView_ViewFrame.h +++ b/src/GraphicsView/GraphicsView_ViewFrame.h @@ -46,7 +46,7 @@ public: enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId }; public: - GraphicsView_ViewFrame( SUIT_Desktop*, GraphicsView_Viewer*, QWidget* w = NULL ); + GraphicsView_ViewFrame( SUIT_Desktop*, GraphicsView_Viewer*, QWidget* w = nullptr ); ~GraphicsView_ViewFrame(); GraphicsView_Viewer* getViewer() const { return myViewer; } diff --git a/src/GraphicsView/GraphicsView_ViewManager.h b/src/GraphicsView/GraphicsView_ViewManager.h index 551ee4dde..216f7538c 100644 --- a/src/GraphicsView/GraphicsView_ViewManager.h +++ b/src/GraphicsView/GraphicsView_ViewManager.h @@ -21,7 +21,6 @@ #define GRAPHICSVIEW_VIEWMANAGER_H #include "GraphicsView.h" - #include class GraphicsView_Viewer; @@ -42,5 +41,4 @@ public: GraphicsView_Viewer* getViewer(); }; - #endif diff --git a/src/GraphicsView/GraphicsView_ViewPort.h b/src/GraphicsView/GraphicsView_ViewPort.h index 5387c5269..a8cb1503d 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.h +++ b/src/GraphicsView/GraphicsView_ViewPort.h @@ -34,18 +34,19 @@ class GRAPHICSVIEW_API GraphicsView_ViewPort : public QGraphicsView Q_OBJECT public: - GraphicsView_ViewPort( QWidget* theParent ); + GraphicsView_ViewPort(QWidget* theParent); ~GraphicsView_ViewPort(); - void addItem( QGraphicsItem* theItem ); + void addItem(QGraphicsItem* theItem); void fitAll(); void fitSelect(); void fitRect(const QRectF& theRect); + void pan(double theDX, double theDY); // rectangle selection - void startDrawingRect( int x, int y ); - void drawingRect( int x, int y ); + void startDrawingRect(int x, int y); + void drawingRect(int x, int y); void finishDrawingRect(); QRect selectionRect(); @@ -53,8 +54,6 @@ public: void activateFitAreaAction(); void activatePanAction(); void activateGlobalPanAction(); - void pan( double theDX, double theDY ); - QImage dumpView(bool theWholeScene = false, QSizeF theSize = QSizeF()); bool dumpViewToFormat(const QString& fileName, const QString& format); diff --git a/src/GraphicsView/GraphicsView_Viewer.cxx b/src/GraphicsView/GraphicsView_Viewer.cxx index 87a3d2251..0fe841abb 100644 --- a/src/GraphicsView/GraphicsView_Viewer.cxx +++ b/src/GraphicsView/GraphicsView_Viewer.cxx @@ -272,36 +272,60 @@ void GraphicsView_Viewer::onSelectionDone() emit selectionChanged(); } +//================================================================ +// Function : fitAll +// Purpose : +//================================================================ void GraphicsView_Viewer::fitAll() { if (GraphicsView_ViewPort* aViewPort = getActiveViewPort()) aViewPort->fitAll(); } +//================================================================ +// Function : fitSelect +// Purpose : +//================================================================ void GraphicsView_Viewer::fitSelect() { if (GraphicsView_ViewPort* aViewPort = getActiveViewPort()) aViewPort->fitSelect(); } +//================================================================ +// Function : fitArea +// Purpose : +//================================================================ void GraphicsView_Viewer::fitArea() { if (GraphicsView_ViewPort* aViewPort = getActiveViewPort()) aViewPort->activateFitAreaAction(); } +//================================================================ +// Function : zoom +// Purpose : +//================================================================ void GraphicsView_Viewer::zoom() { if (GraphicsView_ViewPort* aViewPort = getActiveViewPort()) aViewPort->activateZoomAction(); } +//================================================================ +// Function : pan +// Purpose : +//================================================================ void GraphicsView_Viewer::pan() { if (GraphicsView_ViewPort* aViewPort = getActiveViewPort()) aViewPort->activatePanAction(); } +//================================================================ +// Function : globalPan +// Purpose : +//================================================================ void GraphicsView_Viewer::globalPan() { if (GraphicsView_ViewPort* aViewPort = getActiveViewPort()) -- 2.39.2