Skip to content

RMainWindowQt

Class in GUI Module
Header: #include <src/gui/RMainWindowQt.h>
Inherits: QMainWindow, RMainWindow

Base class for a Qt based MDI main application window.

Scriptable: This class is available in script environments.

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 RMainWindowQt * getMainWindow()
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)
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 bool isCursorKeyReservedForScreenReader(QKeyEvent *ke)
static bool isStaleAutoRepeatKeyEvent(QKeyEvent *ke)
QList< int > closedDockWidgetPositionsX
QList< QPointer< QWidget > > closedDockWidgets
bool closingDown
int disableCounter
QByteArray dockWidgetState
bool dockWidgetStateValid
QString keyLog
QElapsedTimer keyTimeOut
RMdiArea * mdiArea
void forgetDockWidgetState()
Discards the dock widget state remembered by notifyDockWidgetClosed().
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)

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.

virtual RMainWindowQt::~RMainWindowQt()

virtual

virtual void RMainWindowQt::cancelProgress()

virtual

void RMainWindowQt::clearKeyLog()

virtual QMenu * RMainWindowQt::createPopupMenu()

virtual

virtual void RMainWindowQt::disable()

virtual

Reimplemented from disable.

virtual void RMainWindowQt::enable()

virtual

Reimplemented from enable.

virtual void RMainWindowQt::escapeEvent()

virtual

Reimplemented from escapeEvent.

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.

virtual QWidget * RMainWindowQt::getChildWidget(const QString &name)

virtual

Reimplemented from getChildWidget.

QList< QDockWidget * > RMainWindowQt::getDockWidgets()

inline

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.

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.

virtual int RMainWindowQt::getHeight()

virtual

Returns: Height of the main application window.

Reimplemented from getHeight.

QString RMainWindowQt::getKeyLog() const

inline const

RMdiArea * RMainWindowQt::getMdiArea()

RMdiChildQt * RMainWindowQt::getMdiChild()

virtual int RMainWindowQt::getPositionX()

virtual

Returns: X position of the main application window (distance from left of screen).

Reimplemented from getPositionX.

virtual int RMainWindowQt::getPositionY()

virtual

Returns: Y position of the main application window (distance from top of screen).

Reimplemented from getPositionY.

QTabBar * RMainWindowQt::getTabBar()

QList< QToolBar * > RMainWindowQt::getToolBars()

inline

virtual int RMainWindowQt::getWidth()

virtual

Returns: Width of the main application window.

Reimplemented from getWidth.

void RMainWindowQt::handleEnterKey(QObject *obj)

inline

bool RMainWindowQt::handleTabKey(QObject *obj, bool backTab=false)

inline

virtual void RMainWindowQt::handleUserCommand(const QString &message, bool escape=true)

virtual

Reimplemented from handleUserCommand.

virtual void RMainWindowQt::handleUserInfo(const QString &message, bool escape=true)

virtual

Reimplemented from handleUserInfo.

virtual void RMainWindowQt::handleUserMessage(const QString &message, bool escape=true)

virtual

Reimplemented from handleUserMessage.

virtual void RMainWindowQt::handleUserWarning(const QString &message, bool messageBox=false, bool escape=true)

virtual

Reimplemented from handleUserWarning.

bool RMainWindowQt::isFocusReachable(QWidget *w) const

const

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.

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.

virtual void RMainWindowQt::postCloseEvent()

virtual

Reimplemented from postCloseEvent.

virtual void RMainWindowQt::postPropertyEvent(RPropertyTypeId propertyTypeId, const QVariant &value, RS::EntityType entityTypeFilter=RS::EntityAll)

virtual

Reimplemented from postPropertyEvent.

virtual void RMainWindowQt::postSelectionChangedEvent()

virtual

Reimplemented from postSelectionChangedEvent.

virtual void RMainWindowQt::postTransactionEvent(RTransaction &t, bool onlyChanges=false, RS::EntityType entityTypeFilter=RS::EntityAll)

virtual

Reimplemented from postTransactionEvent.

virtual bool RMainWindowQt::readSettings()

virtual

Restores the application window settings (size, position, …).

Reimplemented from readSettings.

virtual void RMainWindowQt::reloadXRefs(RDocumentInterface *di, const QSet< QString > &dirtyXRefPaths)

virtual

Reimplemented from reloadXRefs.

virtual void RMainWindowQt::requestResourceBlockEditing(RObject::Id entityId, const RVector &pos)

virtual

virtual void RMainWindowQt::resize(int width, int height)

virtual

Resizes the application window to the given width and height.

Reimplemented from resize.

virtual void RMainWindowQt::setCommandPrompt(const QString &text="")

virtual

Reimplemented from setCommandPrompt.

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.

virtual void RMainWindowQt::setLeftMouseTip(const QString &text="")

virtual

Reimplemented from setLeftMouseTip.

virtual void RMainWindowQt::setProgress(int value)

virtual

Reimplemented from setProgress.

virtual void RMainWindowQt::setProgressEnd()

virtual

Reimplemented from setProgressEnd.

virtual void RMainWindowQt::setProgressText(const QString &text="")

virtual

Reimplemented from setProgressText.

virtual void RMainWindowQt::setRightMouseTip(const QString &text="")

virtual

Reimplemented from setRightMouseTip.

virtual void RMainWindowQt::showContextMenu(RObject::Id entityId, const RVector &pos)

virtual

virtual void RMainWindowQt::writeSettings()

virtual

Stores the application window settings (size, position, …).

Reimplemented from writeSettings.

static RMainWindowQt * RMainWindowQt::getMainWindow()

static

void RMainWindowQt::currentTabChanged(int index)

Part of the workaround for QMdiArea bug with events filtering through all stacked windows:

void RMainWindowQt::initGuiActions()

void RMainWindowQt::notifyListenersSlot(QMdiSubWindow *mdiChild)

void RMainWindowQt::quit()

void RMainWindowQt::subWindowActivated(QMdiSubWindow *sw)

void RMainWindowQt::suspendAndResume(QMdiSubWindow *mdiChild)

void RMainWindowQt::updateGuiActions(QMdiSubWindow *mdiChild=NULL)

void RMainWindowQt::updateScenes(QMdiSubWindow *mdiChild)

virtual void RMainWindowQt::closeEvent(QCloseEvent *e)

virtual protected

virtual void RMainWindowQt::dragEnterEvent(QDragEnterEvent *event)

virtual protected

virtual void RMainWindowQt::dropEvent(QDropEvent *event)

virtual protected

virtual bool RMainWindowQt::event(QEvent *e)

virtual protected

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).

void RMainWindowQt::restoreClosedDockWidgets()

protected

Shows all dock widgets again which were closed by Qt as part of the current (canceled) close operation.

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).

static bool RMainWindowQt::isStaleAutoRepeatKeyEvent(QKeyEvent *ke)

static protected

Non-Scriptable: This function is not available in script environments.

QList<int> RMainWindowQt::closedDockWidgetPositionsX

protected

QList<QPointer<QWidget> > RMainWindowQt::closedDockWidgets

protected

bool RMainWindowQt::closingDown

protected

int RMainWindowQt::disableCounter

protected

QByteArray RMainWindowQt::dockWidgetState

protected

bool RMainWindowQt::dockWidgetStateValid

protected

QString RMainWindowQt::keyLog

protected

QElapsedTimer RMainWindowQt::keyTimeOut

protected

RMdiArea* RMainWindowQt::mdiArea

protected

void RMainWindowQt::forgetDockWidgetState()

protected

Discards the dock widget state remembered by notifyDockWidgetClosed().

void RMainWindowQt::closeRequested()

void RMainWindowQt::commandPrompt(const QString &text)

Emitted when the command prompt is requested to change.

void RMainWindowQt::contextMenu(int entityId, const RVector &pos)

Emitted when a context menu is requested on top of the given entity.

void RMainWindowQt::dragEnter(QDragEnterEvent *event)

void RMainWindowQt::drop(QDropEvent *event)

void RMainWindowQt::editResourceBlock(int entityId, const RVector &pos)

Emitted when resource block editing is requested (double-click, context menu, …):

void RMainWindowQt::enterPressed()

void RMainWindowQt::escape()

void RMainWindowQt::leftMouseTip(const QString &message)

Emitted when the left mouse button tip is requested to change.

void RMainWindowQt::progress(int value)

void RMainWindowQt::progressCanceled()

void RMainWindowQt::progressEnd()

void RMainWindowQt::progressText(const QString &label)

void RMainWindowQt::reloadXRefsSignal(RDocumentInterface *di, const QStringList &dirtyXRefPaths)

void RMainWindowQt::resumedTab(RMdiChildQt *mdiChild)

void RMainWindowQt::rightMouseTip(const QString &message)

Emitted when the right mouse button tip is requested to change.

void RMainWindowQt::toolBarContextMenu(QMenu *menu)

void RMainWindowQt::userCommand(const QString &message, bool escape)

void RMainWindowQt::userInfo(const QString &message, bool escape)

void RMainWindowQt::userMessage(const QString &message, bool escape)

void RMainWindowQt::userWarning(const QString &message, bool messageBox, bool escape)