Convert features.mainwindow to QT_[REQUIRE_]CONFIG

Change-Id: If7efc8c15d8876f5bc5575d48686894ea71bbe62
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-08-27 19:08:17 +02:00
parent 689606de91
commit 79851be729
19 changed files with 59 additions and 44 deletions

View File

@ -120,7 +120,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
iface = new QAccessibleWidget(widget, QAccessible::Dialog);
} else if (classname == QLatin1String("QMessageBox")) {
iface = new QAccessibleWidget(widget, QAccessible::AlertMessage);
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
} else if (classname == QLatin1String("QMainWindow")) {
iface = new QAccessibleMainWindow(widget);
#endif

View File

@ -80,7 +80,9 @@
#include <QDockWidget>
#include <private/qdockwidget_p.h>
#endif
#if QT_CONFIG(mainwindow)
#include <QMainWindow>
#endif
#include <QFocusFrame>
#ifndef QT_NO_ACCESSIBILITY
@ -1090,7 +1092,7 @@ void QAccessibleTextWidget::replaceText(int startOffset, int endOffset, const QS
#endif // QT_NO_CURSOR
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
QAccessibleMainWindow::QAccessibleMainWindow(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::Window) { }
@ -1139,7 +1141,7 @@ QMainWindow *QAccessibleMainWindow::mainWindow() const
return qobject_cast<QMainWindow *>(object());
}
#endif //QT_NO_MAINWINDOW
#endif // QT_CONFIG(mainwindow)
QT_END_NAMESPACE

View File

@ -304,7 +304,7 @@ protected:
#endif // QT_CONFIG(dockwidget)
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
class QAccessibleMainWindow : public QAccessibleWidget
{
public:
@ -317,7 +317,7 @@ public:
QMainWindow *mainWindow() const;
};
#endif //QT_NO_MAINWINDOW
#endif // QT_CONFIG(mainwindow)
#endif // QT_NO_ACCESSIBILITY

View File

@ -55,7 +55,9 @@
#include <qdir.h>
#include <qstyleoption.h>
#include <qapplication.h>
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
#include <qfont.h>
#if QT_CONFIG(groupbox)
#include <qgroupbox.h>

View File

@ -74,7 +74,9 @@
#include <qhash.h>
#include <qheaderview.h>
#include <qlineedit.h>
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
#include <qmdisubwindow.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h>
@ -959,7 +961,7 @@ static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSiz
return QAquaSizeLarge;
}
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
if (qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) {
//if (small.width() != -1 || small.height() != -1)
return QAquaSizeSmall;
@ -2457,7 +2459,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
#endif
break;
case PM_DefaultFrameWidth:
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
if (widget && (widget->isWindow() || !widget->parentWidget()
|| (qobject_cast<const QMainWindow*>(widget->parentWidget())
&& static_cast<QMainWindow *>(widget->parentWidget())->centralWidget() == widget))
@ -4801,7 +4803,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// the title bar. The following code fills the toolBar area with transparent pixels
// to make that gradient visible.
if (w) {
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) {
if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) {
@ -6986,7 +6988,7 @@ bool QMacStyle::event(QEvent *e)
QWidget *top = f->parentWidget();
while (top && !top->isWindow() && !(top->windowType() == Qt::SubWindow))
top = top->parentWidget();
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
if (qobject_cast<QMainWindow *>(top)) {
QWidget *central = static_cast<QMainWindow *>(top)->centralWidget();
for (const QWidget *par = f; par; par = par->parentWidget()) {

View File

@ -78,7 +78,9 @@
#if QT_CONFIG(listview)
#include <qlistview.h>
#endif
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
#include <qmap.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h>

View File

@ -85,7 +85,9 @@
#include <qtabbar.h>
#endif
#include <QMetaProperty>
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
#if QT_CONFIG(dockwidget)
#include <qdockwidget.h>
#endif
@ -2825,7 +2827,7 @@ void QStyleSheetStyle::polish(QWidget *w)
#ifndef QT_NO_FRAME
|| qobject_cast<QFrame *>(w)
#endif
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
|| qobject_cast<QMainWindow *>(w)
#endif
#ifndef QT_NO_MDIAREA

View File

@ -62,7 +62,9 @@
#endif
#include "qwidget.h"
#include "qdebug.h"
#if QT_CONFIG(mainwindow)
#include "qmainwindow.h"
#endif
#include "qfile.h"
#include "qtextstream.h"
#include "qpixmapcache.h"
@ -1113,7 +1115,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
break;
#endif // QT_CONFIG(rubberband)
#if !defined(QT_NO_MENU) && !defined(QT_NO_MAINWINDOW)
#if !defined(QT_NO_MENU) && QT_CONFIG(mainwindow)
case CE_MenuBarEmptyArea:
if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
p->fillRect(opt->rect, opt->palette.button());

View File

@ -851,7 +851,7 @@ bool QDockWidgetPrivate::isAnimating() const
bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
{
#if !defined(QT_NO_MAINWINDOW)
#if QT_CONFIG(mainwindow)
Q_Q(QDockWidget);
QDockWidgetLayout *dwLayout
@ -880,7 +880,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
return true;
}
#endif // !defined(QT_NO_MAINWINDOW)
#endif // QT_CONFIG(mainwindow)
return false;
}
@ -903,7 +903,7 @@ bool QDockWidgetPrivate::mouseDoubleClickEvent(QMouseEvent *event)
bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
{
bool ret = false;
#if !defined(QT_NO_MAINWINDOW)
#if QT_CONFIG(mainwindow)
Q_Q(QDockWidget);
if (!state)
@ -944,20 +944,20 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
ret = true;
}
#endif // !defined(QT_NO_MAINWINDOW)
#endif // QT_CONFIG(mainwindow)
return ret;
}
bool QDockWidgetPrivate::mouseReleaseEvent(QMouseEvent *event)
{
#if !defined(QT_NO_MAINWINDOW)
#if QT_CONFIG(mainwindow)
if (event->button() == Qt::LeftButton && state && !state->nca) {
endDrag();
return true; //filter out the event
}
#endif // !defined(QT_NO_MAINWINDOW)
#endif // QT_CONFIG(mainwindow)
return false;
}

View File

@ -42,8 +42,6 @@
#include "qmainwindow.h"
#include "qmainwindowlayout_p.h"
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(dockwidget)
#include "qdockwidget.h"
#endif
@ -1778,5 +1776,3 @@ QMenu *QMainWindow::createPopupMenu()
QT_END_NAMESPACE
#include "moc_qmainwindow.cpp"
#endif // QT_NO_MAINWINDOW

View File

@ -46,11 +46,10 @@
#include <QtWidgets/qtabwidget.h>
#endif
QT_REQUIRE_CONFIG(mainwindow);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_MAINWINDOW
class QDockWidget;
class QMainWindowPrivate;
class QMenuBar;
@ -215,8 +214,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QMainWindow::DockOptions)
#endif // QT_NO_MAINWINDOW
QT_END_NAMESPACE
#endif // QDYNAMICMAINWINDOW_H

View File

@ -40,7 +40,6 @@
#include "qmainwindowlayout_p.h"
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(dockwidget)
#include "qdockarealayout_p.h"
#include "qdockwidget.h"
@ -2724,9 +2723,6 @@ void QMainWindowLayout::timerEvent(QTimerEvent *e)
QLayout::timerEvent(e);
}
QT_END_NAMESPACE
#include "moc_qmainwindowlayout_p.cpp"
#endif // QT_NO_MAINWINDOW

View File

@ -54,8 +54,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qmainwindow.h"
#ifndef QT_NO_MAINWINDOW
#include "QtWidgets/qlayout.h"
#if QT_CONFIG(tabbar)
#include "QtWidgets/qtabbar.h"
@ -71,6 +69,8 @@
#endif
#include "qtoolbararealayout_p.h"
QT_REQUIRE_CONFIG(mainwindow);
QT_BEGIN_NAMESPACE
class QToolBar;
@ -379,6 +379,4 @@ QDebug operator<<(QDebug debug, const QMainWindowLayout *layout);
QT_END_NAMESPACE
#endif // QT_NO_MAINWINDOW
#endif // QDYNAMICMAINWINDOWLAYOUT_P_H

View File

@ -157,7 +157,9 @@
#include <QWhatsThis>
#endif
#include <QToolTip>
#if QT_CONFIG(mainwindow)
#include <QMainWindow>
#endif
#include <QScrollBar>
#include <QDebug>
#if QT_CONFIG(style_mac)
@ -741,7 +743,7 @@ ControlContainer::~ControlContainer()
*/
QMenuBar *QMdiSubWindowPrivate::menuBar() const
{
#if defined(QT_NO_MAINWINDOW)
#if !QT_CONFIG(mainwindow)
return 0;
#else
Q_Q(const QMdiSubWindow);
@ -1784,7 +1786,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
#else
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
return true;
#if !QT_CONFIG(menubar) || defined(QT_NO_MAINWINDOW)
#if !QT_CONFIG(menubar) || !QT_CONFIG(mainwindow)
Q_UNUSED(isChildOfQMdiSubWindow);
return true;
#else
@ -1850,7 +1852,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
return;
QMenuBar *currentMenuBar = 0;
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())) {
// NB! We can't use menuBar() here because that one will actually create
// a menubar for us if not set. That's not what we want :-)

View File

@ -49,7 +49,9 @@
#include <qpainter.h>
#include <qstylepainter.h>
#include <qevent.h>
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
#include <qtoolbar.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>

View File

@ -48,7 +48,9 @@
#include "qstyle.h"
#include "qstyleoption.h"
#include "qsizegrip.h"
#if QT_CONFIG(mainwindow)
#include "qmainwindow.h"
#endif
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"

View File

@ -50,7 +50,9 @@
#include <qstyle.h>
#include <qstyleoption.h>
#include <qtooltip.h>
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
#include <qtoolbar.h>
#include <qvariant.h>
#include <qstylepainter.h>

View File

@ -40,7 +40,9 @@
#include <QtCore/qpropertyanimation.h>
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qstyle.h>
#if QT_CONFIG(mainwindow)
#include <private/qmainwindowlayout_p.h>
#endif
#include "qwidgetanimator_p.h"
@ -61,7 +63,7 @@ void QWidgetAnimator::abort(QWidget *w)
if (anim) {
anim->stop();
}
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
m_mainWindowLayout->animationFinished(w);
#endif
#else
@ -108,9 +110,9 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
{
//we do it in one shot
widget->setGeometry(final_geometry);
#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(mainwindow)
m_mainWindowLayout->animationFinished(widget);
#endif //QT_NO_MAINWINDOW
#endif // QT_CONFIG(mainwindow)
}
}

View File

@ -7,8 +7,6 @@ HEADERS += \
widgets/qframe_p.h \
widgets/qlineedit.h \
widgets/qlineedit_p.h \
widgets/qmainwindow.h \
widgets/qmainwindowlayout_p.h \
widgets/qmdiarea.h \
widgets/qmdiarea_p.h \
widgets/qmdisubwindow.h \
@ -38,8 +36,6 @@ SOURCES += \
widgets/qframe.cpp \
widgets/qlineedit_p.cpp \
widgets/qlineedit.cpp \
widgets/qmainwindow.cpp \
widgets/qmainwindowlayout.cpp \
widgets/qmdiarea.cpp \
widgets/qmdisubwindow.cpp \
widgets/qmenu.cpp \
@ -177,6 +173,16 @@ qtConfig(lcdnumber) {
widgets/qlcdnumber.cpp
}
qtConfig(mainwindow) {
HEADERS += \
widgets/qmainwindow.h \
widgets/qmainwindowlayout_p.h
SOURCES += \
widgets/qmainwindow.cpp \
widgets/qmainwindowlayout.cpp
}
qtConfig(menubar) {
HEADERS += \
widgets/qmenubar.h \