QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
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 <QElapsedTimer>
27#include <QMainWindow>
28#include <QToolBar>
29
30#include "RMainWindow.h"
31#include "RObject.h"
32
33class QMdiSubWindow;
34
35class RBlockListener;
37class RDocument;
39class REntity;
41class RExportListener;
42class RExporter;
43class RFocusListener;
44class RGraphicsView;
45class RImportListener;
47class RKeyListener;
48class RLayerListener;
49class RMainWindow;
51class RMainWindowQt;
52class RMdiArea;
53class RMdiChildQt;
54class RMessageHandler;
56class RObject;
58class RPenListener;
61class RPropertyEvent;
63class RPropertyTypeId;
65class RSnapListener;
66class RTransaction;
68class RUcsListener;
69class RVector;
71class RViewListener;
72
73
81class QCADGUI_EXPORT RMainWindowQt: public QMainWindow, public RMainWindow {
82Q_OBJECT
83
84public:
85 RMainWindowQt(QWidget* parent = 0, bool hasMdiArea = true);
86 virtual ~RMainWindowQt();
88 virtual int getWidth();
89 virtual int getHeight();
90 virtual int getPositionX();
91 virtual int getPositionY();
92 virtual void resize(int width, int height);
93 virtual void move(int x, int y);
94 virtual void disable();
95 virtual void enable();
96 virtual RDocument* getDocument();
98
99 virtual void handleUserMessage(const QString& message, bool escape = true);
100 virtual void handleUserInfo(const QString& message, bool escape = true);
101 virtual void handleUserWarning(const QString& message, bool messageBox = false, bool escape = true);
102 virtual void handleUserCommand(const QString& message, bool escape = true);
103
104 void handleEnterKey(QObject* obj) {
105 if (mainWindowProxy) {
106 mainWindowProxy->handleEnterKey(obj);
107 }
108 }
109
110 bool handleTabKey(QObject* obj, bool backTab = false) {
111 if (mainWindowProxy) {
112 return mainWindowProxy->handleTabKey(obj, backTab);
113 }
114 return false;
115 }
116
117 virtual void postSelectionChangedEvent();
118 virtual void postTransactionEvent(
119 RTransaction& t,
120 bool onlyChanges=false,
121 RS::EntityType entityTypeFilter = RS::EntityAll
122 );
123 virtual void postPropertyEvent(RPropertyTypeId propertyTypeId,
124 const QVariant& value,
125 RS::EntityType entityTypeFilter = RS::EntityAll
126 );
127 virtual void postCloseEvent();
128
129 RMdiChildQt* getMdiChild();
130 QTabBar* getTabBar();
131 RMdiArea* getMdiArea();
132
133 virtual void cancelProgress();
134 virtual void setProgress(int value);
135 virtual void setProgressEnd();
136 virtual void setProgressText(const QString& text = "");
137
138 virtual void setCommandPrompt(const QString& text = "");
139 virtual void setLeftMouseTip(const QString& text = "");
140 virtual void setRightMouseTip(const QString& text = "");
141
142 virtual void showContextMenu(RObject::Id entityId, const RVector& pos);
143 virtual void requestResourceBlockEditing(RObject::Id entityId, const RVector& pos);
144 virtual void escapeEvent();
145
146 virtual void setGraphicsViewCursor(const QCursor& cursor);
147
148 virtual bool readSettings();
149 virtual void writeSettings();
150
151 virtual QMenu* createPopupMenu();
152
153 virtual QWidget* getChildWidget(const QString& name);
154
155 QList<QDockWidget*> getDockWidgets() {
156 return findChildren<QDockWidget*>();
157 }
158 QList<QToolBar*> getToolBars() {
159 return findChildren<QToolBar*>();
160 }
161
162 void clearKeyLog();
163
164 QString getKeyLog() const {
165 return keyLog;
166 }
167
168public slots:
169 void quit();
170 void currentTabChanged(int index);
171 void subWindowActivated(QMdiSubWindow* sw);
172 //void objectDestroyed(QObject *obj);
173
174signals:
178 void commandPrompt(const QString& text);
179
183 void leftMouseTip(const QString& message);
184
188 void rightMouseTip(const QString& message);
189
190 void progress(int value);
192 void progressText(const QString& label);
194
195 void userMessage(const QString& message, bool escape);
196 void userInfo(const QString& message, bool escape);
197 void userWarning(const QString& message, bool messageBox, bool escape);
198 void userCommand(const QString& message, bool escape);
199
203 void contextMenu(int entityId, const RVector& pos);
207 void editResourceBlock(int entityId, const RVector& pos);
208 void escape();
209 void drop(QDropEvent* event);
210 void dragEnter(QDragEnterEvent* event);
211
212 void resumedTab(RMdiChildQt* mdiChild);
213
216
217 void toolBarContextMenu(QMenu* menu);
218
219protected:
220 virtual void closeEvent(QCloseEvent* e);
221 virtual void dropEvent(QDropEvent* event);
222 virtual void dragEnterEvent(QDragEnterEvent* event);
223
224 virtual bool event(QEvent* e);
225
226public slots:
227 void updateGuiActions(QMdiSubWindow* mdiChild = NULL);
228 void initGuiActions();
229 void updateScenes(QMdiSubWindow* mdiChild);
230 void notifyListenersSlot(QMdiSubWindow* mdiChild);
231 void suspendAndResume(QMdiSubWindow* mdiChild);
232
233protected:
235
237
238 QString keyLog;
239 QElapsedTimer keyTimeOut;
240
241//private:
242// bool objectWasDestroyed;
243};
244
246
247#endif
Q_DECLARE_METATYPE(RMath *)
Abstract base class for classes that are interested in being notified whenever a block has been added...
Definition RBlockListener.h:37
Abstract base class for classes that are interested in the current coordinate of the mouse cursor.
Definition RCoordinateListener.h:38
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Interface for interaction between a graphics document and a user.
Definition RDocumentInterface.h:97
Abstract base class for classes that wish to be notified when an entity is exported.
Definition REntityExportListener.h:40
Base class for all entity classes.
Definition REntity.h:63
Abstract base class for classes that are interested in file export events.
Definition RExportListener.h:37
Abstract base class for exporters.
Definition RExporter.h:78
Abstract base class for classes that are interested in the current focus.
Definition RFocusListener.h:36
Graphics view.
Definition RGraphicsView.h:67
Abstract base class for classes that are interested in file import events.
Definition RImportListener.h:38
Abstract base class for classes that are interested in transactions in progress.
Definition RInterTransactionListener.h:41
Abstract base class for classes that are interested in key events.
Definition RKeyListener.h:33
Abstract base class for classes that are interested in being notified whenever a layer has been added...
Definition RLayerListener.h:39
Base class for an MDI main application window.
Definition RMainWindow.h:74
virtual void postCloseEvent()=0
virtual int getPositionY()=0
virtual void handleUserCommand(const QString &message, bool escape=true)
Definition RMainWindow.h:276
virtual int getWidth()=0
virtual void resize(int width, int height)=0
Resizes the application window to the given width and height.
virtual void disable()
Definition RMainWindow.h:92
virtual void postSelectionChangedEvent()=0
virtual void handleUserWarning(const QString &message, bool messageBox=false, bool escape=true)
Definition RMainWindow.h:269
virtual void writeSettings()
Stores the application window settings (size, position, ...).
Definition RMainWindow.cpp:809
virtual QWidget * getChildWidget(const QString &name)=0
virtual void setCommandPrompt(const QString &text="")=0
virtual void setGraphicsViewCursor(const QCursor &cursor)=0
Sets the cursor of all graphics views in all MDI children.
virtual void handleUserInfo(const QString &message, bool escape=true)
Definition RMainWindow.h:263
virtual void quit()=0
Closes the application window.
virtual int getPositionX()=0
virtual void postTransactionEvent(RTransaction &t, bool onlyChanges=false, RS::EntityType entityTypeFilter=RS::EntityAll)=0
virtual bool readSettings()
Restores the application window settings (size, position, ...).
Definition RMainWindow.cpp:777
virtual void postPropertyEvent(RPropertyTypeId propertyTypeId, const QVariant &value, RS::EntityType entityTypeFilter=RS::EntityAll)=0
virtual void escapeEvent()=0
virtual void setRightMouseTip(const QString &text="")=0
virtual void handleUserMessage(const QString &message, bool escape=true)
Definition RMainWindow.h:257
virtual void enable()
Definition RMainWindow.h:93
virtual int getHeight()=0
virtual void setLeftMouseTip(const QString &text="")=0
Definition RMainWindowProxy.h:8
Base class for a Qt based MDI main application window.
Definition RMainWindowQt.h:81
void progress(int value)
QString keyLog
Definition RMainWindowQt.h:238
void userMessage(const QString &message, bool escape)
void userCommand(const QString &message, bool escape)
QElapsedTimer keyTimeOut
Definition RMainWindowQt.h:239
void rightMouseTip(const QString &message)
Emitted when the right mouse button tip is requested to change.
void drop(QDropEvent *event)
QList< QToolBar * > getToolBars()
Definition RMainWindowQt.h:158
QString getKeyLog() const
Definition RMainWindowQt.h:164
void contextMenu(int entityId, const RVector &pos)
Emitted when a context menu is requested on top of the given entity.
void resumedTab(RMdiChildQt *mdiChild)
void leftMouseTip(const QString &message)
Emitted when the left mouse button tip is requested to change.
bool handleTabKey(QObject *obj, bool backTab=false)
Definition RMainWindowQt.h:110
void userWarning(const QString &message, bool messageBox, bool escape)
QList< QDockWidget * > getDockWidgets()
Definition RMainWindowQt.h:155
void userInfo(const QString &message, bool escape)
void handleEnterKey(QObject *obj)
Definition RMainWindowQt.h:104
void enterPressed()
void progressEnd()
int disableCounter
Definition RMainWindowQt.h:236
void dragEnter(QDragEnterEvent *event)
void progressCanceled()
void closeRequested()
void progressText(const QString &label)
void toolBarContextMenu(QMenu *menu)
RMdiArea * mdiArea
Definition RMainWindowQt.h:234
void commandPrompt(const QString &text)
Emitted when the command prompt is requested to change.
void editResourceBlock(int entityId, const RVector &pos)
Emitted when resource block editing is requested (double-click, context menu, ...):
MDI area with tabbar that features add tab button.
Definition RMdiArea.h:38
MDI child window.
Definition RMdiChildQt.h:41
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RMessageHandler.h:33
Abstract base class for classes that are interested in being notified when a new document is created.
Definition RNewDocumentListener.h:37
Abstract base class for all objects.
Definition RObject.h:64
int Id
Definition RObject.h:69
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPaletteListener.h:33
Abstract base class for classes that are interested in being notified whenever the current pen change...
Definition RPenListener.h:37
Abstract base class for classes that are interested in changes in drawing or application preferences.
Definition RPreferencesListener.h:36
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RProgressHandler.h:33
virtual void setProgress(int value)=0
virtual void setProgressText(const QString &text="")=0
virtual void setProgressEnd()=0
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyEvent.h:40
Abstract base class for classes that are interested in properties of the current selection or the cur...
Definition RPropertyListener.h:43
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyTypeId.h:54
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
@ EntityAll
All entities (for filters)
Definition RS.h:241
Abstract base class for classes that are interested in the current selection and want to be notified ...
Definition RSelectionListener.h:36
Abstract base class for classes that are interested in the current snap mode.
Definition RSnapListener.h:39
Transaction implementation.
Definition RTransaction.h:73
Abstract base class for classes that want to be notified on every transaction (objects added,...
Definition RTransactionListener.h:40
Abstract base class for classes that are interested in being notified whenever a UCS has been added o...
Definition RUcsListener.h:36
Represents a 3d vector (x/y/z).
Definition RVector.h:47
Abstract base class for classes that are interested in the current view focus.
Definition RViewFocusListener.h:36
Abstract base class for classes that are interested in being notified whenever a view has been added ...
Definition RViewListener.h:37
void getDocument()
Returns the current RDocument or undefined.
Definition simple.js:63
void move(void e, void offset)
Moves the given entity or shape by the given offset.
Definition simple_modify.js:58
void getDocumentInterface()
Returns the current RDocumentInterface or undefined.
Definition simple.js:69
#define QCADGUI_EXPORT
Definition gui_global.h:10
void getMainWindow()
Definition library.js:357
#define NULL
Definition opennurbs_system.h:256