QCAD
Open Source 2D CAD
RMainWindowQt.h
Go to the documentation of this file.
1 
20 #ifndef RMAINWINDOWQT_H
21 #define RMAINWINDOWQT_H
22 
23 #include "gui_global.h"
24 
25 #include <QDockWidget>
26 #include <QMainWindow>
27 #include <QKeyEvent>
28 #include <QToolBar>
29 
30 #include "RCloseCurrentEvent.h"
31 #include "RMainWindow.h"
32 #include "RObject.h"
33 
34 class QMdiArea;
35 class QMdiSubWindow;
36 
37 class RBlockListener;
39 class RDocument;
40 class RDocumentInterface;
41 class RFocusListener;
42 class RGraphicsView;
43 class RLayerListener;
44 class RMdiArea;
45 class RMdiChildQt;
47 class RPenListener;
49 class RPropertyListener;
50 class RSelectionListener;
51 class RSnapListener;
52 class RUcsListener;
53 class RViewFocusListener;
54 class RViewListener;
55 
63 class QCADGUI_EXPORT RMainWindowQt: public QMainWindow, public RMainWindow {
64 Q_OBJECT
65 
66 public:
67  RMainWindowQt(QWidget* parent = 0, bool hasMdiArea = true);
68  virtual ~RMainWindowQt();
69  static RMainWindowQt* getMainWindow();
70  virtual int getWidth();
71  virtual int getHeight();
72  virtual int getPositionX();
73  virtual int getPositionY();
74  virtual void resize(int width, int height);
75  virtual void move(int x, int y);
76  virtual void disable() {
77  setEnabled(false);
78  }
79  virtual void enable() {
80  setEnabled(true);
81  }
82  virtual RDocument* getDocument();
84 
85  virtual void handleUserMessage(const QString& message);
86  virtual void handleUserInfo(const QString& message);
87  virtual void handleUserWarning(const QString& message, bool messageBox = false);
88  virtual void handleUserCommand(const QString& message);
89 
90  virtual void postSelectionChangedEvent();
91  virtual void postTransactionEvent(
92  RTransaction& t,
93  bool onlyChanges=false,
94  RS::EntityType entityTypeFilter = RS::EntityAll
95  );
96  virtual void postCloseEvent();
97 
98  RMdiChildQt* getMdiChild();
99  QTabBar* getTabBar();
100  RMdiArea* getMdiArea();
101 
102  virtual void cancelProgress();
103  virtual void setProgress(int value);
104  virtual void setProgressEnd();
105  virtual void setProgressText(const QString& text = "");
106 
107  virtual void setCommandPrompt(const QString& text = "");
108  virtual void setLeftMouseTip(const QString& text = "");
109  virtual void setRightMouseTip(const QString& text = "");
110 
111  virtual void showContextMenu(RObject::Id entityId, const RVector& pos);
112  virtual void escapeEvent();
113 
114  virtual void setGraphicsViewCursor(const QCursor& cursor);
115 
116  virtual bool readSettings();
117  virtual void writeSettings();
118 
119  virtual QMenu* createPopupMenu();
120 
121  virtual QWidget* getChildWidget(const QString& name);
122 
123  QList<QDockWidget*> getDockWidgets() {
124  return findChildren<QDockWidget*>();
125  }
126  QList<QToolBar*> getToolBars() {
127  return findChildren<QToolBar*>();
128  }
129 
130 public slots:
131  void quit();
132  void currentTabChanged(int index);
133  void subWindowActivated(QMdiSubWindow* sw);
134  //void objectDestroyed(QObject *obj);
135 
136 signals:
140  void commandPrompt(const QString& text);
141 
145  void leftMouseTip(const QString& message);
146 
150  void rightMouseTip(const QString& message);
151 
152  void progress(int value);
153  void progressEnd();
154  void progressText(const QString& label);
155  void progressCanceled();
156 
157  void userMessage(const QString& message);
158  void userInfo(const QString& message);
159  void userWarning(const QString& message, bool messageBox);
160  void userCommand(const QString& message);
161 
165  void contextMenu(int entityId, const RVector& pos);
166  void escape();
167  void drop(QDropEvent* event);
168  void dragEnter(QDragEnterEvent* event);
169 
170  void resumedTab(RMdiChildQt* mdiChild);
171 
172  void closeRequested();
173  void enterPressed();
174 
175  void toolBarContextMenu(QMenu* menu);
176 
177 protected:
178  virtual void closeEvent(QCloseEvent* e);
179  virtual void dropEvent(QDropEvent* event);
180  virtual void dragEnterEvent(QDragEnterEvent* event);
181 
182  virtual bool event(QEvent* e);
183 
184 protected slots:
185  void updateGuiActions(QMdiSubWindow* mdiChild = NULL);
186  void initGuiActions();
187  void updateScenes(QMdiSubWindow* mdiChild);
188  void notifyListenersSlot(QMdiSubWindow* mdiChild);
189  void suspendAndResume(QMdiSubWindow* mdiChild);
190 
191 protected:
193 
194 //private:
195 // bool objectWasDestroyed;
196 };
197 
199 
200 #endif
Abstract base class for classes that are interested in being notified whenever a view has been added ...
Definition: RViewListener.h:37
MDI area with tabbar that features add tab button.
Definition: RMdiArea.h:38
Abstract base class for classes that are interested in the current snap mode.
Definition: RSnapListener.h:39
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
Abstract base class for classes that are interested in being notified when a new document is created...
Definition: RNewDocumentListener.h:37
virtual void handleUserWarning(const QString &message, bool messageBox=false)
Definition: RMainWindow.h:249
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADGUI_EXPORT
Definition: gui_global.h:10
virtual void postCloseEvent()=0
Base class for an MDI main application window.
Definition: RMainWindow.h:67
virtual int getPositionX()=0
int Id
Definition: RObject.h:53
Transaction implementation.
Definition: RTransaction.h:70
virtual void setRightMouseTip(const QString &text="")=0
Abstract base class for classes that are interested in being notified whenever a layer has been added...
Definition: RLayerListener.h:37
virtual void postSelectionChangedEvent()=0
Abstract base class for classes that are interested in changes in drawing or application preferences...
Definition: RPreferencesListener.h:36
Abstract base class for classes that are interested in being notified whenever a UCS has been added o...
Definition: RUcsListener.h:36
virtual QWidget * getChildWidget(const QString &name)=0
Abstract base class for classes that are interested in being notified whenever a block has been added...
Definition: RBlockListener.h:37
virtual void quit()=0
Closes the application window.
Abstract base class for classes that are interested in being notified whenever the current pen change...
Definition: RPenListener.h:37
static RMainWindow * getMainWindow()
Definition: RMainWindow.cpp:61
Abstract base class for classes that are interested in the current clipboard contents and want to be ...
Definition: RSelectionListener.h:36
QList< QToolBar * > getToolBars()
Definition: RMainWindowQt.h:126
Abstract base class for classes that are interested in properties of the current selection or the cur...
Definition: RPropertyListener.h:43
virtual void setProgress(int value)=0
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
virtual int getWidth()=0
QList< QDockWidget * > getDockWidgets()
Definition: RMainWindowQt.h:123
Q_DECLARE_METATYPE(RMath *)
Abstract base class for classes that are interested in the current view focus.
Definition: RViewFocusListener.h:36
virtual void enable()
Definition: RMainWindowQt.h:79
virtual void setGraphicsViewCursor(const QCursor &cursor)=0
Sets the cursor of all graphics views in all MDI children.
MDI child window.
Definition: RMdiChildQt.h:41
virtual void setProgressEnd()=0
Base class for a Qt based MDI main application window.
Definition: RMainWindowQt.h:63
virtual bool readSettings()
Restores the application window settings (size, position, ...).
Definition: RMainWindow.cpp:708
virtual void handleUserMessage(const QString &message)
Definition: RMainWindow.h:241
virtual RDocumentInterface * getDocumentInterface()=0
Abstract base class for classes that are interested in the current focus.
Definition: RFocusListener.h:36
All entities (for filters)
Definition: RS.h:86
Abstract base class for classes that are interested in the current coordinate of the mouse cursor...
Definition: RCoordinateListener.h:38
virtual void handleUserCommand(const QString &message)
Definition: RMainWindow.h:254
virtual void escapeEvent()=0
virtual void writeSettings()
Stores the application window settings (size, position, ...).
Definition: RMainWindow.cpp:738
virtual int getHeight()=0
Interface for interaction between a graphics document and a user.
Definition: RDocumentInterface.h:82
virtual RDocument * getDocument()=0
virtual void move(int x, int y)=0
Moves the application window to the given x / y position.
virtual void postTransactionEvent(RTransaction &t, bool onlyChanges=false, RS::EntityType entityTypeFilter=RS::EntityAll)=0
virtual void disable()
Definition: RMainWindowQt.h:76
virtual void setCommandPrompt(const QString &text="")=0
virtual void resize(int width, int height)=0
Resizes the application window to the given width and height.
virtual int getPositionY()=0
virtual void setLeftMouseTip(const QString &text="")=0
virtual void handleUserInfo(const QString &message)
Definition: RMainWindow.h:245
Graphics view.
Definition: RGraphicsView.h:58
RMdiArea * mdiArea
Definition: RMainWindowQt.h:192
virtual void setProgressText(const QString &text="")=0