Streamline debug output of QMainWindowLayout.
Remove define Q_DEBUG_MAINWINDOW_LAYOUT and dependent exported function, introduce operators for QDebug. Task-number: QTBUG-38761 Change-Id: I7794cffbfaea20ead0eac9e8ace4e3a910c50f95 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
32e2d8e58c
commit
cd89ec830d
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||||
@ -62,7 +62,10 @@
|
|||||||
#include <qmap.h>
|
#include <qmap.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
|
||||||
#include <qdebug.h>
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
# include <qdebug.h>
|
||||||
|
# include <qtextstream.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <private/qapplication_p.h>
|
#include <private/qapplication_p.h>
|
||||||
#include <private/qlayoutengine_p.h>
|
#include <private/qlayoutengine_p.h>
|
||||||
@ -71,23 +74,17 @@
|
|||||||
# include <private/qt_cocoa_helpers_mac_p.h>
|
# include <private/qt_cocoa_helpers_mac_p.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QT_NO_DOCKWIDGET
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#ifndef QT_NO_DOCKWIDGET
|
||||||
extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
|
extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_DEBUG_MAINWINDOW_LAYOUT
|
|
||||||
# include <QTextStream>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
** debug
|
** debug
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(Q_DEBUG_MAINWINDOW_LAYOUT) && !defined(QT_NO_DOCKWIDGET)
|
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_DEBUG_STREAM)
|
||||||
|
|
||||||
static QTextStream qout(stderr, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent);
|
static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent);
|
||||||
|
|
||||||
@ -101,7 +98,7 @@ static void dumpLayout(QTextStream &qout, const QDockAreaLayoutItem &item, QStri
|
|||||||
if (item.widgetItem != 0) {
|
if (item.widgetItem != 0) {
|
||||||
qout << indent << "widget: "
|
qout << indent << "widget: "
|
||||||
<< item.widgetItem->widget()->metaObject()->className()
|
<< item.widgetItem->widget()->metaObject()->className()
|
||||||
<< ' ' << item.widgetItem->widget()->windowTitle() << '\n';
|
<< " \"" << item.widgetItem->widget()->windowTitle() << "\"\n";
|
||||||
} else if (item.subinfo != 0) {
|
} else if (item.subinfo != 0) {
|
||||||
qout << indent << "subinfo:\n";
|
qout << indent << "subinfo:\n";
|
||||||
dumpLayout(qout, *item.subinfo, indent + QLatin1String(" "));
|
dumpLayout(qout, *item.subinfo, indent + QLatin1String(" "));
|
||||||
@ -117,16 +114,17 @@ static void dumpLayout(QTextStream &qout, const QDockAreaLayoutItem &item, QStri
|
|||||||
<< " rect:" << r.x() << ',' << r.y() << ' '
|
<< " rect:" << r.x() << ',' << r.y() << ' '
|
||||||
<< r.width() << 'x' << r.height() << '\n';
|
<< r.width() << 'x' << r.height() << '\n';
|
||||||
}
|
}
|
||||||
qout.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent)
|
static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QString indent)
|
||||||
{
|
{
|
||||||
|
const QSize minSize = layout.minimumSize();
|
||||||
qout << indent << "QDockAreaLayoutInfo: "
|
qout << indent << "QDockAreaLayoutInfo: "
|
||||||
<< layout.rect.left() << ','
|
<< layout.rect.left() << ','
|
||||||
<< layout.rect.top() << ' '
|
<< layout.rect.top() << ' '
|
||||||
<< layout.rect.width() << 'x'
|
<< layout.rect.width() << 'x'
|
||||||
<< layout.rect.height()
|
<< layout.rect.height()
|
||||||
|
<< " min size: " << minSize.width() << ',' << minSize.height()
|
||||||
<< " orient:" << layout.o
|
<< " orient:" << layout.o
|
||||||
<< " tabbed:" << layout.tabbed
|
<< " tabbed:" << layout.tabbed
|
||||||
<< " tbshape:" << layout.tabBarShape << '\n';
|
<< " tbshape:" << layout.tabBarShape << '\n';
|
||||||
@ -137,36 +135,42 @@ static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QSt
|
|||||||
qout << indent << "Item: " << i << '\n';
|
qout << indent << "Item: " << i << '\n';
|
||||||
dumpLayout(qout, layout.item_list.at(i), indent + QLatin1String(" "));
|
dumpLayout(qout, layout.item_list.at(i), indent + QLatin1String(" "));
|
||||||
}
|
}
|
||||||
qout.flush();
|
}
|
||||||
};
|
|
||||||
|
|
||||||
static void dumpLayout(QTextStream &qout, const QDockAreaLayout &layout, QString indent)
|
static void dumpLayout(QTextStream &qout, const QDockAreaLayout &layout)
|
||||||
{
|
{
|
||||||
qout << indent << "QDockAreaLayout: "
|
qout << "QDockAreaLayout: "
|
||||||
<< layout.rect.left() << ','
|
<< layout.rect.left() << ','
|
||||||
<< layout.rect.top() << ' '
|
<< layout.rect.top() << ' '
|
||||||
<< layout.rect.width() << 'x'
|
<< layout.rect.width() << 'x'
|
||||||
<< layout.rect.height() << '\n';
|
<< layout.rect.height() << '\n';
|
||||||
|
|
||||||
qout << indent << "TopDockArea:\n";
|
qout << "TopDockArea:\n";
|
||||||
dumpLayout(qout, layout.docks[QInternal::TopDock], indent + QLatin1String(" "));
|
dumpLayout(qout, layout.docks[QInternal::TopDock], QLatin1String(" "));
|
||||||
qout << indent << "LeftDockArea:\n";
|
qout << "LeftDockArea:\n";
|
||||||
dumpLayout(qout, layout.docks[QInternal::LeftDock], indent + QLatin1String(" "));
|
dumpLayout(qout, layout.docks[QInternal::LeftDock], QLatin1String(" "));
|
||||||
qout << indent << "RightDockArea:\n";
|
qout << "RightDockArea:\n";
|
||||||
dumpLayout(qout, layout.docks[QInternal::RightDock], indent + QLatin1String(" "));
|
dumpLayout(qout, layout.docks[QInternal::RightDock], QLatin1String(" "));
|
||||||
qout << indent << "BottomDockArea:\n";
|
qout << "BottomDockArea:\n";
|
||||||
dumpLayout(qout, layout.docks[QInternal::BottomDock], indent + QLatin1String(" "));
|
dumpLayout(qout, layout.docks[QInternal::BottomDock], QLatin1String(" "));
|
||||||
|
|
||||||
qout.flush();
|
|
||||||
};
|
|
||||||
|
|
||||||
void qt_dumpLayout(QTextStream &qout, QMainWindow *window)
|
|
||||||
{
|
|
||||||
QMainWindowLayout *layout = qt_mainwindow_layout(window);
|
|
||||||
dumpLayout(qout, layout->layoutState.dockAreaLayout, QString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // Q_DEBUG_MAINWINDOW_LAYOUT && !QT_NO_DOCKWIDGET
|
QDebug operator<<(QDebug debug, const QDockAreaLayout &layout)
|
||||||
|
{
|
||||||
|
QString s;
|
||||||
|
QTextStream str(&s);
|
||||||
|
dumpLayout(str, layout);
|
||||||
|
debug << s;
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const QMainWindowLayout *layout)
|
||||||
|
{
|
||||||
|
debug << layout->layoutState.dockAreaLayout;
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_DEBUG)
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
** QMainWindowLayoutState
|
** QMainWindowLayoutState
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||||
@ -68,15 +68,6 @@
|
|||||||
#include "qdockarealayout_p.h"
|
#include "qdockarealayout_p.h"
|
||||||
#include "qtoolbararealayout_p.h"
|
#include "qtoolbararealayout_p.h"
|
||||||
|
|
||||||
//#define Q_DEBUG_MAINWINDOW_LAYOUT
|
|
||||||
|
|
||||||
#if defined(Q_DEBUG_MAINWINDOW_LAYOUT) && !defined(QT_NO_DOCKWIDGET)
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QTextStream;
|
|
||||||
Q_WIDGETS_EXPORT void qt_dumpLayout(QTextStream &qout, QMainWindow *window);
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
#endif // Q_DEBUG_MAINWINDOW_LAYOUT && !QT_NO_DOCKWIDGET
|
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// Forward defs to make avoid including Carbon.h (faster compile you know ;).
|
// Forward defs to make avoid including Carbon.h (faster compile you know ;).
|
||||||
struct OpaqueHIObjectRef;
|
struct OpaqueHIObjectRef;
|
||||||
@ -344,6 +335,13 @@ public:
|
|||||||
|
|
||||||
#endif // Q_WS_MAC
|
#endif // Q_WS_MAC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_DEBUG_STREAM)
|
||||||
|
class QDebug;
|
||||||
|
QDebug operator<<(QDebug debug, const QDockAreaLayout &layout);
|
||||||
|
QDebug operator<<(QDebug debug, const QMainWindowLayout *layout);
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_MAINWINDOW
|
#endif // QT_NO_MAINWINDOW
|
||||||
|
Loading…
x
Reference in New Issue
Block a user