Version: 9.15.0
GraphicsView_ViewFrame.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2025 CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef GRAPHICSVIEW_VIEWFRAME_H
21 #define GRAPHICSVIEW_VIEWFRAME_H
22 
23 #include "GraphicsView.h"
24 
25 #include <SUIT_ViewWindow.h>
26 #include <QPainterPath>
27 
28 class QGraphicsSceneContextMenuEvent;
29 class QGraphicsSceneMouseEvent;
30 class QGraphicsSceneWheelEvent;
31 
32 class QAction;
33 
34 class SUIT_Desktop;
35 
38 
39 /*
40  Class : GraphicsView_ViewFrame
41  Description : View frame of the graphics view
42 */
44 {
45  Q_OBJECT
46 
47 public:
48  enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId };
49 
50 public:
53 
54  GraphicsView_Viewer* getViewer() const { return myViewer; }
55  GraphicsView_ViewPort* getViewPort() const { return myViewPort; }
56 
57  virtual QImage dumpView();
58 
59  virtual QString getVisualParameters();
60  virtual void setVisualParameters( const QString& theParameters );
61 
62  virtual void expandToolBarActions();
63  int getToolBarId();
64 
65 public slots:
66  virtual void showEvent( QShowEvent* );
67  virtual void hideEvent( QHideEvent* );
68 
69 protected slots:
70  void onViewPan();
71  void onViewZoom();
72  void onViewFitAll();
73  void onViewFitArea();
74  void onViewFitSelect();
75  void onViewGlobalPan();
76  void onViewReset();
77 
78 private slots:
79  void keyEvent( QKeyEvent* );
80  void mouseEvent( QGraphicsSceneMouseEvent* );
81  void wheelEvent( QGraphicsSceneWheelEvent* );
82  void contextMenuEvent( QGraphicsSceneContextMenuEvent* );
83 
84 signals:
85  void keyPressed( QKeyEvent* );
86  void keyReleased( QKeyEvent* );
87  void mousePressed( QGraphicsSceneMouseEvent* );
88  void mouseMoving( QGraphicsSceneMouseEvent* );
89  void mouseReleased( QGraphicsSceneMouseEvent* );
90  void mouseDoubleClicked( QGraphicsSceneMouseEvent* );
91  void wheeling( QGraphicsSceneWheelEvent* );
92 
93  void sketchingFinished( QPainterPath );
94 
95  void Show( QShowEvent* );
96  void Hide( QHideEvent* );
97 
98 protected:
99  virtual void createActions();
100  virtual int createToolBar();
101  virtual QString filter() const;
102  virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
103 
104 private:
107 
111 };
112 
113 #endif
#define GRAPHICSVIEW_API
Definition: GraphicsView.h:29
Definition: GraphicsView_ViewFrame.h:44
void mouseReleased(QGraphicsSceneMouseEvent *)
@ DumpId
Definition: GraphicsView_ViewFrame.h:48
void mousePressed(QGraphicsSceneMouseEvent *)
QAction * myScaleAction
Definition: GraphicsView_ViewFrame.h:109
void mouseMoving(QGraphicsSceneMouseEvent *)
void mouseDoubleClicked(QGraphicsSceneMouseEvent *)
int myToolBarId
Definition: GraphicsView_ViewFrame.h:108
GraphicsView_ViewPort * myViewPort
Definition: GraphicsView_ViewFrame.h:106
void Hide(QHideEvent *)
QAction * myPanAction
Definition: GraphicsView_ViewFrame.h:110
GraphicsView_Viewer * myViewer
Definition: GraphicsView_ViewFrame.h:105
void keyPressed(QKeyEvent *)
GraphicsView_ViewPort * getViewPort() const
Definition: GraphicsView_ViewFrame.h:55
GraphicsView_Viewer * getViewer() const
Definition: GraphicsView_ViewFrame.h:54
void Show(QShowEvent *)
void keyReleased(QKeyEvent *)
void wheeling(QGraphicsSceneWheelEvent *)
void sketchingFinished(QPainterPath)
Definition: GraphicsView_ViewPort.h:41
Definition: GraphicsView_Viewer.h:48
Definition: SUIT_Desktop.h:47
Definition: SUIT_ViewWindow.h:42
virtual void contextMenuEvent(QContextMenuEvent *)
Definition: SUIT_ViewWindow.cxx:150
bool dumpViewToFormat(const QString &fileName, const QString &format)
Definition: SUIT_ViewWindow.cxx:125
virtual void setVisualParameters(const QString &parameters)
Definition: SUIT_ViewWindow.cxx:259
virtual QString getVisualParameters()
Definition: SUIT_ViewWindow.cxx:250
virtual QImage dumpView()
Definition: SUIT_ViewWindow.cxx:92
virtual QString filter() const
Definition: SUIT_ViewWindow.cxx:175