4#ifndef QDYNAMICMAINWINDOWLAYOUT_P_H
5#define QDYNAMICMAINWINDOWLAYOUT_P_H
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
21#include "QtWidgets/qlayout.h"
23#include "QtWidgets/qtabbar.h"
24#include "QtGui/qpainter.h"
25#include "QtGui/qevent.h"
27#include "QtCore/qbasictimer.h"
28#include "QtCore/qlist.h"
29#include "QtCore/qset.h"
30#include "private/qlayoutengine_p.h"
31#include "private/qwidgetanimator_p.h"
33#if QT_CONFIG(dockwidget)
40#include <QtCore/qloggingcategory.h>
51template <
typename Layout>
54 Layout *layout() {
return static_cast<Layout *
>(
this); }
55 const Layout *layout()
const {
return static_cast<const Layout *
>(
this); }
56 QWidget *window() {
return layout()->parentWidget(); }
66#if QT_CONFIG(dockwidget)
73 bool hasOldCursor =
false;
74 bool cursorAdjusted =
false;
78 QPoint movingSeparatorOrigin, movingSeparatorPos;
81 bool startSeparatorMove(
const QPoint &
pos);
90#if QT_CONFIG(dockwidget)
93template <
typename Layout>
98 if (
path.size() == 1) {
100 switch (
path.first()) {
117template <
typename Layout>
124 if (!hoverSeparator.isEmpty())
125 w->update(
layout()->dockAreaLayoutInfo()->separatorRect(hoverSeparator));
126 hoverSeparator.clear();
128 if (cursorAdjusted) {
129 cursorAdjusted =
false;
131 w->setCursor(oldCursor);
135 }
else if (movingSeparator.isEmpty()) {
138 if (pathToSeparator != hoverSeparator) {
139 if (!hoverSeparator.isEmpty())
140 w->
update(
layout()->dockAreaLayoutInfo()->separatorRect(hoverSeparator));
142 hoverSeparator = pathToSeparator;
144 if (hoverSeparator.isEmpty()) {
145 if (cursorAdjusted) {
146 cursorAdjusted =
false;
148 w->setCursor(oldCursor);
153 w->update(
layout()->dockAreaLayoutInfo()->separatorRect(hoverSeparator));
154 if (!cursorAdjusted) {
155 oldCursor =
w->cursor();
158 adjustedCursor = separatorCursor(hoverSeparator);
159 w->setCursor(adjustedCursor);
160 cursorAdjusted =
true;
167template <
typename Layout>
171 switch (
event->type()) {
175 layout()->dockAreaLayoutInfo()->paintSeparators(&
p,
w,
r, hoverPos);
190 adjustCursor(
QPoint(0, 0));
193 adjustCursor(
QPoint(0, 0));
199 if (
e->button() ==
Qt::LeftButton && startSeparatorMove(
e->position().toPoint())) {
211 adjustCursor(
e->position().toPoint());
214 if (separatorMove(
e->position().toPoint())) {
226 if (endSeparatorMove(
e->position().toPoint())) {
239 if (cursorAdjusted && adjustedCursor.shape() !=
w->cursor().shape()) {
240 oldCursor =
w->cursor();
244 w->setCursor(adjustedCursor);
251 separatorMoveTimer.stop();
252 if (movingSeparator.isEmpty())
254 if (movingSeparatorOrigin == movingSeparatorPos)
258 window()->update(
layout()->dockAreaLayoutInfo()->separatorRegion());
261 layout()->dockAreaLayoutInfo()->separatorMove(movingSeparator, movingSeparatorOrigin,
263 movingSeparatorPos = movingSeparatorOrigin;
273template <
typename Layout>
276 movingSeparator =
layout()->dockAreaLayoutInfo()->findSeparator(
pos);
278 if (movingSeparator.isEmpty())
282 movingSeparatorPos = movingSeparatorOrigin =
pos;
286template <
typename Layout>
289 if (movingSeparator.isEmpty())
291 movingSeparatorPos =
pos;
292 separatorMoveTimer.start(0,
window());
295template <
typename Layout>
298 if (movingSeparator.isEmpty())
300 movingSeparator.clear();
301 layout()->savedState.clear();
309 explicit QDockWidgetGroupWindow(
QWidget *
parent =
nullptr, Qt::WindowFlags
f = {})
318 void destroyOrHideIfEmpty();
320 bool hasNativeDecos()
const;
323 void updateCurrentGapRect();
327 QRect currentGapRect;
338 QSize m_removedFrameSize;
343class QDockWidgetGroupWindowItem :
public QWidgetItem
352 if (
auto dw =
widget()->findChild<QDockWidget *>())
353 return dw->minimumSize();
354 return lay()->minimumSize();
361 return lay()->maximumSize();
368 return lay()->sizeHint();
373 QLayout *lay()
const {
return const_cast<QDockWidgetGroupWindowItem *
>(
this)->
widget()->
layout(); }
391#if QT_CONFIG(toolbar)
395#if QT_CONFIG(dockwidget)
402 void apply(
bool animated);
403 void deleteAllLayoutItems();
404 void deleteCentralWidgetItem();
421 QWidget *centralWidget()
const;
428 bool isValid()
const;
452 void setDockOptions(QMainWindow::DockOptions opts);
457#if QT_CONFIG(statusbar)
463 QWidget *centralWidget()
const;
467#if QT_CONFIG(toolbar)
469 void insertToolBarBreak(
QToolBar *before);
470 void removeToolBarBreak(
QToolBar *before);
475 bool toolBarBreak(
QToolBar *toolBar)
const;
476 void getStyleOptionInfo(QStyleOptionToolBar *
option,
QToolBar *toolBar)
const;
477 void removeToolBar(
QToolBar *toolbar);
478 void toggleToolBarsVisible();
483#if QT_CONFIG(dockwidget)
486 enum DockWidgetAreaSize {Visible, Maximum};
499 void setVerticalTabsEnabled(
bool enabled);
503 bool documentMode()
const;
504 void setDocumentMode(
bool enabled);
509 bool verticalTabsEnabled;
516#if QT_CONFIG(tabwidget)
525 QDockWidgetGroupWindow *createTabbedDockWindow();
529 QDockAreaLayout *dockAreaLayoutInfo() {
return &layoutState.dockAreaLayout; }
546 int count()
const override;
552 void invalidate()
override;
559#if QT_CONFIG(rubberband)
562#if QT_CONFIG(dockwidget)
564 void setCurrentHoveredFloat(QDockWidgetGroupWindow *
w);
566 bool isInApplyState =
false;
573 void restore(
bool keepSavedState =
false);
576#if QT_CONFIG(draganddrop)
577 static bool needsPlatformDrag();
586 void updateGapIndicator();
587#if QT_CONFIG(dockwidget)
590 void tabMoved(
int from,
int to);
595 void updateTabBarShapes();
597 bool isInRestoreState =
false;
600#if QT_CONFIG(dockwidget) && !defined(QT_NO_DEBUG_STREAM)
The QCursor class provides a mouse cursor with an arbitrary shape.
\inmodule QtCore\reentrant
The QLayoutItem class provides an abstract item that a QLayout manipulates.
The QLayout class is the base class of geometry managers.
void update()
Updates the layout for parentWidget().
QList< int > hoverSeparator
QLayoutItem * centralWidgetItem
QList< int > currentGapPos
QBasicTimer discardRestoredStateTimer
QWidgetAnimator widgetAnimator
std::unique_ptr< QMainWindowLayoutState > restoredState
QMainWindow::DockOptions dockOptions
QMainWindowLayoutState layoutState
The QMainWindow class provides a main application window.
T findChild(const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns the child of this object that can be cast into type T and that is called name,...
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QRegion class specifies a clip region for a painter.
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
The QStatusBar class provides a horizontal bar suitable for presenting status information.
The QTabBar class provides a tab bar, e.g.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
static int area(const QSize &s)
#define Q_DECLARE_LOGGING_CATEGORY(name)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei const GLchar *const * path
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static constexpr QChar sep
static const struct TessellationWindingOrderTab cw[]
#define Q_AUTOTEST_EXPORT
#define QT_REQUIRE_CONFIG(feature)
QFileInfo info(fileName)
[8]
settings remove("monkey")
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent