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  virtual void enable();
78  virtual RDocument* getDocument();
80 
81  virtual void handleUserMessage(const QString& message, bool escape = true);
82  virtual void handleUserInfo(const QString& message, bool escape = true);
83  virtual void handleUserWarning(const QString& message, bool messageBox = false, bool escape = true);
84  virtual void handleUserCommand(const QString& message, bool escape = true);
85 
86  virtual void postSelectionChangedEvent();
87  virtual void postTransactionEvent(
88  RTransaction& t,
89  bool onlyChanges=false,
90  RS::EntityType entityTypeFilter = RS::EntityAll
91  );
92  virtual void postCloseEvent();
93 
94  RMdiChildQt* getMdiChild();
95  QTabBar* getTabBar();
96  RMdiArea* getMdiArea();
97 
98  virtual void cancelProgress();
99  virtual void setProgress(int value);
100  virtual void setProgressEnd();
101  virtual void setProgressText(const QString& text = "");
102 
103  virtual void setCommandPrompt(const QString& text = "");
104  virtual void setLeftMouseTip(const QString& text = "");
105  virtual void setRightMouseTip(const QString& text = "");
106 
107  virtual void showContextMenu(RObject::Id entityId, const RVector& pos);
108  virtual void escapeEvent();
109 
110  virtual void setGraphicsViewCursor(const QCursor& cursor);
111 
112  virtual bool readSettings();
113  virtual void writeSettings();
114 
115  virtual QMenu* createPopupMenu();
116 
117  virtual QWidget* getChildWidget(const QString& name);
118 
119  QList<QDockWidget*> getDockWidgets() {
120  return findChildren<QDockWidget*>();
121  }
122  QList<QToolBar*> getToolBars() {
123  return findChildren<QToolBar*>();
124  }
125 
126 public slots:
127  void quit();
128  void currentTabChanged(int index);
129  void subWindowActivated(QMdiSubWindow* sw);
130  //void objectDestroyed(QObject *obj);
131 
132 signals:
136  void commandPrompt(const QString& text);
137 
141  void leftMouseTip(const QString& message);
142 
146  void rightMouseTip(const QString& message);
147 
148  void progress(int value);
149  void progressEnd();
150  void progressText(const QString& label);
151  void progressCanceled();
152 
153  void userMessage(const QString& message, bool escape);
154  void userInfo(const QString& message, bool escape);
155  void userWarning(const QString& message, bool messageBox, bool escape);
156  void userCommand(const QString& message, bool escape);
157 
161  void contextMenu(int entityId, const RVector& pos);
162  void escape();
163  void drop(QDropEvent* event);
164  void dragEnter(QDragEnterEvent* event);
165 
166  void resumedTab(RMdiChildQt* mdiChild);
167 
168  void closeRequested();
169  void enterPressed();
170 
171  void toolBarContextMenu(QMenu* menu);
172 
173 protected:
174  virtual void closeEvent(QCloseEvent* e);
175  virtual void dropEvent(QDropEvent* event);
176  virtual void dragEnterEvent(QDragEnterEvent* event);
177 
178  virtual bool event(QEvent* e);
179 
180 protected slots:
181  void updateGuiActions(QMdiSubWindow* mdiChild = NULL);
182  void initGuiActions();
183  void updateScenes(QMdiSubWindow* mdiChild);
184  void notifyListenersSlot(QMdiSubWindow* mdiChild);
185  void suspendAndResume(QMdiSubWindow* mdiChild);
186 
187 protected:
189 
191 
192 //private:
193 // bool objectWasDestroyed;
194 };
195 
197 
198 #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
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADGUI_EXPORT
Definition: gui_global.h:10
virtual void postCloseEvent()=0
virtual void handleUserCommand(const QString &message, bool escape=true)
Definition: RMainWindow.h:260
Base class for an MDI main application window.
Definition: RMainWindow.h:67
virtual int getPositionX()=0
int Id
Definition: RObject.h:57
virtual void handleUserMessage(const QString &message, bool escape=true)
Definition: RMainWindow.h:241
virtual void handleUserInfo(const QString &message, bool escape=true)
Definition: RMainWindow.h:247
Transaction implementation.
Definition: RTransaction.h:74
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
virtual void enable()
Definition: RMainWindow.h:86
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 selection and want to be notified ...
Definition: RSelectionListener.h:36
QList< QToolBar * > getToolBars()
Definition: RMainWindowQt.h:122
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:119
Q_DECLARE_METATYPE(RMath *)
Abstract base class for classes that are interested in the current view focus.
Definition: RViewFocusListener.h:36
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
int disableCounter
Definition: RMainWindowQt.h:190
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 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:88
Abstract base class for classes that are interested in the current coordinate of the mouse cursor...
Definition: RCoordinateListener.h:38
virtual void escapeEvent()=0
virtual void writeSettings()
Stores the application window settings (size, position, ...).
Definition: RMainWindow.cpp:727
virtual void disable()
Definition: RMainWindow.h:85
virtual int getHeight()=0
Interface for interaction between a graphics document and a user.
Definition: RDocumentInterface.h:82
virtual RDocument * getDocument()=0
virtual void handleUserWarning(const QString &message, bool messageBox=false, bool escape=true)
Definition: RMainWindow.h:253
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 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
Graphics view.
Definition: RGraphicsView.h:58
RMdiArea * mdiArea
Definition: RMainWindowQt.h:188
virtual void setProgressText(const QString &text="")=0