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

The QMdiSubWindow class provides a subwindow class for QMdiArea. More...

#include <qmdisubwindow.h>

Inheritance diagram for QMdiSubWindow:
QWidget QObject QPaintDevice

Public Types

enum  SubWindowOption { AllowOutsideAreaHorizontally = 0x1, AllowOutsideAreaVertically = 0x2, RubberBandResize = 0x4, RubberBandMove = 0x8 }
 This enum describes options that customize the behavior of QMdiSubWindow. 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 showShaded ()
 Calling this function makes the subwindow enter the shaded mode. More...
 
void showSystemMenu ()
 Shows the system menu below the system menu icon in the title bar. 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 aboutToActivate ()
 QMdiSubWindow emits this signal immediately before it is activated. More...
 
void windowStateChanged (Qt::WindowStates oldState, Qt::WindowStates newState)
 QMdiSubWindow emits this signal after the window state changes. 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

bool isShaded () const
 Returns true if this window is shaded; otherwise returns false. More...
 
int keyboardPageStep () const
 
int keyboardSingleStep () const
 
QWidgetmaximizedButtonsWidget () const
 
QWidgetmaximizedSystemMenuIconWidget () const
 
QMdiAreamdiArea () const
 Returns the area containing this sub-window, or 0 if there is none. More...
 
QSize minimumSizeHint () const
 Reimplemented Function More...
 
 QMdiSubWindow (QWidget *parent=0, Qt::WindowFlags flags=0)
 Constructs a new QMdiSubWindow widget. More...
 
void setKeyboardPageStep (int step)
 
void setKeyboardSingleStep (int step)
 
void setOption (SubWindowOption option, bool on=true)
 If on is true, option is enabled on the subwindow; otherwise it is disabled. More...
 
void setSystemMenu (QMenu *systemMenu)
 Sets systemMenu as the current system menu for this subwindow. More...
 
void setWidget (QWidget *widget)
 Sets widget as the internal widget of this subwindow. More...
 
QSize sizeHint () const
 Reimplemented Function More...
 
QMenusystemMenu () const
 Returns a pointer to the current system menu, or zero if no system menu is set. More...
 
bool testOption (SubWindowOption) const
 Returns true if option is enabled; otherwise returns false. More...
 
QWidgetwidget () const
 Returns the current internal widget. More...
 
 ~QMdiSubWindow ()
 Destroys the subwindow. 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
 
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 *changeEvent)
 Reimplemented Function More...
 
void childEvent (QChildEvent *childEvent)
 Reimplemented Function More...
 
void closeEvent (QCloseEvent *closeEvent)
 Reimplemented Function More...
 
void contextMenuEvent (QContextMenuEvent *contextMenuEvent)
 Reimplemented Function More...
 
bool event (QEvent *event)
 Reimplemented Function More...
 
bool eventFilter (QObject *object, QEvent *event)
 Reimplemented Function More...
 
void focusInEvent (QFocusEvent *focusInEvent)
 Reimplemented Function More...
 
void focusOutEvent (QFocusEvent *focusOutEvent)
 Reimplemented Function More...
 
void hideEvent (QHideEvent *hideEvent)
 Reimplemented Function More...
 
void keyPressEvent (QKeyEvent *keyEvent)
 Reimplemented Function More...
 
void leaveEvent (QEvent *leaveEvent)
 Reimplemented Function More...
 
void mouseDoubleClickEvent (QMouseEvent *mouseEvent)
 Reimplemented Function More...
 
void mouseMoveEvent (QMouseEvent *mouseEvent)
 Reimplemented Function More...
 
void mousePressEvent (QMouseEvent *mouseEvent)
 Reimplemented Function More...
 
void mouseReleaseEvent (QMouseEvent *mouseEvent)
 Reimplemented Function More...
 
void moveEvent (QMoveEvent *moveEvent)
 Reimplemented Function More...
 
void paintEvent (QPaintEvent *paintEvent)
 Reimplemented Function More...
 
void resizeEvent (QResizeEvent *resizeEvent)
 Reimplemented Function More...
 
void showEvent (QShowEvent *showEvent)
 Reimplemented Function More...
 
void timerEvent (QTimerEvent *timerEvent)
 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...
 
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...
 
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...
 
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 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 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 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
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 

Properties

int keyboardPageStep
 sets how far a widget should move or resize when using the keyboard page keys. More...
 
int keyboardSingleStep
 sets how far a widget should move or resize when using the keyboard arrow keys. More...
 

Friends

class QMdi::ControlContainer
 
class QMdiAreaPrivate
 
class QMdiAreaTabBar
 

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 QMdiSubWindow class provides a subwindow class for QMdiArea.

Since
4.3

QMdiSubWindow represents a top-level window in a QMdiArea, and consists of a title bar with window decorations, an internal widget, and (depending on the current style) a window frame and a size grip. QMdiSubWindow has its own layout, which consists of the title bar and a center area for the internal widget.

qmdisubwindowlayout.png

The most common way to construct a QMdiSubWindow is to call QMdiArea::addSubWindow() with the internal widget as the argument. You can also create a subwindow yourself, and set an internal widget by calling setWidget().

You use the same API when programming with subwindows as with regular top-level windows (e.g., you can call functions such as show(), hide(), showMaximized(), and setWindowTitle()).

Subwindow Handling

QMdiSubWindow also supports behavior specific to subwindows in an MDI area.

By default, each QMdiSubWindow is visible inside the MDI area viewport when moved around, but it is also possible to specify transparent window movement and resizing behavior, where only the outline of a subwindow is updated during these operations. The setOption() function is used to enable this behavior.

The isShaded() function detects whether the subwindow is currently shaded (i.e., the window is collapsed so that only the title bar is visible). To enter shaded mode, call showShaded(). QMdiSubWindow emits the windowStateChanged() signal whenever the window state has changed (e.g., when the window becomes minimized, or is restored). It also emits aboutToActivate() before it is activated.

In keyboard-interactive mode, the windows are moved and resized with the keyboard. You can enter this mode through the system menu of the window. The keyboardSingleStep and keyboardPageStep properties control the distance the widget is moved or resized for each keypress event. When shift is pressed down page step is used; otherwise single step is used.

You can also change the active window with the keyboard. By pressing the control and tab keys at the same time, the next (using the current QMdiArea::WindowOrder) subwindow will be activated. By pressing control, shift, and tab, you will activate the previous window. This is equivalent to calling QMdiArea::activateNextSubWindow() and QMdiArea::activatePreviousSubWindow(). Note that these shortcuts overrides global shortcuts, but not the QMdiArea shortcuts.

See also
QMdiArea

Definition at line 60 of file qmdisubwindow.h.

Enumerations

◆ SubWindowOption

This enum describes options that customize the behavior of QMdiSubWindow.

  • AllowOutsideAreaHorizontally
  • AllowOutsideAreaVertically
  • RubberBandResize If you enable this option, a rubber band control is used to represent the subwindow's outline, and the user resizes this instead of the subwindow itself. As a result, the subwindow maintains its original position and size until the resize operation has been completed, at which time it will receive a single QResizeEvent. By default, this option is disabled.
  • RubberBandMove If you enable this option, a rubber band control is used to represent the subwindow's outline, and the user moves this instead of the subwindow itself. As a result, the subwindow remains in its original position until the move operation has completed, at which time a QMoveEvent is sent to the window. By default, this option is disabled.
Enumerator
AllowOutsideAreaHorizontally 
AllowOutsideAreaVertically 
RubberBandResize 
RubberBandMove 

Definition at line 66 of file qmdisubwindow.h.

Constructors and Destructors

◆ QMdiSubWindow()

QMdiSubWindow::QMdiSubWindow ( QWidget parent = 0,
Qt::WindowFlags  flags = 0 
)

Constructs a new QMdiSubWindow widget.

The parent and flags arguments are passed to QWidget's constructor.

Instead of using addSubWindow(), it is also simply possible to use setParent() when you add the subwindow to a QMdiArea.

Note that only QMdiSubWindow can be set as children of QMdiArea; you cannot, for instance, write:

QMdiArea mdiArea; QTextEdit editor(&mdiArea); // invalid child widget

See also
QMdiArea::addSubWindow()

Definition at line 2258 of file qmdisubwindow.cpp.

2259  : QWidget(*new QMdiSubWindowPrivate, parent, 0)
2260 {
2261  Q_D(QMdiSubWindow);
2262 #ifndef QT_NO_MENU
2263  d->createSystemMenu();
2264  addActions(d->systemMenu->actions());
2265 #endif
2266  d->setWindowFlags(flags);
2268  setAutoFillBackground(true);
2269  setMouseTracking(true);
2270  setLayout(new QVBoxLayout);
2272  layout()->setMargin(0);
2273  d->updateGeometryConstraints();
2274  setAttribute(Qt::WA_Resized, false);
2275  d->titleBarPalette = d->desktopPalette();
2276  d->font = QApplication::font("QWorkspaceTitleBar");
2277  // We don't want the menu icon by default on mac.
2278 #ifndef Q_WS_MAC
2279  if (windowIcon().isNull())
2280  d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
2281  else
2282  d->menuIcon = windowIcon();
2283 #endif
2284  connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)),
2285  this, SLOT(_q_processFocusChanged(QWidget*,QWidget*)));
2286 }
double d
Definition: qnumeric_p.h:62
void setLayout(QLayout *)
Sets the layout manager for this widget to layout.
Definition: qwidget.cpp:10104
#define SLOT(a)
Definition: qobjectdefs.h:226
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_D(Class)
Definition: qglobal.h:2482
QStyle * style() const
Definition: qwidget.cpp:2742
static QFont font()
Returns the default application font.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QIcon windowIcon() const
void setBackgroundRole(QPalette::ColorRole)
Sets the background role of the widget to role.
Definition: qwidget.cpp:4708
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
Definition: qstyle.cpp:2327
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
#define qApp
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 addActions(QList< QAction *> actions)
Appends the actions actions to this widget&#39;s list of actions.
Definition: qwidget.cpp:3327
void setMouseTracking(bool enable)
Definition: qwidget.h:990
void setAutoFillBackground(bool enabled)
Definition: qwidget.cpp:631
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
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
void setMargin(int)
Definition: qlayout.cpp:464
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300
void setFocusPolicy(Qt::FocusPolicy policy)
Definition: qwidget.cpp:7631

◆ ~QMdiSubWindow()

QMdiSubWindow::~QMdiSubWindow ( )

Destroys the subwindow.

See also
QMdiArea::removeSubWindow()

Definition at line 2293 of file qmdisubwindow.cpp.

2294 {
2295  Q_D(QMdiSubWindow);
2296 #ifndef QT_NO_MENUBAR
2297  d->removeButtonsFromMenuBar();
2298 #endif
2299  d->setActive(false);
2300 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

Functions

◆ aboutToActivate

QMdiSubWindow::aboutToActivate ( )
signal

QMdiSubWindow emits this signal immediately before it is activated.

After the subwindow has been activated, the QMdiArea that manages the subwindow will also emit the QMdiArea::subWindowActivated() signal.

See also
QMdiArea::subWindowActivated()

◆ changeEvent()

void QMdiSubWindow::changeEvent ( QEvent changeEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 2994 of file qmdisubwindow.cpp.

Referenced by eventFilter().

2995 {
2996  if (!parent()) {
2997  QWidget::changeEvent(changeEvent);
2998  return;
2999  }
3000 
3001  if (changeEvent->type() != QEvent::WindowStateChange) {
3002  QWidget::changeEvent(changeEvent);
3003  return;
3004  }
3005 
3007  if (event->isOverride()) {
3008  event->ignore();
3009  return;
3010  }
3011 
3012  Qt::WindowStates oldState = event->oldState();
3013  Qt::WindowStates newState = windowState();
3014  if (oldState == newState) {
3015  changeEvent->ignore();
3016  return;
3017  }
3018 
3019  // QWidget ensures that the widget is visible _after_ setWindowState(),
3020  // but we need to ensure that the widget is visible _before_
3021  // setWindowState() returns.
3022  Q_D(QMdiSubWindow);
3023  if (!isVisible()) {
3024  d->ensureWindowState(Qt::WindowNoState);
3025  setVisible(true);
3026  }
3027 
3028  if (!d->oldGeometry.isValid())
3029  d->oldGeometry = geometry();
3030 
3031  if ((oldState & Qt::WindowActive) && (newState & Qt::WindowActive))
3032  d->currentOperation = QMdiSubWindowPrivate::None;
3033 
3034  if (!(oldState & Qt::WindowMinimized) && (newState & Qt::WindowMinimized))
3035  d->setMinimizeMode();
3036  else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized))
3037  d->setMaximizeMode();
3038  else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized)))
3039  d->setNormalMode();
3040 
3041  if (d->isActive)
3042  d->ensureWindowState(Qt::WindowActive);
3043  if (d->activationEnabled)
3044  emit windowStateChanged(oldState, windowState());
3045 }
double d
Definition: qnumeric_p.h:62
void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)
QMdiSubWindow emits this signal after the window state changes.
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
bool isVisible() const
Definition: qwidget.h:1005
void changeEvent(QEvent *changeEvent)
Reimplemented Function
#define Q_D(Class)
Definition: qglobal.h:2482
#define emit
Definition: qobjectdefs.h:76
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition: qwidget.cpp:9170
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
bool event(QEvent *event)
Reimplemented Function
The QWindowStateChangeEvent class provides the window state before a window state change...
Definition: qevent.h:705
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
const QRect & geometry() const
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ childEvent()

void QMdiSubWindow::childEvent ( QChildEvent childEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QObject.

Definition at line 3492 of file qmdisubwindow.cpp.

3493 {
3494  if (childEvent->type() != QEvent::ChildPolished)
3495  return;
3496 #ifndef QT_NO_SIZEGRIP
3497  if (QSizeGrip *sizeGrip = qobject_cast<QSizeGrip *>(childEvent->child()))
3498  d_func()->setSizeGrip(sizeGrip);
3499 #endif
3500 }
The QSizeGrip class provides a resize handle for resizing top-level windows.
Definition: qsizegrip.h:55
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
QObject * child() const
Returns the child object that was added or removed.
Definition: qcoreevent.h:358

◆ closeEvent()

void QMdiSubWindow::closeEvent ( QCloseEvent closeEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3050 of file qmdisubwindow.cpp.

3051 {
3052  Q_D(QMdiSubWindow);
3053  bool acceptClose = true;
3054  if (d->baseWidget)
3055  acceptClose = d->baseWidget->close();
3056  if (!acceptClose) {
3057  closeEvent->ignore();
3058  return;
3059  }
3060 #ifndef QT_NO_MENUBAR
3061  d->removeButtonsFromMenuBar();
3062 #endif
3063  d->setActive(false);
3065  QChildEvent childRemoved(QEvent::ChildRemoved, this);
3066  QApplication::sendEvent(parentWidget(), &childRemoved);
3067  }
3068  closeEvent->accept();
3069 }
double d
Definition: qnumeric_p.h:62
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
#define Q_D(Class)
Definition: qglobal.h:2482
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QChildEvent class contains event parameters for child object events.
Definition: qcoreevent.h:353
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
Definition: qcoreevent.h:309
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ contextMenuEvent()

void QMdiSubWindow::contextMenuEvent ( QContextMenuEvent contextMenuEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3456 of file qmdisubwindow.cpp.

3457 {
3458  Q_D(QMdiSubWindow);
3459  if (!d->systemMenu) {
3460  contextMenuEvent->ignore();
3461  return;
3462  }
3463 
3464  if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu
3465  || d->getRegion(QMdiSubWindowPrivate::Move).contains(contextMenuEvent->pos())) {
3466  d->systemMenu->exec(contextMenuEvent->globalPos());
3467  } else {
3468  contextMenuEvent->ignore();
3469  }
3470 }
double d
Definition: qnumeric_p.h:62
const QPoint & pos() const
Returns the position of the mouse pointer relative to the widget that received the event...
Definition: qevent.h:412
#define Q_D(Class)
Definition: qglobal.h:2482
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
const QPoint & globalPos() const
Returns the global position of the mouse pointer at the time of the event.
Definition: qevent.h:413
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ event()

bool QMdiSubWindow::event ( QEvent event)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 2812 of file qmdisubwindow.cpp.

Referenced by changeEvent(), and eventFilter().

2813 {
2814  Q_D(QMdiSubWindow);
2815  switch (event->type()) {
2816  case QEvent::StyleChange: {
2817  bool wasShaded = isShaded();
2818  bool wasMinimized = isMinimized();
2819  bool wasMaximized = isMaximized();
2820  // Don't emit subWindowActivated, the app doesn't have to know about our hacks
2821  const QScopedValueRollback<bool> activationEnabledSaver(d->activationEnabled);
2822  d->activationEnabled = false;
2823 
2824  ensurePolished();
2825  setContentsMargins(0, 0, 0, 0);
2826  if (wasMinimized || wasMaximized || wasShaded)
2827  showNormal();
2828  d->updateGeometryConstraints();
2829  resize(d->internalMinimumSize.expandedTo(size()));
2830  d->updateMask();
2831  d->updateDirtyRegions();
2832  if (wasShaded)
2833  showShaded();
2834  else if (wasMinimized)
2835  showMinimized();
2836  else if (wasMaximized)
2837  showMaximized();
2838  break;
2839  }
2841  d->setActive(false);
2842  break;
2843  case QEvent::ParentChange: {
2844  bool wasResized = testAttribute(Qt::WA_Resized);
2845 #ifndef QT_NO_MENUBAR
2846  d->removeButtonsFromMenuBar();
2847 #endif
2848  d->currentOperation = QMdiSubWindowPrivate::None;
2849  d->activeSubControl = QStyle::SC_None;
2850  d->hoveredSubControl = QStyle::SC_None;
2851 #ifndef QT_NO_RUBBERBAND
2852  if (d->isInRubberBandMode)
2853  d->leaveRubberBandMode();
2854 #endif
2855  d->isShadeMode = false;
2856  d->isMaximizeMode = false;
2857  d->isWidgetHiddenByUs = false;
2858  if (!parent()) {
2859 #if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
2860  if (qobject_cast<QMacStyle *>(style()))
2861  delete d->sizeGrip;
2862 #endif
2863  setOption(RubberBandResize, false);
2864  setOption(RubberBandMove, false);
2865  } else {
2866  d->setWindowFlags(windowFlags());
2867  }
2868  setContentsMargins(0, 0, 0, 0);
2869  d->updateGeometryConstraints();
2870  d->updateCursor();
2871  d->updateMask();
2872  d->updateDirtyRegions();
2873  d->updateActions();
2874  if (!wasResized && testAttribute(Qt::WA_Resized))
2875  setAttribute(Qt::WA_Resized, false);
2876  break;
2877  }
2879  if (d->ignoreNextActivationEvent) {
2880  d->ignoreNextActivationEvent = false;
2881  break;
2882  }
2883  d->isExplicitlyDeactivated = false;
2884  d->setActive(true);
2885  break;
2887  if (d->ignoreNextActivationEvent) {
2888  d->ignoreNextActivationEvent = false;
2889  break;
2890  }
2891  d->isExplicitlyDeactivated = true;
2892  d->setActive(false);
2893  break;
2895  if (!d->ignoreWindowTitleChange)
2896  d->updateWindowTitle(false);
2897  d->updateInternalWindowTitle();
2898  break;
2900  if (!windowTitle().contains(QLatin1String("[*]")))
2901  break;
2902 #ifndef QT_NO_MENUBAR
2903  if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
2904  ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
2906  }
2907 #endif // QT_NO_MENUBAR
2908  d->updateInternalWindowTitle();
2909  break;
2911  d->updateDirtyRegions();
2912  break;
2913  case QEvent::LayoutRequest:
2914  d->updateGeometryConstraints();
2915  break;
2917  d->menuIcon = windowIcon();
2918  if (d->menuIcon.isNull())
2919  d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
2920  if (d->controlContainer)
2921  d->controlContainer->updateWindowIcon(d->menuIcon);
2923  update(0, 0, width(), d->titleBarHeight());
2924  break;
2925  case QEvent::PaletteChange:
2926  d->titleBarPalette = d->desktopPalette();
2927  break;
2928  case QEvent::FontChange:
2929  d->font = font();
2930  break;
2931 #ifndef QT_NO_TOOLTIP
2932  case QEvent::ToolTip:
2933  showToolTip(static_cast<QHelpEvent *>(event), this, d->titleBarOptions(),
2934  QStyle::CC_TitleBar, d->hoveredSubControl);
2935  break;
2936 #endif
2937  default:
2938  break;
2939  }
2940  return QWidget::event(event);
2941 }
void showMaximized()
Shows the widget maximized.
Definition: qwidget.cpp:3218
double d
Definition: qnumeric_p.h:62
QSize size() const
void setWindowModified(bool)
Definition: qwidget.cpp:11559
void ensurePolished() const
Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette).
Definition: qwidget.cpp:10024
static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOptionComplex &opt, QStyle::ComplexControl complexControl, QStyle::SubControl subControl)
void showShaded()
Calling this function makes the subwindow enter the shaded mode.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setOption(SubWindowOption option, bool on=true)
If on is true, option is enabled on the subwindow; otherwise it is disabled.
#define Q_D(Class)
Definition: qglobal.h:2482
void showNormal()
Restores the widget after it has been maximized or minimized.
Definition: qwidget.cpp:3250
QStyle * style() const
Definition: qwidget.cpp:2742
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
QIcon windowIcon() const
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
Definition: qstyle.cpp:2327
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
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
QString windowTitle() const
bool isShaded() const
Returns true if this window is shaded; otherwise returns false.
void showMinimized()
Shows the widget minimized, as an icon.
Definition: qwidget.cpp:3038
bool isMaximized() const
Definition: qwidget.cpp:3074
The QScopedValueRollback class resets a variable to its previous value on destruction.
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QWidget * maximizedSystemMenuIconWidget() const
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
bool isMinimized() const
Definition: qwidget.cpp:3027
const QFont & font() const
QWidget * maximizedButtonsWidget() const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
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
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ eventFilter()

bool QMdiSubWindow::eventFilter ( QObject object,
QEvent event 
)
protectedvirtual

Reimplemented Function

Reimplemented from QObject.

Definition at line 2705 of file qmdisubwindow.cpp.

2706 {
2707  Q_D(QMdiSubWindow);
2708  if (!object)
2709  return QWidget::eventFilter(object, event);
2710 
2711 #ifndef QT_NO_MENU
2712  // System menu events.
2713  if (d->systemMenu && d->systemMenu == object) {
2714  if (event->type() == QEvent::MouseButtonDblClick) {
2715  close();
2716  } else if (event->type() == QEvent::MouseMove) {
2717  QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
2718  d->hoveredSubControl = d->getSubControl(mapFromGlobal(mouseEvent->globalPos()));
2719  } else if (event->type() == QEvent::Hide) {
2720  d->systemMenu->removeEventFilter(this);
2721  d->activeSubControl = QStyle::SC_None;
2722  update(QRegion(0, 0, width(), d->titleBarHeight()));
2723  }
2724  return QWidget::eventFilter(object, event);
2725  }
2726 #endif
2727 
2728 #ifndef QT_NO_SIZEGRIP
2729  if (object != d->baseWidget && parent() && qobject_cast<QSizeGrip *>(object)) {
2731  return QWidget::eventFilter(object, event);
2732  const QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
2733  d->mousePressPosition = parentWidget()->mapFromGlobal(mouseEvent->globalPos());
2734  d->oldGeometry = geometry();
2737 #ifndef QT_NO_RUBBERBAND
2738  d->enterRubberBandMode();
2739 #endif
2740  return true;
2741  }
2742 #endif
2743 
2744  if (object != d->baseWidget && event->type() != QEvent::WindowTitleChange)
2745  return QWidget::eventFilter(object, event);
2746 
2747  switch (event->type()) {
2748  case QEvent::Show:
2749  d->setActive(true);
2750  break;
2751  case QEvent::ShowToParent:
2752  if (!d->isWidgetHiddenByUs)
2753  show();
2754  break;
2757  if (changeEvent->isOverride())
2758  break;
2759  Qt::WindowStates oldState = changeEvent->oldState();
2760  Qt::WindowStates newState = d->baseWidget->windowState();
2761  if (!(oldState & Qt::WindowMinimized) && (newState & Qt::WindowMinimized))
2762  showMinimized();
2763  else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized))
2764  showMaximized();
2765  else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized)))
2766  showNormal();
2767  break;
2768  }
2769  case QEvent::Enter:
2770  d->currentOperation = QMdiSubWindowPrivate::None;
2771  d->updateCursor();
2772  break;
2773  case QEvent::LayoutRequest:
2774  d->updateGeometryConstraints();
2775  break;
2777  if (d->ignoreWindowTitleChange)
2778  break;
2779  if (object == d->baseWidget) {
2780  d->updateWindowTitle(true);
2781  d->lastChildWindowTitle = d->baseWidget->windowTitle();
2782 #ifndef QT_NO_MENUBAR
2783  } else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
2784  ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
2785  d->originalTitle = QString::null;
2786  if (d->baseWidget && d->baseWidget->windowTitle() == windowTitle())
2787  d->updateWindowTitle(true);
2788  else
2789  d->updateWindowTitle(false);
2790 #endif
2791  }
2792  break;
2793  case QEvent::ModifiedChange: {
2794  if (object != d->baseWidget)
2795  break;
2796  bool windowModified = d->baseWidget->isWindowModified();
2797  if (!windowModified && d->baseWidget->windowTitle() != windowTitle())
2798  break;
2799  if (windowTitle().contains(QLatin1String("[*]")))
2800  setWindowModified(windowModified);
2801  break;
2802  }
2803  default:
2804  break;
2805  }
2806  return QWidget::eventFilter(object, event);
2807 }
void showMaximized()
Shows the widget maximized.
Definition: qwidget.cpp:3218
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.h:904
double d
Definition: qnumeric_p.h:62
Qt::WindowStates oldState() const
Returns the state of the window before the change.
Definition: qevent.h:712
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
void setWindowModified(bool)
Definition: qwidget.cpp:11559
void changeEvent(QEvent *changeEvent)
Reimplemented Function
bool windowModified
whether the document shown in the window has unsaved changes
Definition: qwidget.h:202
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool isOverride() const
Definition: qevent.cpp:4071
#define Q_D(Class)
Definition: qglobal.h:2482
void showNormal()
Restores the widget after it has been maximized or minimized.
Definition: qwidget.cpp:3250
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
int width() const
bool testOption(SubWindowOption) const
Returns true if option is enabled; otherwise returns false.
QString windowTitle() const
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void show()
Shows the widget and its child widgets.
void showMinimized()
Shows the widget minimized, as an icon.
Definition: qwidget.cpp:3038
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 QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
bool event(QEvent *event)
Reimplemented Function
The QWindowStateChangeEvent class provides the window state before a window state change...
Definition: qevent.h:705
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
Definition: qtestmouse.h:71
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
bool isLeftToRight() const
Definition: qwidget.h:429
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
QWidget * maximizedButtonsWidget() const
static const Null null
Definition: qstring.h:502
const QRect & geometry() const
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
Definition: qevent.h:96
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ focusInEvent()

void QMdiSubWindow::focusInEvent ( QFocusEvent focusInEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3476 of file qmdisubwindow.cpp.

3477 {
3478  d_func()->focusInReason = focusInEvent->reason();
3479 }
Qt::FocusReason reason()
Definition: qevent.cpp:1197

◆ focusOutEvent()

void QMdiSubWindow::focusOutEvent ( QFocusEvent focusOutEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3484 of file qmdisubwindow.cpp.

3485 {
3486  // To avoid update() in QWidget::focusOutEvent.
3487 }

◆ hideEvent()

void QMdiSubWindow::hideEvent ( QHideEvent hideEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 2984 of file qmdisubwindow.cpp.

2985 {
2986 #ifndef QT_NO_MENUBAR
2987  d_func()->removeButtonsFromMenuBar();
2988 #endif
2989 }

◆ isShaded()

bool QMdiSubWindow::isShaded ( ) const

Returns true if this window is shaded; otherwise returns false.

A window is shaded if it is collapsed so that only the title bar is visible.

Definition at line 2409 of file qmdisubwindow.cpp.

Referenced by QMdiAreaPrivate::_q_deactivateAllWindows(), event(), minimumSizeHint(), mouseDoubleClickEvent(), QMdiAreaPrivate::rearrange(), and showShaded().

2410 {
2411  return d_func()->isShadeMode;
2412 }

◆ keyboardPageStep()

int QMdiSubWindow::keyboardPageStep ( ) const

Referenced by setKeyboardSingleStep().

◆ keyboardSingleStep()

int QMdiSubWindow::keyboardSingleStep ( ) const

Referenced by testOption().

◆ keyPressEvent()

void QMdiSubWindow::keyPressEvent ( QKeyEvent keyEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3373 of file qmdisubwindow.cpp.

3374 {
3375  Q_D(QMdiSubWindow);
3376  if (!d->isInInteractiveMode || !parent()) {
3377  keyEvent->ignore();
3378  return;
3379  }
3380 
3381  QPoint delta;
3382  switch (keyEvent->key()) {
3383  case Qt::Key_Right:
3384  if (keyEvent->modifiers() & Qt::ShiftModifier)
3385  delta = QPoint(d->keyboardPageStep, 0);
3386  else
3387  delta = QPoint(d->keyboardSingleStep, 0);
3388  break;
3389  case Qt::Key_Up:
3390  if (keyEvent->modifiers() & Qt::ShiftModifier)
3391  delta = QPoint(0, -d->keyboardPageStep);
3392  else
3393  delta = QPoint(0, -d->keyboardSingleStep);
3394  break;
3395  case Qt::Key_Left:
3396  if (keyEvent->modifiers() & Qt::ShiftModifier)
3397  delta = QPoint(-d->keyboardPageStep, 0);
3398  else
3399  delta = QPoint(-d->keyboardSingleStep, 0);
3400  break;
3401  case Qt::Key_Down:
3402  if (keyEvent->modifiers() & Qt::ShiftModifier)
3403  delta = QPoint(0, d->keyboardPageStep);
3404  else
3405  delta = QPoint(0, d->keyboardSingleStep);
3406  break;
3407  case Qt::Key_Escape:
3408  case Qt::Key_Return:
3409  case Qt::Key_Enter:
3410  d->leaveInteractiveMode();
3411  return;
3412  default:
3413  keyEvent->ignore();
3414  return;
3415  }
3416 
3417 #ifndef QT_NO_CURSOR
3418  QPoint newPosition = parentWidget()->mapFromGlobal(cursor().pos() + delta);
3419  QRect oldGeometry =
3420 #ifndef QT_NO_RUBBERBAND
3421  d->isInRubberBandMode ? d->rubberBand->geometry() :
3422 #endif
3423  geometry();
3424  d->setNewGeometry(newPosition);
3425  QRect currentGeometry =
3426 #ifndef QT_NO_RUBBERBAND
3427  d->isInRubberBandMode ? d->rubberBand->geometry() :
3428 #endif
3429  geometry();
3430  if (currentGeometry == oldGeometry)
3431  return;
3432 
3433  // Update cursor position
3434 
3435  QPoint actualDelta;
3436  if (d->isMoveOperation()) {
3437  actualDelta = QPoint(currentGeometry.x() - oldGeometry.x(),
3438  currentGeometry.y() - oldGeometry.y());
3439  } else {
3440  int dx = isLeftToRight() ? currentGeometry.width() - oldGeometry.width()
3441  : currentGeometry.x() - oldGeometry.x();
3442  actualDelta = QPoint(dx, currentGeometry.height() - oldGeometry.height());
3443  }
3444 
3445  // Adjust in case we weren't able to move as long as wanted.
3446  if (actualDelta != delta)
3447  newPosition += (actualDelta - delta);
3448  cursor().setPos(parentWidget()->mapToGlobal(newPosition));
3449 #endif
3450 }
QPoint pos() const
double d
Definition: qnumeric_p.h:62
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QCursor cursor() const
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
static void setPos(int x, int y)
Moves the cursor (hot spot) to the global screen position (x, y).
Definition: qcursor_mac.mm:315
#define Q_D(Class)
Definition: qglobal.h:2482
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
Definition: qevent.cpp:999
int key() const
Returns the code of the key that was pressed or released.
Definition: qevent.h:231
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
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
bool isLeftToRight() const
Definition: qwidget.h:429
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
const QRect & geometry() const
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ leaveEvent()

void QMdiSubWindow::leaveEvent ( QEvent leaveEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3074 of file qmdisubwindow.cpp.

3075 {
3076  Q_D(QMdiSubWindow);
3077  if (d->hoveredSubControl != QStyle::SC_None) {
3078  d->hoveredSubControl = QStyle::SC_None;
3079  update(QRegion(0, 0, width(), d->titleBarHeight()));
3080  }
3081 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
int width() const
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ maximizedButtonsWidget()

QWidget * QMdiSubWindow::maximizedButtonsWidget ( ) const
Warning
This function is not part of the public interface.

Definition at line 2380 of file qmdisubwindow.cpp.

Referenced by event(), eventFilter(), and showEvent().

2381 {
2382  Q_D(const QMdiSubWindow);
2383  if (isVisible() && d->controlContainer && isMaximized() && !d->drawTitleBarWhenMaximized()
2384  && !isChildOfTabbedQMdiArea(this)) {
2385  return d->controlContainer->controllerWidget();
2386  }
2387  return 0;
2388 }
double d
Definition: qnumeric_p.h:62
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
bool isVisible() const
Definition: qwidget.h:1005
#define Q_D(Class)
Definition: qglobal.h:2482
bool isMaximized() const
Definition: qwidget.cpp:3074
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ maximizedSystemMenuIconWidget()

QWidget * QMdiSubWindow::maximizedSystemMenuIconWidget ( ) const
Warning
This function is not part of the public interface.

Definition at line 2393 of file qmdisubwindow.cpp.

Referenced by event(), and showSystemMenu().

2394 {
2395  Q_D(const QMdiSubWindow);
2396  if (isVisible() && d->controlContainer && isMaximized() && !d->drawTitleBarWhenMaximized()
2397  && !isChildOfTabbedQMdiArea(this)) {
2398  return d->controlContainer->systemMenuLabel();
2399  }
2400  return 0;
2401 }
double d
Definition: qnumeric_p.h:62
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
bool isVisible() const
Definition: qwidget.h:1005
#define Q_D(Class)
Definition: qglobal.h:2482
bool isMaximized() const
Definition: qwidget.cpp:3074
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ mdiArea()

QMdiArea * QMdiSubWindow::mdiArea ( ) const

Returns the area containing this sub-window, or 0 if there is none.

Since
4.4
See also
QMdiArea::addSubWindow()

Definition at line 2597 of file qmdisubwindow.cpp.

Referenced by isChildOfTabbedQMdiArea().

2598 {
2600  while (parent) {
2601  if (QMdiArea *area = qobject_cast<QMdiArea *>(parent)) {
2602  if (area->viewport() == parentWidget())
2603  return area;
2604  }
2605  parent = parent->parentWidget();
2606  }
2607  return 0;
2608 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QMdiArea widget provides an area in which MDI windows are displayed.
Definition: qmdiarea.h:59
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
static int area(const QSize &s)
Definition: qicon.cpp:155

◆ minimumSizeHint()

QSize QMdiSubWindow::minimumSizeHint ( ) const
virtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3519 of file qmdisubwindow.cpp.

Referenced by QMdiArea::minimumSizeHint(), and sizeHint().

3520 {
3521  Q_D(const QMdiSubWindow);
3522  if (isVisible())
3523  ensurePolished();
3524 
3525  // Minimized window.
3526  if (parent() && isMinimized() && !isShaded())
3527  return d->iconSize();
3528 
3529  // Calculate window decoration.
3530  int margin, minWidth;
3531  d->sizeParameters(&margin, &minWidth);
3532  int decorationHeight = margin + d->titleBarHeight();
3533  int minHeight = decorationHeight;
3534 
3535  // Shaded window.
3536  if (parent() && isShaded())
3537  return QSize(qMax(minWidth, width()), d->titleBarHeight());
3538 
3539  // Content
3540  if (layout()) {
3541  QSize minLayoutSize = layout()->minimumSize();
3542  if (minLayoutSize.isValid()) {
3543  minWidth = qMax(minWidth, minLayoutSize.width() + 2 * margin);
3544  minHeight += minLayoutSize.height();
3545  }
3546  } else if (d->baseWidget && d->baseWidget->isVisible()) {
3547  QSize minBaseWidgetSize = d->baseWidget->minimumSizeHint();
3548  if (minBaseWidgetSize.isValid()) {
3549  minWidth = qMax(minWidth, minBaseWidgetSize.width() + 2 * margin);
3550  minHeight += minBaseWidgetSize.height();
3551  }
3552  }
3553 
3554 #ifndef QT_NO_SIZEGRIP
3555  // SizeGrip
3556  int sizeGripHeight = 0;
3557  if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
3558  sizeGripHeight = d->sizeGrip->height();
3559 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
3560  else if (parent() && qobject_cast<QMacStyle *>(style()) && !d->sizeGrip)
3561  sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
3562 #endif
3563  minHeight = qMax(minHeight, decorationHeight + sizeGripHeight);
3564 #endif
3565 
3566  return QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut());
3567 }
double d
Definition: qnumeric_p.h:62
void ensurePolished() const
Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette).
Definition: qwidget.cpp:10024
bool isVisible() const
Definition: qwidget.h:1005
static QSize globalStrut()
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
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
#define Q_D(Class)
Definition: qglobal.h:2482
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QStyle * style() const
Definition: qwidget.cpp:2742
int width() const
Returns the width.
Definition: qsize.h:126
int width() const
bool isShaded() const
Returns true if this window is shaded; otherwise returns false.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
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
QSize minimumSize() const
Returns the minimum size of this layout.
Definition: qlayout.cpp:1166
bool isMinimized() const
Definition: qwidget.cpp:3027
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ mouseDoubleClickEvent()

void QMdiSubWindow::mouseDoubleClickEvent ( QMouseEvent mouseEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3246 of file qmdisubwindow.cpp.

3247 {
3248  if (!parent()) {
3249  QWidget::mouseDoubleClickEvent(mouseEvent);
3250  return;
3251  }
3252 
3253  if (mouseEvent->button() != Qt::LeftButton) {
3254  mouseEvent->ignore();
3255  return;
3256  }
3257 
3258  Q_D(QMdiSubWindow);
3259  if (!d->isMoveOperation()) {
3260 #ifndef QT_NO_MENU
3261  if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu)
3262  close();
3263 #endif
3264  return;
3265  }
3266 
3267  Qt::WindowFlags flags = windowFlags();
3268  if (isMinimized()) {
3269  if ((isShaded() && (flags & Qt::WindowShadeButtonHint))
3270  || (flags & Qt::WindowMinimizeButtonHint)) {
3271  showNormal();
3272  }
3273  return;
3274  }
3275 
3276  if (isMaximized()) {
3277  if (flags & Qt::WindowMaximizeButtonHint)
3278  showNormal();
3279  return;
3280  }
3281 
3282  if (flags & Qt::WindowShadeButtonHint)
3283  showShaded();
3284  else if (flags & Qt::WindowMaximizeButtonHint)
3285  showMaximized();
3286 }
void showMaximized()
Shows the widget maximized.
Definition: qwidget.cpp:3218
double d
Definition: qnumeric_p.h:62
void showShaded()
Calling this function makes the subwindow enter the shaded mode.
#define Q_D(Class)
Definition: qglobal.h:2482
void showNormal()
Restores the widget after it has been maximized or minimized.
Definition: qwidget.cpp:3250
virtual void mouseDoubleClickEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click...
Definition: qwidget.cpp:9306
bool isShaded() const
Returns true if this window is shaded; otherwise returns false.
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
bool isMaximized() const
Definition: qwidget.cpp:3074
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
bool isMinimized() const
Definition: qwidget.cpp:3027
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
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
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ mouseMoveEvent()

void QMdiSubWindow::mouseMoveEvent ( QMouseEvent mouseEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3328 of file qmdisubwindow.cpp.

3329 {
3330  if (!parent()) {
3331  QWidget::mouseMoveEvent(mouseEvent);
3332  return;
3333  }
3334 
3335  Q_D(QMdiSubWindow);
3336  // No update needed if we're in a move/resize operation.
3337  if (!d->isMoveOperation() && !d->isResizeOperation()) {
3338  // Find previous and current hover region.
3339  const QStyleOptionTitleBar options = d->titleBarOptions();
3340  QStyle::SubControl oldHover = d->hoveredSubControl;
3341  d->hoveredSubControl = d->getSubControl(mouseEvent->pos());
3342  QRegion hoverRegion;
3343  if (isHoverControl(oldHover) && oldHover != d->hoveredSubControl)
3344  hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, oldHover, this);
3345  if (isHoverControl(d->hoveredSubControl) && d->hoveredSubControl != oldHover) {
3346  hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
3347  d->hoveredSubControl, this);
3348  }
3349 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
3350  if (qobject_cast<QMacStyle *>(style()) && !hoverRegion.isEmpty())
3351  hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options));
3352 #endif
3353  if (!hoverRegion.isEmpty())
3354  update(hoverRegion);
3355  }
3356 
3357  if ((mouseEvent->buttons() & Qt::LeftButton) || d->isInInteractiveMode) {
3358  if ((d->isResizeOperation() && d->resizeEnabled) || (d->isMoveOperation() && d->moveEnabled))
3359  d->setNewGeometry(mapToParent(mouseEvent->pos()));
3360  return;
3361  }
3362 
3363  // Do not resize/move if not allowed.
3364  d->currentOperation = d->getOperation(mouseEvent->pos());
3365  if ((d->isResizeOperation() && !d->resizeEnabled) || (d->isMoveOperation() && !d->moveEnabled))
3366  d->currentOperation = QMdiSubWindowPrivate::None;
3367  d->updateCursor();
3368 }
double d
Definition: qnumeric_p.h:62
SubControl
This enum describes the available sub controls.
Definition: qstyle.h:402
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
#define Q_D(Class)
Definition: qglobal.h:2482
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:95
QStyle * style() const
Definition: qwidget.cpp:2742
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
int width() const
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static bool isHoverControl(QStyle::SubControl control)
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
Definition: qevent.h:102
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QPoint mapToParent(const QPoint &) const
Translates the widget coordinate pos to a coordinate in the parent widget.
Definition: qwidget.cpp:4459
virtual void mouseMoveEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
Definition: qwidget.cpp:9239
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ mousePressEvent()

void QMdiSubWindow::mousePressEvent ( QMouseEvent mouseEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3200 of file qmdisubwindow.cpp.

3201 {
3202  if (!parent()) {
3203  QWidget::mousePressEvent(mouseEvent);
3204  return;
3205  }
3206 
3207  Q_D(QMdiSubWindow);
3208  if (d->isInInteractiveMode)
3209  d->leaveInteractiveMode();
3210 #ifndef QT_NO_RUBBERBAND
3211  if (d->isInRubberBandMode)
3212  d->leaveRubberBandMode();
3213 #endif
3214 
3215  if (mouseEvent->button() != Qt::LeftButton) {
3216  mouseEvent->ignore();
3217  return;
3218  }
3219 
3220  if (d->currentOperation != QMdiSubWindowPrivate::None) {
3221  d->updateCursor();
3222  d->mousePressPosition = mapToParent(mouseEvent->pos());
3223  if (d->resizeEnabled || d->moveEnabled)
3224  d->oldGeometry = geometry();
3225 #ifndef QT_NO_RUBBERBAND
3226  if ((testOption(QMdiSubWindow::RubberBandResize) && d->isResizeOperation())
3227  || (testOption(QMdiSubWindow::RubberBandMove) && d->isMoveOperation())) {
3228  d->enterRubberBandMode();
3229  }
3230 #endif
3231  return;
3232  }
3233 
3234  d->activeSubControl = d->hoveredSubControl;
3235 #ifndef QT_NO_MENU
3236  if (d->activeSubControl == QStyle::SC_TitleBarSysMenu)
3237  showSystemMenu();
3238  else
3239 #endif
3240  update(QRegion(0, 0, width(), d->titleBarHeight()));
3241 }
double d
Definition: qnumeric_p.h:62
virtual void mousePressEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
Definition: qwidget.cpp:9261
void showSystemMenu()
Shows the system menu below the system menu icon in the title bar.
#define Q_D(Class)
Definition: qglobal.h:2482
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:95
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
int width() const
bool testOption(SubWindowOption) const
Returns true if option is enabled; otherwise returns false.
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QPoint mapToParent(const QPoint &) const
Translates the widget coordinate pos to a coordinate in the parent widget.
Definition: qwidget.cpp:4459
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
const QRect & geometry() const
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ mouseReleaseEvent()

void QMdiSubWindow::mouseReleaseEvent ( QMouseEvent mouseEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3291 of file qmdisubwindow.cpp.

3292 {
3293  if (!parent()) {
3294  QWidget::mouseReleaseEvent(mouseEvent);
3295  return;
3296  }
3297 
3298  if (mouseEvent->button() != Qt::LeftButton) {
3299  mouseEvent->ignore();
3300  return;
3301  }
3302 
3303  Q_D(QMdiSubWindow);
3304  if (d->currentOperation != QMdiSubWindowPrivate::None) {
3305 #ifndef QT_NO_RUBBERBAND
3306  if (d->isInRubberBandMode && !d->isInInteractiveMode)
3307  d->leaveRubberBandMode();
3308 #endif
3309  if (d->resizeEnabled || d->moveEnabled)
3310  d->oldGeometry = geometry();
3311  }
3312 
3313  d->currentOperation = d->getOperation(mouseEvent->pos());
3314  d->updateCursor();
3315 
3316  d->hoveredSubControl = d->getSubControl(mouseEvent->pos());
3317  if (d->activeSubControl != QStyle::SC_None
3318  && d->activeSubControl == d->hoveredSubControl) {
3319  d->processClickedSubControl();
3320  }
3321  d->activeSubControl = QStyle::SC_None;
3322  update(QRegion(0, 0, width(), d->titleBarHeight()));
3323 }
double d
Definition: qnumeric_p.h:62
virtual void mouseReleaseEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
Definition: qwidget.cpp:9286
#define Q_D(Class)
Definition: qglobal.h:2482
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:95
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
int width() const
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
const QRect & geometry() const
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ moveEvent()

void QMdiSubWindow::moveEvent ( QMoveEvent moveEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3131 of file qmdisubwindow.cpp.

3132 {
3133  if (!parent()) {
3134  QWidget::moveEvent(moveEvent);
3135  return;
3136  }
3137 
3138  Q_D(QMdiSubWindow);
3139  if (d->isMaximizeMode)
3140  d->ensureWindowState(Qt::WindowMaximized);
3141 }
double d
Definition: qnumeric_p.h:62
virtual void moveEvent(QMoveEvent *)
This event handler can be reimplemented in a subclass to receive widget move events which are passed ...
Definition: qwidget.cpp:9566
#define Q_D(Class)
Definition: qglobal.h:2482
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ paintEvent()

void QMdiSubWindow::paintEvent ( QPaintEvent paintEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3146 of file qmdisubwindow.cpp.

3147 {
3148  if (!parent() || (windowFlags() & Qt::FramelessWindowHint)) {
3149  QWidget::paintEvent(paintEvent);
3150  return;
3151  }
3152 
3153  Q_D(QMdiSubWindow);
3154  if (isMaximized() && !d->drawTitleBarWhenMaximized())
3155  return;
3156 
3157  if (d->resizeTimerId != -1) {
3158  // Only update the style option rect and the window title.
3159  int border = d->hasBorder(d->cachedStyleOptions) ? 4 : 0;
3160  int titleBarHeight = d->titleBarHeight(d->cachedStyleOptions);
3161  titleBarHeight -= isMinimized() ? 2 * border : border;
3162  d->cachedStyleOptions.rect = QRect(border, border, width() - 2 * border, titleBarHeight);
3163  if (!d->windowTitle.isEmpty()) {
3164  int width = style()->subControlRect(QStyle::CC_TitleBar, &d->cachedStyleOptions,
3166  d->cachedStyleOptions.text = d->cachedStyleOptions.fontMetrics
3167  .elidedText(d->windowTitle, Qt::ElideRight, width);
3168  }
3169  } else {
3170  // Force full update.
3171  d->cachedStyleOptions = d->titleBarOptions();
3172  }
3173 
3174  QStylePainter painter(this);
3175  if (!d->windowTitle.isEmpty())
3176  painter.setFont(d->font);
3177  painter.drawComplexControl(QStyle::CC_TitleBar, d->cachedStyleOptions);
3178 
3179  if (isMinimized() && !d->hasBorder(d->cachedStyleOptions))
3180  return;
3181 
3182  QStyleOptionFrame frameOptions;
3183  frameOptions.initFrom(this);
3184  frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this);
3185  if (d->isActive)
3186  frameOptions.state |= QStyle::State_Active;
3187  else
3188  frameOptions.state &= ~QStyle::State_Active;
3189 
3190  // ### Ensure that we do not require setting the cliprect for 4.4
3191  if (!isMinimized() && !d->hasBorder(d->cachedStyleOptions))
3192  painter.setClipRect(rect().adjusted(0, d->titleBarHeight(d->cachedStyleOptions), 0, 0));
3193  if (!isMinimized() || d->hasBorder(d->cachedStyleOptions))
3194  painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions);
3195 }
double d
Definition: qnumeric_p.h:62
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
#define Q_D(Class)
Definition: qglobal.h:2482
QStyle * style() const
Definition: qwidget.cpp:2742
virtual void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qwidget.cpp:9548
int lineWidth
the line width for drawing the frame
Definition: qstyleoption.h:124
int width() const
void initFrom(const QWidget *w)
Definition: qstyleoption.h:99
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
bool isMaximized() const
Definition: qwidget.cpp:3074
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
bool isMinimized() const
Definition: qwidget.cpp:3027
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget...
Definition: qstylepainter.h:55
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ resizeEvent()

void QMdiSubWindow::resizeEvent ( QResizeEvent resizeEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3086 of file qmdisubwindow.cpp.

3087 {
3088  Q_D(QMdiSubWindow);
3089 #ifndef QT_NO_SIZEGRIP
3090  if (d->sizeGrip) {
3091  d->sizeGrip->move(isLeftToRight() ? width() - d->sizeGrip->width() : 0,
3092  height() - d->sizeGrip->height());
3093  }
3094 #endif
3095 
3096  if (!parent()) {
3097  QWidget::resizeEvent(resizeEvent);
3098  return;
3099  }
3100 
3101  if (d->isMaximizeMode)
3102  d->ensureWindowState(Qt::WindowMaximized);
3103 
3104  d->updateMask();
3105  if (!isVisible())
3106  return;
3107 
3108  if (d->resizeTimerId <= 0)
3109  d->cachedStyleOptions = d->titleBarOptions();
3110  else
3111  killTimer(d->resizeTimerId);
3112  d->resizeTimerId = startTimer(200);
3113 }
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
double d
Definition: qnumeric_p.h:62
bool isVisible() const
Definition: qwidget.h:1005
virtual void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qwidget.cpp:9587
#define Q_D(Class)
Definition: qglobal.h:2482
int height() const
int width() const
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
bool isLeftToRight() const
Definition: qwidget.h:429
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650

◆ setKeyboardPageStep()

void QMdiSubWindow::setKeyboardPageStep ( int  step)

Definition at line 2496 of file qmdisubwindow.cpp.

2497 {
2498  // Haven't done any boundary check here since negative step only
2499  // means inverted behavior, which is OK if the user want it.
2500  // A step equal to zero means "do nothing".
2501  d_func()->keyboardPageStep = step;
2502 }

◆ setKeyboardSingleStep()

void QMdiSubWindow::setKeyboardSingleStep ( int  step)

Definition at line 2466 of file qmdisubwindow.cpp.

2467 {
2468  // Haven't done any boundary check here since negative step only
2469  // means inverted behavior, which is OK if the user want it.
2470  // A step equal to zero means "do nothing".
2471  d_func()->keyboardSingleStep = step;
2472 }

◆ setOption()

void QMdiSubWindow::setOption ( SubWindowOption  option,
bool  on = true 
)

If on is true, option is enabled on the subwindow; otherwise it is disabled.

See SubWindowOption for the effect of each option.

See also
SubWindowOption, testOption()

Definition at line 2420 of file qmdisubwindow.cpp.

Referenced by QMdiAreaPrivate::appendChild(), event(), and QMdiAreaPrivate::scrollBarPolicyChanged().

2421 {
2422  Q_D(QMdiSubWindow);
2423  if (on && !(d->options & option))
2424  d->options |= option;
2425  else if (!on && (d->options & option))
2426  d->options &= ~option;
2427 
2428 #ifndef QT_NO_RUBBERBAND
2429  if ((option & (RubberBandResize | RubberBandMove)) && !on && d->isInRubberBandMode)
2430  d->leaveRubberBandMode();
2431 #endif
2432 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ setSystemMenu()

void QMdiSubWindow::setSystemMenu ( QMenu systemMenu)

Sets systemMenu as the current system menu for this subwindow.

By default, each QMdiSubWindow has a standard system menu.

QActions for the system menu created by QMdiSubWindow will automatically be updated depending on the current window state; e.g., the minimize action will be disabled after the window is minimized.

QActions added by the user are not updated by QMdiSubWindow.

QMdiSubWindow takes ownership of systemMenu; you do not have to delete it. Any existing menus will be deleted.

See also
systemMenu(), showSystemMenu()

Definition at line 2522 of file qmdisubwindow.cpp.

2523 {
2524  Q_D(QMdiSubWindow);
2525  if (systemMenu && systemMenu == d->systemMenu) {
2526  qWarning("QMdiSubWindow::setSystemMenu: system menu is already set");
2527  return;
2528  }
2529 
2530  if (d->systemMenu) {
2531  delete d->systemMenu;
2532  d->systemMenu = 0;
2533  }
2534 
2535  if (!systemMenu)
2536  return;
2537 
2538  if (systemMenu->parent() != this)
2539  systemMenu->setParent(this);
2540  d->systemMenu = systemMenu;
2541 }
double d
Definition: qnumeric_p.h:62
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QMenu * systemMenu() const
Returns a pointer to the current system menu, or zero if no system menu is set.
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qWarning(const char *,...)
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ setWidget()

void QMdiSubWindow::setWidget ( QWidget widget)

Sets widget as the internal widget of this subwindow.

The internal widget is displayed in the center of the subwindow beneath the title bar.

QMdiSubWindow takes temporary ownership of widget; you do not have to delete it. Any existing internal widget will be removed and reparented to the root window.

See also
widget()

Definition at line 2313 of file qmdisubwindow.cpp.

Referenced by QMdiArea::addSubWindow(), and QMdiArea::removeSubWindow().

2314 {
2315  Q_D(QMdiSubWindow);
2316  if (!widget) {
2317  d->removeBaseWidget();
2318  return;
2319  }
2320 
2321  if (widget == d->baseWidget) {
2322  qWarning("QMdiSubWindow::setWidget: widget is already set");
2323  return;
2324  }
2325 
2326  bool wasResized = testAttribute(Qt::WA_Resized);
2327  d->removeBaseWidget();
2328 
2329  if (QLayout *layout = this->layout())
2330  layout->addWidget(widget);
2331  else
2332  widget->setParent(this);
2333 
2334 #ifndef QT_NO_SIZEGRIP
2335  QSizeGrip *sizeGrip = widget->findChild<QSizeGrip *>();
2336  if (sizeGrip)
2337  sizeGrip->installEventFilter(this);
2338  if (d->sizeGrip)
2339  d->sizeGrip->raise();
2340 #endif
2341 
2342  d->baseWidget = widget;
2343  d->baseWidget->installEventFilter(this);
2344 
2345  d->ignoreWindowTitleChange = true;
2346  bool isWindowModified = this->isWindowModified();
2347  if (windowTitle().isEmpty()) {
2348  d->updateWindowTitle(true);
2349  isWindowModified = d->baseWidget->isWindowModified();
2350  }
2351  if (!this->isWindowModified() && isWindowModified
2352  && windowTitle().contains(QLatin1String("[*]"))) {
2353  setWindowModified(isWindowModified);
2354  }
2355  d->lastChildWindowTitle = d->baseWidget->windowTitle();
2356  d->ignoreWindowTitleChange = false;
2357 
2358  if (windowIcon().isNull() && !d->baseWidget->windowIcon().isNull())
2359  setWindowIcon(d->baseWidget->windowIcon());
2360 
2361  d->updateGeometryConstraints();
2362  if (!wasResized && testAttribute(Qt::WA_Resized))
2363  setAttribute(Qt::WA_Resized, false);
2364 }
double d
Definition: qnumeric_p.h:62
The QSizeGrip class provides a resize handle for resizing top-level windows.
Definition: qsizegrip.h:55
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
void setWindowModified(bool)
Definition: qwidget.cpp:11559
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_D(Class)
Definition: qglobal.h:2482
bool isWindowModified() const
Definition: qwidget.cpp:11554
QIcon windowIcon() const
static bool isEmpty(const char *str)
QWidget * widget() const
Returns the current internal widget.
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
Q_CORE_EXPORT void qWarning(const char *,...)
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.
Definition: qobject.h:158
QString windowTitle() const
void setWindowIcon(const QIcon &icon)
Definition: qwidget.cpp:6362
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
Definition: qlayout.cpp:319
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
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
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300

◆ showEvent()

void QMdiSubWindow::showEvent ( QShowEvent showEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 2946 of file qmdisubwindow.cpp.

2947 {
2948  Q_D(QMdiSubWindow);
2949  if (!parent()) {
2950  QWidget::showEvent(showEvent);
2951  return;
2952  }
2953 
2954 #if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
2955  if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip
2957  d->setSizeGrip(new QSizeGrip(0));
2958  Q_ASSERT(d->sizeGrip);
2959  if (isMinimized())
2960  d->setSizeGripVisible(false);
2961  else
2962  d->setSizeGripVisible(true);
2963  resize(size().expandedTo(d->internalMinimumSize));
2964  }
2965 #endif
2966 
2967  d->updateDirtyRegions();
2968  // Show buttons in the menu bar if they're already not there.
2969  // We want to do this when QMdiSubWindow becomes visible after being hidden.
2970 #ifndef QT_NO_MENUBAR
2971  if (d->controlContainer) {
2972  if (QMenuBar *menuBar = d->menuBar()) {
2973  if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget())
2974  d->showButtonsInMenuBar(menuBar);
2975  }
2976  }
2977 #endif
2978  d->setActive(true);
2979 }
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
The QSizeGrip class provides a resize handle for resizing top-level windows.
Definition: qsizegrip.h:55
QSize size() const
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
QStyle * style() const
Definition: qwidget.cpp:2742
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
bool isMinimized() const
Definition: qwidget.cpp:3027
QWidget * maximizedButtonsWidget() const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ showShaded

void QMdiSubWindow::showShaded ( )
slot

Calling this function makes the subwindow enter the shaded mode.

When the subwindow is shaded, only the title bar is visible.

Although shading is not supported by all styles, this function will still show the subwindow as shaded, regardless of whether support for shading is available. However, when used with styles without shading support, the user will be unable to return from shaded mode through the user interface (e.g., through a shade button in the title bar).

See also
isShaded()

Definition at line 2623 of file qmdisubwindow.cpp.

Referenced by event(), and mouseDoubleClickEvent().

2624 {
2625  if (!parent())
2626  return;
2627 
2628  Q_D(QMdiSubWindow);
2629  // setMinimizeMode uses this function.
2630  if (!d->isShadeRequestFromMinimizeMode && isShaded())
2631  return;
2632 
2633  d->isMaximizeMode = false;
2634 
2635  QWidget *currentFocusWidget = QApplication::focusWidget();
2636  if (!d->restoreFocusWidget && isAncestorOf(currentFocusWidget))
2637  d->restoreFocusWidget = currentFocusWidget;
2638 
2639  if (!d->isShadeRequestFromMinimizeMode) {
2640  d->isShadeMode = true;
2641  d->ensureWindowState(Qt::WindowMinimized);
2642  }
2643 
2644 #ifndef QT_NO_MENUBAR
2645  d->removeButtonsFromMenuBar();
2646 #endif
2647 
2648  // showMinimized() will reset Qt::WindowActive, which makes sense
2649  // for top level widgets, but in MDI it makes sense to have an
2650  // active window which is minimized.
2651  if (hasFocus() || isAncestorOf(currentFocusWidget))
2652  d->ensureWindowState(Qt::WindowActive);
2653 
2654 #ifndef QT_NO_SIZEGRIP
2655  d->setSizeGripVisible(false);
2656 #endif
2657 
2658  if (!d->restoreSize.isValid() || d->isShadeMode) {
2659  d->oldGeometry = geometry();
2660  d->restoreSize.setWidth(d->oldGeometry.width());
2661  d->restoreSize.setHeight(d->oldGeometry.height());
2662  }
2663 
2664  // Hide the window before we change the geometry to avoid multiple resize
2665  // events and wrong window state.
2666  const bool wasVisible = isVisible();
2667  if (wasVisible)
2668  setVisible(false);
2669 
2670  d->updateGeometryConstraints();
2671  // Update minimum size to internalMinimumSize if set by user.
2672  if (!minimumSize().isNull()) {
2673  d->userMinimumSize = minimumSize();
2674  setMinimumSize(d->internalMinimumSize);
2675  }
2676  resize(d->internalMinimumSize);
2677 
2678  // Hide the internal widget if not already hidden by the user.
2679  if (d->baseWidget && !d->baseWidget->isHidden()) {
2680  d->baseWidget->hide();
2681  d->isWidgetHiddenByUs = true;
2682  }
2683 
2684  if (wasVisible)
2685  setVisible(true);
2686 
2687  d->setFocusWidget();
2688  d->resizeEnabled = false;
2689  d->moveEnabled = true;
2690  d->updateDirtyRegions();
2691  d->updateMask();
2692 
2693 #ifndef QT_NO_ACTION
2694  d->setEnabled(QMdiSubWindowPrivate::MinimizeAction, false);
2695  d->setEnabled(QMdiSubWindowPrivate::ResizeAction, d->resizeEnabled);
2696  d->setEnabled(QMdiSubWindowPrivate::MaximizeAction, true);
2697  d->setEnabled(QMdiSubWindowPrivate::RestoreAction, true);
2698  d->setEnabled(QMdiSubWindowPrivate::MoveAction, d->moveEnabled);
2699 #endif
2700 }
double d
Definition: qnumeric_p.h:62
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setMinimumSize(const QSize &)
Definition: qwidget.h:969
bool hasFocus() const
Definition: qwidget.cpp:6583
#define Q_D(Class)
Definition: qglobal.h:2482
bool isShaded() const
Returns true if this window is shaded; otherwise returns false.
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
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...
Definition: qwidget.cpp:8573
QSize minimumSize() const
const QRect & geometry() const
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300

◆ showSystemMenu

void QMdiSubWindow::showSystemMenu ( )
slot

Shows the system menu below the system menu icon in the title bar.

See also
setSystemMenu(), systemMenu()

Definition at line 2560 of file qmdisubwindow.cpp.

Referenced by mousePressEvent().

2561 {
2562  Q_D(QMdiSubWindow);
2563  if (!d->systemMenu)
2564  return;
2565 
2566  QPoint globalPopupPos;
2567  if (QWidget *icon = maximizedSystemMenuIconWidget()) {
2568  if (isLeftToRight())
2569  globalPopupPos = icon->mapToGlobal(QPoint(0, icon->y() + icon->height()));
2570  else
2571  globalPopupPos = icon->mapToGlobal(QPoint(icon->width(), icon->y() + icon->height()));
2572  } else {
2573  if (isLeftToRight())
2574  globalPopupPos = mapToGlobal(contentsRect().topLeft());
2575  else // + QPoint(1, 0) because topRight() == QPoint(left() + width() -1, top())
2576  globalPopupPos = mapToGlobal(contentsRect().topRight()) + QPoint(1, 0);
2577  }
2578 
2579  // Adjust x() with -menuwidth in reverse mode.
2580  if (isRightToLeft())
2581  globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0);
2582  d->systemMenu->installEventFilter(this);
2583  d->systemMenu->popup(globalPopupPos);
2584 }
double d
Definition: qnumeric_p.h:62
QRect contentsRect() const
Returns the area inside the widget&#39;s margins.
Definition: qwidget.cpp:7544
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_D(Class)
Definition: qglobal.h:2482
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QWidget * maximizedSystemMenuIconWidget() const
bool isLeftToRight() const
Definition: qwidget.h:429
bool isRightToLeft() const
Definition: qwidget.h:428
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ sizeHint()

QSize QMdiSubWindow::sizeHint ( ) const
virtual

Reimplemented Function

Reimplemented from QWidget.

Definition at line 3505 of file qmdisubwindow.cpp.

Referenced by QMdiAreaPrivate::appendChild(), QMdiArea::showEvent(), and QMdiArea::sizeHint().

3506 {
3507  Q_D(const QMdiSubWindow);
3508  int margin, minWidth;
3509  d->sizeParameters(&margin, &minWidth);
3510  QSize size(2 * margin, d->titleBarHeight() + margin);
3511  if (d->baseWidget && d->baseWidget->sizeHint().isValid())
3512  size += d->baseWidget->sizeHint();
3513  return size.expandedTo(minimumSizeHint());
3514 }
double d
Definition: qnumeric_p.h:62
QSize size() const
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
#define Q_D(Class)
Definition: qglobal.h:2482
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QSize minimumSizeHint() const
Reimplemented Function
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ systemMenu()

QMenu * QMdiSubWindow::systemMenu ( ) const

Returns a pointer to the current system menu, or zero if no system menu is set.

QMdiSubWindow provides a default system menu, but you can also set the menu with setSystemMenu().

See also
setSystemMenu(), showSystemMenu()

Definition at line 2550 of file qmdisubwindow.cpp.

Referenced by setSystemMenu().

2551 {
2552  return d_func()->systemMenu;
2553 }

◆ testOption()

bool QMdiSubWindow::testOption ( SubWindowOption  option) const

Returns true if option is enabled; otherwise returns false.

See also
SubWindowOption, setOption()

Definition at line 2439 of file qmdisubwindow.cpp.

Referenced by eventFilter(), and mousePressEvent().

2440 {
2441  return d_func()->options & option;
2442 }

◆ timerEvent()

void QMdiSubWindow::timerEvent ( QTimerEvent timerEvent)
protectedvirtual

Reimplemented Function

Reimplemented from QObject.

Definition at line 3118 of file qmdisubwindow.cpp.

3119 {
3120  Q_D(QMdiSubWindow);
3121  if (timerEvent->timerId() == d->resizeTimerId) {
3122  killTimer(d->resizeTimerId);
3123  d->resizeTimerId = -1;
3124  d->updateDirtyRegions();
3125  }
3126 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650

◆ widget()

QWidget * QMdiSubWindow::widget ( ) const

Returns the current internal widget.

See also
setWidget()

Definition at line 2371 of file qmdisubwindow.cpp.

Referenced by QAccessibleMdiSubWindow::indexOfChild(), QAccessibleMdiSubWindow::navigate(), QMdiArea::removeSubWindow(), and setWidget().

2372 {
2373  return d_func()->baseWidget;
2374 }

◆ windowStateChanged

QMdiSubWindow::windowStateChanged ( Qt::WindowStates  oldState,
Qt::WindowStates  newState 
)
signal

QMdiSubWindow emits this signal after the window state changes.

oldState is the window state before it changed, and newState is the new, current state.

Referenced by changeEvent().

Friends and Related Functions

◆ QMdi::ControlContainer

Definition at line 148 of file qmdisubwindow.h.

◆ QMdiAreaPrivate

friend class QMdiAreaPrivate
friend

Definition at line 144 of file qmdisubwindow.h.

◆ QMdiAreaTabBar

friend class QMdiAreaTabBar
friend

Definition at line 146 of file qmdisubwindow.h.

Properties

◆ keyboardPageStep

int QMdiSubWindow::keyboardPageStep
private

sets how far a widget should move or resize when using the keyboard page keys.

When in keyboard-interactive mode, you can use the arrow and page keys to either move or resize the window. This property controls the page keys. The common way to enter keyboard interactive mode is to enter the subwindow menu, and select either "resize" or "move".

The default keyboard page step value is 20 pixels.

See also
keyboardSingleStep

Definition at line 64 of file qmdisubwindow.h.

◆ keyboardSingleStep

int QMdiSubWindow::keyboardSingleStep
private

sets how far a widget should move or resize when using the keyboard arrow keys.

When in keyboard-interactive mode, you can use the arrow and page keys to either move or resize the window. This property controls the arrow keys. The common way to enter keyboard interactive mode is to enter the subwindow menu, and select either "resize" or "move".

The default keyboard single step value is 5 pixels.

See also
keyboardPageStep

Definition at line 63 of file qmdisubwindow.h.


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