Qt 4.8
Classes | Public Types | Public Functions | Public Variables | List of all members
QMdiSubWindowPrivate Class Reference

#include <qmdisubwindow_p.h>

Inheritance diagram for QMdiSubWindowPrivate:
QWidgetPrivate QObjectPrivate QObjectData

Classes

struct  OperationInfo
 

Public Types

enum  ChangeFlag {
  HMove = 0x01, VMove = 0x02, HResize = 0x04, VResize = 0x08,
  HResizeReverse = 0x10, VResizeReverse = 0x20
}
 
enum  Operation {
  None, Move, TopResize, BottomResize,
  LeftResize, RightResize, TopLeftResize, TopRightResize,
  BottomLeftResize, BottomRightResize
}
 
typedef QMap< Operation, OperationInfoOperationInfoMap
 
enum  WindowStateAction {
  RestoreAction, MoveAction, ResizeAction, MinimizeAction,
  MaximizeAction, StayOnTopAction, CloseAction, NumWindowStateActions
}
 
- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 

Public Functions

void _q_enterInteractiveMode ()
 
void _q_processFocusChanged (QWidget *old, QWidget *now)
 
void _q_updateStaysOnTopHint ()
 
void addToSystemMenu (WindowStateAction, const QString &text, const char *slot)
 
bool autoRaise () const
 
void createSystemMenu ()
 
QPalette desktopPalette () const
 
bool drawTitleBarWhenMaximized () const
 
void ensureWindowState (Qt::WindowState state)
 
void enterRubberBandMode ()
 
Operation getOperation (const QPoint &pos) const
 
QRegion getRegion (Operation operation) const
 
QStyle::SubControl getSubControl (const QPoint &pos) const
 
bool hasBorder (const QStyleOptionTitleBar &options) const
 
QSize iconSize () const
 
void initOperationMap ()
 
bool isMoveOperation () const
 
bool isResizeOperation () const
 
void leaveInteractiveMode ()
 
void leaveRubberBandMode ()
 
QMenuBarmenuBar () const
 
QString originalWindowTitle ()
 
void processClickedSubControl ()
 
 QMdiSubWindowPrivate ()
 
void removeBaseWidget ()
 
void removeButtonsFromMenuBar ()
 
void restoreFocus ()
 
void setActive (bool activate, bool changeFocus=true)
 
void setEnabled (WindowStateAction, bool enable=true)
 
void setFocusWidget ()
 
void setMaximizeMode ()
 
void setMinimizeMode ()
 
void setNewGeometry (const QPoint &pos)
 
void setNewGeometry (QRect *geometry)
 
void setNewWindowTitle ()
 
void setNormalMode ()
 
void setSizeGrip (QSizeGrip *sizeGrip)
 
void setSizeGripVisible (bool visible=true) const
 
void setVisible (WindowStateAction, bool visible=true)
 
void setWindowFlags (Qt::WindowFlags windowFlags)
 
void showButtonsInMenuBar (QMenuBar *menuBar)
 
void sizeParameters (int *margin, int *minWidth) const
 
int titleBarHeight (const QStyleOptionTitleBar &options) const
 
int titleBarHeight () const
 
QStyleOptionTitleBar titleBarOptions () const
 
void updateActions ()
 
void updateCursor ()
 
void updateDirtyRegions ()
 
void updateGeometryConstraints ()
 
void updateInternalWindowTitle ()
 
void updateMask ()
 
void updateWindowTitle (bool requestFromChild)
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

QPointer< QActionactions [NumWindowStateActions]
 
bool activationEnabled
 
QStyle::SubControl activeSubControl
 
QPointer< QWidgetbaseWidget
 
QStyleOptionTitleBar cachedStyleOptions
 
QPointer< QMdi::ControlContainercontrolContainer
 
Operation currentOperation
 
Qt::FocusReason focusInReason
 
QFont font
 
QStyle::SubControl hoveredSubControl
 
bool ignoreNextActivationEvent
 
bool ignoreWindowTitleChange
 
QSize internalMinimumSize
 
bool isActive
 
bool isExplicitlyDeactivated
 
bool isInInteractiveMode
 
bool isInRubberBandMode
 
bool isMaximizeMode
 
bool isShadeMode
 
bool isShadeRequestFromMinimizeMode
 
bool isWidgetHiddenByUs
 
int keyboardPageStep
 
int keyboardSingleStep
 
QString lastChildWindowTitle
 
QIcon menuIcon
 
QPoint mousePressPosition
 
bool moveEnabled
 
QRect oldGeometry
 
OperationInfoMap operationMap
 
QMdiSubWindow::SubWindowOptions options
 
QString originalTitle
 
bool resizeEnabled
 
int resizeTimerId
 
QPointer< QWidgetrestoreFocusWidget
 
QSize restoreSize
 
QRubberBandrubberBand
 
QPointer< QSizeGripsizeGrip
 
QPointer< QMenusystemMenu
 
QPalette titleBarPalette
 
QSize userMinimumSize
 
QString windowTitle
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Detailed Description

Definition at line 121 of file qmdisubwindow_p.h.

Typedefs

◆ OperationInfoMap

Definition at line 172 of file qmdisubwindow_p.h.

Enumerations

◆ ChangeFlag

Enumerator
HMove 
VMove 
HResize 
VResize 
HResizeReverse 
VResizeReverse 

Definition at line 139 of file qmdisubwindow_p.h.

◆ Operation

◆ WindowStateAction

Enumerator
RestoreAction 
MoveAction 
ResizeAction 
MinimizeAction 
MaximizeAction 
StayOnTopAction 
CloseAction 
NumWindowStateActions 

Definition at line 148 of file qmdisubwindow_p.h.

Constructors and Destructors

◆ QMdiSubWindowPrivate()

QMdiSubWindowPrivate::QMdiSubWindowPrivate ( )
Warning
This function is not part of the public interface.

Definition at line 877 of file qmdisubwindow.cpp.

878  : baseWidget(0),
880  controlContainer(0),
881 #ifndef QT_NO_SIZEGRIP
882  sizeGrip(0),
883 #endif
884 #ifndef QT_NO_RUBBERBAND
885  rubberBand(0),
886 #endif
887  userMinimumSize(0,0),
888  resizeEnabled(true),
889  moveEnabled(true),
890  isInInteractiveMode(false),
891 #ifndef QT_NO_RUBBERBAND
892  isInRubberBandMode(false),
893 #endif
894  isShadeMode(false),
897  activationEnabled(true),
899  isMaximizeMode(false),
900  isWidgetHiddenByUs(false),
901  isActive(false),
904  keyboardPageStep(20),
905  resizeTimerId(-1),
910 {
912 }
QPointer< QWidget > restoreFocusWidget
QPointer< QMdi::ControlContainer > controlContainer
QPointer< QWidget > baseWidget
Qt::FocusReason focusInReason
QStyle::SubControl activeSubControl
QRubberBand * rubberBand
QPointer< QSizeGrip > sizeGrip
QStyle::SubControl hoveredSubControl

Functions

◆ _q_enterInteractiveMode()

void QMdiSubWindowPrivate::_q_enterInteractiveMode ( )
Warning
This function is not part of the public interface.

Definition at line 936 of file qmdisubwindow.cpp.

Referenced by createSystemMenu().

937 {
938 #ifndef QT_NO_ACTION
940  QAction *action = qobject_cast<QAction *>(q->sender());
941  if (!action)
942  return;
943 
944  QPoint pressPos;
945  if (actions[MoveAction] && actions[MoveAction] == action) {
947  pressPos = QPoint(q->width() / 2, titleBarHeight() - 1);
948  } else if (actions[ResizeAction] && actions[ResizeAction] == action) {
949  currentOperation = q->isLeftToRight() ? BottomRightResize : BottomLeftResize;
950  int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q) / 2;
951  int x = q->isLeftToRight() ? q->width() - offset : offset;
952  pressPos = QPoint(x, q->height() - offset);
953  } else {
954  return;
955  }
956 
957  updateCursor();
958 #ifndef QT_NO_CURSOR
959  q->cursor().setPos(q->mapToGlobal(pressPos));
960 #endif
961  mousePressPosition = q->mapToParent(pressPos);
962  oldGeometry = q->geometry();
963  isInInteractiveMode = true;
964  q->setFocus();
965 #ifndef QT_NO_RUBBERBAND
966  if ((q->testOption(QMdiSubWindow::RubberBandResize)
968  || (q->testOption(QMdiSubWindow::RubberBandMove) && currentOperation == Move)) {
970  } else
971 #endif // QT_NO_RUBBERBAND
972  {
973  q->grabMouse();
974  }
975 #endif // QT_NO_ACTION
976 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
int titleBarHeight() const
#define Q_Q(Class)
Definition: qglobal.h:2483
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QPointer< QAction > actions[NumWindowStateActions]
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64

◆ _q_processFocusChanged()

void QMdiSubWindowPrivate::_q_processFocusChanged ( QWidget old,
QWidget now 
)
Warning
This function is not part of the public interface.

Definition at line 981 of file qmdisubwindow.cpp.

982 {
983  Q_UNUSED(old);
985  if (now && (now == q || q->isAncestorOf(now))) {
986  if (now == q && !isInInteractiveMode)
987  setFocusWidget();
988  setActive(true);
989  }
990 }
#define Q_Q(Class)
Definition: qglobal.h:2483
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
void setActive(bool activate, bool changeFocus=true)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ _q_updateStaysOnTopHint()

void QMdiSubWindowPrivate::_q_updateStaysOnTopHint ( )
Warning
This function is not part of the public interface.

Definition at line 917 of file qmdisubwindow.cpp.

Referenced by createSystemMenu().

918 {
919 #ifndef QT_NO_ACTION
921  if (QAction *senderAction = qobject_cast<QAction *>(q->sender())) {
922  if (senderAction->isChecked()) {
923  q->setWindowFlags(q->windowFlags() | Qt::WindowStaysOnTopHint);
924  q->raise();
925  } else {
926  q->setWindowFlags(q->windowFlags() & ~Qt::WindowStaysOnTopHint);
927  q->lower();
928  }
929  }
930 #endif // QT_NO_ACTION
931 }
#define Q_Q(Class)
Definition: qglobal.h:2483
Definition: qnamespace.h:54
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64

◆ addToSystemMenu()

void QMdiSubWindowPrivate::addToSystemMenu ( WindowStateAction  action,
const QString text,
const char *  slot 
)

Definition at line 2159 of file qmdisubwindow.cpp.

Referenced by createSystemMenu().

2161 {
2162  if (!systemMenu)
2163  return;
2164  actions[action] = systemMenu->addAction(text, q_func(), slot);
2165 }
QAction * addAction(const QString &text)
This convenience function creates a new action with text.
Definition: qmenu.cpp:1453
QPointer< QMenu > systemMenu
QPointer< QAction > actions[NumWindowStateActions]

◆ autoRaise()

bool QMdiSubWindowPrivate::autoRaise ( ) const
inline

Definition at line 327 of file qmdisubwindow_p.h.

Referenced by titleBarOptions().

328  {
329  Q_Q(const QMdiSubWindow);
330  return q->style()->styleHint(QStyle::SH_TitleBar_AutoRaise, 0, q);
331  }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ createSystemMenu()

void QMdiSubWindowPrivate::createSystemMenu ( )
Warning
This function is not part of the public interface.

Definition at line 1060 of file qmdisubwindow.cpp.

1061 {
1062  Q_Q(QMdiSubWindow);
1063  Q_ASSERT_X(q, "QMdiSubWindowPrivate::createSystemMenu",
1064  "You can NOT call this function before QMdiSubWindow's ctor");
1065  systemMenu = new QMenu(q);
1066  const QStyle *style = q->style();
1067  addToSystemMenu(RestoreAction, QMdiSubWindow::tr("&Restore"), SLOT(showNormal()));
1069  actions[RestoreAction]->setEnabled(false);
1072  addToSystemMenu(MinimizeAction, QMdiSubWindow::tr("Mi&nimize"), SLOT(showMinimized()));
1074  addToSystemMenu(MaximizeAction, QMdiSubWindow::tr("Ma&ximize"), SLOT(showMaximized()));
1079  addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), SLOT(close()));
1081 #if !defined(QT_NO_SHORTCUT)
1083 #endif
1084  updateActions();
1085 }
void setCheckable(bool)
Definition: qaction.cpp:1094
#define SLOT(a)
Definition: qobjectdefs.h:226
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
void setEnabled(bool)
Definition: qaction.cpp:1192
#define Q_Q(Class)
Definition: qglobal.h:2483
void addToSystemMenu(WindowStateAction, const QString &text, const char *slot)
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
Definition: qstyle.cpp:2327
QAction * addSeparator()
This convenience function creates a new separator action, i.e.
Definition: qmenu.cpp:1583
void setShortcuts(const QList< QKeySequence > &shortcuts)
Sets shortcuts as the list of shortcuts that trigger the action.
Definition: qaction.cpp:474
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
QPointer< QMenu > systemMenu
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
void setIcon(const QIcon &icon)
Definition: qaction.cpp:772
QPointer< QAction > actions[NumWindowStateActions]
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ desktopPalette()

QPalette QMdiSubWindowPrivate::desktopPalette ( ) const

Definition at line 1937 of file qmdisubwindow.cpp.

1938 {
1939  Q_Q(const QMdiSubWindow);
1940  QPalette newPalette = q->palette();
1941 
1942  bool colorsInitialized = false;
1943 #ifdef Q_WS_WIN // ask system properties on windows
1944 #ifndef SPI_GETGRADIENTCAPTIONS
1945 #define SPI_GETGRADIENTCAPTIONS 0x1008
1946 #endif
1947 #ifndef COLOR_GRADIENTACTIVECAPTION
1948 #define COLOR_GRADIENTACTIVECAPTION 27
1949 #endif
1950 #ifndef COLOR_GRADIENTINACTIVECAPTION
1951 #define COLOR_GRADIENTINACTIVECAPTION 28
1952 #endif
1955  colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION)));
1957  colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION)));
1959  colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT)));
1961  colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT)));
1962 
1963  colorsInitialized = true;
1964  BOOL hasGradient = false;
1965  SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0);
1966 
1967  if (hasGradient) {
1972  } else {
1977  }
1978  }
1979 #endif // Q_WS_WIN
1980  if (!colorsInitialized) {
1986  newPalette.color(QPalette::Inactive, QPalette::Dark));
1988  newPalette.color(QPalette::Inactive, QPalette::Dark));
1991  }
1992 
1993  return newPalette;
1994 }
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SPI_GETGRADIENTCAPTIONS
#define COLOR_GRADIENTACTIVECAPTION
#define COLOR_GRADIENTINACTIVECAPTION
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Definition: qpalette.h:201
static bool desktopSettingsAware()
Returns true if Qt is set to use the system&#39;s standard colors, fonts, etc.
static QRgb colorref2qrgb(COLORREF col)
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ drawTitleBarWhenMaximized()

bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized ( ) const
Warning
This function is not part of the public interface.

Definition at line 1779 of file qmdisubwindow.cpp.

Referenced by removeButtonsFromMenuBar(), showButtonsInMenuBar(), sizeParameters(), titleBarHeight(), and updateMask().

1780 {
1781  Q_Q(const QMdiSubWindow);
1782  if (q->window()->testAttribute(Qt::WA_CanHostQMdiSubWindowTitleBar))
1783  return false;
1784 
1785  if (isChildOfTabbedQMdiArea(q))
1786  return false;
1787 
1788 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_WS_WINCE_WM)
1789  return true;
1790 #else
1791  if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
1792  return true;
1793 #if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW)
1794  return true;
1795 #else
1796  QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window());
1797  if (!mainWindow || !qobject_cast<QMenuBar *>(mainWindow->menuWidget())
1798  || mainWindow->menuWidget()->isHidden())
1799  return true;
1800 
1801  return isChildOfQMdiSubWindow(q);
1802 #endif
1803 #endif
1804 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
QWidget * menuWidget() const
Returns the menu bar for the main window.
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
static bool isChildOfQMdiSubWindow(const QWidget *child)
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ ensureWindowState()

void QMdiSubWindowPrivate::ensureWindowState ( Qt::WindowState  state)
Warning
This function is not part of the public interface.

Definition at line 1692 of file qmdisubwindow.cpp.

Referenced by setActive(), setMaximizeMode(), setMinimizeMode(), and setNormalMode().

1693 {
1694  Q_Q(QMdiSubWindow);
1695  Qt::WindowStates windowStates = q->windowState() | state;
1696  switch (state) {
1697  case Qt::WindowMinimized:
1698  windowStates &= ~Qt::WindowMaximized;
1699  windowStates &= ~Qt::WindowNoState;
1700  break;
1701  case Qt::WindowMaximized:
1702  windowStates &= ~Qt::WindowMinimized;
1703  windowStates &= ~Qt::WindowNoState;
1704  break;
1705  case Qt::WindowNoState:
1706  windowStates &= ~Qt::WindowMinimized;
1707  windowStates &= ~Qt::WindowMaximized;
1708  break;
1709  default:
1710  break;
1711  }
1712  if (baseWidget) {
1713  if (!(baseWidget->windowState() & Qt::WindowActive) && windowStates & Qt::WindowActive)
1714  baseWidget->overrideWindowState(windowStates & ~Qt::WindowActive);
1715  else
1716  baseWidget->overrideWindowState(windowStates);
1717  }
1718  q->overrideWindowState(windowStates);
1719 }
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
void overrideWindowState(Qt::WindowStates state)
Definition: qwidget.cpp:3098
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointer< QWidget > baseWidget
Definition: qnamespace.h:54
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ enterRubberBandMode()

void QMdiSubWindowPrivate::enterRubberBandMode ( )

Definition at line 1903 of file qmdisubwindow.cpp.

Referenced by _q_enterInteractiveMode().

1904 {
1905  Q_Q(QMdiSubWindow);
1906  if (q->isMaximized())
1907  return;
1909  Q_ASSERT(parent);
1910  if (!rubberBand) {
1911  rubberBand = new QRubberBand(QRubberBand::Rectangle, q->parentWidget());
1912  // For accessibility to identify this special widget.
1913  rubberBand->setObjectName(QLatin1String("qt_rubberband"));
1914  }
1915  QPoint rubberBandPos = q->mapToParent(QPoint(0, 0));
1916  rubberBand->setGeometry(rubberBandPos.x(), rubberBandPos.y(),
1918  rubberBand->show();
1919  isInRubberBandMode = true;
1920  q->grabMouse();
1921 }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
void setGeometry(const QRect &r)
Sets the geometry of the rubber band to rect, specified in the coordinate system of its parent widget...
void show()
Shows the widget and its child widgets.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QRubberBand * rubberBand
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QObject * parent
Definition: qobject.h:92
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary...
Definition: qrubberband.h:58
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ getOperation()

QMdiSubWindowPrivate::Operation QMdiSubWindowPrivate::getOperation ( const QPoint pos) const
Warning
This function is not part of the public interface.

Definition at line 1623 of file qmdisubwindow.cpp.

1624 {
1626  for (it = operationMap.constBegin(); it != operationMap.constEnd(); ++it)
1627  if (it.value().region.contains(pos))
1628  return it.key();
1629  return None;
1630 }
#define it(className, varName)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
friend class const_iterator
Definition: qmap.h:369
OperationInfoMap operationMap

◆ getRegion()

QRegion QMdiSubWindowPrivate::getRegion ( Operation  operation) const
Warning
This function is not part of the public interface.

Definition at line 1554 of file qmdisubwindow.cpp.

Referenced by updateDirtyRegions().

1555 {
1556  Q_Q(const QMdiSubWindow);
1557  int width = q->width();
1558  int height = q->height();
1559  int titleBarHeight = this->titleBarHeight();
1560  int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
1561  int cornerConst = titleBarHeight - frameWidth;
1562  int titleBarConst = 2 * titleBarHeight;
1563 
1564  if (operation == Move) {
1566  QRegion move(frameWidth, frameWidth, width - 2 * frameWidth, cornerConst);
1567  // Depending on which window flags are set, activated sub controllers will
1568  // be subtracted from the 'move' region.
1569  for (int i = 0; i < NumSubControls; ++i) {
1571  continue;
1572  move -= QRegion(q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions,
1573  SubControls[i]));
1574  }
1575  return move;
1576  }
1577 
1578  QRegion region;
1579 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
1580  if (qobject_cast<QMacStyle *>(q->style()))
1581  return region;
1582 #endif
1583 
1584  switch (operation) {
1585  case TopResize:
1586  region = QRegion(titleBarHeight, 0, width - titleBarConst, frameWidth);
1587  break;
1588  case BottomResize:
1589  region = QRegion(titleBarHeight, height - frameWidth, width - titleBarConst, frameWidth);
1590  break;
1591  case LeftResize:
1592  region = QRegion(0, titleBarHeight, frameWidth, height - titleBarConst);
1593  break;
1594  case RightResize:
1595  region = QRegion(width - frameWidth, titleBarHeight, frameWidth, height - titleBarConst);
1596  break;
1597  case TopLeftResize:
1598  region = QRegion(0, 0, titleBarHeight, titleBarHeight)
1599  - QRegion(frameWidth, frameWidth, cornerConst, cornerConst);
1600  break;
1601  case TopRightResize:
1602  region = QRegion(width - titleBarHeight, 0, titleBarHeight, titleBarHeight)
1603  - QRegion(width - titleBarHeight, frameWidth, cornerConst, cornerConst);
1604  break;
1605  case BottomLeftResize:
1606  region = QRegion(0, height - titleBarHeight, titleBarHeight, titleBarHeight)
1607  - QRegion(frameWidth, height - titleBarHeight, cornerConst, cornerConst);
1608  break;
1609  case BottomRightResize:
1610  region = QRegion(width - titleBarHeight, height - titleBarHeight, titleBarHeight, titleBarHeight)
1611  - QRegion(width - titleBarHeight, height - titleBarHeight, cornerConst, cornerConst);
1612  break;
1613  default:
1614  break;
1615  }
1616 
1617  return region;
1618 }
static const int NumSubControls
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
int titleBarHeight() const
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QStyleOptionTitleBar titleBarOptions() const
static const QStyle::SubControl SubControls[]
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ getSubControl()

QStyle::SubControl QMdiSubWindowPrivate::getSubControl ( const QPoint pos) const
inline

Definition at line 301 of file qmdisubwindow_p.h.

302  {
303  Q_Q(const QMdiSubWindow);
305  return q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &titleBarOptions, pos, q);
306  }
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
#define Q_Q(Class)
Definition: qglobal.h:2483
QStyleOptionTitleBar titleBarOptions() const
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ hasBorder()

bool QMdiSubWindowPrivate::hasBorder ( const QStyleOptionTitleBar options) const
inline

Definition at line 321 of file qmdisubwindow_p.h.

Referenced by titleBarHeight(), and titleBarOptions().

322  {
323  Q_Q(const QMdiSubWindow);
324  return !q->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, q);
325  }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ iconSize()

QSize QMdiSubWindowPrivate::iconSize ( ) const
Warning
This function is not part of the public interface.

Definition at line 2172 of file qmdisubwindow.cpp.

2173 {
2174  Q_Q(const QMdiSubWindow);
2175  if (!parent || q->windowFlags() & Qt::FramelessWindowHint)
2176  return QSize(-1, -1);
2177  return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());
2178 }
int titleBarHeight() const
#define Q_Q(Class)
Definition: qglobal.h:2483
QObject * parent
Definition: qobject.h:92
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

◆ initOperationMap()

void QMdiSubWindowPrivate::initOperationMap ( )
Warning
This function is not part of the public interface.

Definition at line 1039 of file qmdisubwindow.cpp.

Referenced by QMdiSubWindowPrivate().

1040 {
1041  operationMap.insert(Move, OperationInfo(HMove | VMove, Qt::ArrowCursor, false));
1053 }
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
Definition: qmap.h:559
OperationInfoMap operationMap

◆ isMoveOperation()

bool QMdiSubWindowPrivate::isMoveOperation ( ) const
inline

Definition at line 338 of file qmdisubwindow_p.h.

339  {
340  return currentOperation == Move;
341  }

◆ isResizeOperation()

bool QMdiSubWindowPrivate::isResizeOperation ( ) const
inline

◆ leaveInteractiveMode()

void QMdiSubWindowPrivate::leaveInteractiveMode ( )
Warning
This function is not part of the public interface.

Definition at line 995 of file qmdisubwindow.cpp.

996 {
998 #ifndef QT_NO_RUBBERBAND
999  if (isInRubberBandMode)
1001  else
1002 #endif
1003  q->releaseMouse();
1004  isInInteractiveMode = false;
1007  updateCursor();
1008  if (baseWidget && baseWidget->focusWidget())
1010 }
QWidget * focusWidget() const
Returns the last child of this widget that setFocus had been called on.
Definition: qwidget.cpp:6863
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointer< QWidget > baseWidget
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ leaveRubberBandMode()

void QMdiSubWindowPrivate::leaveRubberBandMode ( )

Definition at line 1923 of file qmdisubwindow.cpp.

Referenced by leaveInteractiveMode().

1924 {
1925  Q_Q(QMdiSubWindow);
1928  q->releaseMouse();
1929  isInRubberBandMode = false;
1930  q->setGeometry(rubberBand->geometry());
1931  rubberBand->hide();
1933 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
void hide()
Hides the widget.
Definition: qwidget.h:501
QRubberBand * rubberBand
const QRect & geometry() const
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ menuBar()

QMenuBar * QMdiSubWindowPrivate::menuBar ( ) const

Definition at line 758 of file qmdisubwindow.cpp.

Referenced by setActive(), and setMaximizeMode().

759 {
760 #if defined(QT_NO_MAINWINDOW)
761  return 0;
762 #else
763  Q_Q(const QMdiSubWindow);
764  if (!q->isMaximized() || drawTitleBarWhenMaximized() || isChildOfTabbedQMdiArea(q))
765  return 0;
766 
767  if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window()))
768  return mainWindow->menuBar();
769 
770  return 0;
771 #endif
772 }
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
#define Q_Q(Class)
Definition: qglobal.h:2483
bool drawTitleBarWhenMaximized() const
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ originalWindowTitle()

QString QMdiSubWindowPrivate::originalWindowTitle ( )

Definition at line 273 of file qmdisubwindow.cpp.

274 {
276  if (originalTitle.isNull()) {
277  originalTitle = q->window()->windowTitle();
278  if (originalTitle.isNull())
280  }
281  return originalTitle;
282 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isNull() const
Returns true if this string is null; otherwise returns false.
Definition: qstring.h:505
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ processClickedSubControl()

void QMdiSubWindowPrivate::processClickedSubControl ( )
Warning
This function is not part of the public interface.

Definition at line 1496 of file qmdisubwindow.cpp.

1497 {
1498  Q_Q(QMdiSubWindow);
1499  switch (activeSubControl) {
1501 #ifndef QT_NO_WHATSTHIS
1503 #endif
1504  break;
1506  q->showShaded();
1508  break;
1510  if (q->isShaded())
1512  q->showNormal();
1513  break;
1515 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
1516  if (qobject_cast<QMacStyle *>(q->style())) {
1517  if (q->isMinimized())
1518  q->showNormal();
1519  else
1520  q->showMinimized();
1521  break;
1522  }
1523 #endif
1524  q->showMinimized();
1525  break;
1527  if (q->isShaded())
1529  q->showNormal();
1530  break;
1532 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
1533  if (qobject_cast<QMacStyle *>(q->style())) {
1534  if (q->isMaximized())
1535  q->showNormal();
1536  else
1537  q->showMaximized();
1538  break;
1539  }
1540 #endif
1541  q->showMaximized();
1542  break;
1544  q->close();
1545  break;
1546  default:
1547  break;
1548  }
1549 }
#define Q_Q(Class)
Definition: qglobal.h:2483
QStyle::SubControl activeSubControl
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
static void enterWhatsThisMode()
This function switches the user interface into "What&#39;s This?" mode.
Definition: qwhatsthis.cpp:633
QStyle::SubControl hoveredSubControl

◆ removeBaseWidget()

void QMdiSubWindowPrivate::removeBaseWidget ( )
Warning
This function is not part of the public interface.

Definition at line 1015 of file qmdisubwindow.cpp.

1016 {
1017  if (!baseWidget)
1018  return;
1019 
1020  Q_Q(QMdiSubWindow);
1022  if (layout)
1024  if (baseWidget->windowTitle() == q->windowTitle()) {
1025  ignoreWindowTitleChange = true;
1026  q->setWindowTitle(QString());
1027  ignoreWindowTitleChange = false;
1028  q->setWindowModified(false);
1029  }
1031  baseWidget->setParent(0);
1032  baseWidget = 0;
1033  isWidgetHiddenByUs = false;
1034 }
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QLayout * layout
Definition: qwidget_p.h:704
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
Definition: qobject.cpp:2099
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
QString windowTitle
the window title (caption)
Definition: qwidget.h:198
QPointer< QWidget > baseWidget
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
void removeWidget(QWidget *w)
Removes the widget widget from the layout.
Definition: qlayout.cpp:1516

◆ removeButtonsFromMenuBar()

void QMdiSubWindowPrivate::removeButtonsFromMenuBar ( )
Warning
This function is not part of the public interface.

Definition at line 1850 of file qmdisubwindow.cpp.

Referenced by setNormalMode(), and showButtonsInMenuBar().

1851 {
1852  Q_Q(QMdiSubWindow);
1853 
1855  return;
1856 
1857  QMenuBar *currentMenuBar = 0;
1858 #ifndef QT_NO_MAINWINDOW
1859  if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())) {
1860  // NB! We can't use menuBar() here because that one will actually create
1861  // a menubar for us if not set. That's not what we want :-)
1862  currentMenuBar = qobject_cast<QMenuBar *>(mainWindow->menuWidget());
1863  }
1864 #endif
1865 
1866  ignoreWindowTitleChange = true;
1867  controlContainer->removeButtonsFromMenuBar(currentMenuBar);
1868  ignoreWindowTitleChange = false;
1869 
1870  QWidget *topLevelWindow = q->window();
1871  topLevelWindow->removeEventFilter(q);
1873  topLevelWindow->setWindowModified(false);
1875 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
void setWindowModified(bool)
Definition: qwidget.cpp:11559
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
Definition: qobject.cpp:2099
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointer< QMdi::ControlContainer > controlContainer
QPointer< QWidget > baseWidget
bool drawTitleBarWhenMaximized() const
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
static const Null null
Definition: qstring.h:502
void removeButtonsFromMenuBar(QMenuBar *menuBar=0)
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ restoreFocus()

void QMdiSubWindowPrivate::restoreFocus ( )

Definition at line 2071 of file qmdisubwindow.cpp.

Referenced by setMaximizeMode(), and setNormalMode().

2072 {
2073  if (!restoreFocusWidget)
2074  return;
2075  if (!restoreFocusWidget->hasFocus() && q_func()->isAncestorOf(restoreFocusWidget)
2079  }
2080  restoreFocusWidget = 0;
2081 }
QPointer< QWidget > restoreFocusWidget
bool isVisible() const
Definition: qwidget.h:1005
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:187
bool hasFocus() const
Definition: qwidget.cpp:6583
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432

◆ setActive()

void QMdiSubWindowPrivate::setActive ( bool  activate,
bool  changeFocus = true 
)
Warning
This function is not part of the public interface.

Definition at line 1436 of file qmdisubwindow.cpp.

Referenced by _q_processFocusChanged(), setMinimizeMode(), and setNormalMode().

1437 {
1438  Q_Q(QMdiSubWindow);
1439  if (!parent || !activationEnabled)
1440  return;
1441 
1442  if (activate && !isActive && q->isEnabled()) {
1443  isActive = true;
1444  isExplicitlyDeactivated = false;
1445  Qt::WindowStates oldWindowState = q->windowState();
1447  emit q->aboutToActivate();
1448 #ifndef QT_NO_MENUBAR
1449  if (QMenuBar *mBar = menuBar())
1450  showButtonsInMenuBar(mBar);
1451 #endif
1452  Q_ASSERT(isActive);
1453  emit q->windowStateChanged(oldWindowState, q->windowState());
1454  } else if (!activate && isActive) {
1455  isActive = false;
1456  Qt::WindowStates oldWindowState = q->windowState();
1457  q->overrideWindowState(q->windowState() & ~Qt::WindowActive);
1458  if (changeFocus) {
1459  QWidget *focusWidget = QApplication::focusWidget();
1460  if (focusWidget && (focusWidget == q || q->isAncestorOf(focusWidget)))
1461  focusWidget->clearFocus();
1462  }
1463  if (baseWidget)
1465  Q_ASSERT(!isActive);
1466  emit q->windowStateChanged(oldWindowState, q->windowState());
1467  }
1468 
1469  if (activate && isActive && q->isEnabled() && !q->hasFocus()
1470  && !q->isAncestorOf(QApplication::focusWidget())) {
1471  if (changeFocus)
1472  setFocusWidget();
1474  }
1475 
1476  int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
1477  int titleBarHeight = this->titleBarHeight();
1478  QRegion windowDecoration = QRegion(0, 0, q->width(), q->height());
1479  windowDecoration -= QRegion(frameWidth, titleBarHeight, q->width() - 2 * frameWidth,
1480  q->height() - titleBarHeight - frameWidth);
1481 
1482  // Make sure we don't use cached style options if we get
1483  // resize events right before activation/deactivation.
1484  if (resizeTimerId != -1) {
1485  q->killTimer(resizeTimerId);
1486  resizeTimerId = -1;
1488  }
1489 
1490  q->update(windowDecoration);
1491 }
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int titleBarHeight() const
void overrideWindowState(Qt::WindowStates state)
Definition: qwidget.cpp:3098
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
void clearFocus()
Takes keyboard input focus from the widget.
Definition: qwidget.cpp:6757
void ensureWindowState(Qt::WindowState state)
#define emit
Definition: qobjectdefs.h:76
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QPointer< QWidget > baseWidget
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
QMenuBar * menuBar() 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...
Definition: qwidget.cpp:8573
Definition: qnamespace.h:54
QObject * parent
Definition: qobject.h:92
void showButtonsInMenuBar(QMenuBar *menuBar)
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

◆ setEnabled()

void QMdiSubWindowPrivate::setEnabled ( WindowStateAction  action,
bool  enable = true 
)

Definition at line 2152 of file qmdisubwindow.cpp.

Referenced by setMaximizeMode(), setMinimizeMode(), and setNormalMode().

2153 {
2154  if (actions[action])
2155  actions[action]->setEnabled(enable);
2156 }
void setEnabled(bool)
Definition: qaction.cpp:1192
QPointer< QAction > actions[NumWindowStateActions]

◆ setFocusWidget()

void QMdiSubWindowPrivate::setFocusWidget ( )

Definition at line 2027 of file qmdisubwindow.cpp.

Referenced by _q_processFocusChanged(), and setActive().

2028 {
2029  Q_Q(QMdiSubWindow);
2030  if (!baseWidget) {
2031  q->setFocus();
2032  return;
2033  }
2034 
2035  // This will give focus to the next child if possible, otherwise
2036  // do nothing, hence it's not possible to tab between windows with
2037  // just hitting tab (unless Qt::TabFocus is removed from the focus policy).
2039  q->focusNextChild();
2040  return;
2041  }
2042 
2043  // Same as above, but gives focus to the previous child.
2045  q->focusPreviousChild();
2046  return;
2047  }
2048 
2049  if (QWidget *focusWidget = baseWidget->focusWidget()) {
2050  if (!focusWidget->hasFocus() && q->isAncestorOf(focusWidget)
2051  && focusWidget->isVisible() && !q->isMinimized()
2052  && focusWidget->focusPolicy() != Qt::NoFocus) {
2053  focusWidget->setFocus();
2054  } else {
2055  q->setFocus();
2056  }
2057  return;
2058  }
2059 
2060  QWidget *focusWidget = q->nextInFocusChain();
2061  while (focusWidget && focusWidget != q && focusWidget->focusPolicy() == Qt::NoFocus)
2062  focusWidget = focusWidget->nextInFocusChain();
2063  if (focusWidget && q->isAncestorOf(focusWidget))
2064  focusWidget->setFocus();
2065  else if (baseWidget->focusPolicy() != Qt::NoFocus)
2066  baseWidget->setFocus();
2067  else if (!q->hasFocus())
2068  q->setFocus();
2069 }
QWidget * focusWidget() const
Returns the last child of this widget that setFocus had been called on.
Definition: qwidget.cpp:6863
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:187
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QWidget * nextInFocusChain() const
Returns the next widget in this widget&#39;s focus chain.
Definition: qwidget.cpp:6873
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointer< QWidget > baseWidget
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
Qt::FocusReason focusInReason
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
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ setMaximizeMode()

void QMdiSubWindowPrivate::setMaximizeMode ( )
Warning
This function is not part of the public interface.

Definition at line 1347 of file qmdisubwindow.cpp.

1348 {
1349  Q_Q(QMdiSubWindow);
1350  Q_ASSERT(parent);
1351 
1353  isShadeMode = false;
1354  isMaximizeMode = true;
1355 
1358 
1359 #ifndef QT_NO_SIZEGRIP
1360  setSizeGripVisible(false);
1361 #endif
1362 
1363  // Store old geometry and set restore size if not already set.
1364  if (!restoreSize.isValid()) {
1365  oldGeometry = q->geometry();
1368  }
1369 
1370  // Hide the window before we change the geometry to avoid multiple resize
1371  // events and wrong window state.
1372  const bool wasVisible = q->isVisible();
1373  if (wasVisible)
1374  q->setVisible(false);
1375 
1376  // Show the internal widget if it was hidden by us.
1377  if (baseWidget && isWidgetHiddenByUs) {
1378  baseWidget->show();
1379  isWidgetHiddenByUs = false;
1380  }
1381 
1383 
1384  if (wasVisible) {
1385 #ifndef QT_NO_MENUBAR
1386  if (QMenuBar *mBar = menuBar())
1387  showButtonsInMenuBar(mBar);
1388  else
1389 #endif
1390  if (!controlContainer)
1392  }
1393 
1394  QWidget *parent = q->parentWidget();
1395  QRect availableRect = parent->contentsRect();
1396 
1397  // Adjust geometry if the sub-window is inside a scroll area.
1399  if (scrollArea && scrollArea->viewport() == parent) {
1400  QScrollBar *hbar = scrollArea->horizontalScrollBar();
1401  QScrollBar *vbar = scrollArea->verticalScrollBar();
1402  const int xOffset = hbar ? hbar->value() : 0;
1403  const int yOffset = vbar ? vbar->value() : 0;
1404  availableRect.adjust(-xOffset, -yOffset, -xOffset, -yOffset);
1405  oldGeometry.adjust(xOffset, yOffset, xOffset, yOffset);
1406  }
1407 
1408  setNewGeometry(&availableRect);
1409  // QWidget::setGeometry will reset Qt::WindowMaximized so we have to update it here.
1411 
1412  if (wasVisible)
1413  q->setVisible(true);
1414 
1415  resizeEnabled = false;
1416  moveEnabled = false;
1417 
1418 #ifndef QT_NO_ACTION
1420  setEnabled(MaximizeAction, false);
1421  setEnabled(MinimizeAction, true);
1422  setEnabled(RestoreAction, true);
1424 #endif // QT_NO_ACTION
1425 
1426  Q_ASSERT(q->windowState() & Qt::WindowMaximized);
1427  Q_ASSERT(!(q->windowState() & Qt::WindowMinimized));
1428 
1429  restoreFocus();
1430  updateMask();
1431 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QPointer< QWidget > restoreFocusWidget
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
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QScrollBar * verticalScrollBar() const
Returns the vertical scroll bar.
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
QWidget * viewport() const
Returns the viewport widget.
The QScrollBar widget provides a vertical or horizontal scroll bar.
Definition: qscrollbar.h:59
int value() const
void ensureWindowState(Qt::WindowState state)
void setSizeGripVisible(bool visible=true) const
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
QPointer< QMdi::ControlContainer > controlContainer
void show()
Shows the widget and its child widgets.
QPointer< QWidget > baseWidget
void setNewGeometry(const QPoint &pos)
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
QMenuBar * menuBar() const
QScrollBar * horizontalScrollBar() const
Returns the horizontal scroll bar.
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
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
void setEnabled(WindowStateAction, bool enable=true)
QObject * parent
Definition: qobject.h:92
void showButtonsInMenuBar(QMenuBar *menuBar)
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

◆ setMinimizeMode()

void QMdiSubWindowPrivate::setMinimizeMode ( )
Warning
This function is not part of the public interface.

Definition at line 1248 of file qmdisubwindow.cpp.

1249 {
1250  Q_Q(QMdiSubWindow);
1251  Q_ASSERT(parent);
1252 
1255  q->showShaded();
1257 
1258  moveEnabled = false;
1259 #ifndef QT_NO_ACTION
1261 #endif
1262 
1263  Q_ASSERT(q->windowState() & Qt::WindowMinimized);
1264  Q_ASSERT(!(q->windowState() & Qt::WindowMaximized));
1265  // This should be a valid assert, but people can actually re-implement
1266  // setVisible and do crazy stuff, so we're not guaranteed that
1267  // the widget is hidden after calling hide().
1268  // Q_ASSERT(baseWidget ? baseWidget->isHidden() : true);
1269 
1270  setActive(true);
1271 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
void ensureWindowState(Qt::WindowState state)
void setEnabled(WindowStateAction, bool enable=true)
void setActive(bool activate, bool changeFocus=true)
QObject * parent
Definition: qobject.h:92
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ setNewGeometry() [1/2]

void QMdiSubWindowPrivate::setNewGeometry ( const QPoint pos)
Warning
This function is not part of the public interface.

Definition at line 1180 of file qmdisubwindow.cpp.

Referenced by setMaximizeMode().

1181 {
1182  Q_Q(QMdiSubWindow);
1184  Q_ASSERT(parent);
1185 
1186  uint cflags = operationMap.find(currentOperation).value().changeFlags;
1187  int posX = pos.x();
1188  int posY = pos.y();
1189 
1190  const bool restrictHorizontal = !q->testOption(QMdiSubWindow::AllowOutsideAreaHorizontally);
1191  const bool restrictVertical = !q->testOption(QMdiSubWindow::AllowOutsideAreaVertically);
1192 
1193  if (restrictHorizontal || restrictVertical) {
1194  QRect parentRect = q->parentWidget()->rect();
1195  if (restrictVertical && (cflags & VResizeReverse || currentOperation == Move)) {
1196  posY = qMin(qMax(mousePressPosition.y() - oldGeometry.y(), posY),
1197  parentRect.height() - BoundaryMargin);
1198  }
1199  if (currentOperation == Move) {
1200  if (restrictHorizontal)
1201  posX = qMin(qMax(BoundaryMargin, posX), parentRect.width() - BoundaryMargin);
1202  if (restrictVertical)
1203  posY = qMin(posY, parentRect.height() - BoundaryMargin);
1204  } else {
1205  if (restrictHorizontal) {
1206  if (cflags & HResizeReverse)
1207  posX = qMax(mousePressPosition.x() - oldGeometry.x(), posX);
1208  else
1209  posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width()
1210  - mousePressPosition.x()), posX);
1211  }
1212  if (restrictVertical && !(cflags & VResizeReverse)) {
1213  posY = qMin(parentRect.height() - (oldGeometry.y() + oldGeometry.height()
1214  - mousePressPosition.y()), posY);
1215  }
1216  }
1217  }
1218 
1219  QRect geometry;
1220  if (cflags & (HMove | VMove)) {
1221  int dx = getMoveDeltaComponent(cflags, HMove, HResize, posX - mousePressPosition.x(),
1223  oldGeometry.width() - q->maximumWidth());
1224  int dy = getMoveDeltaComponent(cflags, VMove, VResize, posY - mousePressPosition.y(),
1226  oldGeometry.height() - q->maximumHeight());
1227  geometry.setTopLeft(oldGeometry.topLeft() + QPoint(dx, dy));
1228  } else {
1229  geometry.setTopLeft(q->geometry().topLeft());
1230  }
1231 
1232  if (cflags & (HResize | VResize)) {
1233  int dx = getResizeDeltaComponent(cflags, HResize, HResizeReverse,
1234  posX - mousePressPosition.x());
1235  int dy = getResizeDeltaComponent(cflags, VResize, VResizeReverse,
1236  posY - mousePressPosition.y());
1237  geometry.setSize(oldGeometry.size() + QSize(dx, dy));
1238  } else {
1239  geometry.setSize(q->geometry().size());
1240  }
1241 
1242  setNewGeometry(&geometry);
1243 }
static int getResizeDeltaComponent(uint cflags, uint resizeFlag, uint resizeReverseFlag, int delta)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
iterator find(const Key &key)
Returns an iterator pointing to the item with key key in the map.
Definition: qmap.h:618
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
int width() const
Returns the width.
Definition: qsize.h:126
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
Definition: qrect.h:448
unsigned int uint
Definition: qglobal.h:996
void setTopLeft(const QPoint &p)
Set the top-left corner of the rectangle to the given position.
Definition: qrect.h:270
static const int BoundaryMargin
void setNewGeometry(const QPoint &pos)
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
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QObject * parent
Definition: qobject.h:92
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
static int getMoveDeltaComponent(uint cflags, uint moveFlag, uint resizeFlag, int delta, int maxDelta, int minDelta)
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288
OperationInfoMap operationMap

◆ setNewGeometry() [2/2]

void QMdiSubWindowPrivate::setNewGeometry ( QRect geometry)
inline

Definition at line 308 of file qmdisubwindow_p.h.

309  {
311  Q_ASSERT(parent);
312  geometry->setSize(geometry->size().expandedTo(internalMinimumSize));
313 #ifndef QT_NO_RUBBERBAND
314  if (isInRubberBandMode)
315  rubberBand->setGeometry(*geometry);
316  else
317 #endif
318  q->setGeometry(*geometry);
319  }
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_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
void setGeometry(const QRect &r)
Sets the geometry of the rubber band to rect, specified in the coordinate system of its parent widget...
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
Definition: qrect.h:448
QRubberBand * rubberBand
QObject * parent
Definition: qobject.h:92
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ setNewWindowTitle()

void QMdiSubWindowPrivate::setNewWindowTitle ( )

Definition at line 284 of file qmdisubwindow.cpp.

Referenced by updateWindowTitle().

285 {
287  QString childTitle = q->windowTitle();
288  if (childTitle.isEmpty())
289  return;
290  QString original = originalWindowTitle();
291  if (!original.isEmpty()) {
292  if (!original.contains(QMdiSubWindow::tr("- [%1]").arg(childTitle)))
293  q->window()->setWindowTitle(QMdiSubWindow::tr("%1 - [%2]").arg(original, childTitle));
294 
295  } else {
296  q->window()->setWindowTitle(childTitle);
297  }
298 }
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.h:904
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ setNormalMode()

void QMdiSubWindowPrivate::setNormalMode ( )
Warning
This function is not part of the public interface.

Definition at line 1276 of file qmdisubwindow.cpp.

1277 {
1278  Q_Q(QMdiSubWindow);
1279  Q_ASSERT(parent);
1280 
1281  isShadeMode = false;
1282  isMaximizeMode = false;
1283 
1285 #ifndef QT_NO_MENUBAR
1287 #endif
1288 
1289  // Hide the window before we change the geometry to avoid multiple resize
1290  // events and wrong window state.
1291  const bool wasVisible = q->isVisible();
1292  if (wasVisible)
1293  q->setVisible(false);
1294 
1295  // Restore minimum size if set by user.
1296  if (!userMinimumSize.isNull()) {
1297  q->setMinimumSize(userMinimumSize);
1298  userMinimumSize = QSize(0, 0);
1299  }
1300 
1301  // Show the internal widget if it was hidden by us,
1302  if (baseWidget && isWidgetHiddenByUs) {
1303  baseWidget->show();
1304  isWidgetHiddenByUs = false;
1305  }
1306 
1308  QRect newGeometry = oldGeometry;
1310  q->setGeometry(newGeometry);
1311 
1312  if (wasVisible)
1313  q->setVisible(true);
1314 
1315  // Invalidate the restore size.
1316  restoreSize.setWidth(-1);
1317  restoreSize.setHeight(-1);
1318 
1319 #ifndef QT_NO_SIZEGRIP
1320  setSizeGripVisible(true);
1321 #endif
1322 
1323 #ifndef QT_NO_ACTION
1324  setEnabled(MoveAction, true);
1325  setEnabled(MaximizeAction, true);
1326  setEnabled(MinimizeAction, true);
1327  setEnabled(RestoreAction, false);
1329 #endif // QT_NO_ACTION
1330 
1331  Q_ASSERT(!(q_func()->windowState() & Qt::WindowMinimized));
1332  // This sub-window can be maximized when shown above if not the
1333  // QMdiArea::DontMaximizeSubWindowOnActionvation is set. Make sure
1334  // the Qt::WindowMaximized flag is set accordingly.
1335  Q_ASSERT((isMaximizeMode && q_func()->windowState() & Qt::WindowMaximized)
1336  || (!isMaximizeMode && !(q_func()->windowState() & Qt::WindowMaximized)));
1338 
1339  setActive(true);
1340  restoreFocus();
1341  updateMask();
1342 }
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
void ensureWindowState(Qt::WindowState state)
void setSizeGripVisible(bool visible=true) const
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
Definition: qrect.h:448
void show()
Shows the widget and its child widgets.
QPointer< QWidget > baseWidget
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void setEnabled(WindowStateAction, bool enable=true)
void setActive(bool activate, bool changeFocus=true)
QObject * parent
Definition: qobject.h:92
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
Definition: qsize.h:117
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

◆ setSizeGrip()

void QMdiSubWindowPrivate::setSizeGrip ( QSizeGrip newSizeGrip)
Warning
This function is not part of the public interface.

Definition at line 2185 of file qmdisubwindow.cpp.

2186 {
2187  Q_Q(QMdiSubWindow);
2188  if (!newSizeGrip || sizeGrip || q->windowFlags() & Qt::FramelessWindowHint)
2189  return;
2190 
2191  if (layout && layout->indexOf(newSizeGrip) != -1)
2192  return;
2193  newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
2194  bool putSizeGripInLayout = layout ? true : false;
2195 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
2196  if (qobject_cast<QMacStyle *>(q->style()))
2197  putSizeGripInLayout = false;
2198 #endif
2199  if (putSizeGripInLayout) {
2200  layout->addWidget(newSizeGrip);
2202  } else {
2203  newSizeGrip->setParent(q);
2204  newSizeGrip->move(q->isLeftToRight() ? q->width() - newSizeGrip->width() : 0,
2205  q->height() - newSizeGrip->height());
2206  sizeGrip = newSizeGrip;
2207  }
2208  newSizeGrip->raise();
2210  newSizeGrip->installEventFilter(q);
2211 }
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QLayout * layout
Definition: qwidget_p.h:704
int height() const
#define Q_Q(Class)
Definition: qglobal.h:2483
void raise()
Raises this widget to the top of the parent widget&#39;s stack.
Definition: qwidget.cpp:11901
virtual int indexOf(QWidget *) const
Searches for widget widget in this layout (not including child layouts).
Definition: qlayout.cpp:1378
int width() const
void setFixedSize(const QSize &)
Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing o...
Definition: qwidget.cpp:4284
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
QSize sizeHint() const
Reimplemented Function
Definition: qsizegrip.cpp:266
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
QPointer< QSizeGrip > sizeGrip
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
bool setAlignment(QWidget *w, Qt::Alignment alignment)
Sets the alignment for widget w to alignment and returns true if w is found in this layout (not inclu...
Definition: qlayout.cpp:332
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011

◆ setSizeGripVisible()

void QMdiSubWindowPrivate::setSizeGripVisible ( bool  visible = true) const
Warning
This function is not part of the public interface.

Definition at line 2216 of file qmdisubwindow.cpp.

Referenced by setMaximizeMode(), and setNormalMode().

2217 {
2218  // See if we can find any size grips
2219  QList<QSizeGrip *> sizeGrips = q_func()->findChildren<QSizeGrip *>();
2220  foreach (QSizeGrip *grip, sizeGrips)
2221  grip->setVisible(visible);
2222 }
The QSizeGrip class provides a resize handle for resizing top-level windows.
Definition: qsizegrip.h:55
void setVisible(bool)
Reimplemented Function
Definition: qsizegrip.cpp:529
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ setVisible()

void QMdiSubWindowPrivate::setVisible ( WindowStateAction  action,
bool  visible = true 
)

Definition at line 2134 of file qmdisubwindow.cpp.

Referenced by QMdiAreaTabBar::contextMenuEvent(), and updateActions().

2135 {
2136 #ifndef QT_NO_ACTION
2137  if (actions[action])
2138  actions[action]->setVisible(visible);
2139 #endif
2140 
2141  Q_Q(QMdiSubWindow);
2142  if (!controlContainer)
2144 
2145  if (ControllerWidget *ctrlWidget = qobject_cast<ControllerWidget *>
2147  ctrlWidget->setControlVisible(action, visible);
2148  }
2149 }
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointer< QMdi::ControlContainer > controlContainer
void setVisible(bool)
Definition: qaction.cpp:1230
QWidget * controllerWidget() const
QPointer< QAction > actions[NumWindowStateActions]
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ setWindowFlags()

void QMdiSubWindowPrivate::setWindowFlags ( Qt::WindowFlags  windowFlags)
Warning
This function is not part of the public interface.

Please add QEvent::WindowFlagsChange event

Definition at line 2087 of file qmdisubwindow.cpp.

2088 {
2089  Q_Q(QMdiSubWindow);
2090  if (!parent) {
2091  q->setWindowFlags(windowFlags);
2092  return;
2093  }
2094 
2095  Qt::WindowFlags windowType = windowFlags & Qt::WindowType_Mask;
2096  if (windowType == Qt::Dialog || windowFlags & Qt::MSWindowsFixedSizeDialogHint)
2098 
2099  // Set standard flags if none of the customize flags are set
2100  if (!(windowFlags & CustomizeWindowFlags))
2102  else if (windowFlags & Qt::FramelessWindowHint && windowFlags & Qt::WindowStaysOnTopHint)
2104  else if (windowFlags & Qt::FramelessWindowHint)
2105  windowFlags = Qt::FramelessWindowHint;
2106 
2107  windowFlags &= ~windowType;
2108  windowFlags |= Qt::SubWindow;
2109 
2110 #ifndef QT_NO_ACTION
2111  if (QAction *stayOnTopAction = actions[QMdiSubWindowPrivate::StayOnTopAction]) {
2112  if (windowFlags & Qt::WindowStaysOnTopHint)
2113  stayOnTopAction->setChecked(true);
2114  else
2115  stayOnTopAction->setChecked(false);
2116  }
2117 #endif
2118 
2119 #ifndef QT_NO_SIZEGRIP
2120  if ((windowFlags & Qt::FramelessWindowHint) && sizeGrip)
2121  delete sizeGrip;
2122 #endif
2123 
2124  q->setWindowFlags(windowFlags);
2126  updateActions();
2127  QSize currentSize = q->size();
2128  if (q->isVisible() && (currentSize.width() < internalMinimumSize.width()
2129  || currentSize.height() < internalMinimumSize.height())) {
2130  q->resize(currentSize.expandedTo(internalMinimumSize));
2131  }
2132 }
static const Qt::WindowFlags CustomizeWindowFlags
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_Q(Class)
Definition: qglobal.h:2483
int width() const
Returns the width.
Definition: qsize.h:126
void setWindowFlags(Qt::WindowFlags type)
Definition: qwidget.cpp:10399
int height() const
Returns the height.
Definition: qsize.h:129
QObject * parent
Definition: qobject.h:92
QPointer< QAction > actions[NumWindowStateActions]
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QPointer< QSizeGrip > sizeGrip
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64

◆ showButtonsInMenuBar()

void QMdiSubWindowPrivate::showButtonsInMenuBar ( QMenuBar menuBar)
Warning
This function is not part of the public interface.

Definition at line 1811 of file qmdisubwindow.cpp.

Referenced by setActive(), and setMaximizeMode().

1812 {
1813  Q_Q(QMdiSubWindow);
1814  Q_ASSERT(q->isMaximized() && !drawTitleBarWhenMaximized());
1815 
1816  if (isChildOfTabbedQMdiArea(q))
1817  return;
1818 
1820  if (!controlContainer)
1822 
1823  ignoreWindowTitleChange = true;
1825  ignoreWindowTitleChange = false;
1826 
1827  QWidget *topLevelWindow = q->window();
1828  topLevelWindow->setWindowModified(q->isWindowModified());
1829  topLevelWindow->installEventFilter(q);
1830 
1831  int buttonHeight = 0;
1833  buttonHeight = controlContainer->controllerWidget()->height();
1834  else if (controlContainer->systemMenuLabel())
1835  buttonHeight = controlContainer->systemMenuLabel()->height();
1836 
1837  // This will rarely happen.
1838  if (menuBar && menuBar->height() < buttonHeight
1839  && topLevelWindow->layout()) {
1840  // Make sure topLevelWindow->contentsRect returns correct geometry.
1841  // topLevelWidget->updateGeoemtry will not do the trick here since it will post the event.
1843  QApplication::sendEvent(topLevelWindow, &event);
1844  }
1845 }
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
EventRef event
void setWindowModified(bool)
Definition: qwidget.cpp:11559
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int height() const
#define Q_Q(Class)
Definition: qglobal.h:2483
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
void showButtonsInMenuBar(QMenuBar *menuBar)
QPointer< QMdi::ControlContainer > controlContainer
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
bool drawTitleBarWhenMaximized() const
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
QWidget * controllerWidget() const
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
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 QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
QWidget * systemMenuLabel() const
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ sizeParameters()

void QMdiSubWindowPrivate::sizeParameters ( int *  margin,
int *  minWidth 
) const
Warning
This function is not part of the public interface.

Definition at line 1746 of file qmdisubwindow.cpp.

Referenced by updateGeometryConstraints().

1747 {
1748  Q_Q(const QMdiSubWindow);
1749  Qt::WindowFlags flags = q->windowFlags();
1750  if (!parent || flags & Qt::FramelessWindowHint) {
1751  *margin = 0;
1752  *minWidth = 0;
1753  return;
1754  }
1755 
1756  if (q->isMaximized() && !drawTitleBarWhenMaximized())
1757  *margin = 0;
1758  else
1759  *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
1760 
1761  QStyleOptionTitleBar opt = this->titleBarOptions();
1762  int tempWidth = 0;
1763  for (int i = 0; i < NumSubControls; ++i) {
1765  tempWidth += 30;
1766  continue;
1767  }
1768  QRect rect = q->style()->subControlRect(QStyle::CC_TitleBar, &opt, SubControls[i], q);
1769  if (!rect.isValid())
1770  continue;
1771  tempWidth += rect.width();
1772  }
1773  *minWidth = tempWidth;
1774 }
static const int NumSubControls
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
#define Q_Q(Class)
Definition: qglobal.h:2483
QStyleOptionTitleBar titleBarOptions() const
bool drawTitleBarWhenMaximized() const
static const QStyle::SubControl SubControls[]
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QObject * parent
Definition: qobject.h:92
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ titleBarHeight() [1/2]

int QMdiSubWindowPrivate::titleBarHeight ( const QStyleOptionTitleBar options) const
Warning
This function is not part of the public interface.

Definition at line 1724 of file qmdisubwindow.cpp.

1725 {
1726  Q_Q(const QMdiSubWindow);
1727  if (!parent || q->windowFlags() & Qt::FramelessWindowHint
1728  || (q->isMaximized() && !drawTitleBarWhenMaximized())) {
1729  return 0;
1730  }
1731 
1732  int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
1733 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
1734  // ### Fix mac style, the +4 pixels hack is not necessary anymore
1735  if (qobject_cast<QMacStyle *>(q->style()))
1736  height -= 4;
1737 #endif
1738  if (hasBorder(options))
1739  height += q->isMinimized() ? 8 : 4;
1740  return height;
1741 }
#define Q_Q(Class)
Definition: qglobal.h:2483
bool drawTitleBarWhenMaximized() const
bool hasBorder(const QStyleOptionTitleBar &options) const
QObject * parent
Definition: qobject.h:92
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ titleBarHeight() [2/2]

int QMdiSubWindowPrivate::titleBarHeight ( ) const
inline

Definition at line 287 of file qmdisubwindow_p.h.

Referenced by _q_enterInteractiveMode(), getRegion(), iconSize(), setActive(), titleBarOptions(), updateGeometryConstraints(), and updateInternalWindowTitle().

288  {
289  Q_Q(const QMdiSubWindow);
290  if (!parent || q->windowFlags() & Qt::FramelessWindowHint
291  || (q->isMaximized() && !drawTitleBarWhenMaximized())) {
292  return 0;
293  }
295  int height = options.rect.height();
296  if (hasBorder(options))
297  height += q->isMinimized() ? 8 : 4;
298  return height;
299  }
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QMdiSubWindow::SubWindowOptions options
#define Q_Q(Class)
Definition: qglobal.h:2483
QStyleOptionTitleBar titleBarOptions() const
bool drawTitleBarWhenMaximized() const
bool hasBorder(const QStyleOptionTitleBar &options) const
QObject * parent
Definition: qobject.h:92
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ titleBarOptions()

QStyleOptionTitleBar QMdiSubWindowPrivate::titleBarOptions ( ) const
Warning
This function is not part of the public interface.

Definition at line 1637 of file qmdisubwindow.cpp.

Referenced by getRegion(), sizeParameters(), and updateMask().

1638 {
1639  Q_Q(const QMdiSubWindow);
1641  titleBarOptions.initFrom(q);
1644  titleBarOptions.state |= QStyle::State_Sunken;
1645  titleBarOptions.activeSubControls = activeSubControl;
1646  }
1647  } else if (autoRaise() && hoveredSubControl != QStyle::SC_None
1649  titleBarOptions.state |= QStyle::State_MouseOver;
1650  titleBarOptions.activeSubControls = hoveredSubControl;
1651  } else {
1652  titleBarOptions.state &= ~QStyle::State_MouseOver;
1653  titleBarOptions.activeSubControls = QStyle::SC_None;
1654  }
1655 
1656  titleBarOptions.subControls = QStyle::SC_All;
1657  titleBarOptions.titleBarFlags = q->windowFlags();
1658  titleBarOptions.titleBarState = q->windowState();
1659  titleBarOptions.palette = titleBarPalette;
1660  titleBarOptions.icon = menuIcon;
1661 
1662  if (isActive) {
1663  titleBarOptions.state |= QStyle::State_Active;
1664  titleBarOptions.titleBarState |= QStyle::State_Active;
1666  } else {
1667  titleBarOptions.state &= ~QStyle::State_Active;
1669  }
1670 
1671  int border = hasBorder(titleBarOptions) ? 4 : 0;
1672  int paintHeight = titleBarHeight(titleBarOptions);
1673  paintHeight -= q->isMinimized() ? 2 * border : border;
1674  titleBarOptions.rect = QRect(border, border, q->width() - 2 * border, paintHeight);
1675 
1676  if (!windowTitle.isEmpty()) {
1677  // Set the text here before asking for the width of the title bar label
1678  // in case people uses the actual text to calculate the width.
1679  titleBarOptions.text = windowTitle;
1680  titleBarOptions.fontMetrics = QFontMetrics(font);
1681  int width = q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions,
1682  QStyle::SC_TitleBarLabel, q).width();
1683  // Set elided text if we don't have enough space for the entire title.
1684  titleBarOptions.text = titleBarOptions.fontMetrics.elidedText(windowTitle, Qt::ElideRight, width);
1685  }
1686  return titleBarOptions;
1687 }
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QIcon icon
the icon for the title bar
Definition: qstyleoption.h:823
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
int titleBarHeight() const
QString text
the text of the title bar
Definition: qstyleoption.h:822
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
Definition: qstyleoption.h:694
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
Definition: qstyleoption.h:91
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
If the string text is wider than width, returns an elided version of the string (i.
#define Q_Q(Class)
Definition: qglobal.h:2483
void setCurrentColorGroup(ColorGroup cg)
Set the palette&#39;s current color group to cg.
Definition: qpalette.h:105
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void initFrom(const QWidget *w)
Definition: qstyleoption.h:99
QStyleOptionTitleBar titleBarOptions() const
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
bool hasBorder(const QStyleOptionTitleBar &options) const
QStyle::SubControl activeSubControl
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
Qt::WindowFlags titleBarFlags
the widget flags for the title bar
Definition: qstyleoption.h:825
int titleBarState
the state of the title bar
Definition: qstyleoption.h:824
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
Definition: qstyleoption.h:693
QStyle::SubControl hoveredSubControl

◆ updateActions()

void QMdiSubWindowPrivate::updateActions ( )

Definition at line 1996 of file qmdisubwindow.cpp.

Referenced by QMdiAreaTabBar::contextMenuEvent(), createSystemMenu(), and setWindowFlags().

1997 {
1998  Qt::WindowFlags windowFlags = q_func()->windowFlags();
1999  // Hide all
2000  for (int i = 0; i < NumWindowStateActions; ++i)
2001  setVisible(WindowStateAction(i), false);
2002 
2003  if (windowFlags & Qt::FramelessWindowHint)
2004  return;
2005 
2006  setVisible(StayOnTopAction, true);
2009 
2010  // CloseAction
2011  if (windowFlags & Qt::WindowSystemMenuHint)
2012  setVisible(CloseAction, true);
2013 
2014  // RestoreAction
2016  setVisible(RestoreAction, true);
2017 
2018  // MinimizeAction
2019  if (windowFlags & Qt::WindowMinimizeButtonHint)
2020  setVisible(MinimizeAction, true);
2021 
2022  // MaximizeAction
2023  if (windowFlags & Qt::WindowMaximizeButtonHint)
2024  setVisible(MaximizeAction, true);
2025 }
void setVisible(WindowStateAction, bool visible=true)

◆ updateCursor()

void QMdiSubWindowPrivate::updateCursor ( )
Warning
This function is not part of the public interface.

Definition at line 1091 of file qmdisubwindow.cpp.

Referenced by _q_enterInteractiveMode(), and leaveInteractiveMode().

1092 {
1093 #ifndef QT_NO_CURSOR
1094  Q_Q(QMdiSubWindow);
1095 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
1096  if (qobject_cast<QMacStyle *>(q->style()))
1097  return;
1098 #endif
1099 
1100  if (currentOperation == None) {
1101  q->unsetCursor();
1102  return;
1103  }
1104 
1105  if (currentOperation == Move || operationMap.find(currentOperation).value().hover) {
1106  q->setCursor(operationMap.find(currentOperation).value().cursorShape);
1107  return;
1108  }
1109 #endif
1110 }
iterator find(const Key &key)
Returns an iterator pointing to the item with key key in the map.
Definition: qmap.h:618
#define Q_Q(Class)
Definition: qglobal.h:2483
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
OperationInfoMap operationMap

◆ updateDirtyRegions()

void QMdiSubWindowPrivate::updateDirtyRegions ( )
Warning
This function is not part of the public interface.

Definition at line 1115 of file qmdisubwindow.cpp.

Referenced by leaveInteractiveMode(), setActive(), and updateGeometryConstraints().

1116 {
1117  // No update necessary
1118  if (!parent)
1119  return;
1120 
1121  foreach (Operation operation, operationMap.keys())
1122  operationMap.find(operation).value().region = getRegion(operation);
1123 }
iterator find(const Key &key)
Returns an iterator pointing to the item with key key in the map.
Definition: qmap.h:618
QRegion getRegion(Operation operation) const
QList< Key > keys() const
Returns a list containing all the keys in the map in ascending order.
Definition: qmap.h:818
QObject * parent
Definition: qobject.h:92
OperationInfoMap operationMap

◆ updateGeometryConstraints()

void QMdiSubWindowPrivate::updateGeometryConstraints ( )
Warning
This function is not part of the public interface.

Definition at line 1128 of file qmdisubwindow.cpp.

Referenced by setMaximizeMode(), setNormalMode(), setSizeGrip(), and setWindowFlags().

1129 {
1130  Q_Q(QMdiSubWindow);
1131  if (!parent)
1132  return;
1133 
1134  internalMinimumSize = (!q->isMinimized() && !q->minimumSize().isNull())
1135  ? q->minimumSize() : q->minimumSizeHint();
1136  int margin, minWidth;
1137  sizeParameters(&margin, &minWidth);
1138  q->setContentsMargins(margin, titleBarHeight(), margin, margin);
1139  if (q->isMaximized() || (q->isMinimized() && !q->isShaded())) {
1140  moveEnabled = false;
1141  resizeEnabled = false;
1142  } else {
1143  moveEnabled = true;
1144  if ((q->windowFlags() & Qt::MSWindowsFixedSizeDialogHint) || q->isShaded())
1145  resizeEnabled = false;
1146  else
1147  resizeEnabled = true;
1148  }
1150 }
int titleBarHeight() const
void sizeParameters(int *margin, int *minWidth) const
#define Q_Q(Class)
Definition: qglobal.h:2483
QObject * parent
Definition: qobject.h:92
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ updateInternalWindowTitle()

void QMdiSubWindowPrivate::updateInternalWindowTitle ( )
Warning
This function is not part of the public interface.

Definition at line 2229 of file qmdisubwindow.cpp.

2230 {
2231  Q_Q(QMdiSubWindow);
2232  if (q->isWindowModified()) {
2233  windowTitle = q->windowTitle();
2235  } else {
2236  windowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q);
2237  }
2238  q->update(0, 0, q->width(), titleBarHeight());
2239 }
QString qt_setWindowTitle_helperHelper(const QString &, const QWidget *)
Returns a modified window title with the [*] place holder replaced according to the rules described i...
Definition: qwidget.cpp:6240
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
int titleBarHeight() const
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_Q(Class)
Definition: qglobal.h:2483
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ updateMask()

void QMdiSubWindowPrivate::updateMask ( )
Warning
This function is not part of the public interface.

Definition at line 1155 of file qmdisubwindow.cpp.

Referenced by setMaximizeMode(), and setNormalMode().

1156 {
1157  Q_Q(QMdiSubWindow);
1158  if (!q->mask().isEmpty())
1159  q->clearMask();
1160 
1161  if (!parent)
1162  return;
1163 
1164  if ((q->isMaximized() && !drawTitleBarWhenMaximized())
1165  || q->windowFlags() & Qt::FramelessWindowHint)
1166  return;
1167 
1168  if (resizeTimerId == -1)
1170  cachedStyleOptions.rect = q->rect();
1171  QStyleHintReturnMask frameMask;
1172  q->style()->styleHint(QStyle::SH_WindowFrame_Mask, &cachedStyleOptions, q, &frameMask);
1173  if (!frameMask.region.isEmpty())
1174  q->setMask(frameMask.region);
1175 }
QStyleOptionTitleBar cachedStyleOptions
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
QStyleOptionTitleBar titleBarOptions() const
The QStyleHintReturnMask class provides style hints that return a QRegion.
Definition: qstyleoption.h:923
bool drawTitleBarWhenMaximized() const
QObject * parent
Definition: qobject.h:92
QRegion region
the region for style hints that return a QRegion
Definition: qstyleoption.h:930
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ updateWindowTitle()

void QMdiSubWindowPrivate::updateWindowTitle ( bool  requestFromChild)

Definition at line 1879 of file qmdisubwindow.cpp.

1880 {
1881  Q_Q(QMdiSubWindow);
1882  if (isRequestFromChild && !q->windowTitle().isEmpty() && !lastChildWindowTitle.isEmpty()
1883  && lastChildWindowTitle != q->windowTitle()) {
1884  return;
1885  }
1886 
1887  QWidget *titleWidget = 0;
1888  if (isRequestFromChild)
1889  titleWidget = baseWidget;
1890  else
1891  titleWidget = q;
1892  if (!titleWidget || titleWidget->windowTitle().isEmpty())
1893  return;
1894 
1895  ignoreWindowTitleChange = true;
1896  q->setWindowTitle(titleWidget->windowTitle());
1897  if (q->maximizedButtonsWidget())
1899  ignoreWindowTitleChange = false;
1900 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString windowTitle
the window title (caption)
Definition: qwidget.h:198
QPointer< QWidget > baseWidget
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

Properties

◆ actions

QPointer<QAction> QMdiSubWindowPrivate::actions[NumWindowStateActions]

◆ activationEnabled

bool QMdiSubWindowPrivate::activationEnabled

Definition at line 200 of file qmdisubwindow_p.h.

Referenced by setActive().

◆ activeSubControl

QStyle::SubControl QMdiSubWindowPrivate::activeSubControl

Definition at line 211 of file qmdisubwindow_p.h.

Referenced by processClickedSubControl(), and titleBarOptions().

◆ baseWidget

QPointer<QWidget> QMdiSubWindowPrivate::baseWidget

◆ cachedStyleOptions

QStyleOptionTitleBar QMdiSubWindowPrivate::cachedStyleOptions

Definition at line 224 of file qmdisubwindow_p.h.

Referenced by updateMask().

◆ controlContainer

QPointer<QMdi::ControlContainer> QMdiSubWindowPrivate::controlContainer

◆ currentOperation

Operation QMdiSubWindowPrivate::currentOperation

◆ focusInReason

Qt::FocusReason QMdiSubWindowPrivate::focusInReason

Definition at line 212 of file qmdisubwindow_p.h.

Referenced by setFocusWidget().

◆ font

QFont QMdiSubWindowPrivate::font

Definition at line 222 of file qmdisubwindow_p.h.

Referenced by titleBarOptions().

◆ hoveredSubControl

QStyle::SubControl QMdiSubWindowPrivate::hoveredSubControl

Definition at line 210 of file qmdisubwindow_p.h.

Referenced by processClickedSubControl(), and titleBarOptions().

◆ ignoreNextActivationEvent

bool QMdiSubWindowPrivate::ignoreNextActivationEvent

Definition at line 199 of file qmdisubwindow_p.h.

◆ ignoreWindowTitleChange

bool QMdiSubWindowPrivate::ignoreWindowTitleChange

◆ internalMinimumSize

QSize QMdiSubWindowPrivate::internalMinimumSize

◆ isActive

bool QMdiSubWindowPrivate::isActive

Definition at line 204 of file qmdisubwindow_p.h.

Referenced by setActive(), and titleBarOptions().

◆ isExplicitlyDeactivated

bool QMdiSubWindowPrivate::isExplicitlyDeactivated

Definition at line 205 of file qmdisubwindow_p.h.

Referenced by setActive().

◆ isInInteractiveMode

bool QMdiSubWindowPrivate::isInInteractiveMode

◆ isInRubberBandMode

bool QMdiSubWindowPrivate::isInRubberBandMode

◆ isMaximizeMode

bool QMdiSubWindowPrivate::isMaximizeMode

Definition at line 202 of file qmdisubwindow_p.h.

Referenced by setMaximizeMode(), and setNormalMode().

◆ isShadeMode

bool QMdiSubWindowPrivate::isShadeMode

Definition at line 197 of file qmdisubwindow_p.h.

Referenced by setMaximizeMode(), and setNormalMode().

◆ isShadeRequestFromMinimizeMode

bool QMdiSubWindowPrivate::isShadeRequestFromMinimizeMode

Definition at line 201 of file qmdisubwindow_p.h.

Referenced by setMinimizeMode().

◆ isWidgetHiddenByUs

bool QMdiSubWindowPrivate::isWidgetHiddenByUs

Definition at line 203 of file qmdisubwindow_p.h.

Referenced by removeBaseWidget(), setMaximizeMode(), and setNormalMode().

◆ keyboardPageStep

int QMdiSubWindowPrivate::keyboardPageStep

Definition at line 207 of file qmdisubwindow_p.h.

◆ keyboardSingleStep

int QMdiSubWindowPrivate::keyboardSingleStep

Definition at line 206 of file qmdisubwindow_p.h.

◆ lastChildWindowTitle

QString QMdiSubWindowPrivate::lastChildWindowTitle

Definition at line 219 of file qmdisubwindow_p.h.

Referenced by removeBaseWidget(), and updateWindowTitle().

◆ menuIcon

QIcon QMdiSubWindowPrivate::menuIcon

Definition at line 223 of file qmdisubwindow_p.h.

Referenced by titleBarOptions().

◆ mousePressPosition

QPoint QMdiSubWindowPrivate::mousePressPosition

Definition at line 186 of file qmdisubwindow_p.h.

Referenced by _q_enterInteractiveMode(), and setNewGeometry().

◆ moveEnabled

bool QMdiSubWindowPrivate::moveEnabled

◆ oldGeometry

QRect QMdiSubWindowPrivate::oldGeometry

◆ operationMap

OperationInfoMap QMdiSubWindowPrivate::operationMap

◆ options

QMdiSubWindow::SubWindowOptions QMdiSubWindowPrivate::options

Definition at line 218 of file qmdisubwindow_p.h.

◆ originalTitle

QString QMdiSubWindowPrivate::originalTitle

Definition at line 225 of file qmdisubwindow_p.h.

Referenced by removeButtonsFromMenuBar().

◆ resizeEnabled

bool QMdiSubWindowPrivate::resizeEnabled

◆ resizeTimerId

int QMdiSubWindowPrivate::resizeTimerId

Definition at line 208 of file qmdisubwindow_p.h.

Referenced by setActive(), and updateMask().

◆ restoreFocusWidget

QPointer<QWidget> QMdiSubWindowPrivate::restoreFocusWidget

Definition at line 178 of file qmdisubwindow_p.h.

Referenced by restoreFocus(), and setMaximizeMode().

◆ restoreSize

QSize QMdiSubWindowPrivate::restoreSize

Definition at line 190 of file qmdisubwindow_p.h.

Referenced by setMaximizeMode(), and setNormalMode().

◆ rubberBand

QRubberBand* QMdiSubWindowPrivate::rubberBand

Definition at line 184 of file qmdisubwindow_p.h.

Referenced by enterRubberBandMode(), and leaveRubberBandMode().

◆ sizeGrip

QPointer<QSizeGrip> QMdiSubWindowPrivate::sizeGrip

Definition at line 181 of file qmdisubwindow_p.h.

Referenced by setSizeGrip(), and setWindowFlags().

◆ systemMenu

QPointer<QMenu> QMdiSubWindowPrivate::systemMenu

◆ titleBarPalette

QPalette QMdiSubWindowPrivate::titleBarPalette

Definition at line 220 of file qmdisubwindow_p.h.

Referenced by titleBarOptions().

◆ userMinimumSize

QSize QMdiSubWindowPrivate::userMinimumSize

Definition at line 189 of file qmdisubwindow_p.h.

Referenced by setNormalMode().

◆ windowTitle

QString QMdiSubWindowPrivate::windowTitle

Definition at line 221 of file qmdisubwindow_p.h.

Referenced by titleBarOptions(), and updateInternalWindowTitle().


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