RMainWindowQt
Class in GUI Module
Header: #include <src/gui/RMainWindowQt.h>
Inherits: QMainWindow, RMainWindow
Description
Section titled “Description”Base class for a Qt based MDI main application window.
Scriptable: This class is available in script environments.
Public Functions
Section titled “Public Functions”RMainWindowQt(QWidget *parent=0, bool hasMdiArea=true) |
|
| virtual | ~RMainWindowQt() |
| virtual void | cancelProgress() |
| void | clearKeyLog() |
| virtual QMenu * | createPopupMenu() |
| virtual void | disable() |
| virtual void | enable() |
| virtual void | escapeEvent() |
| bool | focusNextPrevWidget(bool next, QWidget *from=NULL)Moves the keyboard focus to the next (or previous) widget in the focus chain of the main window (standard Tab / Shift+Tab behavior). |
| virtual QWidget * | getChildWidget(const QString &name) |
| QList< QDockWidget * > | getDockWidgets() |
| virtual RDocument * | getDocument() |
| virtual RDocumentInterface * | getDocumentInterface() |
| virtual int | getHeight() |
| QString | getKeyLog() const |
| RMdiArea * | getMdiArea() |
| RMdiChildQt * | getMdiChild() |
| virtual int | getPositionX() |
| virtual int | getPositionY() |
| QTabBar * | getTabBar() |
| QList< QToolBar * > | getToolBars() |
| virtual int | getWidth() |
| void | handleEnterKey(QObject *obj) |
| bool | handleTabKey(QObject *obj, bool backTab=false) |
| virtual void | handleUserCommand(const QString &message, bool escape=true) |
| virtual void | handleUserInfo(const QString &message, bool escape=true) |
| virtual void | handleUserMessage(const QString &message, bool escape=true) |
| virtual void | handleUserWarning(const QString &message, bool messageBox=false, bool escape=true) |
| bool | isFocusReachable(QWidget *w) const |
| virtual void | move(int x, int y)Moves the application window to the given x / y position. |
| void | notifyDockWidgetClosed(QWidget *dockWidget)Part 2 of workaround for Qt bug: dock widget closes before close dialog is shown dock widget state not persistent between sessions dock widget closes if user cancels close dialog. |
| virtual void | postCloseEvent() |
| virtual void | postPropertyEvent(RPropertyTypeId propertyTypeId, const QVariant &value, RS::EntityType entityTypeFilter=RS::EntityAll) |
| virtual void | postSelectionChangedEvent() |
| virtual void | postTransactionEvent(RTransaction &t, bool onlyChanges=false, RS::EntityType entityTypeFilter=RS::EntityAll) |
| virtual bool | readSettings()Restores the application window settings (size, position, …). |
| virtual void | reloadXRefs(RDocumentInterface *di, const QSet< QString > &dirtyXRefPaths) |
| virtual void | requestResourceBlockEditing(RObject::Id entityId, const RVector &pos) |
| virtual void | resize(int width, int height)Resizes the application window to the given width and height. |
| virtual void | setCommandPrompt(const QString &text=“”) |
| virtual void | setGraphicsViewCursor(const QCursor &cursor)Sets the cursor of all graphics views in all MDI children. |
| virtual void | setLeftMouseTip(const QString &text=“”) |
| virtual void | setProgress(int value) |
| virtual void | setProgressEnd() |
| virtual void | setProgressText(const QString &text=“”) |
| virtual void | setRightMouseTip(const QString &text=“”) |
| virtual void | showContextMenu(RObject::Id entityId, const RVector &pos) |
| virtual void | writeSettings()Stores the application window settings (size, position, …). |
Static Public Functions
Section titled “Static Public Functions”| static RMainWindowQt * | getMainWindow() |
Public Slots
Section titled “Public Slots”| void | currentTabChanged(int index)Part of the workaround for QMdiArea bug with events filtering through all stacked windows: |
| void | initGuiActions() |
| void | notifyListenersSlot(QMdiSubWindow *mdiChild) |
| void | quit() |
| void | subWindowActivated(QMdiSubWindow *sw) |
| void | suspendAndResume(QMdiSubWindow *mdiChild) |
| void | updateGuiActions(QMdiSubWindow *mdiChild=NULL) |
| void | updateScenes(QMdiSubWindow *mdiChild) |
Protected Functions
Section titled “Protected Functions”| virtual void | closeEvent(QCloseEvent *e) |
| virtual void | dragEnterEvent(QDragEnterEvent *event) |
| virtual void | dropEvent(QDropEvent *event) |
| virtual bool | event(QEvent *e) |
| virtual bool | focusNextPrevChild(bool next)Standard Tab / Shift+Tab handling of the main window, using focusNextPrevWidget to skip widgets which are not reachable (e.g. |
| void | restoreClosedDockWidgets()Shows all dock widgets again which were closed by Qt as part of the current (canceled) close operation. |
Static Protected Functions
Section titled “Static Protected Functions”| static bool | isCursorKeyReservedForScreenReader(QKeyEvent *ke) |
| static bool | isStaleAutoRepeatKeyEvent(QKeyEvent *ke) |
Protected Attributes
Section titled “Protected Attributes”| QList< int > | closedDockWidgetPositionsX |
| QList< QPointer< QWidget > > | closedDockWidgets |
| bool | closingDown |
| int | disableCounter |
| QByteArray | dockWidgetState |
| bool | dockWidgetStateValid |
| QString | keyLog |
| QElapsedTimer | keyTimeOut |
| RMdiArea * | mdiArea |
Protected Slots
Section titled “Protected Slots”| void | forgetDockWidgetState()Discards the dock widget state remembered by notifyDockWidgetClosed(). |
Signals
Section titled “Signals”| void | closeRequested() |
| void | commandPrompt(const QString &text)Emitted when the command prompt is requested to change. |
| void | contextMenu(int entityId, const RVector &pos)Emitted when a context menu is requested on top of the given entity. |
| void | dragEnter(QDragEnterEvent *event) |
| void | drop(QDropEvent *event) |
| void | editResourceBlock(int entityId, const RVector &pos)Emitted when resource block editing is requested (double-click, context menu, …): |
| void | enterPressed() |
| void | escape() |
| void | leftMouseTip(const QString &message)Emitted when the left mouse button tip is requested to change. |
| void | progress(int value) |
| void | progressCanceled() |
| void | progressEnd() |
| void | progressText(const QString &label) |
| void | reloadXRefsSignal(RDocumentInterface *di, const QStringList &dirtyXRefPaths) |
| void | resumedTab(RMdiChildQt *mdiChild) |
| void | rightMouseTip(const QString &message)Emitted when the right mouse button tip is requested to change. |
| void | toolBarContextMenu(QMenu *menu) |
| void | userCommand(const QString &message, bool escape) |
| void | userInfo(const QString &message, bool escape) |
| void | userMessage(const QString &message, bool escape) |
| void | userWarning(const QString &message, bool messageBox, bool escape) |
Member Documentation
Section titled “Member Documentation”RMainWindowQt
Section titled “RMainWindowQt”RMainWindowQt::RMainWindowQt(QWidget *parent=0, bool hasMdiArea=true)All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
~RMainWindowQt
Section titled “~RMainWindowQt”virtual RMainWindowQt::~RMainWindowQt()virtual
cancelProgress
Section titled “cancelProgress”virtual void RMainWindowQt::cancelProgress()virtual
clearKeyLog
Section titled “clearKeyLog”void RMainWindowQt::clearKeyLog()createPopupMenu
Section titled “createPopupMenu”virtual QMenu * RMainWindowQt::createPopupMenu()virtual
disable
Section titled “disable”virtual void RMainWindowQt::disable()virtual
Reimplemented from disable.
enable
Section titled “enable”virtual void RMainWindowQt::enable()virtual
Reimplemented from enable.
escapeEvent
Section titled “escapeEvent”virtual void RMainWindowQt::escapeEvent()virtual
Reimplemented from escapeEvent.
focusNextPrevWidget
Section titled “focusNextPrevWidget”bool RMainWindowQt::focusNextPrevWidget(bool next, QWidget *from=NULL)Moves the keyboard focus to the next (or previous) widget in the focus chain of the main window (standard Tab / Shift+Tab behavior).
Moves the keyboard focus to the next (or previous) widget in the focus chain of this main window, starting at widget from (default: current focus widget).
Used by widgets that handle Tab themselves (graphics view, options tool bar) to continue the focus chain when they cannot handle it.
This is the standard Tab / Shift+Tab behavior, used by widgets which handle Tab themselves (graphics view, options tool bar) to continue the focus chain when they cannot handle it.
Unlike QWidget::focusNextPrevChild, this skips ancestors of from: QMdiSubWindow is focusable but immediately passes the focus back to its child widget (the graphics view), which would trap the focus.
getChildWidget
Section titled “getChildWidget”virtual QWidget * RMainWindowQt::getChildWidget(const QString &name)virtual
Reimplemented from getChildWidget.
getDockWidgets
Section titled “getDockWidgets”QList< QDockWidget * > RMainWindowQt::getDockWidgets()inline
getDocument
Section titled “getDocument”virtual RDocument * RMainWindowQt::getDocument()virtual
Returns: Pointer to the document that is currently open and has the focus or NULL if no document is open.
Reimplemented from getDocument.
getDocumentInterface
Section titled “getDocumentInterface”virtual RDocumentInterface * RMainWindowQt::getDocumentInterface()virtual
Returns: Pointer to the document interface of the document that is currently open and has the focus or NULL if no document is open.
Reimplemented from getDocumentInterface.
getHeight
Section titled “getHeight”virtual int RMainWindowQt::getHeight()virtual
Returns: Height of the main application window.
Reimplemented from getHeight.
getKeyLog
Section titled “getKeyLog”QString RMainWindowQt::getKeyLog() constinline const
getMdiArea
Section titled “getMdiArea”RMdiArea * RMainWindowQt::getMdiArea()getMdiChild
Section titled “getMdiChild”RMdiChildQt * RMainWindowQt::getMdiChild()getPositionX
Section titled “getPositionX”virtual int RMainWindowQt::getPositionX()virtual
Returns: X position of the main application window (distance from left of screen).
Reimplemented from getPositionX.
getPositionY
Section titled “getPositionY”virtual int RMainWindowQt::getPositionY()virtual
Returns: Y position of the main application window (distance from top of screen).
Reimplemented from getPositionY.
getTabBar
Section titled “getTabBar”QTabBar * RMainWindowQt::getTabBar()getToolBars
Section titled “getToolBars”QList< QToolBar * > RMainWindowQt::getToolBars()inline
getWidth
Section titled “getWidth”virtual int RMainWindowQt::getWidth()virtual
Returns: Width of the main application window.
Reimplemented from getWidth.
handleEnterKey
Section titled “handleEnterKey”void RMainWindowQt::handleEnterKey(QObject *obj)inline
handleTabKey
Section titled “handleTabKey”bool RMainWindowQt::handleTabKey(QObject *obj, bool backTab=false)inline
handleUserCommand
Section titled “handleUserCommand”virtual void RMainWindowQt::handleUserCommand(const QString &message, bool escape=true)virtual
Reimplemented from handleUserCommand.
handleUserInfo
Section titled “handleUserInfo”virtual void RMainWindowQt::handleUserInfo(const QString &message, bool escape=true)virtual
Reimplemented from handleUserInfo.
handleUserMessage
Section titled “handleUserMessage”virtual void RMainWindowQt::handleUserMessage(const QString &message, bool escape=true)virtual
Reimplemented from handleUserMessage.
handleUserWarning
Section titled “handleUserWarning”virtual void RMainWindowQt::handleUserWarning(const QString &message, bool messageBox=false, bool escape=true)virtual
Reimplemented from handleUserWarning.
isFocusReachable
Section titled “isFocusReachable”bool RMainWindowQt::isFocusReachable(QWidget *w) constconst
Returns: True if the given widget can be reached with the keyboard (Tab): enabled, visible and not covered, e.g. by another dock widget in the same tab stack (such dock widgets report isVisible() true but have an empty visible region). Widgets in scroll areas are checked at the level of the scroll area, since they might be scrolled out of view temporarily.
virtual void RMainWindowQt::move(int x, int y)virtual
Moves the application window to the given x / y position.
Reimplemented from move.
notifyDockWidgetClosed
Section titled “notifyDockWidgetClosed”void RMainWindowQt::notifyDockWidgetClosed(QWidget *dockWidget)Part 2 of workaround for Qt bug: dock widget closes before close dialog is shown dock widget state not persistent between sessions dock widget closes if user cancels close dialog.
Called by RDockWidget whenever a dock widget receives a close event, i.e. before the dock widget is hidden by Qt.
When the application is terminated, Qt closes all top level widgets (QApplicationPrivate::tryCloseAllWidgetWindows). Floating dock widgets are top level widgets, so they are closed (and hidden) as well. The order in which this happens is the order of QApplication::topLevelWidgets(), which is based on an unordered set and therefore arbitrary: if a floating dock widget happens to come before the main window, it is already hidden when closeEvent() / writeSettings() is called and saveState() would store it as hidden for the next session. Docked (non-floating) dock widgets are not top level widgets and are never affected, which is why only floating dock widgets lose their visibility (and only sometimes).
We therefore remember the dock widget state of the main window before the first dock widget of a close operation is hidden. The remembered state is discarded again as soon as control returns to the event loop: if the dock widget was closed by the user (and not as part of closing the main window), closeEvent() is never called and the state must not be reused.
postCloseEvent
Section titled “postCloseEvent”virtual void RMainWindowQt::postCloseEvent()virtual
Reimplemented from postCloseEvent.
postPropertyEvent
Section titled “postPropertyEvent”virtual void RMainWindowQt::postPropertyEvent(RPropertyTypeId propertyTypeId, const QVariant &value, RS::EntityType entityTypeFilter=RS::EntityAll)virtual
Reimplemented from postPropertyEvent.
postSelectionChangedEvent
Section titled “postSelectionChangedEvent”virtual void RMainWindowQt::postSelectionChangedEvent()virtual
Reimplemented from postSelectionChangedEvent.
postTransactionEvent
Section titled “postTransactionEvent”virtual void RMainWindowQt::postTransactionEvent(RTransaction &t, bool onlyChanges=false, RS::EntityType entityTypeFilter=RS::EntityAll)virtual
Reimplemented from postTransactionEvent.
readSettings
Section titled “readSettings”virtual bool RMainWindowQt::readSettings()virtual
Restores the application window settings (size, position, …).
Reimplemented from readSettings.
reloadXRefs
Section titled “reloadXRefs”virtual void RMainWindowQt::reloadXRefs(RDocumentInterface *di, const QSet< QString > &dirtyXRefPaths)virtual
Reimplemented from reloadXRefs.
requestResourceBlockEditing
Section titled “requestResourceBlockEditing”virtual void RMainWindowQt::requestResourceBlockEditing(RObject::Id entityId, const RVector &pos)virtual
resize
Section titled “resize”virtual void RMainWindowQt::resize(int width, int height)virtual
Resizes the application window to the given width and height.
Reimplemented from resize.
setCommandPrompt
Section titled “setCommandPrompt”virtual void RMainWindowQt::setCommandPrompt(const QString &text="")virtual
Reimplemented from setCommandPrompt.
setGraphicsViewCursor
Section titled “setGraphicsViewCursor”virtual void RMainWindowQt::setGraphicsViewCursor(const QCursor &cursor)virtual
Sets the cursor of all graphics views in all MDI children.
Necessary as workaround for Qt cursor bug (cursor inconsistent with multiple widgets on top of each other in MDI area).
Reimplemented from setGraphicsViewCursor.
setLeftMouseTip
Section titled “setLeftMouseTip”virtual void RMainWindowQt::setLeftMouseTip(const QString &text="")virtual
Reimplemented from setLeftMouseTip.
setProgress
Section titled “setProgress”virtual void RMainWindowQt::setProgress(int value)virtual
Reimplemented from setProgress.
setProgressEnd
Section titled “setProgressEnd”virtual void RMainWindowQt::setProgressEnd()virtual
Reimplemented from setProgressEnd.
setProgressText
Section titled “setProgressText”virtual void RMainWindowQt::setProgressText(const QString &text="")virtual
Reimplemented from setProgressText.
setRightMouseTip
Section titled “setRightMouseTip”virtual void RMainWindowQt::setRightMouseTip(const QString &text="")virtual
Reimplemented from setRightMouseTip.
showContextMenu
Section titled “showContextMenu”virtual void RMainWindowQt::showContextMenu(RObject::Id entityId, const RVector &pos)virtual
writeSettings
Section titled “writeSettings”virtual void RMainWindowQt::writeSettings()virtual
Stores the application window settings (size, position, …).
Reimplemented from writeSettings.
getMainWindow
Section titled “getMainWindow”static RMainWindowQt * RMainWindowQt::getMainWindow()static
currentTabChanged
Section titled “currentTabChanged”void RMainWindowQt::currentTabChanged(int index)Part of the workaround for QMdiArea bug with events filtering through all stacked windows:
initGuiActions
Section titled “initGuiActions”void RMainWindowQt::initGuiActions()notifyListenersSlot
Section titled “notifyListenersSlot”void RMainWindowQt::notifyListenersSlot(QMdiSubWindow *mdiChild)void RMainWindowQt::quit()subWindowActivated
Section titled “subWindowActivated”void RMainWindowQt::subWindowActivated(QMdiSubWindow *sw)suspendAndResume
Section titled “suspendAndResume”void RMainWindowQt::suspendAndResume(QMdiSubWindow *mdiChild)updateGuiActions
Section titled “updateGuiActions”void RMainWindowQt::updateGuiActions(QMdiSubWindow *mdiChild=NULL)updateScenes
Section titled “updateScenes”void RMainWindowQt::updateScenes(QMdiSubWindow *mdiChild)closeEvent
Section titled “closeEvent”virtual void RMainWindowQt::closeEvent(QCloseEvent *e)virtual protected
dragEnterEvent
Section titled “dragEnterEvent”virtual void RMainWindowQt::dragEnterEvent(QDragEnterEvent *event)virtual protected
dropEvent
Section titled “dropEvent”virtual void RMainWindowQt::dropEvent(QDropEvent *event)virtual protected
virtual bool RMainWindowQt::event(QEvent *e)virtual protected
focusNextPrevChild
Section titled “focusNextPrevChild”virtual bool RMainWindowQt::focusNextPrevChild(bool next)virtual protected
Standard Tab / Shift+Tab handling of the main window, using focusNextPrevWidget to skip widgets which are not reachable (e.g.
in dock widgets not on top of their tab stack).
restoreClosedDockWidgets
Section titled “restoreClosedDockWidgets”void RMainWindowQt::restoreClosedDockWidgets()protected
Shows all dock widgets again which were closed by Qt as part of the current (canceled) close operation.
isCursorKeyReservedForScreenReader
Section titled “isCursorKeyReservedForScreenReader”static bool RMainWindowQt::isCursorKeyReservedForScreenReader(QKeyEvent *ke)static protected
Non-Scriptable: This function is not available in script environments.
Returns: True if the given key event is an auto repeated cursor key event that has been waiting in the event queue for longer than the configured threshold (Keyboard/StaleAutoRepeatThreshold, ms).
Auto repeated key events are queued by the system at the key repeat rate. If handling one event takes longer than the repeat interval (e.g. moving a large selection with the cursor keys), the queue fills up and the queued events are still processed after the key has been released. Dropping stale auto repeat events keeps the reaction to the cursor keys smooth and stops moving the selection when the key is released.
The event time stamp and the wall clock use different bases, the base offset is calibrated with the smallest observed delay (an event that was processed immediately) and re-calibrated on every deliberate key press.
Returns: True if the given key event is a cursor key event which has to be left to a screen reader (see RSettings::isScreenReaderActive).
isStaleAutoRepeatKeyEvent
Section titled “isStaleAutoRepeatKeyEvent”static bool RMainWindowQt::isStaleAutoRepeatKeyEvent(QKeyEvent *ke)static protected
Non-Scriptable: This function is not available in script environments.
closedDockWidgetPositionsX
Section titled “closedDockWidgetPositionsX”QList<int> RMainWindowQt::closedDockWidgetPositionsXprotected
closedDockWidgets
Section titled “closedDockWidgets”QList<QPointer<QWidget> > RMainWindowQt::closedDockWidgetsprotected
closingDown
Section titled “closingDown”bool RMainWindowQt::closingDownprotected
disableCounter
Section titled “disableCounter”int RMainWindowQt::disableCounterprotected
dockWidgetState
Section titled “dockWidgetState”QByteArray RMainWindowQt::dockWidgetStateprotected
dockWidgetStateValid
Section titled “dockWidgetStateValid”bool RMainWindowQt::dockWidgetStateValidprotected
keyLog
Section titled “keyLog”QString RMainWindowQt::keyLogprotected
keyTimeOut
Section titled “keyTimeOut”QElapsedTimer RMainWindowQt::keyTimeOutprotected
mdiArea
Section titled “mdiArea”RMdiArea* RMainWindowQt::mdiAreaprotected
forgetDockWidgetState
Section titled “forgetDockWidgetState”void RMainWindowQt::forgetDockWidgetState()protected
Discards the dock widget state remembered by notifyDockWidgetClosed().
closeRequested
Section titled “closeRequested”void RMainWindowQt::closeRequested()commandPrompt
Section titled “commandPrompt”void RMainWindowQt::commandPrompt(const QString &text)Emitted when the command prompt is requested to change.
contextMenu
Section titled “contextMenu”void RMainWindowQt::contextMenu(int entityId, const RVector &pos)Emitted when a context menu is requested on top of the given entity.
dragEnter
Section titled “dragEnter”void RMainWindowQt::dragEnter(QDragEnterEvent *event)void RMainWindowQt::drop(QDropEvent *event)editResourceBlock
Section titled “editResourceBlock”void RMainWindowQt::editResourceBlock(int entityId, const RVector &pos)Emitted when resource block editing is requested (double-click, context menu, …):
enterPressed
Section titled “enterPressed”void RMainWindowQt::enterPressed()escape
Section titled “escape”void RMainWindowQt::escape()leftMouseTip
Section titled “leftMouseTip”void RMainWindowQt::leftMouseTip(const QString &message)Emitted when the left mouse button tip is requested to change.
progress
Section titled “progress”void RMainWindowQt::progress(int value)progressCanceled
Section titled “progressCanceled”void RMainWindowQt::progressCanceled()progressEnd
Section titled “progressEnd”void RMainWindowQt::progressEnd()progressText
Section titled “progressText”void RMainWindowQt::progressText(const QString &label)reloadXRefsSignal
Section titled “reloadXRefsSignal”void RMainWindowQt::reloadXRefsSignal(RDocumentInterface *di, const QStringList &dirtyXRefPaths)resumedTab
Section titled “resumedTab”void RMainWindowQt::resumedTab(RMdiChildQt *mdiChild)rightMouseTip
Section titled “rightMouseTip”void RMainWindowQt::rightMouseTip(const QString &message)Emitted when the right mouse button tip is requested to change.
toolBarContextMenu
Section titled “toolBarContextMenu”void RMainWindowQt::toolBarContextMenu(QMenu *menu)userCommand
Section titled “userCommand”void RMainWindowQt::userCommand(const QString &message, bool escape)userInfo
Section titled “userInfo”void RMainWindowQt::userInfo(const QString &message, bool escape)userMessage
Section titled “userMessage”void RMainWindowQt::userMessage(const QString &message, bool escape)userWarning
Section titled “userWarning”void RMainWindowQt::userWarning(const QString &message, bool messageBox, bool escape)