Qt 4.8
Public Slots | Signals | Public Functions | Protected Functions | Private Functions | Properties | Friends | List of all members
QWorkspaceChild Class Reference
Inheritance diagram for QWorkspaceChild:
QWidget QObject QPaintDevice

Public Slots

void activate ()
 
void internalRaise ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void showShaded ()
 
void titleBarDoubleClicked ()
 
- 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 popupOperationMenu (const QPoint &)
 
void showOperationMenu ()
 
- 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

void adjustToFullscreen ()
 
QSize baseSize () const
 
void doMove ()
 
void doResize ()
 
int frameWidth () const
 
QWidgeticonWidget () const
 
bool isActive () const
 
bool isWindowOrIconVisible () const
 
QSize minimumSizeHint () const
 
 QWorkspaceChild (QWidget *window, QWorkspace *parent=0, Qt::WindowFlags flags=0)
 
void setActive (bool)
 
void show ()
 
QSize sizeHint () const
 
QWidgetwindowWidget () const
 
 ~QWorkspaceChild ()
 
- 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
 
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 *)
 This event handler can be reimplemented to handle state changes. More...
 
void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
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...
 
bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
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...
 
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...
 
void paintEvent (QPaintEvent *)
 This event handler can be reimplemented in a subclass to receive paint events passed in event. More...
 
void resizeEvent (QResizeEvent *)
 This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. 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)
 
bool event (QEvent *)
 This is the main event handler; it handles event event. 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 hideEvent (QHideEvent *)
 This event handler can be reimplemented in a subclass to receive widget hide events. More...
 
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 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 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 showEvent (QShowEvent *)
 This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter. 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 wheelEvent (QWheelEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive wheel 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 ()
 

Private Functions

void updateMask ()
 

Properties

bool act:1
 
QWidgetchildWidget
 
QPointer< QWorkspaceTitleBariconw
 
bool shademode:1
 
QSize shadeRestore
 
QSize shadeRestoreMin
 
QWorkspaceTitleBartitlebar
 
QWidgetResizeHandlerwidgetResizeHandler
 
QSize windowSize
 

Friends

class QWorkspace
 
class QWorkspacePrivate
 
class QWorkspaceTitleBar
 

Additional Inherited Members

- 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
}
 
- 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

Definition at line 900 of file qworkspace.cpp.

Constructors and Destructors

◆ QWorkspaceChild()

QWorkspaceChild::QWorkspaceChild ( QWidget window,
QWorkspace parent = 0,
Qt::WindowFlags  flags = 0 
)

Definition at line 2511 of file qworkspace.cpp.

2512  : QWidget(parent,
2514 {
2517  setMouseTracking(true);
2518  act = false;
2519  iconw = 0;
2520  shademode = false;
2521  titlebar = 0;
2522  setAutoFillBackground(true);
2523 
2525  if (window) {
2526  flags |= (window->windowFlags() & Qt::MSWindowsOwnDC);
2527  if (flags)
2528  window->setParent(this, flags & ~Qt::WindowType_Mask);
2529  else
2530  window->setParent(this);
2531  }
2532 
2533  if (window && (flags & (Qt::WindowTitleHint
2538  titlebar = new QWorkspaceTitleBar(window, this, flags);
2539  connect(titlebar, SIGNAL(doActivate()),
2540  this, SLOT(activate()));
2541  connect(titlebar, SIGNAL(doClose()),
2542  window, SLOT(close()));
2543  connect(titlebar, SIGNAL(doMinimize()),
2544  this, SLOT(showMinimized()));
2545  connect(titlebar, SIGNAL(doNormal()),
2546  this, SLOT(showNormal()));
2547  connect(titlebar, SIGNAL(doMaximize()),
2548  this, SLOT(showMaximized()));
2550  this, SIGNAL(popupOperationMenu(QPoint)));
2552  this, SIGNAL(showOperationMenu()));
2553  connect(titlebar, SIGNAL(doShade()),
2554  this, SLOT(showShaded()));
2555  connect(titlebar, SIGNAL(doubleClicked()),
2556  this, SLOT(titleBarDoubleClicked()));
2557  }
2558 
2559  setMinimumSize(128, 0);
2560  int fw = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this);
2561  setContentsMargins(fw, fw, fw, fw);
2562 
2563  childWidget = window;
2564  if (!childWidget)
2565  return;
2566 
2568 
2569  QPoint p;
2570  QSize s;
2571  QSize cs;
2572 
2573  bool hasBeenResized = childWidget->testAttribute(Qt::WA_Resized);
2574 
2575  if (!hasBeenResized)
2577  else
2578  cs = childWidget->size();
2579 
2580  windowSize = cs;
2581 
2582  int th = titlebar ? titlebar->sizeHint().height() : 0;
2583  if (titlebar) {
2584  if (!childWidget->windowIcon().isNull())
2586 
2588  th -= contentsRect().y();
2589 
2590  p = QPoint(contentsRect().x(),
2591  th + contentsRect().y());
2592  s = QSize(cs.width() + 2*frameWidth(),
2593  cs.height() + 2*frameWidth() + th);
2594  } else {
2595  p = QPoint(contentsRect().x(), contentsRect().y());
2596  s = QSize(cs.width() + 2*frameWidth(),
2597  cs.height() + 2*frameWidth());
2598  }
2599 
2600  childWidget->move(p);
2601  resize(s);
2602 
2604 
2605  widgetResizeHandler = new QWidgetResizeHandler(this, window);
2609  this, SLOT(activate()));
2612  else
2616  setBaseSize(baseSize());
2617 }
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
int y() const
bool scrollBarsEnabled
whether the workspace provides scroll bars
Definition: qworkspace.h:63
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QRect contentsRect() const
Returns the area inside the widget&#39;s margins.
Definition: qwidget.cpp:7544
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
void setBaseSize(const QSize &)
Definition: qwidget.h:978
#define SLOT(a)
Definition: qobjectdefs.h:226
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...
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 setMinimumSize(const QSize &)
Definition: qwidget.h:969
QWidget * childWidget
Definition: qworkspace.cpp:963
QIcon windowIcon
the widget&#39;s icon
Definition: qwidget.h:199
int frameWidth() const
Definition: qworkspace.cpp:974
QStyle * style() const
Definition: qwidget.cpp:2742
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
int width() const
Returns the width.
Definition: qsize.h:126
void setBackgroundRole(QPalette::ColorRole)
Sets the background role of the widget to role.
Definition: qwidget.cpp:4708
QSize sizeHint() const
Definition: qworkspace.cpp:822
void popupOperationMenu(const QPoint &)
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
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
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.
Definition: qwidget.cpp:7449
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition: qicon.cpp:769
const char * styleHint(const QFontDef &request)
QWidgetResizeHandler * widgetResizeHandler
Definition: qworkspace.cpp:964
QSize minimumSizeHint
the recommended minimum size for the widget
Definition: qwidget.h:196
QString windowTitle
the window title (caption)
Definition: qwidget.h:198
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
void setWindowIcon(const QIcon &icon)
Definition: qwidget.cpp:6362
void showOperationMenu()
void setMouseTracking(bool enable)
Definition: qwidget.h:990
void setAutoFillBackground(bool enabled)
Definition: qwidget.cpp:631
QSize baseSize() const
int x() const
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
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
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int height() const
Returns the height.
Definition: qsize.h:129
friend class QWorkspaceTitleBar
Definition: qworkspace.cpp:906
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
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
void titleBarDoubleClicked()
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
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011

◆ ~QWorkspaceChild()

QWorkspaceChild::~QWorkspaceChild ( )

Definition at line 2619 of file qworkspace.cpp.

2620 {
2621  QWorkspace *workspace = qobject_cast<QWorkspace*>(parentWidget());
2622  if (iconw) {
2623  if (workspace)
2624  workspace->d_func()->removeIcon(iconw->parentWidget());
2625  delete iconw->parentWidget();
2626  }
2627 
2628  if (workspace) {
2629  workspace->d_func()->focus.removeAll(this);
2630  if (workspace->d_func()->active == this)
2631  workspace->activatePreviousWindow();
2632  if (workspace->d_func()->active == this)
2633  workspace->d_func()->activateWindow(0);
2634  if (workspace->d_func()->maxWindow == this) {
2635  workspace->d_func()->hideMaximizeControls();
2636  workspace->d_func()->maxWindow = 0;
2637  }
2638  }
2639 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
T * qobject_cast(QObject *object)
Definition: qobject.h:375
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
void activatePreviousWindow()
Gives the input focus to the previous window in the list of child windows.
void activateWindow()
Sets the top-level widget containing this widget to be the active window.

Functions

◆ activate

void QWorkspaceChild::activate ( )
slot

Definition at line 2718 of file qworkspace.cpp.

Referenced by eventFilter(), iconWidget(), and QWorkspaceChild().

2719 {
2720  ((QWorkspace*)parentWidget())->d_func()->activateWindow(windowWidget());
2721 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
QWidget * windowWidget() const

◆ adjustToFullscreen()

void QWorkspaceChild::adjustToFullscreen ( )

Definition at line 3115 of file qworkspace.cpp.

Referenced by QWorkspacePrivate::maximizeWindow().

3116 {
3117  if (!childWidget)
3118  return;
3119 
3120  if(!((QWorkspace*)parentWidget())->d_func()->maxmenubar || style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, this)) {
3122  } else {
3123  int fw = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this);
3124  bool noBorder = style()->styleHint(QStyle::SH_TitleBar_NoBorder, 0, titlebar);
3125  int th = titlebar ? titlebar->sizeHint().height() : 0;
3126  int w = parentWidget()->width() + 2*fw;
3127  int h = parentWidget()->height() + (noBorder ? fw : 2*fw) + th;
3128  w = qMax(w, childWidget->minimumWidth());
3129  h = qMax(h, childWidget->minimumHeight());
3130  setGeometry(-fw, (noBorder ? 0 : -fw) - th, w, h);
3131  }
3134 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
int minimumHeight
the widget&#39;s minimum height in pixels
Definition: qwidget.h:175
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
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...
QWidget * childWidget
Definition: qworkspace.cpp:963
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
void overrideWindowState(Qt::WindowStates state)
Definition: qwidget.cpp:3098
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
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
QSize sizeHint() const
Definition: qworkspace.cpp:822
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
const char * styleHint(const QFontDef &request)
QRect rect() const
int minimumWidth
the widget&#39;s minimum width in pixels
Definition: qwidget.h:174
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int height() const
Returns the height.
Definition: qsize.h:129

◆ baseSize()

QSize QWorkspaceChild::baseSize ( ) const

Definition at line 2688 of file qworkspace.cpp.

Referenced by QWorkspace::cascade(), eventFilter(), minimumSizeHint(), QWorkspaceChild(), sizeHint(), and QWorkspace::tile().

2689 {
2690  int th = titlebar ? titlebar->sizeHint().height() : 0;
2692  th -= frameWidth();
2693  return QSize(2*frameWidth(), 2*frameWidth() + th);
2694 }
int frameWidth() const
Definition: qworkspace.cpp:974
QStyle * style() const
Definition: qwidget.cpp:2742
QSize sizeHint() const
Definition: qworkspace.cpp:822
const char * styleHint(const QFontDef &request)
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int height() const
Returns the height.
Definition: qsize.h:129
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ changeEvent()

void QWorkspaceChild::changeEvent ( QEvent event)
protectedvirtual

This event handler can be reimplemented to handle state changes.

The state being changed in this event can be retrieved through the event supplied.

Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, QEvent::StyleChange, QEvent::PaletteChange, QEvent::WindowTitleChange, QEvent::IconTextChange, QEvent::ModifiedChange, QEvent::MouseTrackingChange, QEvent::ParentChange, QEvent::WindowStateChange, QEvent::LanguageChange, QEvent::LocaleChange, QEvent::LayoutDirectionChange.

Reimplemented from QWidget.

Definition at line 2895 of file qworkspace.cpp.

2896 {
2897  if(ev->type() == QEvent::StyleChange) {
2898  resizeEvent(0);
2899  if (iconw) {
2900  QFrame *frame = qobject_cast<QFrame*>(iconw->parentWidget());
2901  Q_ASSERT(frame);
2904  frame->resize(196+2*frame->frameWidth(), 20 + 2*frame->frameWidth());
2905  } else {
2906  frame->resize(196, 20);
2907  }
2908  }
2909  updateMask();
2910  }
2912 }
void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
T * qobject_cast(QObject *object)
Definition: qobject.h:375
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QStyle * style() const
Definition: qwidget.cpp:2742
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition: qwidget.cpp:9170
const char * styleHint(const QFontDef &request)
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
void setFrameStyle(int)
Sets the frame style to style.
Definition: qframe.cpp:329
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int frameWidth
the width of the frame that is drawn.
Definition: qframe.h:64
The QFrame class is the base class of widgets that can have a frame.
Definition: qframe.h:55

◆ childEvent()

void QWorkspaceChild::childEvent ( QChildEvent )
protectedvirtual

This event handler can be reimplemented in a subclass to receive child events.

The event is passed in the event parameter.

QEvent::ChildAdded and QEvent::ChildRemoved events are sent to objects when children are added or removed. In both cases you can only rely on the child being a QObject, or if isWidgetType() returns true, a QWidget. (This is because, in the ChildAdded case, the child is not yet fully constructed, and in the ChildRemoved case it might have been destructed already).

QEvent::ChildPolished events are sent to widgets when children are polished, or when polished children are added. If you receive a child polished event, the child's construction is usually completed. However, this is not guaranteed, and multiple polish events may be delivered during the execution of a widget's constructor.

For every child widget, you receive one ChildAdded event, zero or more ChildPolished events, and one ChildRemoved event.

The ChildPolished event is omitted if a child is removed immediately after it is added. If a child is polished several times during construction and destruction, you may receive several child polished events for the same child, each time with a different virtual table.

See also
event()

Reimplemented from QObject.

Definition at line 2844 of file qworkspace.cpp.

2845 {
2846  if (e->type() == QEvent::ChildRemoved && e->child() == childWidget) {
2847  childWidget = 0;
2848  if (iconw) {
2849  ((QWorkspace*)parentWidget())->d_func()->removeIcon(iconw->parentWidget());
2850  delete iconw->parentWidget();
2851  }
2852  close();
2853  }
2854 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QWidget * childWidget
Definition: qworkspace.cpp:963
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
bool close()
Closes this widget.
Definition: qwidget.cpp:8305

◆ doMove()

void QWorkspaceChild::doMove ( )

Definition at line 2862 of file qworkspace.cpp.

2863 {
2865 }
QWidgetResizeHandler * widgetResizeHandler
Definition: qworkspace.cpp:964

◆ doResize()

void QWorkspaceChild::doResize ( )

Definition at line 2857 of file qworkspace.cpp.

2858 {
2860 }
QWidgetResizeHandler * widgetResizeHandler
Definition: qworkspace.cpp:964

◆ enterEvent()

void QWorkspaceChild::enterEvent ( QEvent event)
protectedvirtual

This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter.

An event is sent to the widget when the mouse cursor enters the widget.

See also
leaveEvent(), mouseMoveEvent(), event()

Reimplemented from QWidget.

Definition at line 2867 of file qworkspace.cpp.

2868 {
2869 }

◆ eventFilter()

bool QWorkspaceChild::eventFilter ( QObject ,
QEvent  
)
protectedvirtual

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.

Example:

class MainWindow : public QMainWindow
{
public:
MainWindow();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
private:
QTextEdit *textEdit;
};
MainWindow::MainWindow()
{
textEdit = new QTextEdit;
setCentralWidget(textEdit);
textEdit->installEventFilter(this);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == textEdit) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
qDebug() << "Ate key press" << keyEvent->key();
return true;
} else {
return false;
}
} else {
// pass the event on to the parent class
return QMainWindow::eventFilter(obj, event);
}
}

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Warning
If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash.
See also
installEventFilter()

Reimplemented from QObject.

Definition at line 2723 of file qworkspace.cpp.

2724 {
2725  if (!isActive()
2726  && (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::FocusIn)) {
2727  if (iconw) {
2728  ((QWorkspace*)parentWidget())->d_func()->normalizeWindow(windowWidget());
2729  if (iconw) {
2730  ((QWorkspace*)parentWidget())->d_func()->removeIcon(iconw->parentWidget());
2731  delete iconw->parentWidget();
2732  iconw = 0;
2733  }
2734  }
2735  activate();
2736  }
2737 
2738  // for all widgets except the window, that's the only thing we
2739  // process, and if we have no childWidget we skip totally
2740  if (o != childWidget || childWidget == 0)
2741  return false;
2742 
2743  switch (e->type()) {
2744  case QEvent::ShowToParent:
2745  if (((QWorkspace*)parentWidget())->d_func()->focus.indexOf(this) < 0)
2746  ((QWorkspace*)parentWidget())->d_func()->focus.append(this);
2747 
2749  internalRaise();
2750  show();
2751  }
2752  ((QWorkspace*)parentWidget())->d_func()->showWindow(windowWidget());
2753  break;
2755  if (static_cast<QWindowStateChangeEvent*>(e)->isOverride())
2756  break;
2757  Qt::WindowStates state = windowWidget()->windowState();
2758 
2759  if (state & Qt::WindowMinimized) {
2760  ((QWorkspace*)parentWidget())->d_func()->minimizeWindow(windowWidget());
2761  } else if (state & Qt::WindowMaximized) {
2762  if (windowWidget()->maximumSize().isValid() &&
2767  if (titlebar)
2768  titlebar->update();
2769  break;
2770  }
2772  ((QWorkspace*)parentWidget())->d_func()->maximizeWindow(windowWidget());
2773  else
2774  ((QWorkspace*)parentWidget())->d_func()->normalizeWindow(windowWidget());
2775  } else {
2776  ((QWorkspace*)parentWidget())->d_func()->normalizeWindow(windowWidget());
2777  if (iconw) {
2778  ((QWorkspace*)parentWidget())->d_func()->removeIcon(iconw->parentWidget());
2779  delete iconw->parentWidget();
2780  }
2781  }
2782  } break;
2783  case QEvent::HideToParent:
2784  {
2785  QWidget * w = iconw;
2786  if (w && (w = w->parentWidget())) {
2787  ((QWorkspace*)parentWidget())->d_func()->removeIcon(w);
2788  delete w;
2789  }
2790  ((QWorkspace*)parentWidget())->d_func()->hideChild(this);
2791  } break;
2793  {
2795  if (ws->d_func()->maxtools && ws->d_func()->maxWindow == this) {
2796  int iconSize = ws->d_func()->maxtools->size().height();
2797  ws->d_func()->maxtools->setPixmap(childWidget->windowIcon().pixmap(QSize(iconSize, iconSize)));
2798  }
2799  }
2800  // fall through
2803  if (titlebar)
2804  titlebar->update();
2805  if (iconw)
2806  iconw->update();
2807  break;
2810  if (titlebar)
2811  titlebar->update();
2812  if (iconw)
2813  iconw->update();
2814  break;
2815  case QEvent::Resize:
2816  {
2817  QResizeEvent* re = (QResizeEvent*)e;
2818  if (re->size() != windowSize && !shademode) {
2819  resize(re->size() + baseSize());
2820  childWidget->update(); //workaround
2821  }
2822  }
2823  break;
2824 
2826  if (titlebar && titlebar->isActive()) {
2827  update();
2828  }
2829  break;
2830 
2832  if (titlebar && titlebar->isActive()) {
2833  update();
2834  }
2835  break;
2836 
2837  default:
2838  break;
2839  }
2840 
2841  return QWidget::eventFilter(o, e);
2842 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_CORE_EXPORT QTextStream & ws(QTextStream &s)
QSize size() const
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
void setWindowModified(bool)
Definition: qwidget.cpp:11559
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QWidget * childWidget
Definition: qworkspace.cpp:963
void overrideWindowState(Qt::WindowStates state)
Definition: qwidget.cpp:3098
int height() const
QIcon windowIcon
the widget&#39;s icon
Definition: qwidget.h:199
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
bool isWindowModified() const
Definition: qwidget.cpp:11554
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
int width() const
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
QString windowTitle() const
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
QSize baseSize() const
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
const QSize & size() const
Returns the new size of the widget.
Definition: qevent.h:355
QSize maximumSize() const
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int maximumHeight() const
int height() const
Returns the height.
Definition: qsize.h:129
bool isActive() const
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QWidget * windowWidget() const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
bool isActive() const
Definition: qworkspace.cpp:767
int maximumWidth() const

◆ frameWidth()

int QWorkspaceChild::frameWidth ( ) const

Definition at line 974 of file qworkspace.cpp.

Referenced by baseSize(), QWorkspaceChild(), resizeEvent(), and showShaded().

975 {
976  return contentsRect().left();
977 }
QRect contentsRect() const
Returns the area inside the widget&#39;s margins.
Definition: qwidget.cpp:7544
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240

◆ iconWidget()

QWidget * QWorkspaceChild::iconWidget ( ) const

Definition at line 3010 of file qworkspace.cpp.

Referenced by QWorkspacePrivate::minimizeWindow().

3011 {
3012  if (!iconw) {
3013  QWorkspaceChild* that = (QWorkspaceChild*) this;
3014 
3015  QFrame* frame = new QFrame(that, Qt::Window);
3016  QVBoxLayout *vbox = new QVBoxLayout(frame);
3017  vbox->setMargin(0);
3019  vbox->addWidget(tb);
3020  tb->setObjectName(QLatin1String("_workspacechild_icon_"));
3022  tb->initStyleOption(&opt);
3023  int th = style()->pixelMetric(QStyle::PM_TitleBarHeight, &opt, tb);
3024  int iconSize = style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, this);
3027  frame->resize(iconSize+2*frame->frameWidth(), th+2*frame->frameWidth());
3028  } else {
3029  frame->resize(iconSize, th);
3030  }
3031 
3032  that->iconw = tb;
3033  that->updateMask();
3034  iconw->setActive(isActive());
3035 
3036  connect(iconw, SIGNAL(doActivate()),
3037  this, SLOT(activate()));
3038  connect(iconw, SIGNAL(doClose()),
3039  windowWidget(), SLOT(close()));
3040  connect(iconw, SIGNAL(doNormal()),
3041  this, SLOT(showNormal()));
3042  connect(iconw, SIGNAL(doMaximize()),
3043  this, SLOT(showMaximized()));
3045  this, SIGNAL(popupOperationMenu(QPoint)));
3047  this, SIGNAL(showOperationMenu()));
3048  connect(iconw, SIGNAL(doubleClicked()),
3049  this, SLOT(titleBarDoubleClicked()));
3050  }
3051  if (windowWidget()) {
3053  }
3054  return iconw->parentWidget();
3055 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
void initStyleOption(QStyleOptionTitleBar *option) const
Definition: qworkspace.cpp:326
#define SLOT(a)
Definition: qobjectdefs.h:226
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
QStyle * style() const
Definition: qwidget.cpp:2742
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
void popupOperationMenu(const QPoint &)
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
const char * styleHint(const QFontDef &request)
QString windowTitle() const
void showOperationMenu()
void setActive(bool)
Definition: qworkspace.cpp:757
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setFrameStyle(int)
Sets the frame style to style.
Definition: qframe.cpp:329
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
friend class QWorkspaceTitleBar
Definition: qworkspace.cpp:906
bool isActive() const
void titleBarDoubleClicked()
QWidget * windowWidget() const
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
int frameWidth
the width of the frame that is drawn.
Definition: qframe.h:64
void setMargin(int)
Definition: qlayout.cpp:464
The QFrame class is the base class of widgets that can have a frame.
Definition: qframe.h:55

◆ internalRaise

void QWorkspaceChild::internalRaise ( )
slot

Definition at line 3136 of file qworkspace.cpp.

Referenced by QWorkspace::addWindow(), QWorkspace::cascade(), eventFilter(), and QWorkspacePrivate::maximizeWindow().

3137 {
3138 
3139  QWidget *stackUnderWidget = 0;
3141 
3142  QList<QWorkspaceChild *>::Iterator it(((QWorkspace*)parent())->d_func()->windows.begin());
3143  while (it != ((QWorkspace*)parent())->d_func()->windows.end()) {
3144  QWorkspaceChild* c = *it;
3145  ++it;
3146  if (c->windowWidget() &&
3147  !c->windowWidget()->isHidden() &&
3149  if (stackUnderWidget)
3150  c->stackUnder(stackUnderWidget);
3151  else
3152  c->raise();
3153  stackUnderWidget = c;
3154  }
3155  }
3156  }
3157 
3158  if (stackUnderWidget) {
3159  if (iconw)
3160  iconw->parentWidget()->stackUnder(stackUnderWidget);
3161  stackUnder(stackUnderWidget);
3162  } else {
3163  if (iconw)
3164  iconw->parentWidget()->raise();
3165  raise();
3166  }
3167 
3168 }
void stackUnder(QWidget *)
Places the widget under w in the parent widget&#39;s stack.
Definition: qwidget.cpp:11972
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
unsigned char c[8]
Definition: qnumeric_p.h:62
#define it(className, varName)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
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
void raise()
Raises this widget to the top of the parent widget&#39;s stack.
Definition: qwidget.cpp:11901
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QWidget * windowWidget() const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939

◆ isActive()

bool QWorkspaceChild::isActive ( ) const

Definition at line 2966 of file qworkspace.cpp.

Referenced by eventFilter(), and iconWidget().

2967 {
2968  return act;
2969 }

◆ isWindowOrIconVisible()

bool QWorkspaceChild::isWindowOrIconVisible ( ) const

Definition at line 2976 of file qworkspace.cpp.

Referenced by QWorkspace::windowList().

2977 {
2978  return childWidget && (!isHidden() || (iconw && !iconw->isHidden()));
2979 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * childWidget
Definition: qworkspace.cpp:963
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008

◆ leaveEvent()

void QWorkspaceChild::leaveEvent ( QEvent event)
protectedvirtual

This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter.

A leave event is sent to the widget when the mouse cursor leaves the widget.

See also
enterEvent(), mouseMoveEvent(), event()

Reimplemented from QWidget.

Definition at line 2871 of file qworkspace.cpp.

2872 {
2873 #ifndef QT_NO_CURSOR
2876 #endif
2877 }
QWidgetResizeHandler * widgetResizeHandler
Definition: qworkspace.cpp:964
void setCursor(const QCursor &)
Definition: qwidget.cpp:5290

◆ minimumSizeHint()

QSize QWorkspaceChild::minimumSizeHint ( ) const
virtual

Reimplemented from QWidget.

Definition at line 2708 of file qworkspace.cpp.

Referenced by showShaded(), and sizeHint().

2709 {
2710  if (!childWidget)
2711  return QWidget::minimumSizeHint() + baseSize();
2712  QSize s = childWidget->minimumSize();
2713  if (s.isEmpty())
2715  return s + baseSize();
2716 }
QSize minimumSize
the widget&#39;s minimum size
Definition: qwidget.h:172
virtual QSize minimumSizeHint() const
QWidget * childWidget
Definition: qworkspace.cpp:963
QSize minimumSizeHint
the recommended minimum size for the widget
Definition: qwidget.h:196
QSize baseSize() const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
Definition: qsize.h:120

◆ moveEvent()

void QWorkspaceChild::moveEvent ( QMoveEvent event)
protectedvirtual

This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter.

When the widget receives this event, it is already at the new position.

The old position is accessible through QMoveEvent::oldPos().

See also
resizeEvent(), event(), move(), QMoveEvent

Reimplemented from QWidget.

Definition at line 2641 of file qworkspace.cpp.

2642 {
2643  ((QWorkspace*)parentWidget())->d_func()->updateWorkspace();
2644 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60

◆ paintEvent()

void QWorkspaceChild::paintEvent ( QPaintEvent event)
protectedvirtual

This event handler can be reimplemented in a subclass to receive paint events passed in event.

A paint event is a request to repaint all or part of a widget. It can happen for one of the following reasons:

  • repaint() or update() was invoked,
  • the widget was obscured and has now been uncovered, or
  • many other reasons.

Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.

Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). The repaint() function does not permit this optimization, so we suggest using update() whenever possible.

When the paint event occurs, the update region has normally been erased, so you are painting on the widget's background.

The background can be set using setBackgroundRole() and setPalette().

Since Qt 4.0, QWidget automatically double-buffers its painting, so there is no need to write double-buffering code in paintEvent() to avoid flicker.

Note for the X11 platform: It is possible to toggle global double buffering by calling qt_x11_set_global_double_buffer(). For example,

Note
Generally, you should refrain from calling update() or repaint() inside a paintEvent(). For example, calling update() or repaint() on children inside a paintevent() results in undefined behavior; the child may or may not get a paint event.
Warning
If you are using a custom paint engine without Qt's backingstore, Qt::WA_PaintOnScreen must be set. Otherwise, QWidget::paintEngine() will never be called; the backingstore will be used instead.
See also
event(), repaint(), update(), QPainter, QPixmap, QPaintEvent, {Analog Clock Example}

Reimplemented from QWidget.

Definition at line 2879 of file qworkspace.cpp.

2880 {
2881  QPainter p(this);
2882  QStyleOptionFrame opt;
2883  opt.rect = rect();
2884  opt.palette = palette();
2885  opt.state = QStyle::State_None;
2887  opt.midLineWidth = 1;
2888 
2889  if (titlebar && titlebar->isActive() && isActiveWindow())
2890  opt.state |= QStyle::State_Active;
2891 
2892  style()->drawPrimitive(QStyle::PE_FrameWindow, &opt, &p, this);
2893 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
bool isActiveWindow() const
QStyle * style() const
Definition: qwidget.cpp:2742
int lineWidth
the line width for drawing the frame
Definition: qstyleoption.h:124
const QPalette & palette() const
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
Definition: qstyleoption.h:118
QRect rect() const
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
int midLineWidth
the mid-line width for drawing the frame
Definition: qstyleoption.h:125
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
bool isActive() const
Definition: qworkspace.cpp:767
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ popupOperationMenu

void QWorkspaceChild::popupOperationMenu ( const QPoint )
signal

Referenced by iconWidget(), and QWorkspaceChild().

◆ resizeEvent()

void QWorkspaceChild::resizeEvent ( QResizeEvent )
protectedvirtual

This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter.

When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

See also
moveEvent(), event(), resize(), QResizeEvent, paintEvent(), {Scribble Example}

Reimplemented from QWidget.

Definition at line 2646 of file qworkspace.cpp.

Referenced by changeEvent().

2647 {
2648  bool wasMax = isMaximized();
2649  QRect r = contentsRect();
2650  QRect cr;
2651 
2652  updateMask();
2653 
2654  if (titlebar) {
2655  int th = titlebar->sizeHint().height();
2656  QRect tbrect(0, 0, width(), th);
2658  tbrect = QRect(r.x(), r.y(), r.width(), th);
2659  titlebar->setGeometry(tbrect);
2660 
2662  th -= frameWidth();
2663  cr = QRect(r.x(), r.y() + th + (shademode ? (frameWidth() * 3) : 0),
2664  r.width(), r.height() - th);
2665  } else {
2666  cr = r;
2667  }
2668 
2669  if (!childWidget)
2670  return;
2671 
2672  bool doContentsResize = (windowSize == childWidget->size()
2674  ||childWidget->isMaximized());
2675 
2676  windowSize = cr.size();
2677  childWidget->move(cr.topLeft());
2678  if (doContentsResize)
2679  childWidget->resize(cr.size());
2680  ((QWorkspace*)parentWidget())->d_func()->updateWorkspace();
2681 
2682  if (wasMax) {
2685  }
2686 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QRect contentsRect() const
Returns the area inside the widget&#39;s margins.
Definition: qwidget.cpp:7544
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QWidget * childWidget
Definition: qworkspace.cpp:963
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
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
void overrideWindowState(Qt::WindowStates state)
Definition: qwidget.cpp:3098
int frameWidth() const
Definition: qworkspace.cpp:974
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
QSize sizeHint() const
Definition: qworkspace.cpp:822
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
int width() const
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
const char * styleHint(const QFontDef &request)
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
bool isMaximized() const
Definition: qwidget.cpp:3074
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int height() const
Returns the height.
Definition: qsize.h:129
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
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ setActive()

void QWorkspaceChild::setActive ( bool  b)

Definition at line 2914 of file qworkspace.cpp.

Referenced by QWorkspacePrivate::activateWindow().

2915 {
2916  if (!childWidget)
2917  return;
2918 
2919  bool hasFocus = isChildOf(window()->focusWidget(), this);
2920  if (act == b && (act == hasFocus))
2921  return;
2922 
2923  act = b;
2924 
2925  if (titlebar)
2927  if (iconw)
2928  iconw->setActive(act);
2929  update();
2930 
2932  if (act) {
2933  for (int i = 0; i < wl.size(); ++i) {
2934  QWidget *w = wl.at(i);
2935  w->removeEventFilter(this);
2936  }
2937  if (!hasFocus) {
2938  QWidget *lastfocusw = childWidget->focusWidget();
2939  if (lastfocusw && lastfocusw->focusPolicy() != Qt::NoFocus) {
2940  lastfocusw->setFocus();
2941  } else if (childWidget->focusPolicy() != Qt::NoFocus) {
2942  childWidget->setFocus();
2943  } else {
2944  // find something, anything, that accepts focus, and use that.
2945  for (int i = 0; i < wl.size(); ++i) {
2946  QWidget *w = wl.at(i);
2947  if(w->focusPolicy() != Qt::NoFocus) {
2948  w->setFocus();
2949  hasFocus = true;
2950  break;
2951  }
2952  }
2953  if (!hasFocus)
2954  setFocus();
2955  }
2956  }
2957  } else {
2958  for (int i = 0; i < wl.size(); ++i) {
2959  QWidget *w = wl.at(i);
2960  w->removeEventFilter(this);
2961  w->installEventFilter(this);
2962  }
2963  }
2964 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * focusWidget() const
Returns the last child of this widget that setFocus had been called on.
Definition: qwidget.cpp:6863
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
Definition: qobject.cpp:2099
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:187
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QWidget * childWidget
Definition: qworkspace.cpp:963
bool hasFocus() const
Definition: qwidget.cpp:6583
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void setActive(bool)
Definition: qworkspace.cpp:757
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
static bool isChildOf(QWidget *child, QWidget *parent)
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.
Definition: qobject.h:162

◆ show()

void QWorkspaceChild::show ( )

Definition at line 3170 of file qworkspace.cpp.

Referenced by eventFilter(), QWorkspacePrivate::maximizeWindow(), and QWorkspacePrivate::normalizeWindow().

3171 {
3172  if (childWidget && childWidget->isHidden())
3173  childWidget->show();
3174  QWidget::show();
3175 }
QWidget * childWidget
Definition: qworkspace.cpp:963
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
void show()
Shows the widget and its child widgets.

◆ showMaximized

void QWorkspaceChild::showMaximized ( )
slot

Definition at line 3062 of file qworkspace.cpp.

Referenced by iconWidget(), QWorkspaceChild(), and titleBarDoubleClicked().

3063 {
3065 }
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
void setWindowState(Qt::WindowStates state)
Sets the window state to windowState.
QWidget * windowWidget() const

◆ showMinimized

void QWorkspaceChild::showMinimized ( )
slot

Definition at line 3057 of file qworkspace.cpp.

Referenced by QWorkspaceChild().

3058 {
3060 }
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
void setWindowState(Qt::WindowStates state)
Sets the window state to windowState.
QWidget * windowWidget() const

◆ showNormal

void QWorkspaceChild::showNormal ( )
slot

Definition at line 3067 of file qworkspace.cpp.

Referenced by QWorkspace::cascade(), iconWidget(), QWorkspaceChild(), QWorkspace::tile(), and titleBarDoubleClicked().

3068 {
3070 }
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
void setWindowState(Qt::WindowStates state)
Sets the window state to windowState.
QWidget * windowWidget() const

◆ showOperationMenu

void QWorkspaceChild::showOperationMenu ( )
signal

Referenced by iconWidget(), and QWorkspaceChild().

◆ showShaded

void QWorkspaceChild::showShaded ( )
slot

Definition at line 3072 of file qworkspace.cpp.

Referenced by QWorkspace::eventFilter(), QWorkspaceChild(), and titleBarDoubleClicked().

3073 {
3074  if (!titlebar)
3075  return;
3076  ((QWorkspace*)parentWidget())->d_func()->activateWindow(windowWidget());
3077  QWidget* w = windowWidget();
3078  if (shademode) {
3081 
3082  shademode = false;
3085  style()->polish(this);
3086  } else {
3087  shadeRestore = size();
3089  setMinimumHeight(0);
3090  shademode = true;
3093 
3095  resize(width(), titlebar->height());
3096  else
3097  resize(width(), titlebar->height() + 2*frameWidth() + 1);
3098  style()->polish(this);
3099  }
3100  titlebar->update();
3101 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QSize size() const
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 setMinimumSize(const QSize &)
Definition: qwidget.h:969
void overrideWindowState(Qt::WindowStates state)
Definition: qwidget.cpp:3098
int height() const
void setMinimumHeight(int minh)
Definition: qwidget.cpp:4334
int frameWidth() const
Definition: qworkspace.cpp:974
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
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
int width() const
const char * styleHint(const QFontDef &request)
QSize minimumSizeHint() const
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
QWorkspaceTitleBar * titlebar
Definition: qworkspace.cpp:965
QSize minimumSize() const
virtual void polish(QWidget *)
Initializes the appearance of the given widget.
Definition: qstyle.cpp:390
QWidget * windowWidget() const

◆ sizeHint()

QSize QWorkspaceChild::sizeHint ( ) const
virtual

Reimplemented from QWidget.

Definition at line 2696 of file qworkspace.cpp.

2697 {
2698  if (!childWidget)
2699  return QWidget::sizeHint() + baseSize();
2700 
2702  prefSize = prefSize.expandedTo(windowWidget()->minimumSize()).boundedTo(windowWidget()->maximumSize());
2703  prefSize += baseSize();
2704 
2705  return prefSize;
2706 }
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
QWidget * childWidget
Definition: qworkspace.cpp:963
QSize boundedTo(const QSize &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition: qsize.h:192
virtual QSize sizeHint() const
QSize baseSize() const
QSize minimumSizeHint() const
QSize maximumSize() const
QSize minimumSize() const
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

◆ titleBarDoubleClicked

void QWorkspaceChild::titleBarDoubleClicked ( )
slot

Definition at line 3103 of file qworkspace.cpp.

Referenced by iconWidget(), and QWorkspaceChild().

3104 {
3105  if (!windowWidget())
3106  return;
3107  if (iconw)
3108  showNormal();
3110  showShaded();
3112  showMaximized();
3113 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * windowWidget() const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939

◆ updateMask()

void QWorkspaceChild::updateMask ( )
private

Definition at line 2981 of file qworkspace.cpp.

Referenced by changeEvent(), iconWidget(), and resizeEvent().

2982 {
2983  QStyleOptionTitleBar titleBarOptions;
2984  titleBarOptions.rect = rect();
2985  titleBarOptions.titleBarFlags = windowFlags();
2986  titleBarOptions.titleBarState = windowState();
2987 
2988  QStyleHintReturnMask frameMask;
2989  if (style()->styleHint(QStyle::SH_WindowFrame_Mask, &titleBarOptions, this, &frameMask)) {
2990  setMask(frameMask.region);
2991  } else if (!mask().isEmpty()) {
2992  clearMask();
2993  }
2994 
2995  if (iconw) {
2996  QFrame *frame = qobject_cast<QFrame *>(iconw->parentWidget());
2997  Q_ASSERT(frame);
2998 
2999  titleBarOptions.rect = frame->rect();
3000  titleBarOptions.titleBarFlags = frame->windowFlags();
3001  titleBarOptions.titleBarState = frame->windowState() | Qt::WindowMinimized;
3002  if (style()->styleHint(QStyle::SH_WindowFrame_Mask, &titleBarOptions, frame, &frameMask)) {
3003  frame->setMask(frameMask.region);
3004  } else if (!frame->mask().isEmpty()) {
3005  frame->clearMask();
3006  }
3007  }
3008 }
QPointer< QWorkspaceTitleBar > iconw
Definition: qworkspace.cpp:966
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
T * qobject_cast(QObject *object)
Definition: qobject.h:375
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QStyle * style() const
Definition: qwidget.cpp:2742
void clearMask()
Removes any mask set by setMask().
Definition: qwidget.cpp:13324
static bool isEmpty(const char *str)
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
const char * styleHint(const QFontDef &request)
void setMask(const QBitmap &)
Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible...
Definition: qwidget.cpp:13309
QRect rect() const
QRegion mask() const
Returns the mask currently set on a widget.
Definition: qwidget.cpp:10058
The QStyleHintReturnMask class provides style hints that return a QRegion.
Definition: qstyleoption.h:923
Qt::WindowFlags titleBarFlags
the widget flags for the title bar
Definition: qstyleoption.h:825
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
QRegion region
the region for style hints that return a QRegion
Definition: qstyleoption.h:930
int titleBarState
the state of the title bar
Definition: qstyleoption.h:824
The QFrame class is the base class of widgets that can have a frame.
Definition: qframe.h:55
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ windowWidget()

QWidget * QWorkspaceChild::windowWidget ( ) const

Friends and Related Functions

◆ QWorkspace

friend class QWorkspace
friend

Definition at line 905 of file qworkspace.cpp.

◆ QWorkspacePrivate

friend class QWorkspacePrivate
friend

Definition at line 904 of file qworkspace.cpp.

◆ QWorkspaceTitleBar

friend class QWorkspaceTitleBar
friend

Definition at line 906 of file qworkspace.cpp.

Referenced by iconWidget(), and QWorkspaceChild().

Properties

◆ act

bool QWorkspaceChild::act
private

Definition at line 970 of file qworkspace.cpp.

Referenced by isActive(), QWorkspaceChild(), and setActive().

◆ childWidget

QWidget* QWorkspaceChild::childWidget
private

◆ iconw

QPointer<QWorkspaceTitleBar> QWorkspaceChild::iconw
private

◆ shademode

bool QWorkspaceChild::shademode
private

◆ shadeRestore

QSize QWorkspaceChild::shadeRestore
private

Definition at line 968 of file qworkspace.cpp.

Referenced by showShaded().

◆ shadeRestoreMin

QSize QWorkspaceChild::shadeRestoreMin
private

Definition at line 969 of file qworkspace.cpp.

Referenced by showShaded().

◆ titlebar

QWorkspaceTitleBar* QWorkspaceChild::titlebar
private

◆ widgetResizeHandler

QWidgetResizeHandler* QWorkspaceChild::widgetResizeHandler
private

◆ windowSize

QSize QWorkspaceChild::windowSize
private

Definition at line 967 of file qworkspace.cpp.

Referenced by eventFilter(), QWorkspaceChild(), and resizeEvent().


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