summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmainwindowlayout.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-05-02 13:15:15 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-05-02 13:15:15 +0200
commit7de400052f7df52095103f56f1cb753854be1af1 (patch)
tree823c01302efd5d2181a3b3a55eb2937e52c849b1 /src/widgets/widgets/qmainwindowlayout.cpp
parent8b098e6544221a96bc6a41a6bfcc0dfa7cf805e6 (diff)
parent364bd6ca74b059ffe8ae367e1562645a3ed0855e (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'src/widgets/widgets/qmainwindowlayout.cpp')
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp77
1 files changed, 40 insertions, 37 deletions
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 0082ce291e..053bfbf024 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -45,10 +45,12 @@
#include "qdockwidget.h"
#include "qdockwidget_p.h"
#endif
+#if QT_CONFIG(toolbar)
#include "qtoolbar_p.h"
-#include "qmainwindow.h"
#include "qtoolbar.h"
#include "qtoolbarlayout_p.h"
+#endif
+#include "qmainwindow.h"
#include "qwidgetanimator_p.h"
#if QT_CONFIG(rubberband)
#include "qrubberband.h"
@@ -75,6 +77,7 @@
# include <qtextstream.h>
#endif
+#include <private/qmenu_p.h>
#include <private/qapplication_p.h>
#include <private/qlayoutengine_p.h>
#include <private/qwidgetresizehandler_p.h>
@@ -606,7 +609,7 @@ void QDockWidgetGroupWindow::apply()
QMainWindowLayoutState::QMainWindowLayoutState(QMainWindow *win)
:
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout(win),
#endif
#if QT_CONFIG(dockwidget)
@@ -631,9 +634,9 @@ QSize QMainWindowLayoutState::sizeHint() const
result = centralWidgetItem->sizeHint();
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
result = toolBarAreaLayout.sizeHint(result);
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
return result;
}
@@ -649,16 +652,16 @@ QSize QMainWindowLayoutState::minimumSize() const
result = centralWidgetItem->minimumSize();
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
result = toolBarAreaLayout.minimumSize(result);
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
return result;
}
void QMainWindowLayoutState::apply(bool animated)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.apply(animated);
#endif
@@ -677,12 +680,12 @@ void QMainWindowLayoutState::apply(bool animated)
void QMainWindowLayoutState::fitLayout()
{
QRect r;
-#ifdef QT_NO_TOOLBAR
+#if !QT_CONFIG(toolbar)
r = rect;
#else
toolBarAreaLayout.rect = rect;
r = toolBarAreaLayout.fitLayout();
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget)
dockAreaLayout.rect = r;
@@ -694,7 +697,7 @@ void QMainWindowLayoutState::fitLayout()
void QMainWindowLayoutState::deleteAllLayoutItems()
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.deleteAllLayoutItems();
#endif
@@ -716,7 +719,7 @@ void QMainWindowLayoutState::deleteCentralWidgetItem()
QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QLayoutItem *ret = toolBarAreaLayout.itemAt(x, index))
return ret;
#endif
@@ -734,7 +737,7 @@ QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const
QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QLayoutItem *ret = toolBarAreaLayout.takeAt(x, index))
return ret;
#endif
@@ -757,7 +760,7 @@ QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const
{
QList<int> result;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
// is it a toolbar?
if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
result = toolBarAreaLayout.indexOf(toolBar);
@@ -792,7 +795,7 @@ bool QMainWindowLayoutState::contains(QWidget *widget) const
return true;
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (!toolBarAreaLayout.indexOf(widget).isEmpty())
return true;
#endif
@@ -835,7 +838,7 @@ QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget,
{
QList<int> result;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
// is it a toolbar?
if (qobject_cast<QToolBar*>(widget) != 0) {
result = toolBarAreaLayout.gapIndex(pos);
@@ -873,7 +876,7 @@ bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0) {
Q_ASSERT(qobject_cast<QToolBar*>(item->widget()) != 0);
return toolBarAreaLayout.insertGap(path.mid(1), item);
@@ -894,7 +897,7 @@ void QMainWindowLayoutState::remove(const QList<int> &path)
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
toolBarAreaLayout.remove(path.mid(1));
#endif
@@ -907,7 +910,7 @@ void QMainWindowLayoutState::remove(const QList<int> &path)
void QMainWindowLayoutState::remove(QLayoutItem *item)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.remove(item);
#endif
@@ -923,7 +926,7 @@ void QMainWindowLayoutState::remove(QLayoutItem *item)
void QMainWindowLayoutState::clear()
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.clear();
#endif
@@ -945,7 +948,7 @@ QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path)
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0) {
const QToolBarAreaLayoutItem *tbItem = toolBarAreaLayout.item(path.mid(1));
Q_ASSERT(tbItem);
@@ -965,7 +968,7 @@ QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
return toolBarAreaLayout.itemRect(path.mid(1));
#endif
@@ -982,7 +985,7 @@ QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
return toolBarAreaLayout.itemRect(path.mid(1));
#endif
@@ -999,7 +1002,7 @@ QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path)
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
return toolBarAreaLayout.plug(path.mid(1));
#endif
@@ -1016,7 +1019,7 @@ QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowL
{
int i = path.first();
-#ifdef QT_NO_TOOLBAR
+#if !QT_CONFIG(toolbar)
Q_UNUSED(other);
#else
if (i == 0)
@@ -1047,7 +1050,7 @@ void QMainWindowLayoutState::saveState(QDataStream &stream) const
}
#endif
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.saveState(stream);
#endif
}
@@ -1094,7 +1097,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
stream >> marker;
switch(marker)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case QToolBarAreaLayout::ToolBarStateMarker:
case QToolBarAreaLayout::ToolBarStateMarkerEx:
{
@@ -1104,7 +1107,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
}
}
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget)
case QDockAreaLayout::DockWidgetStateMarker:
@@ -1213,7 +1216,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
#endif // QT_CONFIG(tabwidget)
#endif // QT_CONFIG(dockwidget)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case QToolBarAreaLayout::ToolBarStateMarker:
case QToolBarAreaLayout::ToolBarStateMarkerEx:
{
@@ -1234,7 +1237,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
}
}
break;
-#endif //QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
default:
return false;
}// switch
@@ -1248,7 +1251,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
** QMainWindowLayoutState - toolbars
*/
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
static inline void validateToolBarArea(Qt::ToolBarArea &area)
{
@@ -1423,7 +1426,7 @@ void QMainWindowLayout::toggleToolBarsVisible()
}
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
/******************************************************************************
** QMainWindowLayoutState - dock areas
@@ -1907,7 +1910,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index)
layoutState.remove(ret);
}
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (!currentGapPos.isEmpty() && currentGapPos.constFirst() == 0) {
currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
if (!currentGapPos.isEmpty()) {
@@ -2019,7 +2022,7 @@ void QMainWindowLayout::setCurrentHoveredFloat(QDockWidgetGroupWindow *w)
static void fixToolBarOrientation(QLayoutItem *item, int dockPos)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());
if (toolBar == 0)
return;
@@ -2148,7 +2151,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
{
//this function is called from within the Widget Animator whenever an animation is finished
//on a certain widget
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
if (tbl->animating) {
@@ -2219,7 +2222,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
dw->d_func()->plug(currentGapRect);
}
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
tb->d_func()->plug(currentGapRect);
#endif
@@ -2466,7 +2469,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
}
}
#endif // QT_CONFIG(dockwidget)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
tb->d_func()->unplug(r);
}
@@ -2614,7 +2617,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
if (qobject_cast<QDockWidgetGroupWindow *>(widget))
allowed = true;
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
#endif