4#ifndef QMDISUBWINDOW_P_H
5#define QMDISUBWINDOW_P_H
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
22#include <QStyleOptionTitleBar>
26#if QT_CONFIG(sizegrip)
31#include <private/qwidget_p.h>
33QT_REQUIRE_CONFIG(mdiarea);
53 if (classname && strcmp(classname,
"ControlElement") == 0)
77 QPointer<QWidget> previousLeft;
78 QPointer<QWidget> previousRight;
82 QPointer<QWidget> m_controllerWidget;
83 QPointer<QWidget> m_menuLabel;
84 QPointer<QMdiSubWindow> mdiChild;
90 Q_DECLARE_PUBLIC(QMdiSubWindow)
111 HResizeReverse = 0x10,
112 VResizeReverse = 0x20
115 enum WindowStateAction {
124 NumWindowStateActions
127 struct OperationInfo {
129 Qt::CursorShape cursorShape;
132 OperationInfo(uint changeFlags, Qt::CursorShape cursorShape,
bool hover =
true)
133 : changeFlags(changeFlags),
134 cursorShape(cursorShape),
139 typedef QMap<Operation, OperationInfo> OperationInfoMap;
141 QMdiSubWindowPrivate();
144 QPointer<QWidget> baseWidget;
145 QPointer<QWidget> restoreFocusWidget;
146 QPointer<QMdi::ControlContainer> controlContainer;
147#if QT_CONFIG(sizegrip)
148 QPointer<QSizeGrip> sizeGrip;
150#if QT_CONFIG(rubberband)
151 QRubberBand *rubberBand;
153 QPoint mousePressPosition;
155 QSize internalMinimumSize;
156 QSize userMinimumSize;
160 bool isInInteractiveMode;
161#if QT_CONFIG(rubberband)
162 bool isInRubberBandMode;
165 bool ignoreWindowTitleChange;
166 bool ignoreNextActivationEvent;
167 bool activationEnabled;
168 bool isShadeRequestFromMinimizeMode;
170 bool isWidgetHiddenByUs;
172 bool isExplicitlyDeactivated;
173 int keyboardSingleStep;
174 int keyboardPageStep;
175 QBasicTimer resizeTimer;
176 Operation currentOperation;
177 QStyle::SubControl hoveredSubControl;
178 QStyle::SubControl activeSubControl;
179 Qt::FocusReason focusInReason;
180 OperationInfoMap operationMap;
181 QPointer<QMenu> systemMenu;
183 QPointer<QAction> actions[NumWindowStateActions];
185 QMdiSubWindow::SubWindowOptions options;
186 QString lastChildWindowTitle;
187 QPalette titleBarPalette;
191 QStyleOptionTitleBar cachedStyleOptions;
192 QString originalTitle;
195 void _q_updateStaysOnTopHint();
196 void _q_enterInteractiveMode();
197 void _q_processFocusChanged(QWidget *old, QWidget *now);
200 void leaveInteractiveMode();
201 void removeBaseWidget();
202 void initOperationMap();
204 void createSystemMenu();
207 void updateDirtyRegions();
208 void updateGeometryConstraints();
210 void setNewGeometry(
const QPoint &pos);
211 void setMinimizeMode();
212 void setNormalMode();
213 void setMaximizeMode();
214 void setActive(
bool activate,
bool changeFocus =
true);
215 void processClickedSubControl();
216 QRegion getRegion(Operation operation)
const;
217 Operation getOperation(
const QPoint &pos)
const;
218 QStyleOptionTitleBar titleBarOptions()
const;
219 void ensureWindowState(Qt::WindowState state);
220 int titleBarHeight(
const QStyleOptionTitleBar &options)
const;
221 void sizeParameters(
int *margin,
int *minWidth)
const;
222 bool drawTitleBarWhenMaximized()
const;
223#if QT_CONFIG(menubar)
224 QMenuBar *menuBar()
const;
225 void showButtonsInMenuBar(QMenuBar *menuBar);
226 void removeButtonsFromMenuBar();
228 void updateWindowTitle(
bool requestFromChild);
229#if QT_CONFIG(rubberband)
230 void enterRubberBandMode();
231 void leaveRubberBandMode();
233 QPalette desktopPalette()
const;
234 void updateActions();
235 void setFocusWidget();
237 void storeFocusWidget();
238 void setWindowFlags(Qt::WindowFlags windowFlags) override;
239 using QWidgetPrivate::setVisible;
240 void setVisible(WindowStateAction,
bool visible =
true);
242 void setEnabled(WindowStateAction,
bool enable =
true);
244 void addToSystemMenu(WindowStateAction,
const QString &text,
const char *slot);
247 QSize iconSize()
const;
248#if QT_CONFIG(sizegrip)
249 void setSizeGrip(QSizeGrip *sizeGrip);
250 void setSizeGripVisible(
bool visible =
true)
const;
252 void updateInternalWindowTitle();
253 QString originalWindowTitle();
254 QString originalWindowTitleHelper()
const;
255 void setNewWindowTitle();
257 inline int titleBarHeight()
const
259 Q_Q(
const QMdiSubWindow);
260 if (!parent || q->windowFlags() & Qt::FramelessWindowHint
261 || (q->isMaximized() && !drawTitleBarWhenMaximized())) {
264 QStyleOptionTitleBar options = titleBarOptions();
265 int height = options.rect.height();
266 if (hasBorder(options))
267 height += q->isMinimized() ? 8 : 4;
271 inline QStyle::SubControl getSubControl(
const QPoint &pos)
const
273 Q_Q(
const QMdiSubWindow);
274 QStyleOptionTitleBar titleBarOptions =
this->titleBarOptions();
275 return q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &titleBarOptions, pos, q);
278 inline void setNewGeometry(QRect *geometry)
282 geometry->setSize(geometry->size().expandedTo(internalMinimumSize));
283#if QT_CONFIG(rubberband)
284 if (isInRubberBandMode)
285 rubberBand->setGeometry(*geometry);
288 q->setGeometry(*geometry);
291 inline bool hasBorder(
const QStyleOptionTitleBar &options)
const
293 Q_Q(
const QMdiSubWindow);
294 return !q->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, q);
297 inline bool autoRaise()
const
299 Q_Q(
const QMdiSubWindow);
300 return q->style()->styleHint(QStyle::SH_TitleBar_AutoRaise,
nullptr, q);
303 inline bool isResizeOperation()
const
305 return currentOperation != None && currentOperation != Move;
308 inline bool isMoveOperation()
const
310 return currentOperation == Move;
QWidget * controllerWidget() const
QWidget * systemMenuLabel() const
void updateWindowIcon(const QIcon &windowIcon)
ControlContainer(QMdiSubWindow *mdiChild)
QPointer< QMdiSubWindow > mdiChild
void * qt_metacast(const char *classname) override
ControlElement(QMdiSubWindow *child)
QSize sizeHint() const override
bool event(QEvent *event) override
This virtual function receives events to an object and should return true if the event e was recogniz...
void mousePressEvent(QMouseEvent *mouseEvent) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click...
void paintEvent(QPaintEvent *paintEvent) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
Combined button and popup list for selecting options.
static const int BoundaryMargin
static bool isChildOfQMdiSubWindow(const QWidget *child)
static const int NumSubControls
static const QStyle::SubControl SubControls[]
static int getMoveDeltaComponent(uint cflags, uint moveFlag, uint resizeFlag, int delta, int maxDelta, int minDelta)
static bool isHoverControl(QStyle::SubControl control)
static const Qt::WindowFlags CustomizeWindowFlags
static int getResizeDeltaComponent(uint cflags, uint resizeFlag, uint resizeReverseFlag, int delta)
static bool isMacStyle(QStyle *style)
QString qt_setWindowTitle_helperHelper(const QString &, const QWidget *)
Returns a modified window title with the [*] place holder replaced according to the rules described i...
static ControlElement< T > * ptr(QWidget *widget)
static bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)