Qt 4.8
Public Types | Public Slots | Signals | Public Functions | Protected Functions | Properties | Friends | List of all members
QWorkspace Class Reference

The QWorkspace widget provides a workspace window that can be used in an MDI application. More...

#include <qworkspace.h>

Inheritance diagram for QWorkspace:
QWidget QObject QPaintDevice

Public Types

enum  WindowOrder { CreationOrder, StackingOrder }
 Specifies the order in which child windows are returned from windowList(). More...
 
- Public Types inherited from QWidget
enum  RenderFlag { DrawWindowBackground = 0x1, DrawChildren = 0x2, IgnoreMask = 0x4 }
 This enum describes how to render the widget when calling QWidget::render(). More...
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 

Public Slots

void activateNextWindow ()
 Gives the input focus to the next window in the list of child windows. More...
 
void activatePreviousWindow ()
 Gives the input focus to the previous window in the list of child windows. More...
 
void arrangeIcons ()
 Arranges all iconified windows at the bottom of the workspace. More...
 
void cascade ()
 Arranges all the child windows in a cascade pattern. More...
 
void closeActiveWindow ()
 Closes the child window that is currently active. More...
 
void closeAllWindows ()
 Closes all child windows. More...
 
void setActiveWindow (QWidget *w)
 Makes the child window that contains w the active child window. More...
 
void tile ()
 Arranges all child windows in a tile pattern. More...
 
- Public Slots inherited from QWidget
bool close ()
 Closes this widget. More...
 
void hide ()
 Hides the widget. More...
 
void lower ()
 Lowers the widget to the bottom of the parent widget's stack. More...
 
void raise ()
 Raises this widget to the top of the parent widget's stack. More...
 
void repaint ()
 Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden. More...
 
void setDisabled (bool)
 Disables widget input events if disable is true; otherwise enables input events. More...
 
void setEnabled (bool)
 
void setFocus ()
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setHidden (bool hidden)
 Convenience function, equivalent to setVisible(!hidden). More...
 
QT_MOC_COMPAT void setShown (bool shown)
 Use setVisible(shown) instead. More...
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool)
 
void setWindowTitle (const QString &)
 
void show ()
 Shows the widget and its child widgets. More...
 
void showFullScreen ()
 Shows the widget in full-screen mode. More...
 
void showMaximized ()
 Shows the widget maximized. More...
 
void showMinimized ()
 Shows the widget minimized, as an icon. More...
 
void showNormal ()
 Restores the widget after it has been maximized or minimized. More...
 
void update ()
 Updates the widget unless updates are disabled or the widget is hidden. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 

Signals

void windowActivated (QWidget *w)
 This signal is emitted when the child window w becomes active. More...
 
- Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 This signal is emitted when the widget's contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 

Public Functions

QWidgetactiveWindow () const
 Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active. More...
 
QWidgetaddWindow (QWidget *w, Qt::WindowFlags flags=0)
 Adds widget w as new sub window to the workspace. More...
 
QBrush background () const
 
 QWorkspace (QWidget *parent=0)
 Constructs a workspace with the given parent. More...
 
bool scrollBarsEnabled () const
 
void setBackground (const QBrush &background)
 
void setScrollBarsEnabled (bool enable)
 
QSize sizeHint () const
 Reimplemented Function More...
 
QWidgetList windowList (WindowOrder order=CreationOrder) const
 Returns a list of all visible or minimized child windows. More...
 
 ~QWorkspace ()
 Destroys the workspace and frees any allocated resources. More...
 
- Public Functions inherited from QWidget
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 Returns the (possibly empty) list of this widget's actions. More...
 
void activateWindow ()
 Sets the top-level widget containing this widget to be the active window. More...
 
void addAction (QAction *action)
 Appends the action action to this widget's list of actions. More...
 
void addActions (QList< QAction *> actions)
 Appends the actions actions to this widget's list of actions. More...
 
void adjustSize ()
 Adjusts the size of the widget to fit its contents. More...
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 Returns the background role of the widget. More...
 
QSize baseSize () const
 
QWidgetchildAt (int x, int y) const
 Returns the visible child widget at the position ({x}, {y}) in the widget's coordinate system. More...
 
QWidgetchildAt (const QPoint &p) const
 Returns the visible child widget at point p in the widget's own coordinate system. More...
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 Takes keyboard input focus from the widget. More...
 
void clearMask ()
 Removes any mask set by setMask(). More...
 
QMargins contentsMargins () const
 The contentsMargins function returns the widget's contents margins. More...
 
QRect contentsRect () const
 Returns the area inside the widget's margins. More...
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
void createWinId ()
 
QCursor cursor () const
 
int devType () const
 
WId effectiveWinId () const
 Returns the effective window system identifier of the widget, i. More...
 
void ensurePolished () const
 Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette). More...
 
Qt::FocusPolicy focusPolicy () const
 
QWidgetfocusProxy () const
 Returns the focus proxy, or 0 if there is no focus proxy. More...
 
QWidgetfocusWidget () const
 Returns the last child of this widget that setFocus had been called on. More...
 
const QFontfont () const
 
QFontInfo fontInfo () const
 Returns the font info for the widget's current font. More...
 
QFontMetrics fontMetrics () const
 Returns the font metrics for the widget's current font. More...
 
QPalette::ColorRole foregroundRole () const
 Returns the foreground role. More...
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 Returns the widget's contents margins for left, top, right, and bottom. More...
 
HDC getDC () const
 Returns the window system handle of the widget, for low-level access. More...
 
void grabGesture (Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags())
 Subscribes the widget to a given gesture with specific flags. More...
 
void grabKeyboard ()
 Grabs the keyboard input. More...
 
void grabMouse ()
 Grabs the mouse input. More...
 
void grabMouse (const QCursor &)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context. More...
 
QGraphicsEffectgraphicsEffect () const
 The graphicsEffect function returns a pointer to the widget's graphics effect. More...
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 Returns the proxy widget for the corresponding embedded widget in a graphics view; otherwise returns 0. More...
 
bool hasFocus () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int) const
 Returns the preferred height for this widget, given the width w. More...
 
QInputContextinputContext ()
 This function returns the QInputContext for this widget. More...
 
Qt::InputMethodHints inputMethodHints () const
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery) const
 This method is only relevant for input widgets. More...
 
void insertAction (QAction *before, QAction *action)
 Inserts the action action to this widget's list of actions, before the action before. More...
 
void insertActions (QAction *before, QList< QAction *> actions)
 Inserts the actions actions to this widget's list of actions, before the action before. More...
 
WId internalWinId () const
 Returns the window system identifier of the widget, or 0 if the widget is not created yet. More...
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child, and both widgets are within the same window; otherwise returns false. More...
 
bool isEnabled () const
 
bool isEnabledTo (QWidget *) const
 Returns true if this widget would become enabled if ancestor is enabled; otherwise returns false. More...
 
bool isEnabledToTLW () const
 This function is deprecated. More...
 
bool isFullScreen () const
 
bool isHidden () const
 Returns true if the widget is hidden, otherwise returns false. More...
 
bool isLeftToRight () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isRightToLeft () const
 
bool isTopLevel () const
 Use isWindow() instead. More...
 
bool isVisible () const
 
bool isVisibleTo (QWidget *) const
 Returns true if this widget would become visible if ancestor is shown; otherwise returns false. More...
 
bool isWindow () const
 Returns true if the widget is an independent window, otherwise returns false. More...
 
bool isWindowModified () const
 
QLayoutlayout () const
 Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed. More...
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
Qt::HANDLE macCGHandle () const
 Returns the CoreGraphics handle of the widget. More...
 
Qt::HANDLE macQDHandle () const
 Returns the QuickDraw handle of the widget. More...
 
QPoint mapFrom (QWidget *, const QPoint &) const
 Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system. More...
 
QPoint mapFromGlobal (const QPoint &) const
 Translates the global screen coordinate pos to widget coordinates. More...
 
QPoint mapFromParent (const QPoint &) const
 Translates the parent widget coordinate pos to widget coordinates. More...
 
QPoint mapTo (QWidget *, const QPoint &) const
 Translates the widget coordinate pos to the coordinate system of parent. More...
 
QPoint mapToGlobal (const QPoint &) const
 Translates the widget coordinate pos to global screen coordinates. More...
 
QPoint mapToParent (const QPoint &) const
 Translates the widget coordinate pos to a coordinate in the parent widget. More...
 
QRegion mask () const
 Returns the mask currently set on a widget. More...
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
virtual QSize minimumSizeHint () const
 
int minimumWidth () const
 
void move (int x, int y)
 This corresponds to move(QPoint(x, y)). More...
 
void move (const QPoint &)
 
QWidgetnativeParentWidget () const
 Returns the native parent for this widget, i. More...
 
QWidgetnextInFocusChain () const
 Returns the next widget in this widget's focus chain. More...
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags type)
 Sets the window flags for the widget to flags, without telling the window system. More...
 
void overrideWindowState (Qt::WindowStates state)
 
QPaintEnginepaintEngine () const
 Returns the widget's paint engine. More...
 
const QPalettepalette () const
 
QWidgetparentWidget () const
 Returns the parent of this widget, or 0 if it does not have any parent widget. More...
 
QPoint pos () const
 
QWidgetpreviousInFocusChain () const
 The previousInFocusChain function returns the previous widget in this widget's focus chain. More...
 
 QWidget (QWidget *parent=0, Qt::WindowFlags f=0)
 Constructs a widget which is a child of parent, with widget flags set to f. More...
 
QRect rect () const
 
void releaseDC (HDC) const
 Releases the HDC hdc acquired by a previous call to getDC(). More...
 
void releaseKeyboard ()
 Releases the keyboard grab. More...
 
void releaseMouse ()
 Releases the mouse grab. More...
 
void releaseShortcut (int id)
 Removes the shortcut with the given id from Qt's shortcut system. More...
 
void removeAction (QAction *action)
 Removes the action action from this widget's list of actions. More...
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. More...
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the widget into the painter's QPainter::device(). More...
 
void repaint (int x, int y, int w, int h)
 This version repaints a rectangle (x, y, w, h) inside the widget. More...
 
void repaint (const QRect &)
 This version repaints a rectangle rect inside the widget. More...
 
void repaint (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void resize (int w, int h)
 This corresponds to resize(QSize(w, h)). More...
 
void resize (const QSize &)
 
bool restoreGeometry (const QByteArray &geometry)
 Restores the geometry and state top-level widgets stored in the byte array geometry. More...
 
QByteArray saveGeometry () const
 Saves the current geometry and state for top-level widgets. More...
 
void scroll (int dx, int dy)
 Scrolls the widget including its children dx pixels to the right and dy downward. More...
 
void scroll (int dx, int dy, const QRect &)
 This version only scrolls r and does not move the children of the widget. More...
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute, bool on=true)
 Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. More...
 
void setAutoFillBackground (bool enabled)
 
void setBackgroundRole (QPalette::ColorRole)
 Sets the background role of the widget to role. More...
 
void setBaseSize (const QSize &)
 
void setBaseSize (int basew, int baseh)
 This corresponds to setBaseSize(QSize(basew, baseh)). More...
 
void setContentsMargins (int left, int top, int right, int bottom)
 Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom. More...
 
void setContentsMargins (const QMargins &margins)
 The setContentsMargins function sets the margins around the widget's contents. More...
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &)
 
void setFixedHeight (int h)
 Sets both the minimum and maximum heights of the widget to h without changing the widths. More...
 
void setFixedSize (const QSize &)
 Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking. More...
 
void setFixedSize (int w, int h)
 Sets the width of the widget to w and the height to h. More...
 
void setFixedWidth (int w)
 Sets both the minimum and maximum width of the widget to w without changing the heights. More...
 
void setFocus (Qt::FocusReason reason)
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *)
 Sets the widget's focus proxy to widget w. More...
 
void setFont (const QFont &)
 Use the single-argument overload instead. More...
 
void setForegroundRole (QPalette::ColorRole)
 Sets the foreground role of the widget to role. More...
 
void setGeometry (int x, int y, int w, int h)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setGeometry(QRect(x, y, w, h)). More...
 
void setGeometry (const QRect &)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 The setGraphicsEffect function is for setting the widget's graphics effect. More...
 
void setInputContext (QInputContext *)
 This function sets the input context context on this widget. More...
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *)
 Sets the layout manager for this widget to layout. More...
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &)
 Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. More...
 
void setMask (const QRegion &)
 Causes only the parts of the widget which overlap region to be visible. More...
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &)
 
void setMaximumSize (int maxw, int maxh)
 This function corresponds to setMaximumSize(QSize(maxw, maxh)). More...
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &)
 
void setMinimumSize (int minw, int minh)
 This function corresponds to setMinimumSize(QSize(minw, minh)). More...
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &)
 Use the single-argument overload instead. More...
 
void setParent (QWidget *parent)
 Sets the parent of the widget to parent, and resets the window flags. More...
 
void setParent (QWidget *parent, Qt::WindowFlags f)
 This function also takes widget flags, f as an argument. More...
 
void setShortcutAutoRepeat (int id, bool enable=true)
 If enable is true, auto repeat of the shortcut with the given id is enabled; otherwise it is disabled. More...
 
void setShortcutEnabled (int id, bool enable=true)
 If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled. More...
 
void setSizeIncrement (const QSize &)
 
void setSizeIncrement (int w, int h)
 Sets the x (width) size increment to w and the y (height) size increment to h. More...
 
void setSizePolicy (QSizePolicy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 Sets the size policy of the widget to horizontal and vertical, with standard stretch and no height-for-width. More...
 
void setStatusTip (const QString &)
 
void setStyle (QStyle *)
 Sets the widget's GUI style to style. More...
 
void setToolTip (const QString &)
 
void setUpdatesEnabled (bool enable)
 
void setupUi (QWidget *widget)
 Sets up the user interface for the specified widget. More...
 
void setWhatsThis (const QString &)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags type)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowIconText (const QString &)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &)
 Sets the window's role to role. More...
 
void setWindowState (Qt::WindowStates state)
 Sets the window state to windowState. More...
 
void setWindowSurface (QWindowSurface *surface)
 Sets the window surface to be the surface specified. More...
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *)
 Places the widget under w in the parent widget's stack. More...
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute) const
 Returns true if attribute attribute is set on this widget; otherwise returns false. More...
 
QString toolTip () const
 
QWidgettopLevelWidget () const
 
bool underMouse () const
 Returns true if the widget is under the mouse cursor; otherwise returns false. More...
 
void ungrabGesture (Qt::GestureType type)
 Unsubscribes the widget from a given gesture type. More...
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (int x, int y, int w, int h)
 This version updates a rectangle (x, y, w, h) inside the widget. More...
 
void update (const QRect &)
 This version updates a rectangle rect inside the widget. More...
 
void update (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void updateGeometry ()
 Notifies the layout system that this widget has changed and may need to change geometry. More...
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 Returns the unobscured region where paint events can occur. More...
 
QString whatsThis () const
 
int width () const
 
QWidgetwindow () const
 Returns the window for this widget, i.e. More...
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 Window flags are a combination of a type (e. More...
 
QIcon windowIcon () const
 
QString windowIconText () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 Returns the window's role, or an empty string. More...
 
Qt::WindowStates windowState () const
 Returns the current window state. More...
 
QWindowSurfacewindowSurface () const
 Returns the QWindowSurface this widget will be drawn into. More...
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 Returns the window type of this widget. More...
 
WId winId () const
 Returns the window system identifier of the widget. More...
 
int x () const
 
const QX11Infox11Info () const
 Returns information about the configuration of the X display used to display the widget. More...
 
Qt::HANDLE x11PictureHandle () const
 Returns the X11 Picture handle of the widget for XRender support. More...
 
int y () const
 
 ~QWidget ()
 Destroys the widget. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Protected Functions

void changeEvent (QEvent *)
 Reimplemented Function More...
 
void childEvent (QChildEvent *)
 Reimplemented Function More...
 
bool event (QEvent *e)
 Reimplemented Function More...
 
bool eventFilter (QObject *, QEvent *)
 Reimplemented Function More...
 
void hideEvent (QHideEvent *e)
 Reimplemented Function More...
 
void paintEvent (QPaintEvent *e)
 Reimplemented Function More...
 
void resizeEvent (QResizeEvent *)
 Reimplemented Function More...
 
void showEvent (QShowEvent *e)
 Reimplemented Function More...
 
void wheelEvent (QWheelEvent *e)
 Reimplemented Function More...
 
- Protected Functions inherited from QWidget
virtual void actionEvent (QActionEvent *)
 This event handler is called with the given event whenever the widget's actions are changed. More...
 
virtual void closeEvent (QCloseEvent *)
 This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system. More...
 
virtual void contextMenuEvent (QContextMenuEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events. More...
 
void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
 Creates a new widget window if window is 0, otherwise sets the widget's window to window. More...
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 Frees up window system resources. More...
 
virtual void dragEnterEvent (QDragEnterEvent *)
 This event handler is called when a drag is in progress and the mouse enters this widget. More...
 
virtual void dragLeaveEvent (QDragLeaveEvent *)
 This event handler is called when a drag is in progress and the mouse leaves this widget. More...
 
virtual void dragMoveEvent (QDragMoveEvent *)
 This event handler is called if a drag is in progress, and when any of the following conditions occur: the cursor enters this widget, the cursor moves within this widget, or a modifier key is pressed on the keyboard while this widget has the focus. More...
 
virtual void dropEvent (QDropEvent *)
 This event handler is called when the drag is dropped on this widget. More...
 
virtual void enabledChange (bool)
 
virtual void enterEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter. More...
 
virtual void focusInEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. More...
 
bool focusNextChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual bool focusNextPrevChild (bool next)
 Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual void focusOutEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. More...
 
bool focusPreviousChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual void fontChange (const QFont &)
 
virtual void inputMethodEvent (QInputMethodEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive Input Method composition events. More...
 
virtual void keyPressEvent (QKeyEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget. More...
 
virtual void keyReleaseEvent (QKeyEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget. More...
 
virtual void languageChange ()
 
virtual void leaveEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter. More...
 
virtual bool macEvent (EventHandlerCallRef, EventRef)
 This special event handler can be reimplemented in a subclass to receive native Macintosh events. More...
 
int metric (PaintDeviceMetric) const
 Internal implementation of the virtual QPaintDevice::metric() function. More...
 
virtual void mouseDoubleClickEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget. More...
 
virtual void mouseMoveEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget. More...
 
virtual void mousePressEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget. More...
 
virtual void mouseReleaseEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget. More...
 
virtual void moveEvent (QMoveEvent *)
 This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. More...
 
virtual void paletteChange (const QPalette &)
 
 QWidget (QWidgetPrivate &d, QWidget *parent, Qt::WindowFlags f)
 
virtual bool qwsEvent (QWSEvent *)
 This special event handler can be reimplemented in a subclass to receive native Qt for Embedded Linux events which are passed in the event parameter. More...
 
void resetInputContext ()
 This function can be called on the widget that currently has focus to reset the input method operating on it. More...
 
virtual void styleChange (QStyle &)
 
virtual void tabletEvent (QTabletEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive tablet events for the widget. More...
 
virtual void windowActivationChange (bool)
 
virtual bool winEvent (MSG *message, long *result)
 This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter. More...
 
virtual bool x11Event (XEvent *)
 This special event handler can be reimplemented in a subclass to receive native X11 events passed in the event parameter. More...
 
- Protected Functions inherited from QObject
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 

Properties

QBrush background
 the workspace's background More...
 
bool scrollBarsEnabled
 whether the workspace provides scroll bars More...
 

Friends

class QWorkspaceChild
 

Additional Inherited Members

- Static Public Functions inherited from QWidget
static QWidgetfind (WId)
 Returns a pointer to the widget with window identifer/handle id. More...
 
static QWidgetkeyboardGrabber ()
 Returns the widget that is currently grabbing the keyboard input. More...
 
static QWidgetmouseGrabber ()
 Returns the widget that is currently grabbing the mouse input. More...
 
static void setTabOrder (QWidget *, QWidget *)
 Puts the second widget after the first widget in the focus order. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 Updates the widget's micro focus. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Variables inherited from QPaintDevice
ushort painters
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

The QWorkspace widget provides a workspace window that can be used in an MDI application.

This class is deprecated. Use QMdiArea instead.

Multiple Document Interface (MDI) applications are typically composed of a main window containing a menu bar, a toolbar, and a central QWorkspace widget. The workspace itself is used to display a number of child windows, each of which is a widget.

The workspace itself is an ordinary Qt widget. It has a standard constructor that takes a parent widget. Workspaces can be placed in any layout, but are typically given as the central widget in a QMainWindow:

MainWindow::MainWindow()
{
workspace = new QWorkspace;
setCentralWidget(workspace);
...
}

Child windows (MDI windows) are standard Qt widgets that are inserted into the workspace with addWindow(). As with top-level widgets, you can call functions such as show(), hide(), showMaximized(), and setWindowTitle() on a child window to change its appearance within the workspace. You can also provide widget flags to determine the layout of the decoration or the behavior of the widget itself.

To change or retrieve the geometry of a child window, you must operate on its parentWidget(). The parentWidget() provides access to the decorated frame that contains the child window widget. When a child window is maximised, its decorated frame is hidden. If the top-level widget contains a menu bar, it will display the maximised window's operations menu to the left of the menu entries, and the window's controls to the right.

A child window becomes active when it gets the keyboard focus, or when setFocus() is called. The user can activate a window by moving focus in the usual ways, for example by clicking a window or by pressing Tab. The workspace emits a signal windowActivated() when the active window changes, and the function activeWindow() returns a pointer to the active child window, or 0 if no window is active.

The convenience function windowList() returns a list of all child windows. This information could be used in a popup menu containing a list of windows, for example. This feature is also available as part of the Window Menu Solution.

QWorkspace provides two built-in layout strategies for child windows: cascade() and tile(). Both are slots so you can easily connect menu entries to them.

mdi-cascade.png
mdi-tile.png

If you want your users to be able to work with child windows larger than the visible workspace area, set the scrollBarsEnabled property to true.

See also
QDockWidget, {MDI Example}

Definition at line 60 of file qworkspace.h.

Enumerations

◆ WindowOrder

Specifies the order in which child windows are returned from windowList().

  • CreationOrder The windows are returned in the order of their creation
  • StackingOrder The windows are returned in the order of their stacking
Enumerator
CreationOrder 
StackingOrder 

Definition at line 70 of file qworkspace.h.

Constructors and Destructors

◆ QWorkspace()

QWorkspace::QWorkspace ( QWidget parent = 0)
explicit

Constructs a workspace with the given parent.

Definition at line 1050 of file qworkspace.cpp.

1051  : QWidget(*new QWorkspacePrivate, parent, 0)
1052 {
1053  Q_D(QWorkspace);
1054  d->init();
1055 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
QWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a widget which is a child of parent, with widget flags set to f.
Definition: qwidget.cpp:1189

◆ ~QWorkspace()

QWorkspace::~QWorkspace ( )

Destroys the workspace and frees any allocated resources.

Definition at line 1165 of file qworkspace.cpp.

1166 {
1167 }

Functions

◆ activateNextWindow

void QWorkspace::activateNextWindow ( )
slot

Gives the input focus to the next window in the list of child windows.

See also
activatePreviousWindow()

Definition at line 2240 of file qworkspace.cpp.

2241 {
2242  Q_D(QWorkspace);
2243 
2244  if (d->focus.isEmpty())
2245  return;
2246  if (!d->active) {
2247  if (d->focus.first())
2248  d->activateWindow(d->focus.first()->windowWidget(), false);
2249  return;
2250  }
2251 
2252  int a = d->focus.indexOf(d->active) + 1;
2253 
2254  a = a % d->focus.count();
2255 
2256  if (d->focus.at(a))
2257  d->activateWindow(d->focus.at(a)->windowWidget(), false);
2258  else
2259  d->activateWindow(0);
2260 }
double d
Definition: qnumeric_p.h:62
long ASN1_INTEGER_get ASN1_INTEGER * a
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ activatePreviousWindow

void QWorkspace::activatePreviousWindow ( )
slot

Gives the input focus to the previous window in the list of child windows.

See also
activateNextWindow()

Definition at line 2268 of file qworkspace.cpp.

Referenced by QWorkspaceChild::~QWorkspaceChild().

2269 {
2270  Q_D(QWorkspace);
2271 
2272  if (d->focus.isEmpty())
2273  return;
2274  if (!d->active) {
2275  if (d->focus.last())
2276  d->activateWindow(d->focus.first()->windowWidget(), false);
2277  else
2278  d->activateWindow(0);
2279  return;
2280  }
2281 
2282  int a = d->focus.indexOf(d->active) - 1;
2283  if (a < 0)
2284  a = d->focus.count()-1;
2285 
2286  if (d->focus.at(a))
2287  d->activateWindow(d->focus.at(a)->windowWidget(), false);
2288  else
2289  d->activateWindow(0);
2290 }
double d
Definition: qnumeric_p.h:62
long ASN1_INTEGER_get ASN1_INTEGER * a
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ activeWindow()

QWidget * QWorkspace::activeWindow ( ) const

Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active.

See also
setActiveWindow()

Definition at line 1382 of file qworkspace.cpp.

Referenced by QAccessibleWorkspace::state().

1383 {
1384  Q_D(const QWorkspace);
1385  return d->active? d->active->windowWidget() : 0;
1386 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ addWindow()

QWidget * QWorkspace::addWindow ( QWidget w,
Qt::WindowFlags  flags = 0 
)

Adds widget w as new sub window to the workspace.

If flags are non-zero, they will override the flags set on the widget.

Returns the widget used for the window frame.

To remove the widget w from the workspace, simply call setParent() with the new parent (or 0 to make it a stand-alone window).

Definition at line 1230 of file qworkspace.cpp.

1231 {
1232  Q_D(QWorkspace);
1233  if (!w)
1234  return 0;
1235 
1236  w->setAutoFillBackground(true);
1237 
1239 
1240 #if 0
1241  bool wasMaximized = w->isMaximized();
1242  bool wasMinimized = w->isMinimized();
1243 #endif
1244  bool hasSize = w->testAttribute(Qt::WA_Resized);
1245  int x = w->x();
1246  int y = w->y();
1247  bool hasPos = w->testAttribute(Qt::WA_Moved);
1248  if (!hasSize && w->sizeHint().isValid())
1249  w->adjustSize();
1250 
1251  QWorkspaceChild* child = new QWorkspaceChild(w, this, flags);
1252  child->setObjectName(QLatin1String("qt_workspacechild"));
1253  child->installEventFilter(this);
1254 
1255  connect(child, SIGNAL(popupOperationMenu(QPoint)),
1256  this, SLOT(_q_popupOperationMenu(QPoint)));
1257  connect(child, SIGNAL(showOperationMenu()),
1258  this, SLOT(_q_showOperationMenu()));
1259  d->windows.append(child);
1260  if (child->isVisibleTo(this))
1261  d->focus.append(child);
1262  child->internalRaise();
1263 
1264  if (!hasPos)
1265  d->place(child);
1266  if (!hasSize)
1267  child->adjustSize();
1268  if (hasPos)
1269  child->move(x, y);
1270 
1271  return child;
1272 
1273 #if 0
1274  if (wasMaximized)
1275  w->showMaximized();
1276  else if (wasMinimized)
1277  w->showMinimized();
1278  else if (!hasBeenHidden)
1279  d->activateWindow(w);
1280 
1281  d->updateWorkspace();
1282  return child;
1283 #endif
1284 }
void showMaximized()
Shows the widget maximized.
Definition: qwidget.cpp:3218
double d
Definition: qnumeric_p.h:62
int y() const
friend class QWorkspaceChild
Definition: qworkspace.h:128
bool isVisibleTo(QWidget *) const
Returns true if this widget would become visible if ancestor is shown; otherwise returns false...
Definition: qwidget.cpp:8371
static void adjustFlags(Qt::WindowFlags &flags, QWidget *w=0)
Definition: qwidget.cpp:1242
#define SLOT(a)
Definition: qobjectdefs.h:226
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_D(Class)
Definition: qglobal.h:2482
int x
the x coordinate of the widget relative to its parent including any window frame
Definition: qwidget.h:161
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
void adjustSize()
Adjusts the size of the widget to fit its contents.
Definition: qwidget.cpp:8488
void showMinimized()
Shows the widget minimized, as an icon.
Definition: qwidget.cpp:3038
bool isMaximized() const
Definition: qwidget.cpp:3074
void setAutoFillBackground(bool enabled)
Definition: qwidget.cpp:631
int x() const
int y
the y coordinate of the widget relative to its parent and including any window frame ...
Definition: qwidget.h:162
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
bool isMinimized() const
Definition: qwidget.cpp:3027
QSize sizeHint
the recommended size for the widget
Definition: qwidget.h:195
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011

◆ arrangeIcons

void QWorkspace::arrangeIcons ( )
slot

Arranges all iconified windows at the bottom of the workspace.

See also
cascade(), tile()

Definition at line 2486 of file qworkspace.cpp.

2487 {
2488  Q_D(QWorkspace);
2489 
2490  QRect cr = d->updateWorkspace();
2491  int x = 0;
2492  int y = -1;
2493 
2494  QList<QWidget *>::Iterator it(d->icons.begin());
2495  while (it != d->icons.end()) {
2496  QWidget* i = *it;
2497  if (y == -1)
2498  y = cr.height() - i->height();
2499  if (x > 0 && x + i->width() > cr.width()) {
2500  x = 0;
2501  y -= i->height();
2502  }
2503  i->move(x, y);
2504  x += i->width();
2505  ++it;
2506  }
2507  d->updateWorkspace();
2508 }
double d
Definition: qnumeric_p.h:62
int y() const
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
#define it(className, varName)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
int x() const
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ background()

QBrush QWorkspace::background ( ) const

Referenced by setBackground(), and sizeHint().

◆ cascade

void QWorkspace::cascade ( )
slot

Arranges all the child windows in a cascade pattern.

See also
tile(), arrangeIcons()

Definition at line 2308 of file qworkspace.cpp.

2309 {
2310  Q_D(QWorkspace);
2311  blockSignals(true);
2312  if (d->maxWindow)
2313  d->maxWindow->showNormal();
2314 
2315  if (d->vbar) {
2316  d->vbar->blockSignals(true);
2317  d->vbar->setValue(0);
2318  d->vbar->blockSignals(false);
2319  d->hbar->blockSignals(true);
2320  d->hbar->setValue(0);
2321  d->hbar->blockSignals(false);
2322  d->_q_scrollBarChanged();
2323  }
2324 
2325  const int xoffset = 13;
2326  const int yoffset = 20;
2327 
2328  // make a list of all relevant mdi clients
2329  QList<QWorkspaceChild *> widgets;
2330  QList<QWorkspaceChild *>::Iterator it(d->windows.begin());
2331  QWorkspaceChild* wc = 0;
2332 
2333  for (it = d->focus.begin(); it != d->focus.end(); ++it) {
2334  wc = *it;
2335  if (wc->windowWidget()->isVisibleTo(this) && !(wc->titlebar && wc->titlebar->isTool()))
2336  widgets.append(wc);
2337  }
2338 
2339  int x = 0;
2340  int y = 0;
2341 
2342  it = widgets.begin();
2343  while (it != widgets.end()) {
2344  QWorkspaceChild *child = *it;
2345  ++it;
2346 
2347  QSize prefSize = child->windowWidget()->sizeHint().expandedTo(qSmartMinSize(child->windowWidget()));
2348  if (!prefSize.isValid())
2349  prefSize = child->windowWidget()->size();
2350  prefSize = prefSize.expandedTo(qSmartMinSize(child->windowWidget()));
2351  if (prefSize.isValid())
2352  prefSize += QSize(child->baseSize().width(), child->baseSize().height());
2353 
2354  int w = prefSize.width();
2355  int h = prefSize.height();
2356 
2357  child->showNormal();
2358  if (y + h > height())
2359  y = 0;
2360  if (x + w > width())
2361  x = 0;
2362  child->setGeometry(x, y, w, h);
2363  x += xoffset;
2364  y += yoffset;
2365  child->internalRaise();
2366  }
2367  d->updateWorkspace();
2368  blockSignals(false);
2369 }
double d
Definition: qnumeric_p.h:62
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
Definition: qobject.cpp:1406
int y() const
Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
#define it(className, varName)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
#define Q_D(Class)
Definition: qglobal.h:2482
int height() const
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
int width() const
Returns the width.
Definition: qsize.h:126
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
int width() const
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
QSize baseSize() const
int x() const
int height() const
Returns the height.
Definition: qsize.h:129
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QSize sizeHint
the recommended size for the widget
Definition: qwidget.h:195
QWidget * windowWidget() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ changeEvent()

void QWorkspace::changeEvent ( QEvent ev)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3368 of file qworkspace.cpp.

3369 {
3370  Q_D(QWorkspace);
3371  if(ev->type() == QEvent::StyleChange) {
3372  if (isVisible() && d->maxWindow && d->maxmenubar) {
3374  d->hideMaximizeControls(); //hide any visible maximized controls
3375  d->showMaximizeControls(); //updates the modification state as well
3376  }
3377  }
3378  }
3380 }
double d
Definition: qnumeric_p.h:62
bool isVisible() const
Definition: qwidget.h:1005
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
#define Q_D(Class)
Definition: qglobal.h:2482
QStyle * style() const
Definition: qwidget.cpp:2742
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition: qwidget.cpp:9170
Type type() const
Returns the event type.
Definition: qcoreevent.h:303

◆ childEvent()

void QWorkspace::childEvent ( QChildEvent e)
protectedvirtual

Reimplemented Function

Reimplemented from QObject.

Definition at line 1287 of file qworkspace.cpp.

1288 {
1289  Q_D(QWorkspace);
1290  if (e->removed()) {
1291  if (d->windows.removeAll(static_cast<QWorkspaceChild*>(e->child()))) {
1292  d->focus.removeAll(static_cast<QWorkspaceChild*>(e->child()));
1293  if (d->maxWindow == e->child())
1294  d->maxWindow = 0;
1295  d->updateWorkspace();
1296  }
1297  }
1298 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
bool removed() const
Returns true if type() is QEvent::ChildRemoved; otherwise returns false.
Definition: qcoreevent.h:364
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
QObject * child() const
Returns the child object that was added or removed.
Definition: qcoreevent.h:358

◆ closeActiveWindow

void QWorkspace::closeActiveWindow ( )
slot

Closes the child window that is currently active.

See also
closeAllWindows()

Definition at line 2055 of file qworkspace.cpp.

Referenced by eventFilter(), QWorkspacePrivate::init(), and QWorkspacePrivate::showMaximizeControls().

2056 {
2057  Q_D(QWorkspace);
2058  if (d->maxWindow && d->maxWindow->windowWidget())
2059  d->maxWindow->windowWidget()->close();
2060  else if (d->active && d->active->windowWidget())
2061  d->active->windowWidget()->close();
2062  d->updateWorkspace();
2063 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ closeAllWindows

void QWorkspace::closeAllWindows ( )
slot

Closes all child windows.

If any child window fails to accept the close event, the remaining windows will remain open.

See also
closeActiveWindow()

Definition at line 2073 of file qworkspace.cpp.

2074 {
2075  Q_D(QWorkspace);
2076  bool did_close = true;
2077  QList<QWorkspaceChild *>::const_iterator it = d->windows.constBegin();
2078  while (it != d->windows.constEnd() && did_close) {
2079  QWorkspaceChild *c = *it;
2080  ++it;
2081  if (c->windowWidget() && !c->windowWidget()->isHidden())
2082  did_close = c->windowWidget()->close();
2083  }
2084 }
double d
Definition: qnumeric_p.h:62
unsigned char c[8]
Definition: qnumeric_p.h:62
#define it(className, varName)
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
Definition: qlist.h:228
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
QWidget * windowWidget() const
bool close()
Closes this widget.
Definition: qwidget.cpp:8305

◆ event()

bool QWorkspace::event ( QEvent e)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 1826 of file qworkspace.cpp.

1827 {
1828 #ifndef QT_NO_SHORTCUT
1829  Q_D(QWorkspace);
1830  if (e->type() == QEvent::Shortcut) {
1831  QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
1832  const char *theSlot = d->shortcutMap.value(se->shortcutId(), 0);
1833  if (theSlot)
1834  QMetaObject::invokeMethod(this, theSlot);
1835  } else
1836 #endif
1837  if (e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut){
1838  return true;
1839  }
1840  return QWidget::event(e);
1841 }
double d
Definition: qnumeric_p.h:62
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
Definition: qevent.h:675
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
int shortcutId()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qevent.h:683
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
Invokes the member (a signal or a slot name) on the object obj.
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
Type type() const
Returns the event type.
Definition: qcoreevent.h:303

◆ eventFilter()

bool QWorkspace::eventFilter ( QObject o,
QEvent e 
)
protectedvirtual

Reimplemented Function

Reimplemented from QObject.

Definition at line 1844 of file qworkspace.cpp.

1845 {
1846  Q_D(QWorkspace);
1847  static QElapsedTimer* t = 0;
1848  static QWorkspace* tc = 0;
1849  if (o == d->maxtools) {
1850  switch (e->type()) {
1852  {
1853  QMenuBar* b = (QMenuBar*)o->parent();
1854  if (!t)
1855  t = new QElapsedTimer;
1856  if (tc != this || t->elapsed() > QApplication::doubleClickInterval()) {
1857  if (isRightToLeft()) {
1858  QPoint p = b->mapToGlobal(QPoint(b->x() + b->width(), b->y() + b->height()));
1859  p.rx() -= d->popup->sizeHint().width();
1860  d->_q_popupOperationMenu(p);
1861  } else {
1862  d->_q_popupOperationMenu(b->mapToGlobal(QPoint(b->x(), b->y() + b->height())));
1863  }
1864  t->start();
1865  tc = this;
1866  } else {
1867  tc = 0;
1869  }
1870  return true;
1871  }
1872  default:
1873  break;
1874  }
1875  return QWidget::eventFilter(o, e);
1876  }
1877  switch (e->type()) {
1878  case QEvent::HideToParent:
1879  break;
1880  case QEvent::ShowToParent:
1881  if (QWorkspaceChild *c = qobject_cast<QWorkspaceChild*>(o))
1882  if (!d->focus.contains(c))
1883  d->focus.append(c);
1884  d->updateWorkspace();
1885  break;
1887  if (!d->inTitleChange) {
1888  if (o == window())
1889  d->topTitle = window()->windowTitle();
1890  if (d->maxWindow && d->maxWindow->windowWidget() && d->topTitle.size()) {
1891  d->inTitleChange = true;
1892  window()->setWindowTitle(tr("%1 - [%2]")
1893  .arg(d->topTitle).arg(d->maxWindow->windowWidget()->windowTitle()));
1894  d->inTitleChange = false;
1895  }
1896  }
1897  break;
1898 
1900  if (o == d->maxWindow)
1901  window()->setWindowModified(d->maxWindow->isWindowModified());
1902  break;
1903 
1904  case QEvent::Close:
1905  if (o == window())
1906  {
1907  QList<QWorkspaceChild *>::Iterator it(d->windows.begin());
1908  while (it != d->windows.end()) {
1909  QWorkspaceChild* c = *it;
1910  ++it;
1911  if (c->shademode)
1912  c->showShaded();
1913  }
1914  } else if (qobject_cast<QWorkspaceChild*>(o)) {
1915  d->popup->hide();
1916  }
1917  d->updateWorkspace();
1918  break;
1919  default:
1920  break;
1921  }
1922  return QWidget::eventFilter(o, e);
1923 }
double d
Definition: qnumeric_p.h:62
int y() const
unsigned char c[8]
Definition: qnumeric_p.h:62
void setWindowModified(bool)
Definition: qwidget.cpp:11559
#define it(className, varName)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
#define Q_D(Class)
Definition: qglobal.h:2482
int height() const
The QElapsedTimer class provides a fast way to calculate elapsed times.
Definition: qelapsedtimer.h:53
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
int width() const
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
QString windowTitle
the window title (caption)
Definition: qwidget.h:198
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
int x() const
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
void closeActiveWindow()
Closes the child window that is currently active.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
bool isRightToLeft() const
Definition: qwidget.h:428
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
static int doubleClickInterval()
void start()
Starts this timer.
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.

◆ hideEvent()

void QWorkspace::hideEvent ( QHideEvent e)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 1616 of file qworkspace.cpp.

1617 {
1618  Q_D(QWorkspace);
1619  if (!isVisible())
1620  d->hideMaximizeControls();
1621 }
double d
Definition: qnumeric_p.h:62
bool isVisible() const
Definition: qwidget.h:1005
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ paintEvent()

void QWorkspace::paintEvent ( QPaintEvent e)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 1624 of file qworkspace.cpp.

1625 {
1626  Q_D(QWorkspace);
1627 
1628  if (d->background.style() != Qt::NoBrush) {
1629  QPainter p(this);
1630  p.fillRect(0, 0, width(), height(), d->background);
1631  }
1632 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
int height() const
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
int width() const

◆ resizeEvent()

void QWorkspace::resizeEvent ( QResizeEvent )
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 1579 of file qworkspace.cpp.

1580 {
1581  Q_D(QWorkspace);
1582  if (d->maxWindow) {
1583  d->maxWindow->adjustToFullscreen();
1584  if (d->maxWindow->windowWidget())
1585  d->maxWindow->windowWidget()->overrideWindowState(Qt::WindowMaximized);
1586  }
1587  d->updateWorkspace();
1588 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ scrollBarsEnabled()

bool QWorkspace::scrollBarsEnabled ( ) const

◆ setActiveWindow

void QWorkspace::setActiveWindow ( QWidget w)
slot

Makes the child window that contains w the active child window.

See also
activeWindow()

Definition at line 1393 of file qworkspace.cpp.

1394 {
1395  Q_D(QWorkspace);
1396  d->activateWindow(w, true);
1397  if (w && w->isMinimized())
1399 }
double d
Definition: qnumeric_p.h:62
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
void setWindowState(Qt::WindowStates state)
Sets the window state to windowState.
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
Definition: qnamespace.h:54
bool isMinimized() const
Definition: qwidget.cpp:3027

◆ setBackground()

void QWorkspace::setBackground ( const QBrush background)

Definition at line 1212 of file qworkspace.cpp.

Referenced by sizeHint().

1213 {
1214  Q_D(QWorkspace);
1215  d->background = background;
1217  update();
1218 }
double d
Definition: qnumeric_p.h:62
QBrush background() const
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087

◆ setScrollBarsEnabled()

void QWorkspace::setScrollBarsEnabled ( bool  enable)

Definition at line 3200 of file qworkspace.cpp.

3201 {
3202  Q_D(QWorkspace);
3203  if ((d->vbar != 0) == enable)
3204  return;
3205 
3206  d->xoffset = d->yoffset = 0;
3207  if (enable) {
3208  d->vbar = new QScrollBar(Qt::Vertical, this);
3209  d->vbar->setObjectName(QLatin1String("vertical scrollbar"));
3210  connect(d->vbar, SIGNAL(valueChanged(int)), this, SLOT(_q_scrollBarChanged()));
3211  d->hbar = new QScrollBar(Qt::Horizontal, this);
3212  d->hbar->setObjectName(QLatin1String("horizontal scrollbar"));
3213  connect(d->hbar, SIGNAL(valueChanged(int)), this, SLOT(_q_scrollBarChanged()));
3214  d->corner = new QWidget(this);
3215  d->corner->setBackgroundRole(QPalette::Window);
3216  d->corner->setObjectName(QLatin1String("qt_corner"));
3217  d->updateWorkspace();
3218  } else {
3219  delete d->vbar;
3220  delete d->hbar;
3221  delete d->corner;
3222  d->vbar = d->hbar = 0;
3223  d->corner = 0;
3224  }
3225 
3226  QList<QWorkspaceChild *>::Iterator it(d->windows.begin());
3227  while (it != d->windows.end()) {
3228  QWorkspaceChild *child = *it;
3229  ++it;
3230  child->widgetResizeHandler->setSizeProtection(!enable);
3231  }
3232 }
double d
Definition: qnumeric_p.h:62
#define it(className, varName)
#define SLOT(a)
Definition: qobjectdefs.h:226
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
#define SIGNAL(a)
Definition: qobjectdefs.h:227
The QScrollBar widget provides a vertical or horizontal scroll bar.
Definition: qscrollbar.h:59
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
QWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a widget which is a child of parent, with widget flags set to f.
Definition: qwidget.cpp:1189
QWidgetResizeHandler * widgetResizeHandler
Definition: qworkspace.cpp:964
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181

◆ showEvent()

void QWorkspace::showEvent ( QShowEvent e)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 1591 of file qworkspace.cpp.

1592 {
1593  Q_D(QWorkspace);
1594  if (d->maxWindow)
1595  d->showMaximizeControls();
1596  QWidget::showEvent(e);
1597  if (d->becomeActive) {
1598  d->activateWindow(d->becomeActive);
1599  d->becomeActive = 0;
1600  } else if (d->windows.count() > 0 && !d->active) {
1601  d->activateWindow(d->windows.first()->windowWidget());
1602  }
1603 
1604 // // force a frame repaint - this is a workaround for what seems to be a bug
1605 // // introduced when changing the QWidget::show() implementation. Might be
1606 // // a windows bug as well though.
1607 // for (int i = 0; i < d->windows.count(); ++i) {
1608 // QWorkspaceChild* c = d->windows.at(i);
1609 // c->update(c->rect());
1610 // }
1611 
1612  d->updateWorkspace();
1613 }
double d
Definition: qnumeric_p.h:62
virtual void showEvent(QShowEvent *)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
Definition: qwidget.cpp:9842
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ sizeHint()

QSize QWorkspace::sizeHint ( ) const
virtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 1170 of file qworkspace.cpp.

1171 {
1173  return QSize(s.width()*2/3, s.height()*2/3);
1174 }
QSize size() const
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ tile

void QWorkspace::tile ( )
slot

Arranges all child windows in a tile pattern.

See also
cascade(), arrangeIcons()

Definition at line 2376 of file qworkspace.cpp.

2377 {
2378  Q_D(QWorkspace);
2379  blockSignals(true);
2380  QWidget *oldActive = d->active ? d->active->windowWidget() : 0;
2381  if (d->maxWindow)
2382  d->maxWindow->showNormal();
2383 
2384  if (d->vbar) {
2385  d->vbar->blockSignals(true);
2386  d->vbar->setValue(0);
2387  d->vbar->blockSignals(false);
2388  d->hbar->blockSignals(true);
2389  d->hbar->setValue(0);
2390  d->hbar->blockSignals(false);
2391  d->_q_scrollBarChanged();
2392  }
2393 
2394  int rows = 1;
2395  int cols = 1;
2396  int n = 0;
2397  QWorkspaceChild* c;
2398 
2399  QList<QWorkspaceChild *>::Iterator it(d->windows.begin());
2400  while (it != d->windows.end()) {
2401  c = *it;
2402  ++it;
2403  if (!c->windowWidget()->isHidden()
2405  && !c->iconw)
2406  n++;
2407  }
2408 
2409  while (rows * cols < n) {
2410  if (cols <= rows)
2411  cols++;
2412  else
2413  rows++;
2414  }
2415  int add = cols * rows - n;
2416  bool* used = new bool[cols*rows];
2417  for (int i = 0; i < rows*cols; i++)
2418  used[i] = false;
2419 
2420  int row = 0;
2421  int col = 0;
2422  int w = width() / cols;
2423  int h = height() / rows;
2424 
2425  it = d->windows.begin();
2426  while (it != d->windows.end()) {
2427  c = *it;
2428  ++it;
2429  if (c->iconw || c->windowWidget()->isHidden() || (c->titlebar && c->titlebar->isTool()))
2430  continue;
2431  if (!row && !col) {
2432  w -= c->baseSize().width();
2433  h -= c->baseSize().height();
2434  }
2436  QPoint p = c->pos();
2437  if (p.x()+c->width() < 0)
2438  p.setX(0);
2439  if (p.x() > width())
2440  p.setX(width() - c->width());
2441  if (p.y() + 10 < 0)
2442  p.setY(0);
2443  if (p.y() > height())
2444  p.setY(height() - c->height());
2445 
2446  if (p != c->pos())
2447  c->QWidget::move(p);
2448  } else {
2449  c->showNormal();
2450  used[row*cols+col] = true;
2451  QSize sz(w, h);
2452  QSize bsize(c->baseSize());
2453  sz = sz.expandedTo(c->windowWidget()->minimumSize()).boundedTo(c->windowWidget()->maximumSize());
2454  sz += bsize;
2455 
2456  if ( add ) {
2457  if (sz.height() == h + bsize.height()) // no relevant constrains
2458  sz.rheight() *= 2;
2459  used[(row+1)*cols+col] = true;
2460  add--;
2461  }
2462 
2463  c->setGeometry(col*w + col*bsize.width(), row*h + row*bsize.height(), sz.width(), sz.height());
2464 
2465  while(row < rows && col < cols && used[row*cols+col]) {
2466  col++;
2467  if (col == cols) {
2468  col = 0;
2469  row++;
2470  }
2471  }
2472  }
2473  }
2474  delete [] used;
2475 
2476  d->activateWindow(oldActive);
2477  d->updateWorkspace();
2478  blockSignals(false);
2479 }
QPoint pos() const
double d
Definition: qnumeric_p.h:62
QSize maximumSize
the widget&#39;s maximum size in pixels
Definition: qwidget.h:173
QSize minimumSize
the widget&#39;s minimum size
Definition: qwidget.h:172
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
Definition: qobject.cpp:1406
unsigned char c[8]
Definition: qnumeric_p.h:62
bool isTool() const
Definition: qworkspace.cpp:658
#define add(aName)
#define it(className, varName)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
#define Q_D(Class)
Definition: qglobal.h:2482
int height() const
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
int width() const
Returns the width.
Definition: qsize.h:126
int width() const
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
QSize baseSize() const
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
Definition: qpoint.h:137
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int & rheight()
Returns a reference to the height.
Definition: qsize.h:144
int height() const
Returns the height.
Definition: qsize.h:129
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QWidget * windowWidget() const
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
Definition: qpoint.h:134

◆ wheelEvent()

void QWorkspace::wheelEvent ( QWheelEvent e)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 1302 of file qworkspace.cpp.

1303 {
1304  Q_D(QWorkspace);
1305  if (!scrollBarsEnabled())
1306  return;
1307  // the scroll bars are children of the workspace, so if we receive
1308  // a wheel event we redirect to the scroll bars using a direct event
1309  // call, /not/ using sendEvent() because if the scroll bar ignores the
1310  // event QApplication::sendEvent() will propagate the event to the parent widget,
1311  // which is us, who /just/ sent it.
1312  if (d->vbar && d->vbar->isVisible() && !(e->modifiers() & Qt::AltModifier))
1313  d->vbar->event(e);
1314  else if (d->hbar && d->hbar->isVisible())
1315  d->hbar->event(e);
1316 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
bool scrollBarsEnabled() const
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately before the event occurred.
Definition: qevent.h:79

◆ windowActivated

void QWorkspace::windowActivated ( QWidget w)
signal

This signal is emitted when the child window w becomes active.

Note that w can be 0, and that more than one signal may be emitted for a single activation event.

See also
activeWindow(), windowList()

◆ windowList()

QWidgetList QWorkspace::windowList ( WindowOrder  order = CreationOrder) const

Returns a list of all visible or minimized child windows.

If order is CreationOrder (the default), the windows are listed in the order in which they were inserted into the workspace. If order is StackingOrder, the windows are listed in their stacking order, with the topmost window as the last item in the list.

Definition at line 1801 of file qworkspace.cpp.

Referenced by QAccessibleWorkspace::childCount(), QAccessibleWorkspace::indexOfChild(), QAccessibleWorkspace::navigate(), and QAccessibleWorkspace::state().

1802 {
1803  Q_D(const QWorkspace);
1804  QWidgetList windows;
1805  if (order == StackingOrder) {
1806  QObjectList cl = children();
1807  for (int i = 0; i < cl.size(); ++i) {
1809  if (c && c->isWindowOrIconVisible())
1810  windows.append(c->windowWidget());
1811  }
1812  } else {
1813  QList<QWorkspaceChild *>::ConstIterator it(d->windows.begin());
1814  while (it != d->windows.end()) {
1815  QWorkspaceChild* c = *it;
1816  ++it;
1817  if (c && c->isWindowOrIconVisible())
1818  windows.append(c->windowWidget());
1819  }
1820  }
1821  return windows;
1822 }
double d
Definition: qnumeric_p.h:62
unsigned char c[8]
Definition: qnumeric_p.h:62
#define it(className, varName)
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
Definition: qlist.h:228
T * qobject_cast(QObject *object)
Definition: qobject.h:375
#define Q_D(Class)
Definition: qglobal.h:2482
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool isWindowOrIconVisible() const
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
QWidget * windowWidget() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

Friends and Related Functions

◆ QWorkspaceChild

friend class QWorkspaceChild
friend

Definition at line 128 of file qworkspace.h.

Referenced by addWindow().

Properties

◆ background

QBrush QWorkspace::background
private

the workspace's background

Definition at line 64 of file qworkspace.h.

◆ scrollBarsEnabled

QWorkspace::scrollBarsEnabled
private

whether the workspace provides scroll bars

If this property is true, the workspace will provide scroll bars if any of the child windows extend beyond the edges of the visible workspace. The workspace area will automatically increase to contain child windows if they are resized beyond the right or bottom edges of the visible area.

If this property is false (the default), resizing child windows out of the visible area of the workspace is not permitted, although it is still possible to position them partially outside the visible area.

Definition at line 63 of file qworkspace.h.

Referenced by QWorkspaceChild::QWorkspaceChild().


The documentation for this class was generated from the following files: