summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-09-26 16:08:55 +0200
committerLiang Qi <liang.qi@qt.io>2017-09-26 16:14:54 +0200
commitaadfe7d634de04519102c5827ca885dc2e2199c9 (patch)
treed92db346ca95332b177036a53f1f6beb2e24fb74 /src/widgets
parent4b6c1448047362b8c38d265e6414f0e3e59b8d37 (diff)
parenta732e16d5fd9dbf8a0289fec9f948b12e9ba2c19 (diff)
downloadqtbase-aadfe7d634de04519102c5827ca885dc2e2199c9.tar.gz
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/gui/kernel/qguiapplication.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h src/plugins/platforms/cocoa/qcocoawindow.h src/testlib/qtestsystem.h Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/complexwidgets.cpp8
-rw-r--r--src/widgets/accessible/complexwidgets_p.h4
-rw-r--r--src/widgets/accessible/qaccessiblemenu.cpp18
-rw-r--r--src/widgets/accessible/qaccessiblemenu_p.h8
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp4
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp20
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp31
-rw-r--r--src/widgets/accessible/qaccessiblewidgets_p.h12
-rw-r--r--src/widgets/accessible/rangecontrols.cpp15
-rw-r--r--src/widgets/accessible/rangecontrols_p.h8
-rw-r--r--src/widgets/accessible/simplewidgets.cpp23
-rw-r--r--src/widgets/accessible/simplewidgets_p.h4
-rw-r--r--src/widgets/configure.json3
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp4
-rw-r--r--src/widgets/dialogs/qdialog.cpp20
-rw-r--r--src/widgets/dialogs/qdialog_p.h4
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp8
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp26
-rw-r--r--src/widgets/dialogs/qmessagebox.h4
-rw-r--r--src/widgets/dialogs/qsidebar.cpp6
-rw-r--r--src/widgets/dialogs/qsidebar_p.h2
-rw-r--r--src/widgets/dialogs/qwizard.cpp8
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp4
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp13
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp8
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp22
-rw-r--r--src/widgets/itemviews/qitemeditorfactory_p.h6
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp6
-rw-r--r--src/widgets/kernel/qaction.cpp6
-rw-r--r--src/widgets/kernel/qaction.h2
-rw-r--r--src/widgets/kernel/qaction_p.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp9
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp22
-rw-r--r--src/widgets/kernel/qlayout.cpp18
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp2
-rw-r--r--src/widgets/kernel/qshortcut.cpp10
-rw-r--r--src/widgets/kernel/qtooltip.cpp8
-rw-r--r--src/widgets/kernel/qwidget.cpp39
-rw-r--r--src/widgets/kernel/qwidget_p.h1
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp6
-rw-r--r--src/widgets/styles/qcommonstyle.cpp68
-rw-r--r--src/widgets/styles/qfusionstyle.cpp6
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp4
-rw-r--r--src/widgets/styles/qstylehelper.cpp4
-rw-r--r--src/widgets/styles/qstyleoption.cpp12
-rw-r--r--src/widgets/styles/qstyleoption.h13
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp74
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp48
-rw-r--r--src/widgets/util/qcompleter.cpp6
-rw-r--r--src/widgets/util/qcompleter.h7
-rw-r--r--src/widgets/util/qcompleter_p.h6
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp6
-rw-r--r--src/widgets/util/qsystemtrayicon.h2
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h3
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp2
-rw-r--r--src/widgets/util/util.pri13
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp38
-rw-r--r--src/widgets/widgets/qabstractbutton.h2
-rw-r--r--src/widgets/widgets/qabstractbutton_p.h2
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h4
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp6
-rw-r--r--src/widgets/widgets/qabstractspinbox.h7
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h6
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp4
-rw-r--r--src/widgets/widgets/qbuttongroup.h7
-rw-r--r--src/widgets/widgets/qbuttongroup_p.h6
-rw-r--r--src/widgets/widgets/qcombobox.cpp44
-rw-r--r--src/widgets/widgets/qcombobox.h11
-rw-r--r--src/widgets/widgets/qcombobox_p.h6
-rw-r--r--src/widgets/widgets/qdockwidget.cpp12
-rw-r--r--src/widgets/widgets/qeffects.cpp3
-rw-r--r--src/widgets/widgets/qeffects_p.h5
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp4
-rw-r--r--src/widgets/widgets/qkeysequenceedit.h6
-rw-r--r--src/widgets/widgets/qkeysequenceedit_p.h6
-rw-r--r--src/widgets/widgets/qlabel_p.h2
-rw-r--r--src/widgets/widgets/qlineedit.cpp17
-rw-r--r--src/widgets/widgets/qlineedit.h11
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp11
-rw-r--r--src/widgets/widgets/qlineedit_p.h9
-rw-r--r--src/widgets/widgets/qmainwindow.cpp19
-rw-r--r--src/widgets/widgets/qmainwindow.h11
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp3
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h6
-rw-r--r--src/widgets/widgets/qmdiarea.cpp11
-rw-r--r--src/widgets/widgets/qmdiarea.h6
-rw-r--r--src/widgets/widgets/qmdiarea_p.h4
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp98
-rw-r--r--src/widgets/widgets/qmdisubwindow.h11
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h24
-rw-r--r--src/widgets/widgets/qmenu.cpp61
-rw-r--r--src/widgets/widgets/qmenu.h7
-rw-r--r--src/widgets/widgets/qmenu_mac.mm10
-rw-r--r--src/widgets/widgets/qmenu_p.h9
-rw-r--r--src/widgets/widgets/qmenubar.cpp10
-rw-r--r--src/widgets/widgets/qmenubar.h7
-rw-r--r--src/widgets/widgets/qmenubar_p.h5
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp6
-rw-r--r--src/widgets/widgets/qplaintextedit.h6
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h8
-rw-r--r--src/widgets/widgets/qpushbutton.cpp14
-rw-r--r--src/widgets/widgets/qpushbutton.h6
-rw-r--r--src/widgets/widgets/qpushbutton_p.h2
-rw-r--r--src/widgets/widgets/qradiobutton.cpp2
-rw-r--r--src/widgets/widgets/qscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qscrollarea.h7
-rw-r--r--src/widgets/widgets/qscrollarea_p.h6
-rw-r--r--src/widgets/widgets/qscrollbar.cpp6
-rw-r--r--src/widgets/widgets/qsizegrip.cpp8
-rw-r--r--src/widgets/widgets/qsizegrip.h5
-rw-r--r--src/widgets/widgets/qslider.cpp3
-rw-r--r--src/widgets/widgets/qslider.h7
-rw-r--r--src/widgets/widgets/qspinbox.cpp4
-rw-r--r--src/widgets/widgets/qspinbox.h7
-rw-r--r--src/widgets/widgets/qstackedwidget.cpp4
-rw-r--r--src/widgets/widgets/qstackedwidget.h7
-rw-r--r--src/widgets/widgets/qstatusbar.cpp24
-rw-r--r--src/widgets/widgets/qtextedit.cpp11
-rw-r--r--src/widgets/widgets/qtextedit.h6
-rw-r--r--src/widgets/widgets/qtextedit_p.h8
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp31
-rw-r--r--src/widgets/widgets/qtoolbutton.h8
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp8
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp22
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h12
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp5
-rw-r--r--src/widgets/widgets/qwidgetresizehandler_p.h4
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp16
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h6
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p_p.h2
-rw-r--r--src/widgets/widgets/widgets.pri182
135 files changed, 935 insertions, 763 deletions
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 94ad011533..6cdc06d702 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -52,7 +52,9 @@
#if QT_CONFIG(combobox)
#include <qcombobox.h>
#endif
+#if QT_CONFIG(lineedit)
#include <qlineedit.h>
+#endif
#include <qstyle.h>
#include <qstyleoption.h>
#include <qtooltip.h>
@@ -60,7 +62,9 @@
#include <qwhatsthis.h>
#endif
#include <QAbstractScrollArea>
+#if QT_CONFIG(scrollarea)
#include <QScrollArea>
+#endif
#if QT_CONFIG(scrollbar)
#include <QScrollBar>
#endif
@@ -388,7 +392,7 @@ QStringList QAccessibleComboBox::keyBindingsForAction(const QString &/*actionNam
#endif // QT_CONFIG(combobox)
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
// ======================= QAccessibleAbstractScrollArea =======================
QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::Client)
@@ -497,7 +501,7 @@ QAccessibleScrollArea::QAccessibleScrollArea(QWidget *widget)
{
Q_ASSERT(qobject_cast<QScrollArea *>(widget));
}
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
QT_END_NAMESPACE
diff --git a/src/widgets/accessible/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h
index c842490603..96db2dab70 100644
--- a/src/widgets/accessible/complexwidgets_p.h
+++ b/src/widgets/accessible/complexwidgets_p.h
@@ -70,7 +70,7 @@ class QTitleBar;
class QAbstractScrollArea;
class QScrollArea;
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
class QAccessibleAbstractScrollArea : public QAccessibleWidget
{
public:
@@ -105,7 +105,7 @@ class QAccessibleScrollArea : public QAccessibleAbstractScrollArea
public:
explicit QAccessibleScrollArea(QWidget *widget);
};
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
#if QT_CONFIG(tabbar)
class QAccessibleTabBar : public QAccessibleWidget
diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp
index 2391f74c2f..8b3353f625 100644
--- a/src/widgets/accessible/qaccessiblemenu.cpp
+++ b/src/widgets/accessible/qaccessiblemenu.cpp
@@ -39,8 +39,12 @@
#include "qaccessiblemenu_p.h"
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
+#if QT_CONFIG(menubar)
#include <qmenubar.h>
+#endif
#include <QtWidgets/QAction>
#include <qstyle.h>
@@ -48,7 +52,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QString qt_accStripAmp(const QString &text);
QString qt_accHotKey(const QString &text);
@@ -139,7 +143,7 @@ int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const
return -1;
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QAccessibleMenuBar::QAccessibleMenuBar(QWidget *w)
: QAccessibleWidget(w, QAccessible::MenuBar)
{
@@ -173,7 +177,7 @@ int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const
return -1;
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action)
: m_action(action), m_owner(owner)
@@ -253,13 +257,13 @@ QRect QAccessibleMenuItem::rect() const
{
QRect rect;
QWidget *own = owner();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
rect = menuBar->actionGeometry(m_action);
QPoint globalPos = menuBar->mapToGlobal(QPoint(0,0));
rect = rect.translated(globalPos);
} else
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
if (QMenu *menu = qobject_cast<QMenu*>(own)) {
rect = menu->actionGeometry(m_action);
QPoint globalPos = menu->mapToGlobal(QPoint(0,0));
@@ -289,7 +293,7 @@ QAccessible::State QAccessibleMenuItem::state() const
if (QMenu *menu = qobject_cast<QMenu*>(own)) {
if (menu->activeAction() == m_action)
s.focused = true;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
} else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
if (menuBar->activeAction() == m_action)
s.focused = true;
@@ -387,7 +391,7 @@ QWidget *QAccessibleMenuItem::owner() const
return m_owner;
}
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
QT_END_NAMESPACE
diff --git a/src/widgets/accessible/qaccessiblemenu_p.h b/src/widgets/accessible/qaccessiblemenu_p.h
index 4372ae4dcc..9acd2a42f9 100644
--- a/src/widgets/accessible/qaccessiblemenu_p.h
+++ b/src/widgets/accessible/qaccessiblemenu_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
class QMenu;
class QMenuBar;
class QAction;
@@ -82,7 +82,7 @@ protected:
QMenu *menu() const;
};
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
class QAccessibleMenuBar : public QAccessibleWidget
{
public:
@@ -96,7 +96,7 @@ public:
protected:
QMenuBar *menuBar() const;
};
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActionInterface
@@ -136,7 +136,7 @@ private:
QPointer<QWidget> m_owner; // can hold either QMenu or the QMenuBar that contains the action
};
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
QT_END_NAMESPACE
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index e3dd7383b2..c96d213e7b 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -60,7 +60,9 @@
#include <QRubberBand>
#endif
#include <QFocusFrame>
+#if QT_CONFIG(menu)
#include <QMenu>
+#endif
#include <QtWidgets/private/qwidget_p.h>
QT_BEGIN_NAMESPACE
@@ -72,7 +74,7 @@ static QList<QWidget*> childWidgets(const QWidget *widget)
QWidget *w = qobject_cast<QWidget *>(o);
if (w && !w->isWindow()
&& !qobject_cast<QFocusFrame*>(w)
-#if !defined(QT_NO_MENU)
+#if QT_CONFIG(menu)
&& !qobject_cast<QMenu*>(w)
#endif
&& w->objectName() != QLatin1String("qt_rubberband")
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index 3fbc9714f5..0bac45de27 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -76,7 +76,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
return iface;
if (false) {
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
} else if (classname == QLatin1String("QLineEdit")) {
if (widget->objectName() == QLatin1String("qt_spinbox_lineedit"))
iface = 0;
@@ -87,7 +87,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QComboBox")) {
iface = new QAccessibleComboBox(widget);
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
} else if (classname == QLatin1String("QAbstractSpinBox")) {
iface = new QAccessibleAbstractSpinBox(widget);
} else if (classname == QLatin1String("QSpinBox")) {
@@ -99,7 +99,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QScrollBar")) {
iface = new QAccessibleScrollBar(widget);
#endif
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
} else if (classname == QLatin1String("QAbstractSlider")) {
iface = new QAccessibleAbstractSlider(widget);
} else if (classname == QLatin1String("QSlider")) {
@@ -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
@@ -138,11 +138,11 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
#endif
} else if (classname == QLatin1String("QToolBar")) {
iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle());
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
} else if (classname == QLatin1String("QMenuBar")) {
iface = new QAccessibleMenuBar(widget);
#endif
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
} else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget);
#endif
@@ -167,7 +167,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QSplitterHandle")) {
iface = new QAccessibleWidget(widget, QAccessible::Grip);
#endif
-#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
+#if QT_CONFIG(textedit) && !defined(QT_NO_CURSOR)
} else if (classname == QLatin1String("QTextEdit")) {
iface = new QAccessibleTextEdit(widget);
} else if (classname == QLatin1String("QPlainTextEdit")) {
@@ -177,7 +177,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
iface = new QAccessibleDisplay(widget, QAccessible::ToolTip);
} else if (classname == QLatin1String("QFrame")) {
iface = new QAccessibleWidget(widget, QAccessible::Border);
-#ifndef QT_NO_STACKEDWIDGET
+#if QT_CONFIG(stackedwidget)
} else if (classname == QLatin1String("QStackedWidget")) {
iface = new QAccessibleStackedWidget(widget);
#endif
@@ -185,7 +185,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QToolBox")) {
iface = new QAccessibleToolBox(widget);
#endif
-#ifndef QT_NO_MDIAREA
+#if QT_CONFIG(mdiarea)
} else if (classname == QLatin1String("QMdiArea")) {
iface = new QAccessibleMdiArea(widget);
} else if (classname == QLatin1String("QMdiSubWindow")) {
@@ -207,7 +207,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QTextBrowser")) {
iface = new QAccessibleTextBrowser(widget);
#endif
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
} else if (classname == QLatin1String("QAbstractScrollArea")) {
iface = new QAccessibleAbstractScrollArea(widget);
} else if (classname == QLatin1String("QScrollArea")) {
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 4e7ba78620..f869ab1129 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -41,23 +41,29 @@
#include "qabstracttextdocumentlayout.h"
#include "qapplication.h"
#include "qclipboard.h"
-#include "qtextedit.h"
-#include "private/qtextedit_p.h"
#include "qtextdocument.h"
#include "qtextobject.h"
+#if QT_CONFIG(textedit)
#include "qplaintextedit.h"
+#include "qtextedit.h"
+#include "private/qtextedit_p.h"
+#endif
#include "qtextboundaryfinder.h"
#if QT_CONFIG(scrollbar)
#include "qscrollbar.h"
#endif
#include "qdebug.h"
#include <QApplication>
+#if QT_CONFIG(stackedwidget)
#include <QStackedWidget>
+#endif
#if QT_CONFIG(toolbox)
#include <QToolBox>
#endif
+#if QT_CONFIG(mdiarea)
#include <QMdiArea>
#include <QMdiSubWindow>
+#endif
#if QT_CONFIG(dialogbuttonbox)
#include <QDialogButtonBox>
#endif
@@ -78,8 +84,13 @@
#include <QDockWidget>
#include <private/qdockwidget_p.h>
#endif
+#if QT_CONFIG(mainwindow)
#include <QMainWindow>
+#endif
#include <QFocusFrame>
+#if QT_CONFIG(menu)
+#include <QMenu>
+#endif
#ifndef QT_NO_ACCESSIBILITY
@@ -111,7 +122,7 @@ QList<QWidget*> childWidgets(const QWidget *widget)
return widgets;
}
-#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
+#if QT_CONFIG(textedit) && !defined(QT_NO_CURSOR)
QAccessiblePlainTextEdit::QAccessiblePlainTextEdit(QWidget* o)
:QAccessibleTextWidget(o)
@@ -308,9 +319,9 @@ void QAccessibleTextEdit::scrollToSubstring(int startIndex, int endIndex)
qWarning("AccessibleTextEdit::scrollToSubstring failed!");
}
-#endif // QT_NO_TEXTEDIT && QT_NO_CURSOR
+#endif // QT_CONFIG(textedit) && QT_NO_CURSOR
-#ifndef QT_NO_STACKEDWIDGET
+#if QT_CONFIG(stackedwidget)
// ======================= QAccessibleStackedWidget ======================
QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::LayeredPane)
@@ -356,7 +367,7 @@ QStackedWidget *QAccessibleStackedWidget::stackedWidget() const
{
return static_cast<QStackedWidget *>(object());
}
-#endif // QT_NO_STACKEDWIDGET
+#endif // QT_CONFIG(stackedwidget)
#if QT_CONFIG(toolbox)
// ======================= QAccessibleToolBox ======================
@@ -373,7 +384,7 @@ QToolBox * QAccessibleToolBox::toolBox() const
#endif // QT_CONFIG(toolbox)
// ======================= QAccessibleMdiArea ======================
-#ifndef QT_NO_MDIAREA
+#if QT_CONFIG(mdiarea)
QAccessibleMdiArea::QAccessibleMdiArea(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::LayeredPane)
{
@@ -493,7 +504,7 @@ QMdiSubWindow *QAccessibleMdiSubWindow::mdiSubWindow() const
{
return static_cast<QMdiSubWindow *>(object());
}
-#endif // QT_NO_MDIAREA
+#endif // QT_CONFIG(mdiarea)
#if QT_CONFIG(dialogbuttonbox)
// ======================= QAccessibleDialogButtonBox ======================
@@ -1088,7 +1099,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) { }
@@ -1137,7 +1148,7 @@ QMainWindow *QAccessibleMainWindow::mainWindow() const
return qobject_cast<QMainWindow *>(object());
}
-#endif //QT_NO_MAINWINDOW
+#endif // QT_CONFIG(mainwindow)
QT_END_NAMESPACE
diff --git a/src/widgets/accessible/qaccessiblewidgets_p.h b/src/widgets/accessible/qaccessiblewidgets_p.h
index e663d70de6..87f0b888a0 100644
--- a/src/widgets/accessible/qaccessiblewidgets_p.h
+++ b/src/widgets/accessible/qaccessiblewidgets_p.h
@@ -132,7 +132,7 @@ protected:
virtual QWidget *viewport() const = 0;
};
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
class QAccessiblePlainTextEdit : public QAccessibleTextWidget
{
public:
@@ -184,7 +184,7 @@ protected:
QTextDocument *textDocument() const override;
QWidget *viewport() const override;
};
-#endif // QT_NO_TEXTEDIT
+#endif // QT_CONFIG(textedit)
#endif //QT_NO_CURSOR
class QAccessibleStackedWidget : public QAccessibleWidget
@@ -216,7 +216,7 @@ protected:
QToolBox *toolBox() const;
};
-#ifndef QT_NO_MDIAREA
+#if QT_CONFIG(mdiarea)
class QAccessibleMdiArea : public QAccessibleWidget
{
public:
@@ -246,7 +246,7 @@ public:
protected:
QMdiSubWindow *mdiSubWindow() const;
};
-#endif // QT_NO_MDIAREA
+#endif // QT_CONFIG(mdiarea)
#if QT_CONFIG(dialogbuttonbox)
class QAccessibleDialogButtonBox : public QAccessibleWidget
@@ -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
diff --git a/src/widgets/accessible/rangecontrols.cpp b/src/widgets/accessible/rangecontrols.cpp
index 4aa948ed33..b5b8608418 100644
--- a/src/widgets/accessible/rangecontrols.cpp
+++ b/src/widgets/accessible/rangecontrols.cpp
@@ -39,11 +39,15 @@
#include "rangecontrols_p.h"
+#if QT_CONFIG(slider)
#include <qslider.h>
+#endif
#if QT_CONFIG(dial)
#include <qdial.h>
#endif
+#if QT_CONFIG(spinbox)
#include <qspinbox.h>
+#endif
#if QT_CONFIG(scrollbar)
#include <qscrollbar.h>
#endif
@@ -51,8 +55,9 @@
#include <qstyleoption.h>
#include <qdebug.h>
#include <qglobal.h>
-#include <QDoubleSpinBox>
+#if QT_CONFIG(lineedit)
#include <QtWidgets/qlineedit.h>
+#endif
#include <qmath.h>
#include <private/qmath_p.h>
@@ -62,7 +67,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
QAccessibleAbstractSpinBox::QAccessibleAbstractSpinBox(QWidget *w)
: QAccessibleWidget(w, QAccessible::SpinBox), lineEdit(nullptr)
{
@@ -285,7 +290,7 @@ QString QAccessibleDoubleSpinBox::text(QAccessible::Text textType) const
return QAccessibleWidget::text(textType);
}
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
#if QT_CONFIG(scrollbar)
/*!
@@ -322,7 +327,7 @@ QString QAccessibleScrollBar::text(QAccessible::Text t) const
#endif // QT_CONFIG(scrollbar)
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
/*!
\class QAccessibleSlider
\brief The QAccessibleSlider class implements the QAccessibleInterface for sliders.
@@ -399,7 +404,7 @@ QAbstractSlider *QAccessibleAbstractSlider::abstractSlider() const
return static_cast<QAbstractSlider *>(object());
}
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(dial)
// ======================================= QAccessibleDial ======================================
diff --git a/src/widgets/accessible/rangecontrols_p.h b/src/widgets/accessible/rangecontrols_p.h
index 41c3747c05..1eada8e456 100644
--- a/src/widgets/accessible/rangecontrols_p.h
+++ b/src/widgets/accessible/rangecontrols_p.h
@@ -67,7 +67,7 @@ class QDoubleSpinBox;
class QDial;
class QAccessibleLineEdit;
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
class QAccessibleAbstractSpinBox:
public QAccessibleWidget,
public QAccessibleValueInterface,
@@ -141,7 +141,7 @@ public:
protected:
QDoubleSpinBox *doubleSpinBox() const;
};
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
#if QT_CONFIG(slider)
class QAccessibleAbstractSlider: public QAccessibleWidget, public QAccessibleValueInterface
@@ -174,7 +174,7 @@ protected:
};
#endif // QT_CONFIG(scrollbar)
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
class QAccessibleSlider : public QAccessibleAbstractSlider
{
public:
@@ -184,7 +184,7 @@ public:
protected:
QSlider *slider() const;
};
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(dial)
class QAccessibleDial : public QAccessibleAbstractSlider
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index b6fe003452..73de51ff45 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -60,7 +60,9 @@
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#if QT_CONFIG(label)
#include <qlabel.h>
#endif
@@ -70,14 +72,17 @@
#if QT_CONFIG(lcdnumber)
#include <qlcdnumber.h>
#endif
+#if QT_CONFIG(lineedit)
#include <qlineedit.h>
#include <private/qlineedit_p.h>
+#endif
#include <qstyle.h>
#include <qstyleoption.h>
#include <qtextdocument.h>
#include <qwindow.h>
#include <private/qwindowcontainer_p.h>
#include <QtCore/qvarlengtharray.h>
+#include <QtGui/qvalidator.h>
#ifdef Q_OS_MAC
#include <qfocusframe.h>
@@ -175,7 +180,7 @@ QAccessible::State QAccessibleButton::state() const
if (pb) {
if (pb->isDefault())
state.defaultButton = true;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (pb->menu())
state.hasPopup = true;
#endif
@@ -214,7 +219,7 @@ QAccessible::Role QAccessibleButton::role() const
{
QAbstractButton *ab = button();
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (QPushButton *pb = qobject_cast<QPushButton*>(ab)) {
if (pb->menu())
return QAccessible::ButtonMenu;
@@ -257,7 +262,7 @@ void QAccessibleButton::doAction(const QString &actionName)
return;
if (actionName == pressAction() ||
actionName == showMenuAction()) {
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QPushButton *pb = qobject_cast<QPushButton*>(object());
if (pb && pb->menu())
pb->showMenu();
@@ -311,7 +316,7 @@ QToolButton *QAccessibleToolButton::toolButton() const
*/
bool QAccessibleToolButton::isSplitButton() const
{
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
return toolButton()->menu() && toolButton()->popupMode() == QToolButton::MenuButtonPopup;
#else
return false;
@@ -323,7 +328,7 @@ QAccessible::State QAccessibleToolButton::state() const
QAccessible::State st = QAccessibleButton::state();
if (toolButton()->autoRaise())
st.hotTracked = true;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (toolButton()->menu())
st.hasPopup = true;
#endif
@@ -337,7 +342,7 @@ int QAccessibleToolButton::childCount() const
QAccessible::Role QAccessibleToolButton::role() const
{
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QAbstractButton *ab = button();
QToolButton *tb = qobject_cast<QToolButton*>(ab);
if (!tb->menu())
@@ -351,7 +356,7 @@ QAccessible::Role QAccessibleToolButton::role() const
QAccessibleInterface *QAccessibleToolButton::child(int index) const
{
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (index == 0 && toolButton()->menu())
{
return QAccessible::queryAccessibleInterface(toolButton()->menu());
@@ -658,7 +663,7 @@ QStringList QAccessibleGroupBox::keyBindingsForAction(const QString &) const
#endif
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
/*!
\class QAccessibleLineEdit
\brief The QAccessibleLineEdit class implements the QAccessibleInterface for widgets with editable text
@@ -895,7 +900,7 @@ void QAccessibleLineEdit::replaceText(int startOffset, int endOffset, const QStr
lineEdit()->setText(lineEdit()->text().replace(startOffset, endOffset - startOffset, text));
}
-#endif // QT_NO_LINEEDIT
+#endif // QT_CONFIG(lineedit)
#if QT_CONFIG(progressbar)
QAccessibleProgressBar::QAccessibleProgressBar(QWidget *o)
diff --git a/src/widgets/accessible/simplewidgets_p.h b/src/widgets/accessible/simplewidgets_p.h
index 08ce1a9d77..fcd0e7df47 100644
--- a/src/widgets/accessible/simplewidgets_p.h
+++ b/src/widgets/accessible/simplewidgets_p.h
@@ -148,7 +148,7 @@ private:
};
#endif
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
class QAccessibleLineEdit : public QAccessibleWidget, public QAccessibleTextInterface, public QAccessibleEditableTextInterface
{
public:
@@ -188,7 +188,7 @@ protected:
QLineEdit *lineEdit() const;
friend class QAccessibleAbstractSpinBox;
};
-#endif // QT_NO_LINEEDIT
+#endif // QT_CONFIG(lineedit)
#if QT_CONFIG(progressbar)
class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValueInterface
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 2c183dad65..4c596c09a5 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -74,7 +74,8 @@
"effects": {
"label": "Effects",
"purpose": "Provides special widget effects (e.g. fading and scrolling).",
- "section": "Kernel"
+ "section": "Kernel",
+ "output": [ "privateFeature" ]
},
"filesystemmodel": {
"label": "QFileSystemModel",
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 8cc0812125..03505e78c8 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -49,7 +49,9 @@
#include "qlabel.h"
#include "qlayout.h"
#include "qlineedit.h"
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
#include "qpainter.h"
#include "qpixmap.h"
#include "qpushbutton.h"
@@ -428,7 +430,7 @@ void QWellArray::setSelected(int row, int col)
if (row >= 0)
emit selected(row, col);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (isVisible() && qobject_cast<QMenu*>(parentWidget()))
parentWidget()->close();
#endif
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 9e62f79a8e..f5db4481ee 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -53,11 +53,15 @@
#include <private/qdesktopwidget_p.h>
#include "qapplication.h"
#include "qlayout.h"
+#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
+#endif
#if QT_CONFIG(whatsthis)
#include "qwhatsthis.h"
#endif
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
#include "qcursor.h"
#if QT_CONFIG(messagebox)
#include "qmessagebox.h"
@@ -621,7 +625,7 @@ bool QDialog::eventFilter(QObject *o, QEvent *e)
/*! \reimp */
void QDialog::contextMenuEvent(QContextMenuEvent *e)
{
-#if !QT_CONFIG(whatsthis) || defined(QT_NO_MENU)
+#if !QT_CONFIG(whatsthis) || !QT_CONFIG(menu)
Q_UNUSED(e);
#else
QWidget *w = childAt(e->pos());
@@ -1006,7 +1010,7 @@ void QDialog::showExtension(bool showIt)
setFixedSize(w, height() + s.height());
}
d->extension->show();
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
const bool sizeGripEnabled = isSizeGripEnabled();
setSizeGripEnabled(false);
d->sizeGripEnabled = sizeGripEnabled;
@@ -1019,7 +1023,7 @@ void QDialog::showExtension(bool showIt)
resize(d->size);
if (layout())
layout()->setEnabled(true);
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
setSizeGripEnabled(d->sizeGripEnabled);
#endif
}
@@ -1080,7 +1084,7 @@ void QDialog::setModal(bool modal)
bool QDialog::isSizeGripEnabled() const
{
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
Q_D(const QDialog);
return !!d->resizer;
#else
@@ -1091,11 +1095,11 @@ bool QDialog::isSizeGripEnabled() const
void QDialog::setSizeGripEnabled(bool enabled)
{
-#ifdef QT_NO_SIZEGRIP
+#if !QT_CONFIG(sizegrip)
Q_UNUSED(enabled);
#else
Q_D(QDialog);
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
d->sizeGripEnabled = enabled;
if (enabled && d->doShowExtension)
return;
@@ -1116,7 +1120,7 @@ void QDialog::setSizeGripEnabled(bool enabled)
d->resizer = 0;
}
}
-#endif //QT_NO_SIZEGRIP
+#endif // QT_CONFIG(sizegrip)
}
@@ -1124,7 +1128,7 @@ void QDialog::setSizeGripEnabled(bool enabled)
/*! \reimp */
void QDialog::resizeEvent(QResizeEvent *)
{
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
Q_D(QDialog);
if (d->resizer) {
if (isRightToLeft())
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index c4677918a4..99fff08e65 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -78,7 +78,7 @@ public:
mainDef(0),
#endif
orientation(Qt::Horizontal),extension(0), doShowExtension(false),
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
resizer(0),
sizeGripEnabled(false),
#endif
@@ -99,7 +99,7 @@ public:
QWidget *extension;
bool doShowExtension;
QSize size, min, max;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
QSizeGrip *resizer;
bool sizeGripEnabled;
#endif
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 28cc7f8884..e375a957de 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -50,7 +50,9 @@
#include <qheaderview.h>
#include <qshortcut.h>
#include <qgridlayout.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#if QT_CONFIG(messagebox)
#include <qmessagebox.h>
#endif
@@ -3353,7 +3355,7 @@ void QFileDialogPrivate::_q_showDetailsView()
*/
void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
{
-#ifdef QT_NO_MENU
+#if !QT_CONFIG(menu)
Q_UNUSED(position);
#else
Q_Q(QFileDialog);
@@ -3382,7 +3384,7 @@ void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
menu.addAction(newFolderAction);
}
menu.exec(view->viewport()->mapToGlobal(position));
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
}
/*!
@@ -4130,7 +4132,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const
return parts;
}
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
QT_END_NAMESPACE
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index db54bd39cb..17290381d3 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -69,7 +69,9 @@
#include <qstackedwidget.h>
#include <qdialogbuttonbox.h>
#include <qabstractproxymodel.h>
+#if QT_CONFIG(completer)
#include <qcompleter.h>
+#endif
#include <qpointer.h>
#include <qdebug.h>
#include "qsidebar_p.h"
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 3fe6a7ea7d..190ce93439 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -54,8 +54,12 @@
#include <QtGui/qicon.h>
#include <QtGui/qtextdocument.h>
#include <QtWidgets/qapplication.h>
+#if QT_CONFIG(textedit)
#include <QtWidgets/qtextedit.h>
+#endif
+#if QT_CONFIG(menu)
#include <QtWidgets/qmenu.h>
+#endif
#include "qdialog_p.h"
#include <QtGui/qfont.h>
#include <QtGui/qfontmetrics.h>
@@ -84,7 +88,7 @@ enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5
NewButtonMask = 0xFFFFFC00 };
enum DetailButtonLabel { ShowLabel = 0, HideLabel = 1 };
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
class QMessageBoxDetailsText : public QWidget
{
Q_OBJECT
@@ -153,7 +157,7 @@ private:
bool copyAvailable;
TextEdit *textEdit;
};
-#endif // QT_NO_TEXTEDIT
+#endif // QT_CONFIG(textedit)
class DetailButton : public QPushButton
{
@@ -193,7 +197,7 @@ class QMessageBoxPrivate : public QDialogPrivate
public:
QMessageBoxPrivate() : escapeButton(0), defaultButton(0), checkbox(0), clickedButton(0), detailsButton(0),
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
detailsText(0),
#endif
compatMode(false), autoAddOkButton(true),
@@ -243,7 +247,7 @@ public:
QCheckBox *checkbox;
QAbstractButton *clickedButton;
DetailButton *detailsButton;
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
QMessageBoxDetailsText *detailsText;
#endif
bool compatMode;
@@ -464,7 +468,7 @@ int QMessageBoxPrivate::execReturnCode(QAbstractButton *button)
void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
{
Q_Q(QMessageBox);
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
if (detailsButton && detailsText && button == detailsButton) {
detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel);
detailsText->setHidden(!detailsText->isHidden());
@@ -1418,7 +1422,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT)
-#if !defined(QT_NO_TEXTEDIT)
+#if QT_CONFIG(textedit)
if (e == QKeySequence::Copy) {
if (d->detailsText && d->detailsText->isVisible() && d->detailsText->copy()) {
e->setAccepted(true);
@@ -1429,7 +1433,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
e->setAccepted(true);
return;
}
-#endif // !QT_NO_TEXTEDIT
+#endif // QT_CONFIG(textedit)
#if defined(Q_OS_WIN)
if (e == QKeySequence::Copy) {
@@ -1445,7 +1449,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
for (const auto *button : buttons)
textToCopy += button->text() + QLatin1String(" ");
textToCopy += QLatin1Char('\n') + separator;
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
if (d->detailsText)
textToCopy += d->detailsText->text() + QLatin1Char('\n') + separator;
#endif
@@ -1983,7 +1987,7 @@ int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon ico
void QMessageBoxPrivate::retranslateStrings()
{
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
if (detailsButton)
detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel);
#endif
@@ -2438,7 +2442,7 @@ void QMessageBox::setButtonText(int button, const QString &text)
}
}
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
/*!
\property QMessageBox::detailedText
\brief the text to be displayed in the details area.
@@ -2486,7 +2490,7 @@ void QMessageBox::setDetailedText(const QString &text)
}
d->setupLayout();
}
-#endif // QT_NO_TEXTEDIT
+#endif // QT_CONFIG(textedit)
/*!
\property QMessageBox::informativeText
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index c2ce1ab333..4b993a9e65 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -61,7 +61,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText)
#endif
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText)
@@ -270,7 +270,7 @@ public:
QString informativeText() const;
void setInformativeText(const QString &text);
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
QString detailedText() const;
void setDetailedText(const QString &text);
#endif
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index b8b042ddb5..f77b10ecbc 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -42,7 +42,9 @@
#include <qaction.h>
#include <qurl.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qmimedata.h>
#include <qevent.h>
#include <qdebug.h>
@@ -435,7 +437,7 @@ void QSidebar::selectUrl(const QUrl &url)
this, SLOT(clicked(QModelIndex)));
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
\internal
@@ -454,7 +456,7 @@ void QSidebar::showContextMenu(const QPoint &position)
if (actions.count() > 0)
QMenu::exec(actions, mapToGlobal(position));
}
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
/*!
\internal
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 58ac3569d5..07aaa5abd2 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -148,7 +148,7 @@ protected:
private Q_SLOTS:
void clicked(const QModelIndex &index);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void showContextMenu(const QPoint &position);
#endif
void removeEntry();
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index f5dfe76c39..8b90028fbb 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -40,7 +40,9 @@
#include "qwizard.h"
#include <QtWidgets/private/qtwidgetsglobal_p.h>
+#if QT_CONFIG(spinbox)
#include "qabstractspinbox.h"
+#endif
#include "qalgorithms.h"
#include "qapplication.h"
#include "qboxlayout.h"
@@ -50,7 +52,9 @@
#include "qevent.h"
#include "qframe.h"
#include "qlabel.h"
+#if QT_CONFIG(lineedit)
#include "qlineedit.h"
+#endif
#include "qpainter.h"
#include "qwindow.h"
#include "qpushbutton.h"
@@ -3680,13 +3684,13 @@ bool QWizardPage::isComplete() const
if (value == field.initialValue)
return false;
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(field.object)) {
if (!lineEdit->hasAcceptableInput())
return false;
}
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(field.object)) {
if (!spinBox->hasAcceptableInput())
return false;
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index ebd245c4e7..94ce102a68 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -53,8 +53,12 @@
#include <QtGui/qpainter.h>
#include <QtWidgets/qstyleoption.h>
#include <QtWidgets/qgraphicsview.h>
+#if QT_CONFIG(lineedit)
#include <QtWidgets/qlineedit.h>
+#endif
+#if QT_CONFIG(textedit)
#include <QtWidgets/qtextedit.h>
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index fd4699409c..d532221092 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -49,10 +49,15 @@
#include <qevent.h>
#include <qstring.h>
#include <qdebug.h>
+#if QT_CONFIG(lineedit)
#include <qlineedit.h>
+#endif
+#if QT_CONFIG(textedit)
#include <qtextedit.h>
#include <qplaintextedit.h>
+#endif
#include <qapplication.h>
+#include <qvalidator.h>
#include <private/qtextengine_p.h>
#include <private/qabstractitemdelegate_p.h>
@@ -432,7 +437,7 @@ QAbstractItemDelegatePrivate::QAbstractItemDelegatePrivate()
static bool editorHandlesKeyEvent(QWidget *editor, const QKeyEvent *event)
{
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
// do not filter enter / return / tab / backtab for QTextEdit or QPlainTextEdit
if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor)) {
switch (event->key()) {
@@ -446,7 +451,7 @@ static bool editorHandlesKeyEvent(QWidget *editor, const QKeyEvent *event)
break;
}
}
-#endif // QT_NO_TEXTEDIT
+#endif // QT_CONFIG(textedit)
Q_UNUSED(editor);
Q_UNUSED(event);
@@ -535,7 +540,7 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor)
{
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
if (QLineEdit *e = qobject_cast<QLineEdit*>(editor)) {
if (!e->hasAcceptableInput()) {
#if QT_CONFIG(validator)
@@ -550,7 +555,7 @@ bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor)
}
#else
Q_UNUSED(editor)
-#endif // QT_NO_LINEEDIT
+#endif // QT_CONFIG(lineedit)
return true;
}
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index ed87de4e18..fe27be8522 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -49,8 +49,12 @@
#include <qscrollbar.h>
#include <qtooltip.h>
#include <qdatetime.h>
+#if QT_CONFIG(lineedit)
#include <qlineedit.h>
+#endif
+#if QT_CONFIG(spinbox)
#include <qspinbox.h>
+#endif
#include <qheaderview.h>
#include <qstyleditemdelegate.h>
#include <private/qabstractitemview_p.h>
@@ -4228,11 +4232,11 @@ QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index,
QWidget *focusWidget = w;
while (QWidget *fp = focusWidget->focusProxy())
focusWidget = fp;
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
if (QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget))
le->selectAll();
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget))
sb->selectAll();
else if (QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget))
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index b1e9af1f0f..1d8e03569d 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -50,8 +50,12 @@
#if QT_CONFIG(label)
#include <qlabel.h>
#endif
+#if QT_CONFIG(lineedit)
#include <qlineedit.h>
+#endif
+#if QT_CONFIG(spinbox)
#include <qspinbox.h>
+#endif
#include <qstyle.h>
#include <qstyleoption.h>
#include <limits.h>
@@ -80,7 +84,7 @@ public:
#endif // QT_CONFIG(combobox)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
class QUIntSpinBox : public QSpinBox
{
@@ -107,7 +111,7 @@ Q_SIGNALS:
void uintValueChanged();
};
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
/*!
\class QItemEditorFactory
@@ -242,7 +246,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
cb->setFrame(false);
return cb; }
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case QVariant::UInt: {
QSpinBox *sb = new QUIntSpinBox(parent);
sb->setFrame(false);
@@ -274,7 +278,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
case QVariant::Pixmap:
return new QLabel(parent);
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case QVariant::Double: {
QDoubleSpinBox *sb = new QDoubleSpinBox(parent);
sb->setFrame(false);
@@ -282,7 +286,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
sb->setMaximum(DBL_MAX);
return sb; }
#endif
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
case QVariant::String:
default: {
// the default editor is a lineedit
@@ -306,7 +310,7 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
case QVariant::Bool:
return "currentIndex";
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case QVariant::UInt:
case QVariant::Int:
case QVariant::Double:
@@ -535,7 +539,7 @@ QItemEditorCreatorBase::~QItemEditorCreatorBase()
\reimp
*/
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
QExpandingLineEdit::QExpandingLineEdit(QWidget *parent)
: QLineEdit(parent), originalWidth(-1), widgetOwnsGeometry(false)
@@ -595,7 +599,7 @@ void QExpandingLineEdit::resizeToContents()
}
}
-#endif // QT_NO_LINEEDIT
+#endif // QT_CONFIG(lineedit)
#if QT_CONFIG(combobox)
@@ -620,7 +624,7 @@ bool QBooleanComboBox::value() const
QT_END_NAMESPACE
-#if !defined(QT_NO_LINEEDIT) || QT_CONFIG(combobox)
+#if QT_CONFIG(lineedit) || QT_CONFIG(combobox)
#include "qitemeditorfactory.moc"
#endif
diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h
index 1b7718192c..e78f42b729 100644
--- a/src/widgets/itemviews/qitemeditorfactory_p.h
+++ b/src/widgets/itemviews/qitemeditorfactory_p.h
@@ -53,9 +53,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
-#include <qlineedit.h>
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
+#include <qlineedit.h>
QT_REQUIRE_CONFIG(itemviews);
@@ -89,6 +89,6 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_LINEEDIT
+#endif // QT_CONFIG(lineedit)
#endif //QITEMEDITORFACTORY_P_H
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index bda3325adb..716df2c729 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -42,9 +42,13 @@
#include <qabstractitemmodel.h>
#include <qapplication.h>
#include <qbrush.h>
+#if QT_CONFIG(lineedit)
#include <qlineedit.h>
+#endif
+#if QT_CONFIG(textedit)
#include <qtextedit.h>
#include <qplaintextedit.h>
+#endif
#include <qpainter.h>
#include <qpalette.h>
#include <qpoint.h>
@@ -501,7 +505,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
// let the editor take up all available space
//if the editor is not a QLineEdit
//or it is in a QTableView
-#if QT_CONFIG(tableview) && !defined(QT_NO_LINEEDIT)
+#if QT_CONFIG(tableview) && QT_CONFIG(lineedit)
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
else
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index a7116b1462..2813340ea2 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -48,7 +48,9 @@
#include "qstylehints.h"
#include <private/qshortcutmap_p.h>
#include <private/qapplication_p.h>
+#if QT_CONFIG(menu)
#include <private/qmenu_p.h>
+#endif
#include <private/qdebug_p.h>
#define QAPP_CHECK(functionName) \
@@ -645,7 +647,7 @@ QIcon QAction::icon() const
return d->icon;
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
Returns the menu contained by this action. Actions that contain
menus can be used to create menu items with submenus, or inserted
@@ -672,7 +674,7 @@ void QAction::setMenu(QMenu *menu)
menu->d_func()->setOverrideMenuAction(this);
d->sendDataChanged();
}
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
/*!
If \a b is true then this action will be considered a separator.
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index 2cb30d0fc9..84bf92d2ac 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -121,7 +121,7 @@ public:
void setPriority(Priority priority);
Priority priority() const;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QMenu *menu() const;
void setMenu(QMenu *menu);
#endif
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 4c1537b63b..19ae47c7b9 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -53,7 +53,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qaction.h"
+#if QT_CONFIG(menu)
#include "QtWidgets/qmenu.h"
+#endif
#if QT_CONFIG(graphicsview)
#include "private/qgraphicswidget_p.h"
#endif
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index d141abce24..93e2db4b1a 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2228,8 +2228,15 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
if (test->isWindow())
seenWindow = true;
+ // If the next focus widget has a focus proxy, we need to check to ensure
+ // that the proxy is in the correct parent-child direction (according to
+ // \a next). This is to ensure that we can tab in and out of compound widgets
+ // without getting stuck in a tab-loop between parent and child.
+ QWidget *focusProxy = test->d_func()->deepestFocusProxy();
+
if ((test->focusPolicy() & focus_flag) == focus_flag
- && !(test->d_func()->extra && test->d_func()->extra->focus_proxy)
+ && !(next && focusProxy && focusProxy->isAncestorOf(test))
+ && !(!next && focusProxy && test->isAncestorOf(focusProxy))
&& test->isVisibleTo(toplevel) && test->isEnabled()
&& !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test))
&& (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) {
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index ff32540715..09e39c7cff 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -352,26 +352,8 @@ int QDesktopWidget::screenNumber(const QPoint &p) const
int QDesktopWidgetPrivate::screenNumber(const QPoint &p)
{
- const QList<QScreen *> screens = QGuiApplication::screens();
- if (!screens.isEmpty()) {
- const QList<QScreen *> primaryScreens = screens.first()->virtualSiblings();
- // Find the screen index on the primary virtual desktop first
- foreach (QScreen *screen, primaryScreens) {
- if (screen->geometry().contains(p))
- return screens.indexOf(screen);
- }
- // If the screen index is not found on primary virtual desktop, find
- // the screen index on all screens except the first which was for
- // sure in the previous loop. Some other screens may repeat. Find
- // only when there is more than one virtual desktop.
- if (screens.count() != primaryScreens.count()) {
- for (int i = 1; i < screens.size(); ++i) {
- if (screens[i]->geometry().contains(p))
- return i;
- }
- }
- }
- return primaryScreen(); //even better would be closest screen
+ QScreen *screen = QGuiApplication::screenAt(p);
+ return screen ? QGuiApplication::screens().indexOf(screen) : primaryScreen();
}
void QDesktopWidget::resizeEvent(QResizeEvent *)
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 129c12885a..1e455b0d64 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -41,9 +41,13 @@
#include "qapplication.h"
#include "qlayoutengine_p.h"
+#if QT_CONFIG(menubar)
#include "qmenubar.h"
+#endif
#include "qtoolbar.h"
+#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
+#endif
#include "qevent.h"
#include "qstyle.h"
#include "qvariant.h"
@@ -583,7 +587,7 @@ void QLayoutPrivate::doResize(const QSize &r)
const int mbTop = rect.top();
rect.setTop(mbTop + mbh);
q->setGeometry(rect);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (menubar)
menubar->setGeometry(rect.left(), mbTop, r.width(), mbh);
#endif
@@ -615,7 +619,7 @@ void QLayout::widgetEvent(QEvent *e)
{
QChildEvent *c = (QChildEvent *)e;
if (c->child()->isWidgetType()) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (c->child() == d->menubar)
d->menubar = 0;
#endif
@@ -664,7 +668,7 @@ int QLayout::totalHeightForWidth(int w) const
top += wd->topmargin + wd->bottommargin;
}
int h = heightForWidth(w - side) + top;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
h += menuBarHeightForWidth(d->menubar, w);
#endif
return h;
@@ -687,7 +691,7 @@ QSize QLayout::totalMinimumSize() const
}
QSize s = minimumSize();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width() + side);
#endif
return s + QSize(side, top);
@@ -712,7 +716,7 @@ QSize QLayout::totalSizeHint() const
QSize s = sizeHint();
if (hasHeightForWidth())
s.setHeight(heightForWidth(s.width() + side));
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width());
#endif
return s + QSize(side, top);
@@ -735,7 +739,7 @@ QSize QLayout::totalMaximumSize() const
}
QSize s = maximumSize();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width());
#endif
@@ -813,7 +817,7 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw)
Q_Q(QLayout);
int n = q->count();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (menubar && menubar->parentWidget() != mw) {
menubar->setParent(mw);
}
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 51793bf060..0bdac43c56 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -41,7 +41,9 @@
#include "qapplication.h"
#include "qlayoutengine_p.h"
+#if QT_CONFIG(menubar)
#include "qmenubar.h"
+#endif
#include "qtoolbar.h"
#include "qevent.h"
#include "qstyle.h"
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 891cf563d6..0585a59e89 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -45,8 +45,12 @@
#if QT_CONFIG(whatsthis)
#include <qwhatsthis.h>
#endif
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
+#if QT_CONFIG(menubar)
#include <qmenubar.h>
+#endif
#include <qapplication.h>
#include <private/qapplication_p.h>
#include <private/qshortcutmap_p.h>
@@ -143,7 +147,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window)
{
bool visible = w->isVisible();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(w)) {
if (menuBar->isNativeMenuBar())
visible = true;
@@ -208,7 +212,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)
{
bool visible = w->isVisible();
-#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
+#if defined(Q_OS_DARWIN) && QT_CONFIG(menubar)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true;
#endif
@@ -274,7 +278,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
#endif
for (int i = 0; i < widgets.size(); ++i) {
QWidget *w = widgets.at(i);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (QMenu *menu = qobject_cast<QMenu *>(w)) {
#ifdef Q_OS_DARWIN
// On Mac, menu item shortcuts are processed before reaching any window.
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 12badcee3d..f30a83611d 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -40,6 +40,8 @@
# include <private/qcore_mac_p.h>
#endif
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
+
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <private/qdesktopwidget_p.h>
@@ -49,7 +51,9 @@
#include <qstyleoption.h>
#include <qstylepainter.h>
#include <qtimer.h>
+#if QT_CONFIG(effects)
#include <private/qeffects_p.h>
+#endif
#include <qtextdocument.h>
#include <qdebug.h>
#include <private/qstylesheetstyle_p.h>
@@ -286,7 +290,7 @@ void QTipLabel::timerEvent(QTimerEvent *e)
|| e->timerId() == expireTimer.timerId()){
hideTimer.stop();
expireTimer.stop();
-#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(effects)
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){
// Fade out tip on mac (makes it invisible).
// The tip will not be deleted until a new tip is shown.
@@ -506,7 +510,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons
QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label"));
-#if !defined(QT_NO_EFFECTS) && !0 /* Used to be included in Qt4 for Q_WS_MAC */
+#if QT_CONFIG(effects) && !0 /* Used to be included in Qt4 for Q_WS_MAC */
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
qFadeEffect(QTipLabel::instance);
else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index c245c7e2e7..4794a26804 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -45,7 +45,9 @@
#include "qdesktopwidget_p.h"
#include "qevent.h"
#include "qlayout.h"
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
#include "qmetaobject.h"
#include "qpixmap.h"
#include "qpointer.h"
@@ -2439,7 +2441,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
{
Q_Q(const QWidget);
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
bool resetBrushOrigin = false;
QPointF oldBrushOrigin;
//If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture
@@ -2452,7 +2454,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
painter->setBrushOrigin(-priv->contentsOffset());
}
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
const QBrush autoFillBrush = q->palette().brush(q->backgroundRole());
@@ -2479,10 +2481,10 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
}
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
if (resetBrushOrigin)
painter->setBrushOrigin(oldBrushOrigin);
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
}
/*
@@ -6521,9 +6523,9 @@ void QWidget::setFocus(Qt::FocusReason reason)
if (!isEnabled())
return;
- QWidget *f = this;
- while (f->d_func()->extra && f->d_func()->extra->focus_proxy)
- f = f->d_func()->extra->focus_proxy;
+ QWidget *f = d_func()->deepestFocusProxy();
+ if (!f)
+ f = this;
if (QApplication::focusWidget() == f
#if 0 // Used to be included in Qt4 for Q_WS_WIN
@@ -6620,6 +6622,27 @@ void QWidget::setFocus(Qt::FocusReason reason)
}
}
+
+/*!\internal
+ * A focus proxy can have its own focus proxy, which can have its own
+ * proxy, and so on. This helper function returns the widget that sits
+ * at the bottom of the proxy chain, and therefore the one that should
+ * normally get focus if this widget receives a focus request.
+ */
+QWidget *QWidgetPrivate::deepestFocusProxy() const
+{
+ Q_Q(const QWidget);
+
+ QWidget *focusProxy = q->focusProxy();
+ if (!focusProxy)
+ return nullptr;
+
+ while (QWidget *nextFocusProxy = focusProxy->focusProxy())
+ focusProxy = nextFocusProxy;
+
+ return focusProxy;
+}
+
void QWidgetPrivate::setFocus_sys()
{
Q_Q(QWidget);
@@ -8983,7 +9006,7 @@ bool QWidget::event(QEvent *event)
case Qt::CustomContextMenu:
emit customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
break;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
case Qt::ActionsContextMenu:
if (d->actions.count()) {
QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 57da51dcba..26f8b53392 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -369,6 +369,7 @@ public:
void lower_sys();
void stackUnder_sys(QWidget *);
+ QWidget *deepestFocusProxy() const;
void setFocus_sys();
void updateFocusChild();
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index a17c69c5ce..d2ad7a466e 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -44,7 +44,9 @@
#include <qpa/qplatformintegration.h>
#include <QDebug>
+#if QT_CONFIG(mdiarea)
#include <QMdiSubWindow>
+#endif
#include <QAbstractScrollArea>
QT_BEGIN_NAMESPACE
@@ -98,10 +100,10 @@ public:
QWidget *p = q->parentWidget();
while (p) {
if (false
-#ifndef QT_NO_MDIAREA
+#if QT_CONFIG(mdiarea)
|| qobject_cast<QMdiSubWindow *>(p) != 0
#endif
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
|| qobject_cast<QAbstractScrollArea *>(p) != 0
#endif
) {
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index d5b8d2b32b..0ad508afd2 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -65,11 +65,15 @@
#include <qgroupbox.h>
#endif
#include <qmath.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qpainter.h>
#include <qpaintengine.h>
#include <qpainterpath.h>
+#if QT_CONFIG(slider)
#include <qslider.h>
+#endif
#include <qstyleoption.h>
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
@@ -512,7 +516,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
break;
}
#endif // QT_NO_TOOLBAR
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case PE_IndicatorSpinPlus:
case PE_IndicatorSpinMinus: {
QRect r = opt->rect;
@@ -570,7 +574,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
p->restore();
break; }
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
case PE_PanelTipLabel: {
const QBrush brush(opt->palette.toolTipBase());
qDrawPlainRect(p, opt->rect, opt->palette.toolTipText().color(), 1, &brush);
@@ -611,7 +615,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
break;
#endif // QT_CONFIG(tabbar)
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
case PE_PanelLineEdit:
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
p->fillRect(panel->rect.adjusted(panel->lineWidth, panel->lineWidth, -panel->lineWidth, -panel->lineWidth),
@@ -621,7 +625,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
}
break;
-#endif // QT_NO_LINEEDIT
+#endif // QT_CONFIG(lineedit)
#if QT_CONFIG(columnview)
case PE_IndicatorColumnViewArrow: {
if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
@@ -1371,7 +1375,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
}
break;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
case CE_MenuScroller: {
QStyleOption arrowOpt = *opt;
arrowOpt.state |= State_Enabled;
@@ -1391,8 +1395,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->drawLine(opt->rect.x() + 2, opt->rect.y() + opt->rect.height() / 2,
opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2);
break;
-#endif // QT_NO_MENU
-#ifndef QT_NO_MENUBAR
+#endif // QT_CONFIG(menu)
+#if QT_CONFIG(menubar)
case CE_MenuBarItem:
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
@@ -1412,7 +1416,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground))
p->eraseRect(opt->rect);
break;
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
#if QT_CONFIG(progressbar)
case CE_ProgressBar:
if (const QStyleOptionProgressBar *pb
@@ -1940,7 +1944,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
break;
#endif // QT_CONFIG(tabbar)
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
case CE_SizeGrip: {
p->save();
int x, y, w, h;
@@ -2013,7 +2017,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
p->restore();
break; }
-#endif // QT_NO_SIZEGRIP
+#endif // QT_CONFIG(sizegrip)
#if QT_CONFIG(rubberband)
case CE_RubberBand: {
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
@@ -2472,7 +2476,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r = visualRect(btn->direction, btn->rect, r);
}
break;
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case SE_SliderFocusRect:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
@@ -2485,7 +2489,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r = visualRect(opt->direction, opt->rect, r);
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(progressbar)
case SE_ProgressBarGroove:
case SE_ProgressBarContents:
@@ -3140,7 +3144,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
QPainter *p, const QWidget *widget) const
{
switch (cc) {
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
if (slider->subControls == SC_SliderTickmarks) {
@@ -3196,7 +3200,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar)
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@@ -3285,7 +3289,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
break;
#endif // QT_CONFIG(scrollbar)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case CC_SpinBox:
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QStyleOptionSpinBox copy = *sb;
@@ -3349,7 +3353,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
}
break;
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
#if QT_CONFIG(toolbutton)
case CC_ToolButton:
if (const QStyleOptionToolButton *toolbutton
@@ -3745,7 +3749,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
break;
#endif // QT_CONFIG(groupbox)
-#ifndef QT_NO_MDIAREA
+#if QT_CONFIG(mdiarea)
case CC_MdiControls:
{
QStyleOptionButton btnOpt;
@@ -3808,7 +3812,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
}
break;
-#endif // QT_NO_MDIAREA
+#endif // QT_CONFIG(mdiarea)
default:
qWarning("QCommonStyle::drawComplexControl: Control %d not handled", cc);
}
@@ -3822,7 +3826,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
{
SubControl sc = SC_None;
switch (cc) {
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget);
@@ -3835,7 +3839,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
}
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar)
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@@ -3868,7 +3872,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
}
break;
#endif // QT_CONFIG(toolbutton)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QRect r;
@@ -3883,7 +3887,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
}
}
break;
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
case CC_TitleBar:
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
QRect r;
@@ -3959,7 +3963,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
{
QRect ret;
switch (cc) {
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
@@ -3994,7 +3998,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
ret = visualRect(slider->direction, slider->rect, ret);
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar)
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@@ -4080,7 +4084,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
}
break;
#endif // QT_CONFIG(scrollbar)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QSize bs;
@@ -4339,7 +4343,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
break;
}
#endif // QT_CONFIG(groupbox)
-#ifndef QT_NO_MDIAREA
+#if QT_CONFIG(mdiarea)
case CC_MdiControls:
{
int numSubControls = 0;
@@ -4382,7 +4386,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
ret = QRect(offset, 0, buttonWidth, opt->rect.height());
break;
}
-#endif // QT_NO_MDIAREA
+#endif // QT_CONFIG(mdiarea)
default:
qWarning("QCommonStyle::subControlRect: Case %d not handled", cc);
}
@@ -4497,7 +4501,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MaximumScrollBarDragDistance).toInt();
break;
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case PM_SliderThickness:
ret = int(QStyleHelper::dpiScaled(16.));
break;
@@ -4530,7 +4534,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = 0;
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(dockwidget)
case PM_DockWidgetSeparatorExtent:
ret = int(QStyleHelper::dpiScaled(6.));
@@ -4812,7 +4816,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz.setHeight(qMax(sz.height(), h));
}
break;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
case CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
bool checkable = mi->menuHasCheckableItems;
@@ -4840,7 +4844,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = QSize(w, h);
}
break;
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
#if QT_CONFIG(toolbutton)
case CT_ToolButton:
sz = QSize(sz.width() + 6, sz.height() + 5);
@@ -4917,7 +4921,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
#else
Q_UNUSED(d);
#endif // QT_CONFIG(itemviews)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case CT_SpinBox:
if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
// Add button + frame widths
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index f20ffb0f92..074aa3ecec 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -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>
@@ -64,11 +66,15 @@
#if QT_CONFIG(scrollbar)
#include <qscrollbar.h>
#endif
+#if QT_CONFIG(spinbox)
#include <qspinbox.h>
+#endif
#if QT_CONFIG(abstractslider)
#include <qabstractslider.h>
#endif
+#if QT_CONFIG(slider)
#include <qslider.h>
+#endif
#if QT_CONFIG(splitter)
#include <qsplitter.h>
#endif
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index 975ebfcdbf..976bd2630e 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -43,7 +43,9 @@
#include "qpixmapstyle_p_p.h"
#include <QDebug>
+#if QT_CONFIG(textedit)
#include <QTextEdit>
+#endif
#include <QStringBuilder>
#include <QPainter>
#include <QPixmapCache>
@@ -52,7 +54,9 @@
#if QT_CONFIG(progressbar)
#include <QProgressBar>
#endif
+#if QT_CONFIG(slider)
#include <QSlider>
+#endif
#include <QEvent>
#if QT_CONFIG(combobox)
#include <QComboBox>
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 94376a63e3..e560e713fb 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -69,13 +69,13 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &
% HexString<uint>(size.width())
% HexString<uint>(size.height());
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
% HexString<uint>(spinBox->stepEnabled)
% QLatin1Char(spinBox->frame ? '1' : '0'); ;
}
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
// QTBUG-56743, try to create a palette cache key reflecting the value,
// as leaks may occur in conjunction with QStyleSheetStyle/QRenderRule modifying
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index a346ee18c4..28bdadcdd1 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1949,7 +1949,7 @@ QStyleOptionComplex::QStyleOptionComplex(int version, int type)
\sa QStyle::SubControl
*/
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
/*!
\class QStyleOptionSlider
\brief The QStyleOptionSlider class is used to describe the
@@ -2146,9 +2146,9 @@ QStyleOptionSlider::QStyleOptionSlider(int version)
\sa QAbstractSlider::pageStep
*/
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
/*!
\class QStyleOptionSpinBox
\brief The QStyleOptionSpinBox class is used to describe the
@@ -2252,7 +2252,7 @@ QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
The default value is false, i.e. the spin box has no frame.
*/
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
/*!
\class QStyleOptionDockWidget
@@ -3554,7 +3554,7 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
#endif // QT_CONFIG(tabbar)
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
/*!
\class QStyleOptionSizeGrip
\brief The QStyleOptionSizeGrip class is used to describe the
@@ -3634,7 +3634,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
\sa StyleOptionType
*/
-#endif // QT_NO_SIZEGRIP
+#endif // QT_CONFIG(sizegrip)
/*!
\class QStyleOptionGraphicsItem
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 36dc65151c..2880917510 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -41,11 +41,16 @@
#define QSTYLEOPTION_H
#include <QtWidgets/qtwidgetsglobal.h>
+#include <QtCore/qlocale.h>
#include <QtCore/qvariant.h>
+#if QT_CONFIG(spinbox)
#include <QtWidgets/qabstractspinbox.h>
+#endif
#include <QtGui/qicon.h>
#include <QtGui/qmatrix.h>
+#if QT_CONFIG(slider)
#include <QtWidgets/qslider.h>
+#endif
#include <QtWidgets/qstyle.h>
#if QT_CONFIG(tabbar)
#include <QtWidgets/qtabbar.h>
@@ -505,7 +510,7 @@ public:
QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
};
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
class Q_WIDGETS_EXPORT QStyleOptionSlider : public QStyleOptionComplex
{
public:
@@ -531,9 +536,9 @@ public:
protected:
QStyleOptionSlider(int version);
};
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
class Q_WIDGETS_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex
{
public:
@@ -550,7 +555,7 @@ public:
protected:
QStyleOptionSpinBox(int version);
};
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
class Q_WIDGETS_EXPORT QStyleOptionToolButton : public QStyleOptionComplex
{
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 6b611ab2b4..fd812d8d0d 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -45,11 +45,17 @@
#include "private/qcssutil_p.h"
#include <qdebug.h>
#include <qapplication.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
+#if QT_CONFIG(menubar)
#include <qmenubar.h>
+#endif
#include <qpainter.h>
#include <qstyleoption.h>
+#if QT_CONFIG(lineedit)
#include <qlineedit.h>
+#endif
#include <private/qwindowsstyle_p.h>
#if QT_CONFIG(combobox)
#include <qcombobox.h>
@@ -83,16 +89,22 @@
#include <qtabbar.h>
#endif
#include <QMetaProperty>
+#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
+#endif
#if QT_CONFIG(dockwidget)
#include <qdockwidget.h>
#endif
+#if QT_CONFIG(mdiarea)
#include <qmdisubwindow.h>
+#endif
#if QT_CONFIG(dialog)
#include <qdialog.h>
#endif
#include <private/qwidget_p.h>
+#if QT_CONFIG(spinbox)
#include <QAbstractSpinBox>
+#endif
#if QT_CONFIG(label)
#include <QLabel>
#endif
@@ -1647,7 +1659,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
{
QStyle *base = baseStyle();
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (qobject_cast<const QAbstractSpinBox *>(w))
return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w);
#endif
@@ -1657,12 +1669,12 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w);
#endif
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (qobject_cast<const QMenu *>(w))
return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w);
#endif
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (qobject_cast<const QMenuBar *>(w))
return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w);
#endif
@@ -1805,7 +1817,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
case PseudoElement_SpinBoxDownButton:
case PseudoElement_SpinBoxUpArrow:
case PseudoElement_SpinBoxDownArrow:
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
bool on = false;
bool up = pseudoElement == PseudoElement_SpinBoxUpButton
@@ -1816,7 +1828,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
on = true;
state |= (on ? QStyle::State_On : QStyle::State_Off);
}
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
break;
case PseudoElement_GroupBoxTitle:
state |= (complex->state & (QStyle::State_MouseOver | QStyle::State_Sunken));
@@ -1851,11 +1863,11 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
extraClass |= PseudoClass_ReadOnly;
else
extraClass |= PseudoClass_Editable;
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
} else if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
if (!spin->frame)
extraClass |= PseudoClass_Frameless;
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
} else if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
if (gb->features & QStyleOptionFrame::Flat)
extraClass |= PseudoClass_Flat;
@@ -2034,7 +2046,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
}
#endif
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
// LineEdit sets Sunken flag to indicate Sunken frame (argh)
if (const QLineEdit *lineEdit = qobject_cast<const QLineEdit *>(obj)) {
state &= ~QStyle::State_Sunken;
@@ -2360,12 +2372,12 @@ static QWidget *embeddedWidget(QWidget *w)
}
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (QAbstractSpinBox *sb = qobject_cast<QAbstractSpinBox *>(w))
return sb->findChild<QLineEdit *>();
#endif
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w))
return sa->viewport();
#endif
@@ -2382,21 +2394,21 @@ static QWidget *embeddedWidget(QWidget *w)
*/
static QWidget *containerWidget(const QWidget *w)
{
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
if (qobject_cast<const QLineEdit *>(w)) {
//if the QLineEdit is an embeddedWidget, we need the rule of the real widget
#if QT_CONFIG(combobox)
if (qobject_cast<const QComboBox *>(w->parentWidget()))
return w->parentWidget();
#endif
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (qobject_cast<const QAbstractSpinBox *>(w->parentWidget()))
return w->parentWidget();
#endif
}
-#endif // QT_NO_LINEEDIT
+#endif // QT_CONFIG(lineedit)
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) {
if (sa->viewport() == w)
return w->parentWidget();
@@ -2455,7 +2467,7 @@ static quint64 extendedPseudoClass(const QWidget *w)
pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly);
} else
#endif
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
if (const QLineEdit *edit = qobject_cast<const QLineEdit *>(w)) {
pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable);
} else
@@ -2800,7 +2812,7 @@ void QStyleSheetStyle::polish(QWidget *w)
}
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled);
if ((rule.hasBorder() && rule.border()->hasBorderImage())
@@ -2825,13 +2837,13 @@ 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
+#if QT_CONFIG(mdiarea)
|| qobject_cast<QMdiSubWindow *>(w)
#endif
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
|| qobject_cast<QMenuBar *>(w)
#endif
#if QT_CONFIG(dialog)
@@ -2902,7 +2914,7 @@ void QStyleSheetStyle::unpolish(QWidget *w)
w->setProperty("_q_stylesheet_maxh", QVariant());
w->setAttribute(Qt::WA_StyleSheet, false);
QObject::disconnect(w, 0, this, 0);
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
sa, SLOT(update()));
@@ -2981,7 +2993,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
}
break;
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case CC_SpinBox:
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QStyleOptionSpinBox spinOpt(*spin);
@@ -3044,7 +3056,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
return;
}
break;
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
case CC_GroupBox:
if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
@@ -3221,7 +3233,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
break;
#endif // QT_CONFIG(scrollbar)
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
rule.drawRule(p, opt->rect);
@@ -3275,7 +3287,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
return;
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
case CC_MdiControls:
if (hasStyleRule(w, PseudoElement_MdiCloseButton)
@@ -4337,7 +4349,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
case PE_PanelLineEdit:
if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (w && qobject_cast<const QAbstractSpinBox *>(w->parentWidget())) {
QRenderRule spinboxRule = renderRule(w->parentWidget(), opt);
if (!spinboxRule.hasNativeBorder() || !spinboxRule.baseStyleCanDraw())
@@ -4374,7 +4386,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
}
break;
}
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {
const QAbstractScrollAreaPrivate *sap = sa->d_func();
rule.drawBackground(p, opt->rect, sap->contentsOffset());
@@ -4990,7 +5002,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
break;
case CT_GroupBox:
case CT_LineEdit:
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
if (qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0))
return csz; // we only care about the size hint of the line edit
#endif
@@ -5388,7 +5400,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
}
break;
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case CC_SpinBox:
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
@@ -5447,7 +5459,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
: QWindowsStyle::subControlRect(cc, &spinBox, sc, w);
}
break;
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
case CC_GroupBox:
if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
@@ -5617,7 +5629,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
break;
#endif // QT_CONFIG(scrollbar)
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
@@ -5650,7 +5662,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
}
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
case CC_MdiControls:
if (hasStyleRule(w, PseudoElement_MdiCloseButton)
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 9aaf9c6be0..9e53038348 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -46,9 +46,13 @@
#include "qbitmap.h"
#include "qdrawutil.h" // for now
#include "qevent.h"
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
+#if QT_CONFIG(menubar)
#include "qmenubar.h"
#include <private/qmenubar_p.h>
+#endif
#include "qpaintengine.h"
#include "qpainter.h"
#if QT_CONFIG(rubberband)
@@ -60,7 +64,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"
@@ -166,7 +172,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
// Update state and repaint the menu bars.
d->alt_down = false;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QList<QMenuBar *> l = widget->findChildren<QMenuBar *>();
for (int i = 0; i < l.size(); ++i)
l.at(i)->update();
@@ -343,12 +349,12 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
return 2;
#endif
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case QStyle::PM_SliderLength:
return 11;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
case QStyle::PM_MenuBarHMargin:
case QStyle::PM_MenuBarVMargin:
case QStyle::PM_MenuBarPanelWidth:
@@ -363,7 +369,7 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
case QStyle::PM_DockWidgetFrameWidth:
return 4;
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
case QStyle::PM_ToolBarHandleExtent:
return 10;
default:
@@ -435,7 +441,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = 60;
break;
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
// Returns the number of pixels to use for the business part of the
// slider (i.e., the non-tickmark portion). The remaining space is shared
// equally between the tickmark regions.
@@ -463,7 +469,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = thick;
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
case PM_IconViewIconSize:
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
@@ -574,7 +580,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
// Do nothing if we always paint underlines
Q_D(const QWindowsStyle);
if (!ret && widget && d) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
if (!menuBar && qobject_cast<const QMenu *>(widget)) {
QWidget *w = QApplication::activeWindow();
@@ -587,7 +593,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
ret = 1;
// Otherwise draw underlines if the toplevel widget has seen an alt-press
} else
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
if (d->hasSeenAlt(widget)) {
ret = 1;
}
@@ -1111,7 +1117,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 QT_CONFIG(menu) && QT_CONFIG(mainwindow)
case CE_MenuBarEmptyArea:
if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
p->fillRect(opt->rect, opt->palette.button());
@@ -1122,7 +1128,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
}
break;
#endif
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
int x, y, w, h;
@@ -1259,8 +1265,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
}
break;
-#endif // QT_NO_MENU
-#ifndef QT_NO_MENUBAR
+#endif // QT_CONFIG(menu)
+#if QT_CONFIG(menubar)
case CE_MenuBarItem:
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
bool active = mbi->state & State_Selected;
@@ -1284,7 +1290,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
QCommonStyle::drawControl(ce, &newMbi, p, widget);
}
break;
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
#if QT_CONFIG(tabbar)
case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
@@ -1922,7 +1928,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
QPainter *p, const QWidget *widget) const
{
switch (cc) {
-#ifndef QT_NO_SLIDER
+#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
@@ -2142,7 +2148,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
}
}
break;
-#endif // QT_NO_SLIDER
+#endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar)
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@@ -2227,7 +2233,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
}
break;
#endif // QT_CONFIG(combobox)
-#ifndef QT_NO_SPINBOX
+#if QT_CONFIG(spinbox)
case CC_SpinBox:
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QStyleOptionSpinBox copy = *sb;
@@ -2316,7 +2322,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
}
}
break;
-#endif // QT_NO_SPINBOX
+#endif // QT_CONFIG(spinbox)
default:
QCommonStyle::drawComplexControl(cc, opt, p, widget);
@@ -2349,7 +2355,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = QSize(w, h);
}
break;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
case CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
int w = sz.width();
@@ -2391,8 +2397,8 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz.setWidth(w);
}
break;
-#endif // QT_NO_MENU
-#ifndef QT_NO_MENUBAR
+#endif // QT_CONFIG(menu)
+#if QT_CONFIG(menubar)
case CT_MenuBarItem:
if (!sz.isEmpty())
sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2);
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 25e08c3921..d444fe6053 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -143,8 +143,6 @@
#include "qcompleter_p.h"
-#ifndef QT_NO_COMPLETER
-
#include "QtWidgets/qscrollbar.h"
#include "QtCore/qstringlistmodel.h"
#if QT_CONFIG(dirmodel)
@@ -161,7 +159,9 @@
#include "QtGui/qevent.h"
#include "QtWidgets/qdesktopwidget.h"
#include <private/qdesktopwidget_p.h>
+#if QT_CONFIG(lineedit)
#include "QtWidgets/qlineedit.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -1920,5 +1920,3 @@ QT_END_NAMESPACE
#include "moc_qcompleter.cpp"
#include "moc_qcompleter_p.cpp"
-
-#endif // QT_NO_COMPLETER
diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h
index 62c49ba8b4..de79302e15 100644
--- a/src/widgets/util/qcompleter.h
+++ b/src/widgets/util/qcompleter.h
@@ -47,10 +47,9 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qrect.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(completer);
-#ifndef QT_NO_COMPLETER
+QT_BEGIN_NAMESPACE
class QCompleterPrivate;
class QAbstractItemView;
@@ -162,8 +161,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_fileSystemModelDirectoryLoaded(const QString&))
};
-#endif // QT_NO_COMPLETER
-
QT_END_NAMESPACE
#endif // QCOMPLETER_H
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index dbc57ba905..a1112cb9c7 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -55,8 +55,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qobject_p.h"
-#ifndef QT_NO_COMPLETER
-
#include "QtWidgets/qabstractitemview.h"
#include "QtCore/qabstractproxymodel.h"
#include "qcompleter.h"
@@ -64,6 +62,8 @@
#include "QtGui/qpainter.h"
#include "private/qabstractproxymodel_p.h"
+QT_REQUIRE_CONFIG(completer);
+
QT_BEGIN_NAMESPACE
class QCompletionModel;
@@ -258,6 +258,4 @@ class QCompletionModelPrivate : public QAbstractProxyModelPrivate
QT_END_NAMESPACE
-#endif // QT_NO_COMPLETER
-
#endif // QCOMPLETER_P_H
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index fb3782881c..447c7b2aeb 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -42,7 +42,9 @@
#ifndef QT_NO_SYSTEMTRAYICON
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
#include "qlist.h"
#include "qevent.h"
#include "qpoint.h"
@@ -182,7 +184,7 @@ QSystemTrayIcon::~QSystemTrayIcon()
d->remove_sys();
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
Sets the specified \a menu to be the context menu for the system tray icon.
@@ -228,7 +230,7 @@ QMenu* QSystemTrayIcon::contextMenu() const
return d->menu;
}
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
/*!
\property QSystemTrayIcon::icon
diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
index 91b0c9d8ce..e4652b742c 100644
--- a/src/widgets/util/qsystemtrayicon.h
+++ b/src/widgets/util/qsystemtrayicon.h
@@ -78,7 +78,7 @@ public:
MiddleClick
};
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void setContextMenu(QMenu *menu);
QMenu *contextMenu() const;
#endif
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index 6dd1f7300a..5bdf020a47 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -57,7 +57,10 @@
#ifndef QT_NO_SYSTEMTRAYICON
+#if QT_CONFIG(menu)
#include "QtWidgets/qmenu.h"
+#endif
+#include "QtWidgets/qwidget.h"
#include "QtGui/qpixmap.h"
#include <qpa/qplatformsystemtrayicon.h>
#include "QtCore/qstring.h"
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 8d31e96e43..df93e15f80 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -47,7 +47,9 @@
#include "qevent.h"
#include "qapplication.h"
#include "qlist.h"
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
#include "qtimer.h"
#include "qsystemtrayicon_p.h"
#include "qpaintengine.h"
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index 701758a406..a3bd8897f1 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -3,14 +3,19 @@
HEADERS += \
util/qsystemtrayicon.h \
util/qcolormap.h \
- util/qcompleter.h \
- util/qcompleter_p.h \
util/qsystemtrayicon_p.h
SOURCES += \
util/qsystemtrayicon.cpp \
- util/qcolormap.cpp \
- util/qcompleter.cpp
+ util/qcolormap.cpp
+
+qtConfig(completer) {
+ HEADERS += \
+ util/qcompleter.h \
+ util/qcompleter_p.h
+
+ SOURCES += util/qcompleter.cpp
+}
qtConfig(scroller) {
HEADERS += \
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 1d78d24a88..dbd94e890d 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -39,11 +39,13 @@
#include "private/qabstractbutton_p.h"
-#include "private/qbuttongroup_p.h"
#if QT_CONFIG(itemviews)
#include "qabstractitemview.h"
#endif
+#if QT_CONFIG(buttongroup)
#include "qbuttongroup.h"
+#include "private/qbuttongroup_p.h"
+#endif
#include "qabstractbutton_p.h"
#include "qevent.h"
#include "qpainter.h"
@@ -173,7 +175,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
#endif
checkable(false), checked(false), autoRepeat(false), autoExclusive(false),
down(false), blockRefresh(false), pressed(false),
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
group(0),
#endif
autoRepeatDelay(AUTO_REPEAT_DELAY),
@@ -183,7 +185,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
{
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (group)
return group->d_func()->buttonList;
#endif
@@ -192,7 +194,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
if (autoExclusive) {
auto isNoMemberOfMyAutoExclusiveGroup = [](QAbstractButton *candidate) {
return !candidate->autoExclusive()
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
|| candidate->group()
#endif
;
@@ -206,7 +208,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const
{
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (group)
return group->d_func()->checkedButton;
#endif
@@ -226,7 +228,7 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const
void QAbstractButtonPrivate::notifyChecked()
{
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
Q_Q(QAbstractButton);
if (group) {
QAbstractButton *previous = group->d_func()->checkedButton;
@@ -244,7 +246,7 @@ void QAbstractButtonPrivate::notifyChecked()
void QAbstractButtonPrivate::moveFocus(int key)
{
QList<QAbstractButton *> buttonList = queryButtonList();;
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
bool exclusive = group ? group->d_func()->exclusive : autoExclusive;
#else
bool exclusive = autoExclusive;
@@ -335,7 +337,7 @@ void QAbstractButtonPrivate::moveFocus(int key)
void QAbstractButtonPrivate::fixFocusPolicy()
{
Q_Q(QAbstractButton);
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (!group && !autoExclusive)
#else
if (!autoExclusive)
@@ -382,7 +384,7 @@ void QAbstractButtonPrivate::click()
bool changeState = true;
if (checked && queryCheckedButton() == q) {
// the checked button of an exclusive or autoexclusive group cannot be unchecked
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (group ? group->d_func()->exclusive : autoExclusive)
#else
if (autoExclusive)
@@ -410,7 +412,7 @@ void QAbstractButtonPrivate::emitClicked()
Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q);
emit q->clicked(checked);
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (guard && group) {
emit group->buttonClicked(group->id(q));
if (guard && group)
@@ -424,7 +426,7 @@ void QAbstractButtonPrivate::emitPressed()
Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q);
emit q->pressed();
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (guard && group) {
emit group->buttonPressed(group->id(q));
if (guard && group)
@@ -438,7 +440,7 @@ void QAbstractButtonPrivate::emitReleased()
Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q);
emit q->released();
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (guard && group) {
emit group->buttonReleased(group->id(q));
if (guard && group)
@@ -452,7 +454,7 @@ void QAbstractButtonPrivate::emitToggled(bool checked)
Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q);
emit q->toggled(checked);
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (guard && group) {
emit group->buttonToggled(group->id(q), checked);
if (guard && group)
@@ -476,7 +478,7 @@ QAbstractButton::QAbstractButton(QWidget *parent)
*/
QAbstractButton::~QAbstractButton()
{
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
Q_D(QAbstractButton);
if (d->group)
d->group->removeButton(this);
@@ -623,7 +625,7 @@ void QAbstractButton::setChecked(bool checked)
if (!checked && d->queryCheckedButton() == this) {
// the checked button of an exclusive or autoexclusive group cannot be unchecked
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
if (d->group ? d->group->d_func()->exclusive : d->autoExclusive)
return;
if (d->group)
@@ -798,7 +800,7 @@ bool QAbstractButton::autoExclusive() const
return d->autoExclusive;
}
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
/*!
Returns the group that this button belongs to.
@@ -812,7 +814,7 @@ QButtonGroup *QAbstractButton::group() const
Q_D(const QAbstractButton);
return d->group;
}
-#endif // QT_NO_BUTTONGROUP
+#endif // QT_CONFIG(buttongroup)
/*!
Performs an animated click: the button is pressed immediately, and
@@ -1070,7 +1072,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
#endif
QWidget *pw = parentWidget();
if (d->autoExclusive
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
|| d->group
#endif
#if QT_CONFIG(itemviews)
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 64e4edacc0..e8dee142f2 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -108,7 +108,7 @@ public:
void setAutoExclusive(bool);
bool autoExclusive() const;
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
QButtonGroup *group() const;
#endif
diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h
index 8f67c0d367..39e2e399a7 100644
--- a/src/widgets/widgets/qabstractbutton_p.h
+++ b/src/widgets/widgets/qabstractbutton_p.h
@@ -80,7 +80,7 @@ public:
uint blockRefresh :1;
uint pressed : 1;
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
QButtonGroup* group;
#endif
QBasicTimer repeatTimer;
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index d9cbad4766..249ebd35d3 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -39,7 +39,7 @@
#include "qabstractscrollarea.h"
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
#include "qscrollbar.h"
#include "qapplication.h"
@@ -1662,4 +1662,4 @@ QT_END_NAMESPACE
#include "moc_qabstractscrollarea.cpp"
#include "moc_qabstractscrollarea_p.cpp"
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index 35ffbc3bc1..8a17036fb2 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
class QMargins;
class QScrollBar;
@@ -146,7 +146,7 @@ private:
friend class QWidgetPrivate;
};
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index 588407bc4a..251e563724 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
class QScrollBar;
class QAbstractScrollAreaScrollBarContainer;
@@ -149,7 +149,7 @@ private:
Qt::Orientation orientation;
};
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 22f3745b26..c72c060f9a 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -43,8 +43,6 @@
#include <private/qlineedit_p.h>
#include <qabstractspinbox.h>
-#ifndef QT_NO_SPINBOX
-
#include <qapplication.h>
#include <qstylehints.h>
#include <qclipboard.h>
@@ -53,7 +51,9 @@
#include <qdatetimeedit.h>
#endif
#include <qevent.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qpainter.h>
#include <qpalette.h>
#include <qstylepainter.h>
@@ -2145,5 +2145,3 @@ QVariant QAbstractSpinBoxPrivate::variantBound(const QVariant &min,
QT_END_NAMESPACE
#include "moc_qabstractspinbox.cpp"
-
-#endif // QT_NO_SPINBOX
diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h
index 6cd968f4c9..83bf83d779 100644
--- a/src/widgets/widgets/qabstractspinbox.h
+++ b/src/widgets/widgets/qabstractspinbox.h
@@ -44,10 +44,9 @@
#include <QtWidgets/qwidget.h>
#include <QtGui/qvalidator.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(spinbox);
-#ifndef QT_NO_SPINBOX
+QT_BEGIN_NAMESPACE
class QLineEdit;
@@ -175,8 +174,6 @@ private:
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled)
-#endif // QT_NO_SPINBOX
-
QT_END_NAMESPACE
#endif // QABSTRACTSPINBOX_H
diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h
index 5ec59d899b..8f312fa900 100644
--- a/src/widgets/widgets/qabstractspinbox_p.h
+++ b/src/widgets/widgets/qabstractspinbox_p.h
@@ -54,8 +54,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qabstractspinbox.h"
-#ifndef QT_NO_SPINBOX
-
#include "QtWidgets/qlineedit.h"
#include "QtWidgets/qstyleoption.h"
#include "QtGui/qvalidator.h"
@@ -63,6 +61,8 @@
#include "QtCore/qvariant.h"
#include "private/qwidget_p.h"
+QT_REQUIRE_CONFIG(spinbox);
+
QT_BEGIN_NAMESPACE
QVariant operator+(const QVariant &arg1, const QVariant &arg2);
@@ -165,6 +165,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_SPINBOX
-
#endif // QABSTRACTSPINBOX_P_H
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index ef73fd1b67..fa1ccd347f 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -39,8 +39,6 @@
#include "private/qbuttongroup_p.h"
-#ifndef QT_NO_BUTTONGROUP
-
#include "private/qabstractbutton_p.h"
QT_BEGIN_NAMESPACE
@@ -362,5 +360,3 @@ int QButtonGroup::checkedId() const
QT_END_NAMESPACE
#include "moc_qbuttongroup.cpp"
-
-#endif // QT_NO_BUTTONGROUP
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index c49d120551..fec94ccb3e 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(buttongroup);
-#ifndef QT_NO_BUTTONGROUP
+QT_BEGIN_NAMESPACE
class QAbstractButton;
class QAbstractButtonPrivate;
@@ -94,8 +93,6 @@ private:
friend class QAbstractButtonPrivate;
};
-#endif // QT_NO_BUTTONGROUP
-
QT_END_NAMESPACE
#endif // QBUTTONGROUP_H
diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h
index 93f3f4e0ec..148f572373 100644
--- a/src/widgets/widgets/qbuttongroup_p.h
+++ b/src/widgets/widgets/qbuttongroup_p.h
@@ -54,14 +54,14 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qbuttongroup.h>
-#ifndef QT_NO_BUTTONGROUP
-
#include <QtCore/private/qobject_p.h>
#include <QtCore/qlist.h>
#include <QtCore/qpointer.h>
#include <QtCore/qhash.h>
+QT_REQUIRE_CONFIG(buttongroup);
+
QT_BEGIN_NAMESPACE
class QButtonGroupPrivate: public QObjectPrivate
@@ -81,6 +81,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_BUTTONGROUP
-
#endif // QBUTTONGROUP_P_H
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 9a375ae420..cd2e20694e 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -52,7 +52,9 @@
#endif
#include <qitemdelegate.h>
#include <qmap.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qevent.h>
#include <qlayout.h>
#include <qscrollbar.h>
@@ -71,7 +73,7 @@
#include <private/qabstractscrollarea_p.h>
#include <private/qlineedit_p.h>
#include <qdebug.h>
-#ifndef QT_NO_EFFECTS
+#if QT_CONFIG(effects)
# include <private/qeffects_p.h>
#endif
#ifndef QT_NO_ACCESSIBILITY
@@ -103,7 +105,7 @@ QComboBoxPrivate::QComboBoxPrivate()
#ifdef Q_OS_MAC
, m_platformMenu(0)
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
, completer(0)
#endif
{
@@ -189,7 +191,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
return menuOption;
}
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)
{
Q_Q(QComboBox);
@@ -224,7 +226,7 @@ void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)
}
# endif // QT_KEYPAD_NAVIGATION
}
-#endif // !QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
void QComboBoxPrivate::updateArrow(QStyle::StateFlag state)
{
@@ -1128,7 +1130,7 @@ void QComboBoxPrivate::updateViewContainerPaletteAndOpacity()
Q_Q(QComboBox);
QStyleOptionComboBox opt;
q->initStyleOption(&opt);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) {
QMenu menu;
menu.ensurePolished();
@@ -1214,7 +1216,7 @@ Qt::MatchFlags QComboBoxPrivate::matchFlags() const
{
// Base how duplicates are determined on the autocompletion case sensitivity
Qt::MatchFlags flags = Qt::MatchFixedString;
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive)
#endif
flags |= Qt::MatchCaseSensitive;
@@ -1443,7 +1445,7 @@ int QComboBox::maxCount() const
return d->maxCount;
}
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
/*!
\property QComboBox::autoCompletion
@@ -1538,7 +1540,7 @@ void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity
d->lineEdit->completer()->setCaseSensitivity(sensitivity);
}
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
/*!
\property QComboBox::duplicatesEnabled
@@ -1820,12 +1822,12 @@ void QComboBox::setLineEdit(QLineEdit *edit)
d->updateFocusPolicy();
d->lineEdit->setFocusProxy(this);
d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
setAutoCompletion(d->autoCompletion);
#endif
#ifdef QT_KEYPAD_NAVIGATION
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (QApplication::keypadNavigationEnabled()) {
// Editable combo boxes will have a completer that is set to UnfilteredPopupCompletion.
// This means that when the user enters edit mode they are immediately presented with a
@@ -1889,7 +1891,7 @@ const QValidator *QComboBox::validator() const
}
#endif // QT_NO_VALIDATOR
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
/*!
\fn void QComboBox::setCompleter(QCompleter *completer)
@@ -1929,7 +1931,7 @@ QCompleter *QComboBox::completer() const
return d->lineEdit ? d->lineEdit->completer() : 0;
}
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
/*!
Returns the item delegate used by the popup list view.
@@ -1995,7 +1997,7 @@ void QComboBox::setModel(QAbstractItemModel *model)
if (model == d->model)
return;
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (d->lineEdit && d->lineEdit->completer()
&& d->lineEdit->completer() == d->completer)
d->lineEdit->completer()->setModel(model);
@@ -2141,7 +2143,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
const QString newText = itemText(normalized);
if (lineEdit->text() != newText) {
lineEdit->setText(newText); // may cause lineEdit -> nullptr (QTBUG-54191)
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (lineEdit && lineEdit->completer())
lineEdit->completer()->setCompletionPrefix(newText);
#endif
@@ -2592,7 +2594,7 @@ void QComboBox::showPopup()
#endif // Q_OS_MAC
#ifdef QT_KEYPAD_NAVIGATION
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (QApplication::keypadNavigationEnabled() && d->completer) {
// editable combo box is line edit plus completer
setEditFocus(true);
@@ -2754,7 +2756,7 @@ void QComboBox::showPopup()
const bool updatesEnabled = container->updatesEnabled();
#endif
-#if !defined(QT_NO_EFFECTS)
+#if QT_CONFIG(effects)
bool scrollDown = (listRect.topLeft() == below);
if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)
&& !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen))
@@ -2826,7 +2828,7 @@ void QComboBox::hidePopup()
{
Q_D(QComboBox);
if (d->container && d->container->isVisible()) {
-#if !defined(QT_NO_EFFECTS)
+#if QT_CONFIG(effects)
QSignalBlocker modelBlocker(d->model);
QSignalBlocker viewBlocker(d->container->itemView());
QSignalBlocker containerBlocker(d->container);
@@ -2870,7 +2872,7 @@ void QComboBox::hidePopup()
modelBlocker.unblock();
if (!didFade)
-#endif // QT_NO_EFFECTS
+#endif // QT_CONFIG(effects)
// Fade should implicitly hide as well ;-)
d->container->hide();
}
@@ -2934,7 +2936,7 @@ void QComboBox::focusInEvent(QFocusEvent *e)
update();
if (d->lineEdit) {
d->lineEdit->event(e);
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (d->lineEdit->completer())
d->lineEdit->completer()->setWidget(this);
#endif
@@ -3160,7 +3162,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
{
Q_D(QComboBox);
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (d->lineEdit
&& d->lineEdit->completer()
&& d->lineEdit->completer()->popup()
@@ -3496,7 +3498,7 @@ void QComboBox::setModelColumn(int visibleColumn)
QListView *lv = qobject_cast<QListView *>(d->viewContainer()->itemView());
if (lv)
lv->setModelColumn(visibleColumn);
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (d->lineEdit && d->lineEdit->completer()
&& d->lineEdit->completer() == d->completer)
d->lineEdit->completer()->setCompletionColumn(visibleColumn);
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 5ba544e9a3..671c883584 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -45,6 +45,7 @@
#include <QtWidgets/qabstractitemdelegate.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qvariant.h>
+#include <QtGui/qvalidator.h>
QT_REQUIRE_CONFIG(combobox);
@@ -71,10 +72,10 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget
Q_PROPERTY(int minimumContentsLength READ minimumContentsLength WRITE setMinimumContentsLength)
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false)
Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity DESIGNABLE false)
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled)
Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
@@ -91,7 +92,7 @@ public:
void setMaxCount(int max);
int maxCount() const;
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
bool autoCompletion() const;
void setAutoCompletion(bool enable);
@@ -149,7 +150,7 @@ public:
const QValidator *validator() const;
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
void setCompleter(QCompleter *c);
QCompleter *completer() const;
#endif
@@ -262,7 +263,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex & parent, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_modelReset())
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
Q_PRIVATE_SLOT(d_func(), void _q_completerActivated(const QModelIndex &index))
#endif
};
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index 6bee9409ee..835bbf866e 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -67,7 +67,9 @@
#include "QtCore/qtimer.h"
#include "private/qwidget_p.h"
#include "QtCore/qpointer.h"
+#if QT_CONFIG(completer)
#include "QtWidgets/qcompleter.h"
+#endif
#include "QtGui/qevent.h"
#include "QtCore/qdebug.h"
@@ -356,7 +358,7 @@ public:
void _q_emitCurrentIndexChanged(const QModelIndex &index);
void _q_modelDestroyed();
void _q_modelReset();
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
void _q_completerActivated(const QModelIndex &index);
#endif
void _q_resetButton();
@@ -416,7 +418,7 @@ public:
#ifdef Q_OS_MAC
QPlatformMenu *m_platformMenu;
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
QPointer<QCompleter> completer;
#endif
static QPalette viewContainerPalette(QComboBox *cmb)
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index e7d701f496..26060052d3 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -845,7 +845,7 @@ bool QDockWidgetPrivate::isAnimating() const
bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
{
-#if !defined(QT_NO_MAINWINDOW)
+#if QT_CONFIG(mainwindow)
Q_Q(QDockWidget);
QDockWidgetLayout *dwLayout
@@ -874,7 +874,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
return true;
}
-#endif // !defined(QT_NO_MAINWINDOW)
+#endif // QT_CONFIG(mainwindow)
return false;
}
@@ -897,7 +897,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)
@@ -938,20 +938,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;
}
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index effc1afeee..08ef795b07 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "qapplication.h"
-#ifndef QT_NO_EFFECTS
#include "qdesktopwidget.h"
#include "qeffects_p.h"
#include "qevent.h"
@@ -607,5 +606,3 @@ QT_END_NAMESPACE
*/
#include "qeffects.moc"
-
-#endif //QT_NO_EFFECTS
diff --git a/src/widgets/widgets/qeffects_p.h b/src/widgets/widgets/qeffects_p.h
index a93efce1ec..92f459651f 100644
--- a/src/widgets/widgets/qeffects_p.h
+++ b/src/widgets/widgets/qeffects_p.h
@@ -53,8 +53,9 @@
//
#include "QtCore/qnamespace.h"
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
-#ifndef QT_NO_EFFECTS
+QT_REQUIRE_CONFIG(effects);
QT_BEGIN_NAMESPACE
@@ -77,6 +78,4 @@ extern void Q_WIDGETS_EXPORT qFadeEffect(QWidget*, int time = -1);
QT_END_NAMESPACE
-#endif // QT_NO_EFFECTS
-
#endif // QEFFECTS_P_H
diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp
index 4d86c7cfc7..6f2a6b2d5a 100644
--- a/src/widgets/widgets/qkeysequenceedit.cpp
+++ b/src/widgets/widgets/qkeysequenceedit.cpp
@@ -47,8 +47,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_KEYSEQUENCEEDIT
-
Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here
void QKeySequenceEditPrivate::init()
@@ -332,8 +330,6 @@ void QKeySequenceEdit::timerEvent(QTimerEvent *e)
QWidget::timerEvent(e);
}
-#endif // QT_NO_KEYSEQUENCEEDIT
-
QT_END_NAMESPACE
#include "moc_qkeysequenceedit.cpp"
diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h
index 33bc32d8ef..85d76f14a3 100644
--- a/src/widgets/widgets/qkeysequenceedit.h
+++ b/src/widgets/widgets/qkeysequenceedit.h
@@ -44,9 +44,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(keysequenceedit);
-#ifndef QT_NO_KEYSEQUENCEEDIT
+QT_BEGIN_NAMESPACE
class QKeySequenceEditPrivate;
class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget
@@ -82,8 +82,6 @@ private:
Q_DECLARE_PRIVATE(QKeySequenceEdit)
};
-#endif // QT_NO_KEYSEQUENCEEDIT
-
QT_END_NAMESPACE
#endif // QKEYSEQUENCEEDIT_H
diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h
index 67e60b4032..7af034e735 100644
--- a/src/widgets/widgets/qkeysequenceedit_p.h
+++ b/src/widgets/widgets/qkeysequenceedit_p.h
@@ -58,9 +58,9 @@
#include <private/qwidget_p.h>
#include <private/qkeysequence_p.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(keysequenceedit);
-#ifndef QT_NO_KEYSEQUENCEEDIT
+QT_BEGIN_NAMESPACE
class QLineEdit;
@@ -81,8 +81,6 @@ public:
int releaseTimer;
};
-#endif // QT_NO_KEYSEQUENCEEDIT
-
QT_END_NAMESPACE
#endif // QKEYSEQUENCEEDIT_P_H
diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h
index f3236ac527..e05a5b5c35 100644
--- a/src/widgets/widgets/qlabel_p.h
+++ b/src/widgets/widgets/qlabel_p.h
@@ -65,7 +65,9 @@
#include "qimage.h"
#include "qbitmap.h"
#include "qpicture.h"
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 7f47fdde87..d0a794222e 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -40,7 +40,6 @@
#include "qlineedit.h"
#include "qlineedit_p.h"
-#ifndef QT_NO_LINEEDIT
#include "qaction.h"
#include "qapplication.h"
#include "qclipboard.h"
@@ -49,7 +48,9 @@
#include "qevent.h"
#include "qfontmetrics.h"
#include "qstylehints.h"
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
#include "qpainter.h"
#include "qpixmap.h"
#include "qpointer.h"
@@ -61,8 +62,10 @@
#include "qvariant.h"
#include "qvector.h"
#include "qdebug.h"
+#if QT_CONFIG(textedit)
#include "qtextedit.h"
#include <private/qtextedit_p.h>
+#endif
#include <private/qwidgettextcontrol_p.h>
#ifndef QT_NO_ACCESSIBILITY
@@ -610,7 +613,7 @@ void QLineEdit::setValidator(const QValidator *v)
}
#endif // QT_NO_VALIDATOR
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
/*!
\since 4.2
@@ -662,7 +665,7 @@ QCompleter *QLineEdit::completer() const
return d->control->completer();
}
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
/*!
Returns a recommended size for the widget.
@@ -1764,7 +1767,7 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e)
d->control->processInputMethodEvent(e);
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (!e->commitString().isEmpty())
d->control->complete(Qt::Key_unknown);
#endif
@@ -1841,7 +1844,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
d->control->setCancelText(d->control->text());
}
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (d->control->completer()) {
d->control->completer()->setWidget(this);
QObject::connect(d->control->completer(), SIGNAL(activated(QString)),
@@ -1884,7 +1887,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e)
#ifdef QT_KEYPAD_NAVIGATION
d->control->setCancelText(QString());
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (d->control->completer()) {
QObject::disconnect(d->control->completer(), 0, this, 0);
}
@@ -2231,5 +2234,3 @@ void QLineEdit::changeEvent(QEvent *ev)
QT_END_NAMESPACE
#include "moc_qlineedit.cpp"
-
-#endif // QT_NO_LINEEDIT
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index ed988bfbbd..099bf4bb18 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -46,10 +46,9 @@
#include <QtCore/qstring.h>
#include <QtCore/qmargins.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(lineedit);
-#ifndef QT_NO_LINEEDIT
+QT_BEGIN_NAMESPACE
class QValidator;
class QMenu;
@@ -124,7 +123,7 @@ public:
const QValidator * validator() const;
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
void setCompleter(QCompleter *completer);
QCompleter *completer() const;
#endif
@@ -252,7 +251,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate())
Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &))
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int))
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(const QString &))
#endif
#ifdef QT_KEYPAD_NAVIGATION
@@ -264,8 +263,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_clearButtonClicked())
};
-#endif // QT_NO_LINEEDIT
-
QT_END_NAMESPACE
#endif // QLINEEDIT_H
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 7c32a9cd7a..c66b842223 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -40,8 +40,6 @@
#include "qlineedit.h"
#include "qlineedit_p.h"
-#ifndef QT_NO_LINEEDIT
-
#include "qvariant.h"
#if QT_CONFIG(itemviews)
#include "qabstractitemview.h"
@@ -58,6 +56,7 @@
#endif
#include <qpainter.h>
#include <qpropertyanimation.h>
+#include <qvalidator.h>
QT_BEGIN_NAMESPACE
@@ -90,7 +89,7 @@ QRect QLineEditPrivate::cursorRect() const
return adjustedControlRect(control->cursorRect());
}
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
void QLineEditPrivate::_q_completionHighlighted(const QString &newText)
{
@@ -111,7 +110,7 @@ void QLineEditPrivate::_q_completionHighlighted(const QString &newText)
}
}
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
void QLineEditPrivate::_q_handleWindowActivate()
{
@@ -124,7 +123,7 @@ void QLineEditPrivate::_q_textEdited(const QString &text)
{
Q_Q(QLineEdit);
emit q->textEdited(text);
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (control->completer()
&& control->completer()->completionMode() != QCompleter::InlineCompletion)
control->complete(-1); // update the popup on cut/paste/del
@@ -624,5 +623,3 @@ int QLineEditPrivate::effectiveRightTextMargin() const
QT_END_NAMESPACE
#include "moc_qlineedit_p.cpp"
-
-#endif
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 0dcf1c04c8..a3f549ad31 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -53,7 +53,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
-#ifndef QT_NO_LINEEDIT
#include "private/qwidget_p.h"
#include "QtWidgets/qlineedit.h"
#if QT_CONFIG(toolbutton)
@@ -63,7 +62,9 @@
#include "QtGui/qicon.h"
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qbasictimer.h"
+#if QT_CONFIG(completer)
#include "QtWidgets/qcompleter.h"
+#endif
#include "QtCore/qpointer.h"
#include "QtCore/qmimedata.h"
@@ -71,6 +72,8 @@
#include <algorithm>
+QT_REQUIRE_CONFIG(lineedit);
+
QT_BEGIN_NAMESPACE
class QLineEditPrivate;
@@ -203,7 +206,7 @@ public:
#endif
void _q_selectionChanged();
void _q_updateNeeded(const QRect &);
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
void _q_completionHighlighted(const QString &);
#endif
QPoint mousePressPos;
@@ -254,8 +257,6 @@ private:
Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetLocation, Q_PRIMITIVE_TYPE);
-#endif // QT_NO_LINEEDIT
-
QT_END_NAMESPACE
#endif // QLINEEDIT_P_H
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index e1841bbc55..d97fedadab 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -42,15 +42,16 @@
#include "qmainwindow.h"
#include "qmainwindowlayout_p.h"
-#ifndef QT_NO_MAINWINDOW
-
#if QT_CONFIG(dockwidget)
#include "qdockwidget.h"
#endif
#include "qtoolbar.h"
#include <qapplication.h>
+#include <qmenu.h>
+#if QT_CONFIG(menubar)
#include <qmenubar.h>
+#endif
#if QT_CONFIG(statusbar)
#include <qstatusbar.h>
#endif
@@ -491,7 +492,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
emit toolButtonStyleChanged(d->toolButtonStyle);
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*!
Returns the menu bar for the main window. This function creates
and returns an empty menu bar if the menu bar does not exist.
@@ -578,7 +579,7 @@ void QMainWindow::setMenuWidget(QWidget *menuBar)
}
d->layout->setMenuBar(menuBar);
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
#if QT_CONFIG(statusbar)
/*!
@@ -1412,7 +1413,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
// children and for the menu bar as well
QWidget *child = childAt(event->pos());
while (child && child != this) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) {
if (mb->parentWidget() != this)
return;
@@ -1443,7 +1444,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
if (child == this)
return;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QMenu *popup = createPopupMenu();
if (popup) {
if (!popup->isEmpty()) {
@@ -1458,7 +1459,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
}
#endif // QT_NO_CONTEXTMENU
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
Returns a popup menu containing checkable entries for the toolbars and
dock widgets present in the main window. If there are no toolbars and
@@ -1519,10 +1520,8 @@ QMenu *QMainWindow::createPopupMenu()
Q_UNUSED(d);
return menu;
}
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
QT_END_NAMESPACE
#include "moc_qmainwindow.cpp"
-
-#endif // QT_NO_MAINWINDOW
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index 530ea7086d..069683d4ac 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -46,10 +46,9 @@
#include <QtWidgets/qtabwidget.h>
#endif
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(mainwindow);
-#ifndef QT_NO_MAINWINDOW
+QT_BEGIN_NAMESPACE
class QDockWidget;
class QMainWindowPrivate;
@@ -123,7 +122,7 @@ public:
bool isSeparator(const QPoint &pos) const;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QMenuBar *menuBar() const;
void setMenuBar(QMenuBar *menubar);
@@ -182,7 +181,7 @@ public:
QByteArray saveState(int version = 0) const;
bool restoreState(const QByteArray &state, int version = 0);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
virtual QMenu *createPopupMenu();
#endif
@@ -215,8 +214,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QMainWindow::DockOptions)
-#endif // QT_NO_MAINWINDOW
-
QT_END_NAMESPACE
#endif // QDYNAMICMAINWINDOW_H
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 3444c7a5bb..9b38da340c 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -40,7 +40,6 @@
#include "qmainwindowlayout_p.h"
-#ifndef QT_NO_MAINWINDOW
#if QT_CONFIG(dockwidget)
#include "qdockarealayout_p.h"
#include "qdockwidget.h"
@@ -2725,5 +2724,3 @@ bool QMainWindowLayout::restoreState(QDataStream &stream)
QT_END_NAMESPACE
#include "moc_qmainwindowlayout_p.cpp"
-
-#endif // QT_NO_MAINWINDOW
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 275345f15d..168d4444b9 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -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"
@@ -73,6 +71,8 @@
#endif
#include "qtoolbararealayout_p.h"
+QT_REQUIRE_CONFIG(mainwindow);
+
QT_BEGIN_NAMESPACE
class QToolBar;
@@ -590,6 +590,4 @@ QDebug operator<<(QDebug debug, const QMainWindowLayout *layout);
QT_END_NAMESPACE
-#endif // QT_NO_MAINWINDOW
-
#endif // QDYNAMICMAINWINDOWLAYOUT_P_H
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index fe742d1ac8..bc7333df2e 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -156,8 +156,6 @@
#include "qmdiarea_p.h"
-#ifndef QT_NO_MDIAREA
-
#include <QApplication>
#include <QStyle>
#include <QChildEvent>
@@ -171,6 +169,9 @@
#include <private/qdesktopwidget_p.h>
#include <QDebug>
#include <qmath.h>
+#if QT_CONFIG(menu)
+#include <qmenu.h>
+#endif
#include <private/qlayoutengine_p.h>
#include <algorithm>
@@ -609,7 +610,7 @@ void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event)
return;
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QMdiSubWindowPrivate *subWindowPrivate = subWindow->d_func();
if (!subWindowPrivate->systemMenu) {
event->ignore();
@@ -637,7 +638,7 @@ void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event)
// Restore action visibility.
subWindowPrivate->updateActions();
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
}
#endif // QT_NO_CONTEXTMENU
@@ -2697,5 +2698,3 @@ void QMdiArea::setupViewport(QWidget *viewport)
QT_END_NAMESPACE
#include "moc_qmdiarea.cpp"
-
-#endif // QT_NO_MDIAREA
diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h
index 0939fbb172..35edde9eb8 100644
--- a/src/widgets/widgets/qmdiarea.h
+++ b/src/widgets/widgets/qmdiarea.h
@@ -46,10 +46,9 @@
#include <QtWidgets/qtabwidget.h>
#endif
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(mdiarea);
-#ifndef QT_NO_MDIAREA
+QT_BEGIN_NAMESPACE
class QMdiSubWindow;
@@ -171,5 +170,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiArea::AreaOptions)
QT_END_NAMESPACE
-#endif // QT_NO_MDIAREA
#endif // QMDIAREA_H
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index 8a648eb9dc..fd00118ec6 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -55,7 +55,7 @@
#include "qmdiarea.h"
#include "qmdisubwindow.h"
-#ifndef QT_NO_MDIAREA
+QT_REQUIRE_CONFIG(mdiarea);
#include <QList>
#include <QVector>
@@ -266,8 +266,6 @@ public:
#endif // QT_CONFIG(rubberband)
};
-#endif // QT_NO_MDIAREA
-
QT_END_NAMESPACE
#endif // QMDIAREA_P_H
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index b3ec3df481..0fdeaeb1e6 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -147,8 +147,6 @@
#include "qmdisubwindow_p.h"
-#ifndef QT_NO_MDIAREA
-
#include <QApplication>
#include <QStylePainter>
#include <QVBoxLayout>
@@ -157,11 +155,17 @@
#include <QWhatsThis>
#endif
#include <QToolTip>
+#if QT_CONFIG(mainwindow)
#include <QMainWindow>
+#endif
#include <QScrollBar>
#include <QDebug>
#include <QMdiArea>
#include <QScopedValueRollback>
+#include <QAction>
+#if QT_CONFIG(menu)
+#include <QMenu>
+#endif
QT_BEGIN_NAMESPACE
@@ -702,7 +706,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
: QObject(mdiChild),
previousLeft(0),
previousRight(0),
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
m_menuBar(0),
#endif
mdiChild(mdiChild)
@@ -716,7 +720,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
m_menuLabel = new ControlElement<ControlLabel>(mdiChild);
m_menuLabel->setWindowIcon(mdiChild->windowIcon());
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
connect(m_menuLabel, SIGNAL(_q_clicked()), mdiChild, SLOT(showSystemMenu()));
#endif
connect(m_menuLabel, SIGNAL(_q_doubleClicked()), mdiChild, SLOT(close()));
@@ -724,7 +728,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
ControlContainer::~ControlContainer()
{
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
removeButtonsFromMenuBar();
#endif
delete m_menuLabel;
@@ -733,13 +737,13 @@ ControlContainer::~ControlContainer()
m_controllerWidget = 0;
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*
\internal
*/
QMenuBar *QMdiSubWindowPrivate::menuBar() const
{
-#if defined(QT_NO_MAINWINDOW)
+#if !QT_CONFIG(mainwindow)
return 0;
#else
Q_Q(const QMdiSubWindow);
@@ -845,7 +849,7 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar)
mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle());
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
void ControlContainer::updateWindowIcon(const QIcon &windowIcon)
{
@@ -860,7 +864,7 @@ QMdiSubWindowPrivate::QMdiSubWindowPrivate()
: baseWidget(0),
restoreFocusWidget(0),
controlContainer(0),
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
sizeGrip(0),
#endif
#if QT_CONFIG(rubberband)
@@ -1036,7 +1040,7 @@ void QMdiSubWindowPrivate::initOperationMap()
operationMap.insert(BottomRightResize, OperationInfo(HResize | VResize, Qt::SizeFDiagCursor));
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
\internal
@@ -1265,7 +1269,7 @@ void QMdiSubWindowPrivate::setNormalMode()
isMaximizeMode = false;
ensureWindowState(Qt::WindowNoState);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
removeButtonsFromMenuBar();
#endif
@@ -1299,7 +1303,7 @@ void QMdiSubWindowPrivate::setNormalMode()
restoreSize.setWidth(-1);
restoreSize.setHeight(-1);
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
setSizeGripVisible(true);
#endif
@@ -1346,7 +1350,7 @@ void QMdiSubWindowPrivate::setMaximizeMode()
storeFocusWidget();
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
setSizeGripVisible(false);
#endif
@@ -1372,7 +1376,7 @@ void QMdiSubWindowPrivate::setMaximizeMode()
updateGeometryConstraints();
if (wasVisible) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mBar = menuBar())
showButtonsInMenuBar(mBar);
else
@@ -1435,7 +1439,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus)
Qt::WindowStates oldWindowState = q->windowState();
ensureWindowState(Qt::WindowActive);
emit q->aboutToActivate();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mBar = menuBar())
showButtonsInMenuBar(mBar);
#endif
@@ -1772,7 +1776,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
return true;
-#if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW)
+#if !QT_CONFIG(menubar) || !QT_CONFIG(mainwindow)
Q_UNUSED(isChildOfQMdiSubWindow);
return true;
#else
@@ -1785,7 +1789,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
#endif
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*!
\internal
@@ -1837,7 +1841,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 :-)
@@ -1856,7 +1860,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
originalTitle.clear();
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
{
@@ -2105,7 +2109,7 @@ void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags)
}
#endif
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if ((windowFlags & Qt::FramelessWindowHint) && sizeGrip)
delete sizeGrip;
#endif
@@ -2144,7 +2148,7 @@ void QMdiSubWindowPrivate::setEnabled(WindowStateAction action, bool enable)
actions[action]->setEnabled(enable);
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action, const QString &text,
const char *slot)
{
@@ -2166,7 +2170,7 @@ QSize QMdiSubWindowPrivate::iconSize() const
return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());
}
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
/*!
\internal
@@ -2208,7 +2212,7 @@ void QMdiSubWindowPrivate::setSizeGripVisible(bool visible) const
grip->setVisible(visible);
}
-#endif // QT_NO_SIZEGRIP
+#endif // QT_CONFIG(sizegrip)
/*!
\internal
@@ -2247,7 +2251,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
: QWidget(*new QMdiSubWindowPrivate, parent, 0)
{
Q_D(QMdiSubWindow);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
d->createSystemMenu();
addActions(d->systemMenu->actions());
#endif
@@ -2281,7 +2285,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
QMdiSubWindow::~QMdiSubWindow()
{
Q_D(QMdiSubWindow);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
d->setActive(false);
@@ -2319,7 +2323,7 @@ void QMdiSubWindow::setWidget(QWidget *widget)
else
widget->setParent(this);
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
QSizeGrip *sizeGrip = widget->findChild<QSizeGrip *>();
if (sizeGrip)
sizeGrip->installEventFilter(this);
@@ -2480,7 +2484,7 @@ void QMdiSubWindow::setKeyboardPageStep(int step)
d_func()->keyboardPageStep = step;
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
Sets \a systemMenu as the current system menu for this subwindow.
@@ -2560,7 +2564,7 @@ void QMdiSubWindow::showSystemMenu()
globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0);
d->systemMenu->popup(globalPopupPos);
}
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
/*!
\since 4.4
@@ -2614,7 +2618,7 @@ void QMdiSubWindow::showShaded()
d->ensureWindowState(Qt::WindowMinimized);
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
@@ -2624,7 +2628,7 @@ void QMdiSubWindow::showShaded()
if (hasFocus() || isAncestorOf(QApplication::focusWidget()))
d->ensureWindowState(Qt::WindowActive);
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
d->setSizeGripVisible(false);
#endif
@@ -2681,7 +2685,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
if (!object)
return QWidget::eventFilter(object, event);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
// System menu events.
if (d->systemMenu && d->systemMenu == object) {
if (event->type() == QEvent::MouseButtonDblClick) {
@@ -2700,7 +2704,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
}
#endif
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if (object != d->baseWidget && parent() && qobject_cast<QSizeGrip *>(object)) {
if (event->type() != QEvent::MouseButtonPress || !testOption(QMdiSubWindow::RubberBandResize))
return QWidget::eventFilter(object, event);
@@ -2754,7 +2758,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
if (object == d->baseWidget) {
d->updateWindowTitle(true);
d->lastChildWindowTitle = d->baseWidget->windowTitle();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
} else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
d->originalTitle.clear();
@@ -2817,7 +2821,7 @@ bool QMdiSubWindow::event(QEvent *event)
break;
case QEvent::ParentChange: {
bool wasResized = testAttribute(Qt::WA_Resized);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
d->currentOperation = QMdiSubWindowPrivate::None;
@@ -2831,7 +2835,7 @@ bool QMdiSubWindow::event(QEvent *event)
d->isMaximizeMode = false;
d->isWidgetHiddenByUs = false;
if (!parent()) {
-#if !defined(QT_NO_SIZEGRIP)
+#if QT_CONFIG(sizegrip)
if (isMacStyle(style()))
delete d->sizeGrip;
#endif
@@ -2874,12 +2878,12 @@ bool QMdiSubWindow::event(QEvent *event)
case QEvent::ModifiedChange:
if (!windowTitle().contains(QLatin1String("[*]")))
break;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
window()->setWindowModified(isWindowModified());
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
d->updateInternalWindowTitle();
break;
case QEvent::LayoutDirectionChange:
@@ -2926,7 +2930,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
return;
}
-#if !defined(QT_NO_SIZEGRIP)
+#if QT_CONFIG(sizegrip)
if (isMacStyle(style()) && !d->sizeGrip
&& !(windowFlags() & Qt::FramelessWindowHint)) {
d->setSizeGrip(new QSizeGrip(this));
@@ -2942,7 +2946,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
d->updateDirtyRegions();
// Show buttons in the menu bar if they're already not there.
// We want to do this when QMdiSubWindow becomes visible after being hidden.
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (d->controlContainer) {
if (QMenuBar *menuBar = d->menuBar()) {
if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget())
@@ -2958,7 +2962,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
*/
void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/)
{
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d_func()->removeButtonsFromMenuBar();
#endif
}
@@ -3032,7 +3036,7 @@ void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent)
closeEvent->ignore();
return;
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
d->setActive(false);
@@ -3064,7 +3068,7 @@ void QMdiSubWindow::leaveEvent(QEvent * /*leaveEvent*/)
void QMdiSubWindow::resizeEvent(QResizeEvent *resizeEvent)
{
Q_D(QMdiSubWindow);
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if (d->sizeGrip) {
d->sizeGrip->move(isLeftToRight() ? width() - d->sizeGrip->width() : 0,
height() - d->sizeGrip->height());
@@ -3207,7 +3211,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
}
d->activeSubControl = d->hoveredSubControl;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (d->activeSubControl == QStyle::SC_TitleBarSysMenu)
showSystemMenu();
else
@@ -3232,7 +3236,7 @@ void QMdiSubWindow::mouseDoubleClickEvent(QMouseEvent *mouseEvent)
Q_D(QMdiSubWindow);
if (!d->isMoveOperation()) {
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu)
close();
#endif
@@ -3468,7 +3472,7 @@ void QMdiSubWindow::childEvent(QChildEvent *childEvent)
{
if (childEvent->type() != QEvent::ChildPolished)
return;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if (QSizeGrip *sizeGrip = qobject_cast<QSizeGrip *>(childEvent->child()))
d_func()->setSizeGrip(sizeGrip);
#endif
@@ -3526,7 +3530,7 @@ QSize QMdiSubWindow::minimumSizeHint() const
}
}
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
// SizeGrip
int sizeGripHeight = 0;
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
@@ -3543,5 +3547,3 @@ QT_END_NAMESPACE
#include "moc_qmdisubwindow.cpp"
#include "qmdisubwindow.moc"
-
-#endif //QT_NO_MDIAREA
diff --git a/src/widgets/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h
index af33f9d8ab..302522e1c3 100644
--- a/src/widgets/widgets/qmdisubwindow.h
+++ b/src/widgets/widgets/qmdisubwindow.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(mdiarea);
-#ifndef QT_NO_MDIAREA
+QT_BEGIN_NAMESPACE
class QMenu;
class QMdiArea;
@@ -90,7 +89,7 @@ public:
void setKeyboardPageStep(int step);
int keyboardPageStep() const;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void setSystemMenu(QMenu *systemMenu);
QMenu *systemMenu() const;
#endif
@@ -102,7 +101,7 @@ Q_SIGNALS:
void aboutToActivate();
public Q_SLOTS:
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void showSystemMenu();
#endif
void showShaded();
@@ -148,6 +147,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiSubWindow::SubWindowOptions)
QT_END_NAMESPACE
-#endif // QT_NO_MDIAREA
-
#endif // QMDISUBWINDOW_H
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 044c244ab4..719984c8d4 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -54,16 +54,20 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qmdisubwindow.h"
-#ifndef QT_NO_MDIAREA
-
#include <QStyle>
#include <QStyleOptionTitleBar>
+#if QT_CONFIG(menubar)
#include <QMenuBar>
+#endif
+#if QT_CONFIG(sizegrip)
#include <QSizeGrip>
+#endif
#include <QPointer>
#include <QDebug>
#include <private/qwidget_p.h>
+QT_REQUIRE_CONFIG(mdiarea);
+
QT_BEGIN_NAMESPACE
class QVBoxLayout;
@@ -96,7 +100,7 @@ public:
ControlContainer(QMdiSubWindow *mdiChild);
~ControlContainer();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
void showButtonsInMenuBar(QMenuBar *menuBar);
void removeButtonsFromMenuBar(QMenuBar *menuBar = 0);
QMenuBar *menuBar() const { return m_menuBar; }
@@ -108,7 +112,7 @@ public:
private:
QPointer<QWidget> previousLeft;
QPointer<QWidget> previousRight;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QPointer<QMenuBar> m_menuBar;
#endif
QPointer<QWidget> m_controllerWidget;
@@ -176,7 +180,7 @@ public:
QPointer<QWidget> baseWidget;
QPointer<QWidget> restoreFocusWidget;
QPointer<QMdi::ControlContainer> controlContainer;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
QPointer<QSizeGrip> sizeGrip;
#endif
#if QT_CONFIG(rubberband)
@@ -232,7 +236,7 @@ public:
void leaveInteractiveMode();
void removeBaseWidget();
void initOperationMap();
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void createSystemMenu();
#endif
void updateCursor();
@@ -252,7 +256,7 @@ public:
int titleBarHeight(const QStyleOptionTitleBar &options) const;
void sizeParameters(int *margin, int *minWidth) const;
bool drawTitleBarWhenMaximized() const;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QMenuBar *menuBar() const;
void showButtonsInMenuBar(QMenuBar *menuBar);
void removeButtonsFromMenuBar();
@@ -271,12 +275,12 @@ public:
void setVisible(WindowStateAction, bool visible = true);
#ifndef QT_NO_ACTION
void setEnabled(WindowStateAction, bool enable = true);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void addToSystemMenu(WindowStateAction, const QString &text, const char *slot);
#endif
#endif // QT_NO_ACTION
QSize iconSize() const;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
void setSizeGrip(QSizeGrip *sizeGrip);
void setSizeGripVisible(bool visible = true) const;
#endif
@@ -341,8 +345,6 @@ public:
}
};
-#endif // QT_NO_MDIAREA
-
QT_END_NAMESPACE
#endif // QMDISUBWINDOW_P_H
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index a28cfa1d28..e26742f75e 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -39,7 +39,7 @@
#include "qmenu.h"
-#ifndef QT_NO_MENU
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qdebug.h"
#include "qstyle.h"
@@ -56,7 +56,7 @@
#ifndef QT_NO_ACCESSIBILITY
# include "qaccessible.h"
#endif
-#ifndef QT_NO_EFFECTS
+#if QT_CONFIG(effects)
# include <private/qeffects_p.h>
#endif
#if QT_CONFIG(whatsthis)
@@ -64,7 +64,9 @@
#endif
#include "qmenu_p.h"
+#if QT_CONFIG(menubar)
#include "qmenubar_p.h"
+#endif
#include "qwidgetaction.h"
#if QT_CONFIG(toolbutton)
#include "qtoolbutton.h"
@@ -498,7 +500,7 @@ void QMenuPrivate::hideUpToMenuBar()
QWidget *caused = causedPopup.widget;
hideMenu(q); //hide after getting causedPopup
while(caused) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
mb->d_func()->setCurrentAction(0);
mb->d_func()->setKeyboardMode(false);
@@ -522,7 +524,7 @@ void QMenuPrivate::hideMenu(QMenu *menu)
{
if (!menu)
return;
-#if !defined(QT_NO_EFFECTS)
+#if QT_CONFIG(effects)
QSignalBlocker blocker(menu);
aboutToHide = true;
// Flash item which is about to trigger (if any).
@@ -544,7 +546,7 @@ void QMenuPrivate::hideMenu(QMenu *menu)
aboutToHide = false;
blocker.unblock();
-#endif // QT_NO_EFFECTS
+#endif // QT_CONFIG(effects)
if (activeMenu == menu)
activeMenu = 0;
menu->d_func()->causedPopup.action = 0;
@@ -675,7 +677,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
}
if (hideActiveMenu && previousAction != currentAction) {
if (popup == -1) {
-#ifndef QT_NO_EFFECTS
+#if QT_CONFIG(effects)
// kill any running effect
qFadeEffect(0);
qScrollEffect(0);
@@ -852,6 +854,24 @@ void QMenuPrivate::_q_overrideMenuActionDestroyed()
menuAction=defaultMenuAction;
}
+void QMenuPrivate::adjustMenuScreen(const QPoint &p)
+{
+ Q_Q(QMenu);
+ // The windowHandle must point to the screen where the menu will be shown.
+ // The (item) size calculations depend on the menu screen,
+ // so a wrong screen would often cause wrong sizes (on high DPI)
+ const QScreen *primaryScreen = QApplication::primaryScreen();
+ const QScreen *currentScreen = q->windowHandle() ? q->windowHandle()->screen() : primaryScreen;
+ const int screenNumberForPoint = QApplication::desktop()->screenNumber(p);
+ QScreen *actualScreen = QGuiApplication::screens().at(screenNumberForPoint);
+ if (actualScreen && currentScreen != actualScreen) {
+ if (!q->windowHandle()) // Try to create a window handle if not created.
+ createWinId();
+ if (q->windowHandle())
+ q->windowHandle()->setScreen(actualScreen);
+ itemsDirty = true;
+ }
+}
void QMenuPrivate::updateLayoutDirection()
{
@@ -1280,7 +1300,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
bool passOnEvent = false;
QWidget *next_widget = 0;
QPoint cpos = caused->mapFromGlobal(e->globalPos());
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
passOnEvent = mb->rect().contains(cpos);
} else
@@ -1322,7 +1342,7 @@ void QMenuPrivate::activateCausedStack(const QVector<QPointer<QWidget> > &caused
} else if (action_e == QAction::Hover) {
emit qmenu->hovered(action);
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
} else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) {
if (action_e == QAction::Trigger) {
emit qmenubar->triggered(action);
@@ -1417,7 +1437,7 @@ void QMenuPrivate::_q_actionTriggered()
QVector< QPointer<QWidget> > list;
for(QWidget *widget = q->parentWidget(); widget; ) {
if (qobject_cast<QMenu*>(widget)
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
|| qobject_cast<QMenuBar*>(widget)
#endif
) {
@@ -2317,8 +2337,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
d->motions = 0;
d->doChildEffects = true;
d->updateLayoutDirection();
+ d->adjustMenuScreen(p);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
// if this menu is part of a chain attached to a QMenuBar, set the
// _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type
setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0);
@@ -2414,11 +2435,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
if (snapToMouse) // position flowing left from the mouse
pos.setX(mouse.x() - size.width());
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
// if the menu is in a menubar or is a submenu, it should be right-aligned
if (qobject_cast<QMenuBar*>(d->causedPopup.widget) || qobject_cast<QMenu*>(d->causedPopup.widget))
pos.rx() -= size.width();
-#endif //QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
if (pos.x() < screen.left() + desktopFrame)
pos.setX(qMax(p.x(), screen.left() + desktopFrame));
@@ -2479,7 +2500,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
}
}
setGeometry(QRect(pos, size));
-#ifndef QT_NO_EFFECTS
+#if QT_CONFIG(effects)
int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll;
int vGuess = QEffects::DownScroll;
if (isRightToLeft()) {
@@ -2492,7 +2513,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
hGuess = QEffects::LeftScroll;
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) ||
(qobject_cast<QMenuBar*>(d->causedPopup.widget) &&
pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y()))
@@ -2500,7 +2521,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
#endif
if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) {
bool doChildEffects = true;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) {
doChildEffects = mb->d_func()->doChildEffects;
mb->d_func()->doChildEffects = false;
@@ -2662,7 +2683,7 @@ void QMenu::hideEvent(QHideEvent *)
QAccessibleEvent event(this, QAccessible::PopupMenuEnd);
QAccessible::updateAccessibility(&event);
#endif
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
mb->d_func()->setCurrentAction(0);
#endif
@@ -3211,7 +3232,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this))
{
d->hideMenu(this);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) {
mb->d_func()->setKeyboardMode(false);
}
@@ -3273,7 +3294,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
{
QPointer<QWidget> caused = d->causedPopup.widget;
d->hideMenu(this); // hide after getting causedPopup
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
mb->d_func()->setCurrentAction(d->menuAction);
mb->d_func()->setKeyboardMode(true);
@@ -3350,7 +3371,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
}
}
if (!key_consumed) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) {
QAction *oldAct = mb->d_func()->currentAction;
QApplication::sendEvent(mb, e);
@@ -3762,5 +3783,3 @@ QT_END_NAMESPACE
// for private slots
#include "moc_qmenu.cpp"
#include "qmenu.moc"
-
-#endif // QT_NO_MENU
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 6b1b427ad4..86d927e919 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -50,10 +50,9 @@
Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu);
#endif
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(menu);
-#ifndef QT_NO_MENU
+QT_BEGIN_NAMESPACE
class QMenuPrivate;
class QStyleOptionMenuItem;
@@ -280,8 +279,6 @@ private:
inline QT_DEPRECATED void qt_mac_set_dock_menu(QMenu *menu) { menu->setAsDockMenu(); }
#endif
-#endif // QT_NO_MENU
-
QT_END_NAMESPACE
#endif // QMENU_H
diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm
index f9f3ad08dc..7d932c670f 100644
--- a/src/widgets/widgets/qmenu_mac.mm
+++ b/src/widgets/widgets/qmenu_mac.mm
@@ -41,8 +41,10 @@
#import <AppKit/AppKit.h>
#include "qmenu.h"
+#if QT_CONFIG(menubar)
#include "qmenubar.h"
#include "qmenubar_p.h"
+#endif
#include "qmacnativewidget_mac.h"
#include <QtCore/QDebug>
@@ -52,7 +54,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
namespace {
// TODO use QtMacExtras copy of this function when available.
@@ -137,9 +139,9 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem*
container->show();
}
-#endif //QT_NO_MENU
+#endif // QT_CONFIG(menu)
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*!
\since 5.2
@@ -159,7 +161,7 @@ NSMenu *QMenuBar::toNSMenu()
}
return nil;
}
-#endif //QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 2270313c12..fac58f59ab 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -52,7 +52,9 @@
//
#include <QtWidgets/private/qtwidgetsglobal_p.h>
+#if QT_CONFIG(menubar)
#include "QtWidgets/qmenubar.h"
+#endif
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qdatetime.h"
#include "QtCore/qmap.h"
@@ -62,9 +64,9 @@
#include <qpa/qplatformmenu.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(menu);
-#ifndef QT_NO_MENU
+QT_BEGIN_NAMESPACE
class QTornOffMenu;
class QEventLoop;
@@ -447,6 +449,7 @@ public:
bool hasMouseMoved(const QPoint &globalPos);
+ void adjustMenuScreen(const QPoint &p);
void updateLayoutDirection();
//menu fading/scrolling effects
@@ -478,8 +481,6 @@ public:
QRect rect() const;
};
-#endif // QT_NO_MENU
-
QT_END_NAMESPACE
#endif // QMENU_P_H
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index ff29a0a93f..137d38e558 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -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>
@@ -62,9 +64,6 @@
#include "qpa/qplatformintegration.h"
#include <private/qdesktopwidget_p.h>
-#ifndef QT_NO_MENUBAR
-
-
#include "qmenu_p.h"
#include "qmenubar_p.h"
#include "qdebug.h"
@@ -85,7 +84,7 @@ QMenuBarExtension::QMenuBarExtension(QWidget *parent)
{
setObjectName(QLatin1String("qt_menubar_ext_button"));
setAutoRaise(true);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
setPopupMode(QToolButton::InstantPopup);
#endif
setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, 0, parentWidget()));
@@ -1875,9 +1874,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar()
// for private slots
-
QT_END_NAMESPACE
#include <moc_qmenubar.cpp>
-
-#endif // QT_NO_MENUBAR
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index dffcba4a0a..4f8e3b8d53 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qmenu.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(menubar);
-#ifndef QT_NO_MENUBAR
+QT_BEGIN_NAMESPACE
class QMenuBarPrivate;
class QStyleOptionMenuItem;
@@ -140,8 +139,6 @@ private:
friend class QWindowsStyle;
};
-#endif // QT_NO_MENUBAR
-
QT_END_NAMESPACE
#endif // QMENUBAR_H
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index f5409b9762..01d8793a3a 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -56,9 +56,10 @@
#include <private/qmenu_p.h> // Mac needs what in this file!
#include <qpa/qplatformmenu.h>
+QT_REQUIRE_CONFIG(menubar);
+
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_MENUBAR
class QMenuBarExtension;
class QMenuBarPrivate : public QWidgetPrivate
{
@@ -136,8 +137,6 @@ public:
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
};
-#endif // QT_NO_MENUBAR
-
QT_END_NAMESPACE
#endif // QMENUBAR_P_H
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 6d3f5649c2..555b1f94ad 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -46,7 +46,9 @@
#include <qdebug.h>
#include <qdrag.h>
#include <qclipboard.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qstyle.h>
#include <qtimer.h>
#include "private/qtextdocumentlayout_p.h"
@@ -63,8 +65,6 @@
#include <qtexttable.h>
#include <qvariant.h>
-#ifndef QT_NO_TEXTEDIT
-
QT_BEGIN_NAMESPACE
static inline bool shouldEnableInputMethod(QPlainTextEdit *plaintextedit)
@@ -3216,5 +3216,3 @@ QT_END_NAMESPACE
#include "moc_qplaintextedit.cpp"
#include "moc_qplaintextedit_p.cpp"
-
-#endif // QT_NO_TEXTEDIT
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index f90c76172d..2823aeeb74 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -50,11 +50,10 @@
#include <QtGui/qtextformat.h>
#include <QtGui/qabstracttextdocumentlayout.h>
-#ifndef QT_NO_TEXTEDIT
+QT_REQUIRE_CONFIG(textedit);
QT_BEGIN_NAMESPACE
-
class QStyleSheet;
class QTextDocument;
class QMenu;
@@ -337,7 +336,4 @@ private:
QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTEDIT
-
#endif // QPLAINTEXTEDIT_H
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index 207745b566..1e93ae9f3c 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -59,15 +59,17 @@
#endif
#include "QtGui/qtextcursor.h"
#include "QtGui/qtextformat.h"
+#if QT_CONFIG(menu)
#include "QtWidgets/qmenu.h"
+#endif
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
#include "qplaintextedit.h"
-#ifndef QT_NO_TEXTEDIT
-
#include "private/qwidgettextcontrol_p.h"
+QT_REQUIRE_CONFIG(textedit);
+
QT_BEGIN_NAMESPACE
class QMimeData;
@@ -187,6 +189,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_TEXTEDIT
-
#endif // QPLAINTEXTEDIT_P_H
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index 3dd6ee9b0a..caf175e6ff 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -47,7 +47,6 @@
#include "qdrawutil.h"
#include "qevent.h"
#include "qfontmetrics.h"
-#include "qmenu.h"
#include "qstylepainter.h"
#include "qpixmap.h"
#include "qpointer.h"
@@ -65,7 +64,10 @@
#include "qaccessible.h"
#endif
+#if QT_CONFIG(menu)
+#include "qmenu.h"
#include "private/qmenu_p.h"
+#endif
#include "private/qpushbutton_p.h"
QT_BEGIN_NAMESPACE
@@ -314,7 +316,7 @@ void QPushButton::initStyleOption(QStyleOptionButton *option) const
option->features = QStyleOptionButton::None;
if (d->flat)
option->features |= QStyleOptionButton::Flat;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (d->menu)
option->features |= QStyleOptionButton::HasMenu;
#endif
@@ -419,7 +421,7 @@ QSize QPushButton::sizeHint() const
if(!empty || !h)
h = qMax(h, sz.height());
opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (menu())
w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this);
#endif
@@ -499,13 +501,13 @@ void QPushButton::focusOutEvent(QFocusEvent *e)
}
QAbstractButton::focusOutEvent(e);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (d->menu && d->menu->isVisible()) // restore pressed status
setDown(true);
#endif
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
Associates the popup menu \a menu with this push button. This
turns the button into a menu button, which in some styles will
@@ -628,7 +630,7 @@ QPoint QPushButtonPrivate::adjustedMenuPosition()
return QPoint(x,y);
}
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
void QPushButtonPrivate::resetLayoutItemMargins()
{
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index e6042a719d..b02ba63d07 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -74,7 +74,7 @@ public:
bool isDefault() const;
void setDefault(bool);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void setMenu(QMenu* menu);
QMenu* menu() const;
#endif
@@ -83,7 +83,7 @@ public:
bool isFlat() const;
public Q_SLOTS:
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void showMenu();
#endif
@@ -101,7 +101,7 @@ public:
private:
Q_DISABLE_COPY(QPushButton)
Q_DECLARE_PRIVATE(QPushButton)
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
Q_PRIVATE_SLOT(d_func(), void _q_popupPressed())
#endif
};
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index a32b599b94..a58675fe64 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -76,7 +76,7 @@ public:
#if 0 // Used to be included in Qt4 for Q_WS_MAC
bool hitButton(const QPoint &pos);
#endif
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QPoint adjustedMenuPosition();
#endif
void resetLayoutItemMargins();
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index ac711d34c7..dfba32d3e8 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -40,7 +40,9 @@
#include "qradiobutton.h"
#include "qapplication.h"
#include "qbitmap.h"
+#if QT_CONFIG(buttongroup)
#include "qbuttongroup.h"
+#endif
#include "qstylepainter.h"
#include "qstyle.h"
#include "qstyleoption.h"
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index 0868dcbd69..0bfc56f7fa 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -40,8 +40,6 @@
#include "qscrollarea.h"
#include "private/qscrollarea_p.h"
-#ifndef QT_NO_SCROLLAREA
-
#include "qscrollbar.h"
#include "qlayout.h"
#include "qstyle.h"
@@ -539,5 +537,3 @@ Qt::Alignment QScrollArea::alignment() const
QT_END_NAMESPACE
#include "moc_qscrollarea.cpp"
-
-#endif // QT_NO_SCROLLAREA
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index 0b0160f3aa..6d252821c5 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractscrollarea.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(scrollarea);
-#ifndef QT_NO_SCROLLAREA
+QT_BEGIN_NAMESPACE
class QScrollAreaPrivate;
@@ -91,8 +90,6 @@ private:
Q_DISABLE_COPY(QScrollArea)
};
-#endif // QT_NO_SCROLLAREA
-
QT_END_NAMESPACE
#endif // QSCROLLAREA_H
diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h
index f7c0725dbe..fa2e0241cf 100644
--- a/src/widgets/widgets/qscrollarea_p.h
+++ b/src/widgets/widgets/qscrollarea_p.h
@@ -53,11 +53,11 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
-#ifndef QT_NO_SCROLLAREA
-
#include "private/qabstractscrollarea_p.h"
#include <QtWidgets/qscrollbar.h>
+QT_REQUIRE_CONFIG(scrollarea);
+
QT_BEGIN_NAMESPACE
class QScrollAreaPrivate: public QAbstractScrollAreaPrivate
@@ -74,8 +74,6 @@ public:
Qt::Alignment alignment;
};
-#endif
-
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index e40c922e97..b4168268a0 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -44,7 +44,9 @@
#include "qscrollbar.h"
#include "qstyle.h"
#include "qstyleoption.h"
+#if QT_CONFIG(menu)
#include "qmenu.h"
+#endif
#include <QtCore/qelapsedtimer.h>
#ifndef QT_NO_ACCESSIBILITY
@@ -395,7 +397,7 @@ void QScrollBar::contextMenuEvent(QContextMenuEvent *event)
return ;
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
bool horiz = HORIZONTAL;
QPointer<QMenu> menu = new QMenu(this);
QAction *actScrollHere = menu->addAction(tr("Scroll here"));
@@ -426,7 +428,7 @@ void QScrollBar::contextMenuEvent(QContextMenuEvent *event)
triggerAction(QAbstractSlider::SliderSingleStepSub);
else if (actionSelected == actScrollDn)
triggerAction(QAbstractSlider::SliderSingleStepAdd);
-#endif // QT_NO_MENU
+#endif // QT_CONFIG(menu)
}
#endif // QT_NO_CONTEXTMENU
diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp
index 85efd680ec..dc5a7158dd 100644
--- a/src/widgets/widgets/qsizegrip.cpp
+++ b/src/widgets/widgets/qsizegrip.cpp
@@ -39,8 +39,6 @@
#include "qsizegrip.h"
-#ifndef QT_NO_SIZEGRIP
-
#include "qapplication.h"
#include "qevent.h"
#include "qpainter.h"
@@ -321,13 +319,13 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
// Check if tlw is inside QAbstractScrollArea/QScrollArea.
// If that's the case tlw->parentWidget() will return the viewport
// and tlw->parentWidget()->parentWidget() will return the scroll area.
-#ifndef QT_NO_SCROLLAREA
+#if QT_CONFIG(scrollarea)
QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(tlwParent->parentWidget());
if (scrollArea) {
hasHorizontalSizeConstraint = scrollArea->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff;
hasVerticalSizeConstraint = scrollArea->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff;
}
-#endif // QT_NO_SCROLLAREA
+#endif // QT_CONFIG(scrollarea)
availableGeometry = tlwParent->contentsRect();
}
@@ -508,5 +506,3 @@ bool QSizeGrip::event(QEvent *event)
QT_END_NAMESPACE
#include "moc_qsizegrip.cpp"
-
-#endif //QT_NO_SIZEGRIP
diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h
index 70a2f88492..5285ffdfb8 100644
--- a/src/widgets/widgets/qsizegrip.h
+++ b/src/widgets/widgets/qsizegrip.h
@@ -43,10 +43,10 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(sizegrip);
+QT_BEGIN_NAMESPACE
-#ifndef QT_NO_SIZEGRIP
class QSizeGripPrivate;
class Q_WIDGETS_EXPORT QSizeGrip : public QWidget
{
@@ -76,7 +76,6 @@ private:
Q_DISABLE_COPY(QSizeGrip)
Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden())
};
-#endif // QT_NO_SIZEGRIP
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp
index 356cbcfce7..47d3b2fb81 100644
--- a/src/widgets/widgets/qslider.cpp
+++ b/src/widgets/widgets/qslider.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "qslider.h"
-#ifndef QT_NO_SLIDER
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
@@ -547,8 +546,6 @@ Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider)
return sliderOption;
}
-#endif
-
QT_END_NAMESPACE
#include "moc_qslider.cpp"
diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h
index 67ccf88311..f74f9c8576 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -42,12 +42,11 @@
#include <QtWidgets/qtwidgetsglobal.h>
-#if QT_CONFIG(slider)
-
#include <QtWidgets/qabstractslider.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(slider);
+QT_BEGIN_NAMESPACE
class QSliderPrivate;
class QStyleOptionSlider;
@@ -102,6 +101,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_CONFIG(slider)
-
#endif // QSLIDER_H
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index 89a0f70e90..561215ec85 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -40,8 +40,6 @@
#include <private/qabstractspinbox_p.h>
#include <qspinbox.h>
-#ifndef QT_NO_SPINBOX
-
#include <qlineedit.h>
#include <qlocale.h>
#include <qvalidator.h>
@@ -1321,5 +1319,3 @@ bool QSpinBox::event(QEvent *event)
QT_END_NAMESPACE
#include "moc_qspinbox.cpp"
-
-#endif // QT_NO_SPINBOX
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index c97eaa9c6e..73489c9a68 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractspinbox.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(spinbox);
-#ifndef QT_NO_SPINBOX
+QT_BEGIN_NAMESPACE
class QSpinBoxPrivate;
class Q_WIDGETS_EXPORT QSpinBox : public QAbstractSpinBox
@@ -168,8 +167,6 @@ private:
Q_DECLARE_PRIVATE(QDoubleSpinBox)
};
-#endif // QT_NO_SPINBOX
-
QT_END_NAMESPACE
#endif // QSPINBOX_H
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp
index 38ce182fbf..9d92855a40 100644
--- a/src/widgets/widgets/qstackedwidget.cpp
+++ b/src/widgets/widgets/qstackedwidget.cpp
@@ -39,8 +39,6 @@
#include "qstackedwidget.h"
-#ifndef QT_NO_STACKEDWIDGET
-
#include <qstackedlayout.h>
#include <qevent.h>
#include <private/qframe_p.h>
@@ -294,5 +292,3 @@ bool QStackedWidget::event(QEvent *e)
QT_END_NAMESPACE
#include "moc_qstackedwidget.cpp"
-
-#endif // QT_NO_STACKEDWIDGET
diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h
index d1682e862b..5508f905d4 100644
--- a/src/widgets/widgets/qstackedwidget.h
+++ b/src/widgets/widgets/qstackedwidget.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(stackedwidget);
-#ifndef QT_NO_STACKEDWIDGET
+QT_BEGIN_NAMESPACE
class QStackedWidgetPrivate;
@@ -87,8 +86,6 @@ private:
Q_DECLARE_PRIVATE(QStackedWidget)
};
-#endif // QT_NO_STACKEDWIDGET
-
QT_END_NAMESPACE
#endif // QSTACKEDWIDGET_H
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index da7c86a2af..4635b73a81 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -47,8 +47,12 @@
#include "qtimer.h"
#include "qstyle.h"
#include "qstyleoption.h"
+#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
+#endif
+#if QT_CONFIG(mainwindow)
#include "qmainwindow.h"
+#endif
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
@@ -79,7 +83,7 @@ public:
QBoxLayout * box;
QTimer * timer;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
QSizeGrip * resizer;
bool showSizeGrip;
#endif
@@ -101,7 +105,7 @@ public:
return i;
}
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
void tryToShowSizeGrip()
{
if (!showSizeGrip)
@@ -127,7 +131,7 @@ QRect QStatusBarPrivate::messageRect() const
int left = 6;
int right = q->width() - 12;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if (resizer && resizer->isVisible()) {
if (rtl)
left = resizer->x() + resizer->width();
@@ -232,7 +236,7 @@ QStatusBar::QStatusBar(QWidget * parent)
d->box = 0;
d->timer = 0;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
d->resizer = 0;
setSizeGripEnabled(true); // causes reformat()
#else
@@ -429,7 +433,7 @@ void QStatusBar::removeWidget(QWidget *widget)
bool QStatusBar::isSizeGripEnabled() const
{
-#ifdef QT_NO_SIZEGRIP
+#if !QT_CONFIG(sizegrip)
return false;
#else
Q_D(const QStatusBar);
@@ -439,7 +443,7 @@ bool QStatusBar::isSizeGripEnabled() const
void QStatusBar::setSizeGripEnabled(bool enabled)
{
-#ifdef QT_NO_SIZEGRIP
+#if !QT_CONFIG(sizegrip)
Q_UNUSED(enabled);
#else
Q_D(QStatusBar);
@@ -475,7 +479,7 @@ void QStatusBar::reformat()
delete d->box;
QBoxLayout *vbox;
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if (d->resizer) {
d->box = new QHBoxLayout(this);
d->box->setMargin(0);
@@ -516,7 +520,7 @@ void QStatusBar::reformat()
int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
maxH = qMax(maxH, itemH);
}
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if (d->resizer) {
maxH = qMax(maxH, d->resizer->sizeHint().height());
d->box->addSpacing(1);
@@ -647,7 +651,7 @@ void QStatusBar::hideOrShow()
*/
void QStatusBar::showEvent(QShowEvent *)
{
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
Q_D(QStatusBar);
if (d->resizer && d->showSizeGrip)
d->tryToShowSizeGrip();
@@ -720,7 +724,7 @@ bool QStatusBar::event(QEvent *e)
maxH = qMax(maxH, itemH);
}
-#ifndef QT_NO_SIZEGRIP
+#if QT_CONFIG(sizegrip)
if (d->resizer)
maxH = qMax(maxH, d->resizer->sizeHint().height());
#endif
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 3b92b9b57e..95c85dc4fe 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -38,19 +38,22 @@
****************************************************************************/
#include "qtextedit_p.h"
+#if QT_CONFIG(lineedit)
#include "qlineedit.h"
+#endif
#if QT_CONFIG(textbrowser)
#include "qtextbrowser.h"
#endif
-#ifndef QT_NO_TEXTEDIT
#include <qfont.h>
#include <qpainter.h>
#include <qevent.h>
#include <qdebug.h>
#include <qdrag.h>
#include <qclipboard.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qstyle.h>
#include <qtimer.h>
#ifndef QT_NO_ACCESSIBILITY
@@ -69,12 +72,8 @@
#include <qtexttable.h>
#include <qvariant.h>
-#endif
-
QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_TEXTEDIT
static inline bool shouldEnableInputMethod(QTextEdit *textedit)
{
return !textedit->isReadOnly();
@@ -2658,8 +2657,6 @@ void QTextEdit::ensureCursorVisible()
(\a available is true) or unavailable (\a available is false).
*/
-#endif // QT_NO_TEXTEDIT
-
QT_END_NAMESPACE
#include "moc_qtextedit.cpp"
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index ae5991e93c..9e0913160d 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -47,12 +47,10 @@
#include <QtGui/qtextcursor.h>
#include <QtGui/qtextformat.h>
-#ifndef QT_NO_TEXTEDIT
-
+QT_REQUIRE_CONFIG(textedit);
QT_BEGIN_NAMESPACE
-
class QStyleSheet;
class QTextDocument;
class QMenu;
@@ -329,6 +327,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEdit::AutoFormatting)
QT_END_NAMESPACE
-#endif // QT_NO_TEXTEDIT
-
#endif // QTEXTEDIT_H
diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h
index 28257fe29f..c4ee75c78d 100644
--- a/src/widgets/widgets/qtextedit_p.h
+++ b/src/widgets/widgets/qtextedit_p.h
@@ -59,16 +59,18 @@
#endif
#include "QtGui/qtextcursor.h"
#include "QtGui/qtextformat.h"
+#if QT_CONFIG(menu)
#include "QtWidgets/qmenu.h"
+#endif
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
#include "QtCore/qurl.h"
#include "qtextedit.h"
-#ifndef QT_NO_TEXTEDIT
-
#include "private/qwidgettextcontrol_p.h"
+QT_REQUIRE_CONFIG(textedit);
+
QT_BEGIN_NAMESPACE
class QMimeData;
@@ -141,6 +143,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_TEXTEDIT
-
#endif // QTEXTEDIT_P_H
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index e162d46935..1c6d41ee2f 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -49,7 +49,9 @@
#include <qlayout.h>
#include <qmainwindow.h>
#include <qmenu.h>
+#if QT_CONFIG(menubar)
#include <qmenubar.h>
+#endif
#if QT_CONFIG(rubberband)
#include <qrubberband.h>
#endif
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 60c9c43399..96b88340cd 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -45,19 +45,23 @@
#include <qdrawutil.h>
#include <qevent.h>
#include <qicon.h>
-#include <qmenu.h>
#include <qpainter.h>
#include <qpointer.h>
#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>
#include <private/qabstractbutton_p.h>
#include <private/qaction_p.h>
+#if QT_CONFIG(menu)
+#include <qmenu.h>
#include <private/qmenu_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -66,7 +70,7 @@ class QToolButtonPrivate : public QAbstractButtonPrivate
Q_DECLARE_PUBLIC(QToolButton)
public:
void init();
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void _q_buttonPressed();
void _q_buttonReleased();
void popupTimerDone();
@@ -90,14 +94,14 @@ public:
uint autoRaise : 1;
uint repeat : 1;
QAction *defaultAction;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
bool hasMenu() const;
//workaround for task 177850
QList<QAction *> actionsCopy;
#endif
};
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
bool QToolButtonPrivate::hasMenu() const
{
return ((defaultAction && defaultAction->menu())
@@ -215,7 +219,7 @@ void QToolButtonPrivate::init()
q->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed,
QSizePolicy::ToolButton));
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QObject::connect(q, SIGNAL(pressed()), q, SLOT(_q_buttonPressed()));
QObject::connect(q, SIGNAL(released()), q, SLOT(_q_buttonReleased()));
#endif
@@ -287,7 +291,7 @@ void QToolButton::initStyleOption(QStyleOptionToolButton *option) const
option->features |= QStyleOptionToolButton::Arrow;
if (d->popupMode == QToolButton::DelayedPopup)
option->features |= QStyleOptionToolButton::PopupDelay;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (d->hasMenu())
option->features |= QStyleOptionToolButton::HasMenu;
#endif
@@ -472,7 +476,7 @@ void QToolButton::actionEvent(QActionEvent *event)
case QEvent::ActionRemoved:
if (d->defaultAction == action)
d->defaultAction = 0;
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (action == d->menuAction)
d->menuAction = 0;
#endif
@@ -551,7 +555,7 @@ void QToolButton::leaveEvent(QEvent * e)
*/
void QToolButton::timerEvent(QTimerEvent *e)
{
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
Q_D(QToolButton);
if (e->timerId() == d->popupTimer.timerId()) {
d->popupTimerDone();
@@ -590,7 +594,7 @@ void QToolButton::changeEvent(QEvent *e)
void QToolButton::mousePressEvent(QMouseEvent *e)
{
Q_D(QToolButton);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
QStyleOptionToolButton opt;
initStyleOption(&opt);
if (e->button() == Qt::LeftButton && (d->popupMode == MenuButtonPopup)) {
@@ -629,7 +633,7 @@ bool QToolButton::hitButton(const QPoint &pos) const
}
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
/*!
Associates the given \a menu with this tool button.
@@ -822,10 +826,7 @@ void QToolButtonPrivate::_q_menuTriggered(QAction *action)
if (action && !actionsCopy.contains(action))
emit q->triggered(action);
}
-#endif // QT_NO_MENU
-
-#ifndef QT_NO_MENU
/*! \enum QToolButton::ToolButtonPopupMode
Describes how a menu should be popped up for tool buttons that has
@@ -900,7 +901,7 @@ bool QToolButton::autoRaise() const
void QToolButton::setDefaultAction(QAction *action)
{
Q_D(QToolButton);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
bool hadMenu = false;
hadMenu = d->hasMenu();
#endif
@@ -925,7 +926,7 @@ void QToolButton::setDefaultAction(QAction *action)
#if QT_CONFIG(whatsthis)
setWhatsThis(action->whatsThis());
#endif
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (action->menu() && !hadMenu) {
// new 'default' popup mode defined introduced by tool bar. We
// should have changed QToolButton's default instead. Do that
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index 1479198e1d..52bd2d5f7a 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -56,7 +56,7 @@ class Q_WIDGETS_EXPORT QToolButton : public QAbstractButton
{
Q_OBJECT
Q_ENUMS(Qt::ToolButtonStyle Qt::ArrowType)
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
Q_PROPERTY(ToolButtonPopupMode popupMode READ popupMode WRITE setPopupMode)
#endif
Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle)
@@ -82,7 +82,7 @@ public:
Qt::ArrowType arrowType() const;
void setArrowType(Qt::ArrowType type);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void setMenu(QMenu* menu);
QMenu* menu() const;
@@ -96,7 +96,7 @@ public:
bool autoRaise() const;
public Q_SLOTS:
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
void showMenu();
#endif
void setToolButtonStyle(Qt::ToolButtonStyle style);
@@ -124,7 +124,7 @@ protected:
private:
Q_DISABLE_COPY(QToolButton)
Q_DECLARE_PRIVATE(QToolButton)
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed())
Q_PRIVATE_SLOT(d_func(), void _q_buttonReleased())
Q_PRIVATE_SLOT(d_func(), void _q_updateButtonDown())
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index 3a00999e57..b6828a14ef 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -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)
}
}
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 9281cc8ced..1b7a41d547 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -39,8 +39,6 @@
#include "qwidgetlinecontrol_p.h"
-#ifndef QT_NO_LINEEDIT
-
#if QT_CONFIG(itemviews)
#include "qabstractitemview.h"
#endif
@@ -57,6 +55,8 @@
#include "qgraphicssceneevent.h"
#endif
+#include "qvalidator.h"
+
QT_BEGIN_NAMESPACE
@@ -1428,7 +1428,7 @@ void QWidgetLineControl::emitCursorPositionChanged()
}
}
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
// iterating forward(dir=1)/backward(dir=-1) from the
// current row based. dir=0 indicates a new completion prefix was set.
bool QWidgetLineControl::advanceToEnabledItem(int dir)
@@ -1627,7 +1627,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
{
bool inlineCompletionAccepted = false;
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
if (m_completer) {
QCompleter::CompletionMode completionMode = m_completer->completionMode();
if ((completionMode == QCompleter::PopupCompletion
@@ -1672,7 +1672,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
}
}
}
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
if (hasAcceptableInput() || fixup()) {
@@ -1774,7 +1774,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
end(1);
}
else if (event == QKeySequence::MoveToNextChar) {
-#if defined(QT_NO_COMPLETER)
+#if !QT_CONFIG(completer)
const bool inlineCompletion = false;
#else
const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
@@ -1791,7 +1791,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
}
else if (event == QKeySequence::MoveToPreviousChar) {
-#if defined(QT_NO_COMPLETER)
+#if !QT_CONFIG(completer)
const bool inlineCompletion = false;
#else
const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
@@ -1886,7 +1886,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
del();
}
break;
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
case Qt::Key_Up:
case Qt::Key_Down:
complete(event->key());
@@ -1901,7 +1901,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
case Qt::Key_Backspace:
if (!isReadOnly()) {
backspace();
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
complete(Qt::Key_Backspace);
#endif
}
@@ -1941,7 +1941,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
&& !isReadOnly()
&& isAcceptableInput(event)) {
insert(event->text());
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
complete(event->key());
#endif
event->accept();
@@ -1973,5 +1973,3 @@ bool QWidgetLineControl::isRedoAvailable() const
QT_END_NAMESPACE
#include "moc_qwidgetlinecontrol_p.cpp"
-
-#endif
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index 97ef3b3bc4..16eb337416 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -53,7 +53,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
-#ifndef QT_NO_LINEEDIT
#include "private/qwidget_p.h"
#include "QtWidgets/qlineedit.h"
#include "QtGui/qtextlayout.h"
@@ -62,7 +61,9 @@
#include "QtGui/qclipboard.h"
#include "QtGui/qinputmethod.h"
#include "QtCore/qpoint.h"
+#if QT_CONFIG(completer)
#include "QtWidgets/qcompleter.h"
+#endif
#include "QtCore/qthread.h"
#include "QtGui/private/qinputcontrol_p.h"
@@ -74,8 +75,9 @@
# undef DrawText
#endif
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(lineedit);
+QT_BEGIN_NAMESPACE
class Q_WIDGETS_EXPORT QWidgetLineControl : public QInputControl
{
@@ -289,7 +291,7 @@ public:
void setValidator(const QValidator *v) { m_validator = const_cast<QValidator*>(v); }
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
QCompleter *completer() const { return m_completer; }
/* Note that you must set the widget for the completer separately */
void setCompleter(const QCompleter *c) { m_completer = const_cast<QCompleter*>(c); }
@@ -461,7 +463,7 @@ private:
QPointer<QValidator> m_validator;
#endif
QPointer<QCompleter> m_completer;
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
bool advanceToEnabledItem(int dir);
#endif
@@ -562,6 +564,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_LINEEDIT
-
#endif // QWIDGETLINECONTROL_P_H
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index 79502cdd26..3612a04e99 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -39,13 +39,14 @@
#include "qwidgetresizehandler_p.h"
-#ifndef QT_NO_RESIZEHANDLER
#include "qframe.h"
#include "qapplication.h"
#include "qdesktopwidget.h"
#include <private/qdesktopwidget_p.h>
#include "qcursor.h"
+#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
+#endif
#include "qevent.h"
#include "qdebug.h"
#include "private/qlayoutengine_p.h"
@@ -544,5 +545,3 @@ void QWidgetResizeHandler::doMove()
QT_END_NAMESPACE
#include "moc_qwidgetresizehandler_p.cpp"
-
-#endif //QT_NO_RESIZEHANDLER
diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h
index 79b9fc522c..b87bbd6229 100644
--- a/src/widgets/widgets/qwidgetresizehandler_p.h
+++ b/src/widgets/widgets/qwidgetresizehandler_p.h
@@ -55,7 +55,7 @@
#include "QtCore/qobject.h"
#include "QtCore/qpoint.h"
-#ifndef QT_NO_RESIZEHANDLER
+QT_REQUIRE_CONFIG(resizehandler);
QT_BEGIN_NAMESPACE
@@ -135,6 +135,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_RESIZEHANDLER
-
#endif // QWIDGETRESIZEHANDLER_P_H
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 706e63bbdc..aa5a3329e9 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -48,12 +48,16 @@
#include <qdebug.h>
#include <qdrag.h>
#include <qclipboard.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qstyle.h>
#include <qtimer.h>
#include "private/qtextdocumentlayout_p.h"
#include "private/qabstracttextdocumentlayout_p.h"
+#if QT_CONFIG(textedit)
#include "private/qtextedit_p.h"
+#endif
#include "qtextdocument.h"
#include "private/qtextdocument_p.h"
#include "qtextlist.h"
@@ -79,7 +83,9 @@
#include <qinputmethod.h>
#include <qtooltip.h>
#include <qstyleoption.h>
+#if QT_CONFIG(lineedit)
#include <QtWidgets/qlineedit.h>
+#endif
#include <QtGui/qaccessible.h>
#include <QtCore/qmetaobject.h>
@@ -1350,7 +1356,7 @@ process:
QVariant QWidgetTextControl::loadResource(int type, const QUrl &name)
{
-#ifdef QT_NO_TEXTEDIT
+#if !QT_CONFIG(textedit)
Q_UNUSED(type);
Q_UNUSED(name);
#else
@@ -2411,7 +2417,7 @@ void QWidgetTextControl::setAcceptRichText(bool accept)
d->acceptRichText = accept;
}
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
void QWidgetTextControl::setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections)
{
@@ -2475,7 +2481,7 @@ QList<QTextEdit::ExtraSelection> QWidgetTextControl::extraSelections() const
return selections;
}
-#endif // QT_NO_TEXTEDIT
+#endif // QT_CONFIG(textedit)
void QWidgetTextControl::setTextWidth(qreal width)
{
@@ -3296,7 +3302,7 @@ void QUnicodeControlCharacterMenu::menuActionTriggered()
QChar c(qt_controlCharacters[idx].character);
QString str(c);
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
if (QTextEdit *edit = qobject_cast<QTextEdit *>(editWidget)) {
edit->insertPlainText(str);
return;
@@ -3305,7 +3311,7 @@ void QUnicodeControlCharacterMenu::menuActionTriggered()
if (QWidgetTextControl *control = qobject_cast<QWidgetTextControl *>(editWidget)) {
control->insertPlainText(str);
}
-#ifndef QT_NO_LINEEDIT
+#if QT_CONFIG(lineedit)
if (QLineEdit *edit = qobject_cast<QLineEdit *>(editWidget)) {
edit->insert(str);
return;
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index 05ce54f628..4b2acbd934 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -56,8 +56,12 @@
#include <QtGui/qtextoption.h>
#include <QtGui/qtextcursor.h>
#include <QtGui/qtextformat.h>
+#if QT_CONFIG(textedit)
#include <QtWidgets/qtextedit.h>
+#endif
+#if QT_CONFIG(menu)
#include <QtWidgets/qmenu.h>
+#endif
#include <QtCore/qrect.h>
#include <QtGui/qabstracttextdocumentlayout.h>
#include <QtGui/qtextdocumentfragment.h>
@@ -148,7 +152,7 @@ public:
bool acceptRichText() const;
void setAcceptRichText(bool accept);
-#ifndef QT_NO_TEXTEDIT
+#if QT_CONFIG(textedit)
void setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections);
QList<QTextEdit::ExtraSelection> extraSelections() const;
#endif
diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h
index 3917752d19..232dab180f 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h
@@ -55,7 +55,9 @@
#include "QtGui/qtextdocumentfragment.h"
#include "QtGui/qtextcursor.h"
#include "QtGui/qtextformat.h"
+#if QT_CONFIG(menu)
#include "QtWidgets/qmenu.h"
+#endif
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
#include "QtCore/qpointer.h"
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index c204dad08d..a197c41b95 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -1,78 +1,27 @@
# Qt widgets module
HEADERS += \
- widgets/qbuttongroup.h \
- widgets/qbuttongroup_p.h \
- widgets/qabstractspinbox.h \
- widgets/qabstractspinbox_p.h \
widgets/qframe.h \
widgets/qframe_p.h \
- widgets/qkeysequenceedit.h \
- widgets/qkeysequenceedit_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 \
- widgets/qmdisubwindow_p.h \
- widgets/qmenu.h \
- widgets/qmenu_p.h \
- widgets/qmenubar.h \
- widgets/qmenubar_p.h \
- widgets/qscrollarea_p.h \
- widgets/qsizegrip.h \
- widgets/qslider.h \
- widgets/qspinbox.h \
- widgets/qstackedwidget.h \
- widgets/qtextedit.h \
- widgets/qtextedit_p.h \
widgets/qtoolbar.h \
widgets/qtoolbar_p.h \
widgets/qtoolbarlayout_p.h \
widgets/qtoolbarseparator_p.h \
widgets/qabstractscrollarea.h \
widgets/qabstractscrollarea_p.h \
- widgets/qwidgetresizehandler_p.h \
widgets/qfocusframe.h \
- widgets/qscrollarea.h \
widgets/qwidgetanimator_p.h \
- widgets/qwidgetlinecontrol_p.h \
- widgets/qtoolbararealayout_p.h \
- widgets/qplaintextedit.h \
- widgets/qplaintextedit_p.h
+ widgets/qtoolbararealayout_p.h
SOURCES += \
- widgets/qbuttongroup.cpp \
- widgets/qabstractspinbox.cpp \
- widgets/qeffects.cpp \
widgets/qframe.cpp \
- widgets/qkeysequenceedit.cpp \
- widgets/qlineedit_p.cpp \
- widgets/qlineedit.cpp \
- widgets/qmainwindow.cpp \
- widgets/qmainwindowlayout.cpp \
- widgets/qmdiarea.cpp \
- widgets/qmdisubwindow.cpp \
- widgets/qmenu.cpp \
- widgets/qmenubar.cpp \
- widgets/qsizegrip.cpp \
- widgets/qslider.cpp \
- widgets/qspinbox.cpp \
- widgets/qstackedwidget.cpp \
- widgets/qtextedit.cpp \
widgets/qtoolbar.cpp \
widgets/qtoolbarlayout.cpp \
widgets/qtoolbarseparator.cpp \
widgets/qabstractscrollarea.cpp \
- widgets/qwidgetresizehandler.cpp \
widgets/qfocusframe.cpp \
- widgets/qscrollarea.cpp \
widgets/qwidgetanimator.cpp \
- widgets/qwidgetlinecontrol.cpp \
- widgets/qtoolbararealayout.cpp \
- widgets/qplaintextedit.cpp
+ widgets/qtoolbararealayout.cpp
qtConfig(abstractbutton) {
HEADERS += \
@@ -92,6 +41,14 @@ qtConfig(abstractslider) {
widgets/qabstractslider.cpp
}
+qtConfig(buttongroup) {
+ HEADERS += \
+ widgets/qbuttongroup.h \
+ widgets/qbuttongroup_p.h
+
+ SOURCES += widgets/qbuttongroup.cpp
+}
+
qtConfig(calendarwidget) {
HEADERS += widgets/qcalendarwidget.h
SOURCES += widgets/qcalendarwidget.cpp
@@ -146,6 +103,11 @@ qtConfig(dockwidget) {
widgets/qdockarealayout.cpp
}
+qtConfig(effects) {
+ HEADERS += widgets/qeffects_p.h
+ SOURCES += widgets/qeffects.cpp
+}
+
qtConfig(fontcombobox) {
HEADERS += widgets/qfontcombobox.h
SOURCES += widgets/qfontcombobox.cpp
@@ -156,6 +118,14 @@ qtConfig(groupbox) {
SOURCES += widgets/qgroupbox.cpp
}
+qtConfig(keysequenceedit) {
+ HEADERS += \
+ widgets/qkeysequenceedit.h \
+ widgets/qkeysequenceedit_p.h
+
+ SOURCES += widgets/qkeysequenceedit.cpp
+}
+
qtConfig(label) {
HEADERS += \
widgets/qlabel.h \
@@ -173,6 +143,56 @@ qtConfig(lcdnumber) {
widgets/qlcdnumber.cpp
}
+qtConfig(lineedit) {
+ HEADERS += \
+ widgets/qlineedit.h \
+ widgets/qlineedit_p.h \
+ widgets/qwidgetlinecontrol_p.h
+
+ SOURCES += \
+ widgets/qlineedit_p.cpp \
+ widgets/qlineedit.cpp \
+ widgets/qwidgetlinecontrol.cpp
+}
+
+qtConfig(mainwindow) {
+ HEADERS += \
+ widgets/qmainwindow.h \
+ widgets/qmainwindowlayout_p.h
+
+ SOURCES += \
+ widgets/qmainwindow.cpp \
+ widgets/qmainwindowlayout.cpp
+}
+
+qtConfig(mdiarea) {
+ HEADERS += \
+ widgets/qmdiarea.h \
+ widgets/qmdiarea_p.h \
+ widgets/qmdisubwindow.h \
+ widgets/qmdisubwindow_p.h
+
+ SOURCES += \
+ widgets/qmdiarea.cpp \
+ widgets/qmdisubwindow.cpp
+}
+
+qtConfig(menu) {
+ HEADERS += \
+ widgets/qmenu.h \
+ widgets/qmenu_p.h
+
+ SOURCES += widgets/qmenu.cpp
+}
+
+qtConfig(menubar) {
+ HEADERS += \
+ widgets/qmenubar.h \
+ widgets/qmenubar_p.h
+
+ SOURCES += widgets/qmenubar.cpp
+}
+
qtConfig(progressbar) {
HEADERS += widgets/qprogressbar.h
SOURCES += widgets/qprogressbar.cpp
@@ -195,6 +215,11 @@ qtConfig(radiobutton) {
widgets/qradiobutton.cpp
}
+qtConfig(resizehandler) {
+ HEADERS += widgets/qwidgetresizehandler_p.h
+ SOURCES += widgets/qwidgetresizehandler.cpp
+}
+
qtConfig(dialogbuttonbox) {
HEADERS += \
widgets/qdialogbuttonbox.h
@@ -208,6 +233,14 @@ qtConfig(rubberband) {
SOURCES += widgets/qrubberband.cpp
}
+qtConfig(scrollarea) {
+ HEADERS += \
+ widgets/qscrollarea.h \
+ widgets/qscrollarea_p.h
+
+ SOURCES += widgets/qscrollarea.cpp
+}
+
qtConfig(scrollbar) {
HEADERS += \
widgets/qscrollbar.h \
@@ -216,6 +249,27 @@ qtConfig(scrollbar) {
SOURCES += widgets/qscrollbar.cpp
}
+qtConfig(sizegrip) {
+ HEADERS += widgets/qsizegrip.h
+ SOURCES += widgets/qsizegrip.cpp
+}
+
+qtConfig(slider) {
+ HEADERS += widgets/qslider.h
+ SOURCES += widgets/qslider.cpp
+}
+
+qtConfig(spinbox) {
+ HEADERS += \
+ widgets/qabstractspinbox.h \
+ widgets/qabstractspinbox_p.h \
+ widgets/qspinbox.h
+
+ SOURCES += \
+ widgets/qabstractspinbox.cpp \
+ widgets/qspinbox.cpp
+}
+
qtConfig(splashscreen) {
HEADERS += \
widgets/qsplashscreen.h
@@ -232,6 +286,11 @@ qtConfig(splitter) {
SOURCES += widgets/qsplitter.cpp
}
+qtConfig(stackedwidget) {
+ HEADERS += widgets/qstackedwidget.h
+ SOURCES += widgets/qstackedwidget.cpp
+}
+
qtConfig(statusbar) {
HEADERS += widgets/qstatusbar.h
SOURCES += widgets/qstatusbar.cpp
@@ -245,6 +304,18 @@ qtConfig(tabbar) {
SOURCES += widgets/qtabbar.cpp
}
+qtConfig(textedit) {
+ HEADERS += \
+ widgets/qplaintextedit.h \
+ widgets/qplaintextedit_p.h \
+ widgets/qtextedit.h \
+ widgets/qtextedit_p.h
+
+ SOURCES += \
+ widgets/qplaintextedit.cpp \
+ widgets/qtextedit.cpp
+}
+
qtConfig(textbrowser) {
HEADERS += widgets/qtextbrowser.h
SOURCES += widgets/qtextbrowser.cpp
@@ -285,7 +356,10 @@ macx {
widgets/qmaccocoaviewcontainer_mac.h
OBJECTIVE_SOURCES += \
- widgets/qmenu_mac.mm \
widgets/qmacnativewidget_mac.mm \
widgets/qmaccocoaviewcontainer_mac.mm
+
+ qtConfig(menu)|qtConfig(menubar) {
+ SOURCES += widgets/qmenu_mac.mm
+ }
}