summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/complexwidgets.cpp1
-rw-r--r--src/widgets/accessible/itemviews.cpp16
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp2
-rw-r--r--src/widgets/dialogs/dialogs.pri14
-rw-r--r--src/widgets/dialogs/qdialog.cpp4
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp4
-rw-r--r--src/widgets/dialogs/qfontdialog.h7
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h4
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp3
-rw-r--r--src/widgets/effects/qgraphicseffect.h6
-rw-r--r--src/widgets/effects/qgraphicseffect_p.h5
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp3
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h5
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp42
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h15
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp7
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_p.h8
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp18
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h2
-rw-r--r--src/widgets/itemviews/itemviews.pri11
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp1
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp6
-rw-r--r--src/widgets/itemviews/qlistview.cpp13
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp4
-rw-r--r--src/widgets/itemviews/qtableview.cpp3
-rw-r--r--src/widgets/itemviews/qtableview.h7
-rw-r--r--src/widgets/itemviews/qtableview_p.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp1
-rw-r--r--src/widgets/kernel/qwidget.cpp36
-rw-r--r--src/widgets/kernel/qwidget.h4
-rw-r--r--src/widgets/kernel/qwidget_p.h14
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp18
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp10
-rw-r--r--src/widgets/styles/qdrawutil.cpp85
-rw-r--r--src/widgets/styles/qfusionstyle.cpp6
-rw-r--r--src/widgets/styles/qstyleoption.cpp4
-rw-r--r--src/widgets/styles/qstyleoption.h6
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp10
-rw-r--r--src/widgets/widgets.pro4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp6
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp4
-rw-r--r--src/widgets/widgets/qdatetimeedit.h7
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h4
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp6
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp16
-rw-r--r--src/widgets/widgets/qmdiarea_p.h6
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp30
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h8
-rw-r--r--src/widgets/widgets/qrubberband.cpp4
-rw-r--r--src/widgets/widgets/qrubberband.h7
-rw-r--r--src/widgets/widgets/qsplitter.cpp2
-rw-r--r--src/widgets/widgets/qsplitter_p.h1
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp14
-rw-r--r--src/widgets/widgets/widgets.pri19
64 files changed, 340 insertions, 237 deletions
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 4770c513cf..dd9bea1aec 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -46,7 +46,6 @@
#include <qtabbar.h>
#include <qcombobox.h>
#include <qlistview.h>
-#include <qtableview.h>
#include <qlineedit.h>
#include <qstyle.h>
#include <qstyleoption.h>
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index 3cef564781..87c0a59563 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -40,7 +40,9 @@
#include "itemviews_p.h"
#include <qheaderview.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <qlistview.h>
#include <qtreeview.h>
#include <private/qtreeview_p.h>
@@ -81,7 +83,7 @@ QAccessibleTable::QAccessibleTable(QWidget *w)
{
Q_ASSERT(view());
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
if (qobject_cast<const QTableView*>(view())) {
m_role = QAccessible::Table;
} else
@@ -117,7 +119,7 @@ QHeaderView *QAccessibleTable::horizontalHeader() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
header = tv->horizontalHeader();
#endif
@@ -133,7 +135,7 @@ QHeaderView *QAccessibleTable::verticalHeader() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
header = tv->verticalHeader();
#endif
@@ -866,7 +868,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
header = tv->horizontalHeader();
#endif
@@ -882,7 +884,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
QHeaderView *QAccessibleTableCell::verticalHeader() const
{
QHeaderView *header = 0;
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
if (const QTableView *tv = qobject_cast<const QTableView*>(view))
header = tv->verticalHeader();
#endif
@@ -1125,7 +1127,7 @@ QRect QAccessibleTableHeaderCell::rect() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
if (orientation == Qt::Horizontal) {
header = tv->horizontalHeader();
@@ -1192,7 +1194,7 @@ QHeaderView *QAccessibleTableHeaderCell::headerView() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
if (orientation == Qt::Horizontal) {
header = tv->horizontalHeader();
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index f18930f273..3bc0f7e77b 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -54,7 +54,9 @@
#include "qwidget.h"
#include "qdebug.h"
#include <qmath.h>
+#if QT_CONFIG(rubberband)
#include <QRubberBand>
+#endif
#include <QFocusFrame>
#include <QMenu>
#include <QtWidgets/private/qwidget_p.h>
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index e7db53c251..ccd176cd04 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -193,7 +193,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QDial")) {
iface = new QAccessibleDial(widget);
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
} else if (classname == QLatin1String("QRubberBand")) {
iface = new QAccessibleWidget(widget, QAccessible::Border);
#endif
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 7f77f7c524..60f489d487 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -58,7 +58,9 @@
#include <QDialogButtonBox>
#endif
#include <limits.h>
+#if QT_CONFIG(rubberband)
#include <QRubberBand>
+#endif
#include <QTextBrowser>
#include <QCalendarWidget>
#include <QAbstractItemView>
diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri
index c2625ec1f4..a6a6b2d352 100644
--- a/src/widgets/dialogs/dialogs.pri
+++ b/src/widgets/dialogs/dialogs.pri
@@ -1,12 +1,6 @@
# Qt dialogs module
-HEADERS += \
- dialogs/qfontdialog.h \
- dialogs/qfontdialog_p.h
-
INCLUDEPATH += $$PWD
-SOURCES += \
- dialogs/qfontdialog.cpp
qtConfig(colordialog) {
HEADERS += dialogs/qcolordialog.h
@@ -51,6 +45,14 @@ qtConfig(filesystemmodel) {
dialogs/qfileinfogatherer.cpp
}
+qtConfig(fontdialog) {
+ HEADERS += \
+ dialogs/qfontdialog.h \
+ dialogs/qfontdialog_p.h
+
+ SOURCES += dialogs/qfontdialog.cpp
+}
+
qtConfig(fscompleter) {
HEADERS += dialogs/qfscompleter_p.h
}
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 7cb24d65fc..1cd587b78d 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -41,7 +41,9 @@
#if QT_CONFIG(colordialog)
#include "qcolordialog.h"
#endif
+#if QT_CONFIG(fontdialog)
#include "qfontdialog.h"
+#endif
#if QT_CONFIG(filedialog)
#include "qfiledialog.h"
#endif
@@ -81,7 +83,7 @@ static inline int themeDialogType(const QDialog *dialog)
if (qobject_cast<const QColorDialog *>(dialog))
return QPlatformTheme::ColorDialog;
#endif
-#ifndef QT_NO_FONTDIALOG
+#if QT_CONFIG(fontdialog)
if (qobject_cast<const QFontDialog *>(dialog))
return QPlatformTheme::FontDialog;
#endif
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index b20a1449eb..587e31d8c5 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -40,8 +40,6 @@
#include "qwindowdefs.h"
#include "qfontdialog.h"
-#if QT_CONFIG(fontdialog)
-
#include "qfontdialog_p.h"
#include <qapplication.h>
@@ -1049,5 +1047,3 @@ QT_END_NAMESPACE
#include "qfontdialog.moc"
#include "moc_qfontdialog.cpp"
-
-#endif // QT_CONFIG(fontdialog)
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index da13a5ab99..3fb3997b85 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -44,12 +44,11 @@
#include <QtGui/qwindowdefs.h>
#include <QtGui/qfont.h>
-#ifndef QT_NO_FONTDIALOG
-
#include <QtWidgets/qdialog.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(fontdialog);
+QT_BEGIN_NAMESPACE
class QFontDialogPrivate;
@@ -120,6 +119,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
QT_END_NAMESPACE
-#endif // QT_NO_FONTDIALOG
-
#endif // QFONTDIALOG_H
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index 033f5a2be8..ae923d94ed 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -59,7 +59,7 @@
#include <qpa/qplatformdialoghelper.h>
#include "qsharedpointer.h"
-#ifndef QT_NO_FONTDIALOG
+QT_REQUIRE_CONFIG(fontdialog);
QT_BEGIN_NAMESPACE
@@ -149,8 +149,6 @@ private:
virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
};
-#endif // QT_NO_FONTDIALOG
-
QT_END_NAMESPACE
#endif // QFONTDIALOG_P_H
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 7bb72a00b7..431447734d 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -450,7 +450,7 @@ public:
}
QSize minimumSizeHint() const Q_DECL_OVERRIDE {
- if (!pixmap() && !pixmap()->isNull())
+ if (pixmap() && !pixmap()->isNull())
return pixmap()->size();
return QFrame::minimumSizeHint();
}
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index 4d1d1e9896..028010d3dd 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -114,7 +114,6 @@
#include <QtCore/qdebug.h>
#include <private/qdrawhelper_p.h>
-#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE
QGraphicsEffectPrivate::~QGraphicsEffectPrivate()
@@ -1237,5 +1236,3 @@ QT_END_NAMESPACE
#include "moc_qgraphicseffect.cpp"
#include "moc_qgraphicseffect_p.cpp"
-
-#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index 8e07e51dca..78d025ded5 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -47,9 +47,9 @@
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
-#ifndef QT_NO_GRAPHICSEFFECT
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(graphicseffect);
+QT_BEGIN_NAMESPACE
class QGraphicsItem;
class QStyleOption;
@@ -279,7 +279,5 @@ private:
QT_END_NAMESPACE
-#endif //QT_NO_GRAPHICSEFFECT
-
#endif // QGRAPHICSEFFECT_H
diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h
index 12bdbfe6fc..c5c7ff5900 100644
--- a/src/widgets/effects/qgraphicseffect_p.h
+++ b/src/widgets/effects/qgraphicseffect_p.h
@@ -59,7 +59,8 @@
#include <private/qobject_p.h>
#include <private/qpixmapfilter_p.h>
-#ifndef QT_NO_GRAPHICSEFFECT
+QT_REQUIRE_CONFIG(graphicseffect);
+
QT_BEGIN_NAMESPACE
class QGraphicsEffectSourcePrivate;
@@ -226,6 +227,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_GRAPHICSEFFECT
#endif // QGRAPHICSEFFECT_P_H
-
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 999e551af4..9d70825b0e 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -54,7 +54,6 @@
#include "private/qmemrotate_p.h"
#include "private/qdrawhelper_p.h"
-#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE
class QPixmapFilterPrivate : public QObjectPrivate
@@ -1353,5 +1352,3 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
QT_END_NAMESPACE
#include "moc_qpixmapfilter_p.cpp"
-
-#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index b9af3ae916..399a835142 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -56,9 +56,9 @@
#include <QtGui/qpixmap.h>
#include <QtWidgets/qgraphicseffect.h>
-#ifndef QT_NO_GRAPHICSEFFECT
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(graphicseffect);
+QT_BEGIN_NAMESPACE
class QPainter;
class QPlatformPixmap;
@@ -187,5 +187,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_GRAPHICSEFFECT
#endif // QPIXMAPFILTER_H
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 3ce9c835db..239a110119 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -756,7 +756,9 @@
#include <QtWidgets/qstyleoption.h>
#include <QtGui/qevent.h>
#include <QtGui/qinputmethod.h>
+#if QT_CONFIG(graphicseffect)
#include <QtWidgets/qgraphicseffect.h>
+#endif
#include <private/qgraphicsitem_p.h>
#include <private/qgraphicswidget_p.h>
@@ -1558,9 +1560,9 @@ QGraphicsItem::~QGraphicsItem()
setParentItem(0);
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
delete d_ptr->graphicsEffect;
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (d_ptr->transformData) {
for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
@@ -2383,9 +2385,9 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly,
if (c)
c->purge();
if (scene) {
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
invalidateParentGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true);
}
}
@@ -2832,11 +2834,11 @@ void QGraphicsItem::setOpacity(qreal opacity)
// Update.
if (d_ptr->scene) {
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
d_ptr->invalidateParentGraphicsEffectsRecursively();
if (!(d_ptr->flags & ItemDoesntPropagateOpacityToChildren))
d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
/*force=*/false,
@@ -2854,7 +2856,7 @@ void QGraphicsItem::setOpacity(qreal opacity)
\since 4.6
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect *QGraphicsItem::graphicsEffect() const
{
return d_ptr->graphicsEffect;
@@ -2896,11 +2898,11 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
prepareGeometryChange();
}
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsItemPrivate *itemPrivate = this;
do {
// parent chain already notified?
@@ -2923,7 +2925,7 @@ void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
*/
QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
Q_Q(const QGraphicsItem);
QGraphicsEffect *effect = graphicsEffect;
if (scene && effect && effect->isEnabled()) {
@@ -2939,7 +2941,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
}
return q->mapRectFromScene(sceneEffectRect);
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
return rect;
}
@@ -2955,7 +2957,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
*/
QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectItem) const
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
Q_Q(const QGraphicsItem);
QRectF brect = effectiveBoundingRect(q_ptr->boundingRect());
if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
@@ -2980,10 +2982,10 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectI
}
return brect;
-#else //QT_NO_GRAPHICSEFFECT
+#else //QT_CONFIG(graphicseffect)
Q_UNUSED(topMostEffectItem);
return q_ptr->boundingRect();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
}
@@ -5485,7 +5487,7 @@ int QGraphicsItemPrivate::depth() const
/*!
\internal
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively()
{
QGraphicsItemPrivate *itemPrivate = this;
@@ -5516,7 +5518,7 @@ void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsIt
childPrivate->invalidateChildGraphicsEffectsRecursively(reason);
}
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
/*!
\internal
@@ -5798,9 +5800,9 @@ void QGraphicsItem::update(const QRectF &rect)
return;
// Make sure we notify effects about invalidated source.
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
d_ptr->invalidateParentGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (CacheMode(d_ptr->cacheMode) != NoCache) {
// Invalidate cache.
@@ -11225,7 +11227,7 @@ int QGraphicsItemGroup::type() const
return Type;
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const
{
const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
@@ -11366,7 +11368,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
return pixmap;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
#ifndef QT_NO_DEBUG_STREAM
static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item)
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index 36f8aac124..35e3d544e9 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -228,11 +228,11 @@ public:
qreal effectiveOpacity() const;
void setOpacity(qreal opacity);
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
// Effect
QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
Qt::MouseButtons acceptedMouseButtons() const;
void setAcceptedMouseButtons(Qt::MouseButtons buttons);
@@ -550,7 +550,7 @@ class Q_WIDGETS_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect)
#endif
Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged)
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index c88236d6e8..5c4523f9ed 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -59,9 +59,6 @@
#include "qgraphicstransform.h"
#include <private/qgraphicstransform_p.h>
-#include <private/qgraphicseffect_p.h>
-#include <qgraphicseffect.h>
-
#include <QtCore/qpoint.h>
#if !defined(QT_NO_GRAPHICSVIEW)
@@ -217,13 +214,13 @@ public:
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
virtual void transformChanged() {}
int depth() const;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
enum InvalidateReason {
OpacityChanged
};
void invalidateParentGraphicsEffectsRecursively();
void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
void invalidateDepthRecursively();
void resolveDepth();
void addChild(QGraphicsItem *child);
@@ -590,7 +587,7 @@ struct QGraphicsItemPaintInfo
quint32 drawItem : 1;
};
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{
public:
@@ -650,7 +647,7 @@ public:
QGraphicsItemPaintInfo *info;
QTransform lastEffectTransform;
};
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
/*!
Returns \c true if \a item1 is on top of \a item2.
@@ -784,7 +781,7 @@ inline bool QGraphicsItemPrivate::insertionOrder(QGraphicsItem *a, QGraphicsItem
inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
{
QGraphicsItemPrivate *parentp = this;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) {
parentp->notifyInvalidated = 1;
static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
@@ -800,7 +797,7 @@ inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
// ### Only do this if the parent's effect applies to the entire subtree.
parentp->notifyBoundingRectChanged = 1;
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (parentp->graphicsEffect) {
if (updateBoundingRect) {
static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 35f6298a8a..db41fc3eb9 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -243,10 +243,11 @@
#include <QtWidgets/qtooltip.h>
#include <QtGui/qtransform.h>
#include <QtGui/qinputmethod.h>
-#include <QtWidgets/qgraphicseffect.h>
#include <private/qapplication_p.h>
#include <private/qobject_p.h>
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include <private/qgesturemanager_p.h>
#include <private/qpathclipper_p.h>
@@ -4810,7 +4811,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (itemHasChildren && itemClipsChildrenToShape)
ENSURE_TRANSFORM_PTR;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) {
ENSURE_TRANSFORM_PTR;
QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp,
@@ -4847,7 +4848,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
painter->setWorldTransform(restoreTransform);
sourced->info = 0;
} else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
{
draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity,
effectTransform, wasDirtyParentSceneTransform, drawItem);
diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h
index 795676878b..c52770501f 100644
--- a/src/widgets/graphicsview/qgraphicsscene_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_p.h
@@ -249,7 +249,7 @@ public:
item->d_ptr->fullUpdatePending = 0;
item->d_ptr->ignoreVisible = 0;
item->d_ptr->ignoreOpacity = 0;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect::ChangeFlags flags;
if (item->d_ptr->notifyBoundingRectChanged) {
flags |= QGraphicsEffect::SourceBoundingRectChanged;
@@ -259,15 +259,15 @@ public:
flags |= QGraphicsEffect::SourceInvalidated;
item->d_ptr->notifyInvalidated = 0;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (recursive) {
for (int i = 0; i < item->d_ptr->children.size(); ++i)
resetDirtyItem(item->d_ptr->children.at(i), recursive);
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (flags && item->d_ptr->graphicsEffect)
item->d_ptr->graphicsEffect->sourceChanged(flags);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
}
inline void ensureSortedTopLevelItems()
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index f5f24649c2..a00156ef01 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -353,7 +353,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate()
viewportUpdateMode(QGraphicsView::MinimalViewportUpdate),
optimizationFlags(0),
scene(0),
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
rubberBanding(false),
rubberBandSelectionMode(Qt::IntersectsItemShape),
rubberBandSelectionOperation(Qt::ReplaceSelection),
@@ -633,7 +633,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
{
Q_Q(QGraphicsView);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
updateRubberBand(event);
#endif
@@ -708,7 +708,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
/*!
\internal
*/
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const
{
QStyleHintReturnMask mask;
@@ -1508,7 +1508,7 @@ void QGraphicsView::setDragMode(DragMode mode)
#endif
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
/*!
\property QGraphicsView::rubberBandSelectionMode
\brief the behavior for selecting items with a rubber band selection rectangle.
@@ -3274,7 +3274,7 @@ void QGraphicsView::mousePressEvent(QMouseEvent *event)
}
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->dragMode == QGraphicsView::RubberBandDrag && !d->rubberBanding) {
if (d->sceneInteractionAllowed) {
// Rubberbanding is only allowed in interactive mode.
@@ -3336,7 +3336,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QGraphicsView);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->dragMode == QGraphicsView::RubberBandDrag && d->sceneInteractionAllowed && !event->buttons()) {
if (d->rubberBanding) {
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){
@@ -3459,7 +3459,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Set up the painter
QPainter painter(viewport());
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->rubberBanding && !d->rubberBandRect.isEmpty())
painter.save();
#endif
@@ -3583,7 +3583,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Foreground
drawForeground(&painter, exposedSceneRect);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// Rubberband
if (d->rubberBanding && !d->rubberBandRect.isEmpty()) {
painter.restore();
@@ -3651,7 +3651,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) {
if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) {
if (d->accelerateScrolling) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// Update new and old rubberband regions
if (!d->rubberBandRect.isEmpty()) {
QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect));
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index fb975b9d71..d70ce6cf1c 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -72,7 +72,7 @@ class Q_WIDGETS_EXPORT QGraphicsView : public QAbstractScrollArea
Q_PROPERTY(ViewportAnchor transformationAnchor READ transformationAnchor WRITE setTransformationAnchor)
Q_PROPERTY(ViewportAnchor resizeAnchor READ resizeAnchor WRITE setResizeAnchor)
Q_PROPERTY(ViewportUpdateMode viewportUpdateMode READ viewportUpdateMode WRITE setViewportUpdateMode)
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
Q_PROPERTY(Qt::ItemSelectionMode rubberBandSelectionMode READ rubberBandSelectionMode WRITE setRubberBandSelectionMode)
#endif
Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags)
@@ -144,7 +144,7 @@ public:
DragMode dragMode() const;
void setDragMode(DragMode mode);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
Qt::ItemSelectionMode rubberBandSelectionMode() const;
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode);
QRect rubberBandRect() const;
@@ -228,7 +228,7 @@ public Q_SLOTS:
void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers);
void updateSceneRect(const QRectF &rect);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
Q_SIGNALS:
void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint);
#endif
diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h
index 10103a1809..b34be77f11 100644
--- a/src/widgets/graphicsview/qgraphicsview_p.h
+++ b/src/widgets/graphicsview/qgraphicsview_p.h
@@ -136,7 +136,7 @@ public:
QGraphicsView::OptimizationFlags optimizationFlags;
QPointer<QGraphicsScene> scene;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRect rubberBandRect;
QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const;
void updateRubberBand(const QMouseEvent *event);
diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri
index af0a6f6898..4101be5631 100644
--- a/src/widgets/itemviews/itemviews.pri
+++ b/src/widgets/itemviews/itemviews.pri
@@ -9,8 +9,6 @@ HEADERS += \
itemviews/qlistview.h \
itemviews/qlistview_p.h \
itemviews/qbsptree_p.h \
- itemviews/qtableview.h \
- itemviews/qtableview_p.h \
itemviews/qtreeview.h \
itemviews/qtreeview_p.h \
itemviews/qabstractitemdelegate.h \
@@ -28,7 +26,6 @@ SOURCES += \
itemviews/qheaderview.cpp \
itemviews/qlistview.cpp \
itemviews/qbsptree.cpp \
- itemviews/qtableview.cpp \
itemviews/qtreeview.cpp \
itemviews/qabstractitemdelegate.cpp \
itemviews/qitemdelegate.cpp \
@@ -57,6 +54,14 @@ qtConfig(listwidget) {
SOURCES += itemviews/qlistwidget.cpp
}
+qtConfig(tableview) {
+ HEADERS += \
+ itemviews/qtableview.h \
+ itemviews/qtableview_p.h
+
+ SOURCES += itemviews/qtableview.cpp
+}
+
qtConfig(tablewidget) {
HEADERS += \
itemviews/qtablewidget.h \
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index b225678e0b..2ae885615f 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -53,7 +53,6 @@
#include <qlineedit.h>
#include <qspinbox.h>
#include <qtreeview.h>
-#include <qtableview.h>
#include <qheaderview.h>
#include <qstyleditemdelegate.h>
#include <private/qabstractitemview_p.h>
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index c535cf5f9e..a31689e0b5 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -44,7 +44,9 @@
#ifndef QT_NO_ITEMVIEWS
#include <qcombobox.h>
+#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
+#endif
#if QT_CONFIG(label)
#include <qlabel.h>
#endif
@@ -252,7 +254,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
sb->setMaximum(INT_MAX);
return sb; }
#endif
-#ifndef QT_NO_DATETIMEEDIT
+#if QT_CONFIG(datetimeedit)
case QVariant::Date: {
QDateTimeEdit *ed = new QDateEdit(parent);
ed->setFrame(false);
@@ -308,7 +310,7 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
case QVariant::Double:
return "value";
#endif
-#ifndef QT_NO_DATETIMEEDIT
+#if QT_CONFIG(datetimeedit)
case QVariant::Date:
return "date";
case QVariant::Time:
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index bc0ca7dc1c..e234bae4dd 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -50,7 +50,9 @@
#include <qstyle.h>
#include <qevent.h>
#include <qscrollbar.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include <private/qlistview_p.h>
#include <private/qscrollbar_p.h>
#include <qdebug.h>
@@ -1042,7 +1044,7 @@ void QListView::paintEvent(QPaintEvent *e)
d->commonListView->paintDragDrop(&painter);
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// #### move this implementation into a dynamic class
if (d->showElasticBand && d->elasticBand.isValid()) {
QStyleOptionRubberBand opt;
@@ -1870,6 +1872,11 @@ void QCommonListViewBase::paintDragDrop(QPainter *painter)
}
#endif
+QSize QListModeViewBase::viewportSize(const QAbstractItemView *v)
+{
+ return v->contentsRect().marginsRemoved(v->viewportMargins()).size();
+}
+
void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
{
horizontalScrollBar()->d_func()->itemviewChangeSingleStep(step.width() + spacing());
@@ -1882,7 +1889,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize = qq->contentsRect().size();
+ const QSize viewportSize = QListModeViewBase::viewportSize(qq);
bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow;
@@ -1912,7 +1919,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize = qq->contentsRect().size();
+ const QSize viewportSize = QListModeViewBase::viewportSize(qq);
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow;
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 47effcdfd9..6c0e470a93 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -53,7 +53,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractitemview_p.h"
-#include "qrubberband.h"
#include "qbitarray.h"
#include "qbsptree_p.h"
#include <limits.h>
@@ -225,6 +224,7 @@ public:
QRect mapToViewport(const QRect &rect) const override;
int horizontalOffset() const override;
int verticalOffset() const override;
+ inline static QSize viewportSize(const QAbstractItemView *v);
void updateHorizontalScrollBar(const QSize &step) override;
void updateVerticalScrollBar(const QSize &step) override;
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 4149d3ac3a..0b8019c21c 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -67,7 +67,9 @@
#include <private/qlayoutengine_p.h>
#include <qdebug.h>
#include <qlocale.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <limits.h>
@@ -500,7 +502,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 !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT)
+#if QT_CONFIG(tableview) && !defined(QT_NO_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/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index b79932327b..2d5813198c 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -39,7 +39,6 @@
#include "qtableview.h"
-#ifndef QT_NO_TABLEVIEW
#include <qheaderview.h>
#include <qitemdelegate.h>
#include <qapplication.h>
@@ -3352,5 +3351,3 @@ QT_END_NAMESPACE
#include "qtableview.moc"
#include "moc_qtableview.cpp"
-
-#endif // QT_NO_TABLEVIEW
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index b1c38d521f..75f2e7b44c 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(tableview);
-#ifndef QT_NO_TABLEVIEW
+QT_BEGIN_NAMESPACE
class QHeaderView;
class QTableViewPrivate;
@@ -191,8 +190,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_updateSpanRemovedColumns(QModelIndex,int,int))
};
-#endif // QT_NO_TABLEVIEW
-
QT_END_NAMESPACE
#endif // QTABLEVIEW_H
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index d2f45d557d..1a0fef9017 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -59,7 +59,7 @@
#include <QtCore/QDebug>
#include "private/qabstractitemview_p.h"
-#ifndef QT_NO_TABLEVIEW
+QT_REQUIRE_CONFIG(tableview);
QT_BEGIN_NAMESPACE
@@ -261,6 +261,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_TABLEVIEW
-
#endif // QTABLEVIEW_P_H
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 0286a11612..09162b9ab4 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -51,6 +51,7 @@
#include "qhash.h"
#include "qset.h"
#include "qlayout.h"
+#include "qpixmapcache.h"
#include "qstyle.h"
#include "qstyleoption.h"
#include "qstylefactory.h"
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 37f87c60dc..a8f5b39638 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -83,7 +83,9 @@
#include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/qoffscreensurface.h>
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include <qbackingstore.h>
#include <private/qwidgetbackingstore_p.h>
#if 0 // Used to be included in Qt4 for Q_WS_MAC
@@ -2115,7 +2117,7 @@ void QWidgetPrivate::setSystemClip(QPaintEngine *paintEngine, qreal devicePixelR
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void QWidgetPrivate::invalidateGraphicsEffectsRecursively()
{
Q_Q(QWidget);
@@ -2130,7 +2132,7 @@ void QWidgetPrivate::invalidateGraphicsEffectsRecursively()
w = w->parentWidget();
} while (w);
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
void QWidgetPrivate::setDirtyOpaqueRegion()
{
@@ -2138,9 +2140,9 @@ void QWidgetPrivate::setDirtyOpaqueRegion()
dirtyOpaqueChildren = true;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (q->isWindow())
return;
@@ -2294,12 +2296,12 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion &region) const
const QWidget *w = q;
QPoint offset;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect) {
w = q->parentWidget();
offset -= data.crect.topLeft();
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
while (w) {
const QWidgetPrivate *wd = w->d_func();
@@ -2332,13 +2334,13 @@ void QWidgetPrivate::updateIsOpaque()
// hw: todo: only needed if opacity actually changed
setDirtyOpaqueRegion();
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect) {
// ### We should probably add QGraphicsEffect::isOpaque at some point.
setOpaque(false);
return;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
Q_Q(QWidget);
#if 0 // Used to be included in Qt4 for Q_WS_X11
@@ -5282,13 +5284,13 @@ QPixmap QWidget::grab(const QRect &rectangle)
\sa setGraphicsEffect()
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect *QWidget::graphicsEffect() const
{
Q_D(const QWidget);
return d->graphicsEffect;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
/*!
@@ -5312,7 +5314,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const
\sa graphicsEffect()
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
{
Q_D(QWidget);
@@ -5336,7 +5338,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
d->updateIsOpaque();
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
bool QWidgetPrivate::isAboutToShow() const
{
@@ -5488,7 +5490,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
bool onScreen = paintOnScreen();
Q_Q(QWidget);
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect && graphicsEffect->isEnabled()) {
QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
@@ -5526,7 +5528,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
return;
}
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
const bool alsoOnScreen = flags & DrawPaintOnScreen;
const bool recursive = flags & DrawRecursive;
@@ -5833,7 +5835,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
}
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const
{
if (system != Qt::DeviceCoordinates)
@@ -5908,7 +5910,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *
m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren);
return pixmap;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
#ifndef QT_NO_GRAPHICSVIEW
/*!
@@ -9647,7 +9649,7 @@ void QWidget::leaveEvent(QEvent *)
\note Generally, you should refrain from calling update() or repaint()
\b{inside} a paintEvent(). For example, calling update() or repaint() on
- children inside a paintevent() results in undefined behavior; the child may
+ children inside a paintEvent() results in undefined behavior; the child may
or may not get a paint event.
\warning If you are using a custom paint engine without Qt's backingstore,
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 87a841c729..3b0678d349 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -347,10 +347,10 @@ public:
Q_INVOKABLE QPixmap grab(const QRect &rectangle = QRect(QPoint(0, 0), QSize(-1, -1)));
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index db054b9c58..85214e4bd7 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -64,7 +64,9 @@
#include "QtWidgets/qsizepolicy.h"
#include "QtWidgets/qstyle.h"
#include "QtWidgets/qapplication.h"
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include "QtWidgets/qgraphicsproxywidget.h"
#include "QtWidgets/qgraphicsscene.h"
#include "QtWidgets/qgraphicsview.h"
@@ -420,9 +422,9 @@ public:
void setOpaque(bool opaque);
void updateIsTranslucent();
bool paintOnScreen() const;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
const QRegion &getOpaqueChildren() const;
void setDirtyOpaqueRegion();
@@ -591,10 +593,10 @@ public:
inline QRect effectiveRectFor(const QRect &rect) const
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect && graphicsEffect->isEnabled())
return graphicsEffect->boundingRectFor(rect).toAlignedRect();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
return rect;
}
@@ -890,7 +892,7 @@ struct QWidgetPaintContext
QPainter *painter;
};
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{
public:
@@ -943,7 +945,7 @@ public:
QTransform lastEffectTransform;
bool updateDueToGraphicsEffect;
};
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
inline QWExtra *QWidgetPrivate::extraData() const
{
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 4421218d1d..ee9a83a652 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -53,7 +53,9 @@
#include <private/qwidget_p.h>
#include <private/qapplication_p.h>
#include <private/qpaintengine_raster_p.h>
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include <QtGui/private/qwindow_p.h>
#include <qpa/qplatformbackingstore.h>
@@ -522,9 +524,9 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget,
Q_ASSERT(widget->window() == tlw);
Q_ASSERT(!rgn.isEmpty());
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
widget->d_func()->invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (widget->d_func()->paintOnScreen()) {
if (widget->d_func()->dirty.isEmpty()) {
@@ -563,11 +565,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget,
if (bufferState == BufferInvalid) {
const bool eventAlreadyPosted = !dirty.isEmpty() || updateRequestSent;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (widget->d_func()->graphicsEffect)
dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset);
else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
dirty += rgn.translated(offset);
if (!eventAlreadyPosted || updateTime == UpdateNow)
sendUpdateRequest(tlw, updateTime);
@@ -582,11 +584,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget,
if (widget->d_func()->inDirtyList) {
if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) {
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (widget->d_func()->graphicsEffect)
widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect());
else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
widget->d_func()->dirty += rgn;
}
} else {
@@ -614,9 +616,9 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget,
Q_ASSERT(widget->window() == tlw);
Q_ASSERT(!rect.isEmpty());
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
widget->d_func()->invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (widget->d_func()->paintOnScreen()) {
if (widget->d_func()->dirty.isEmpty()) {
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index 16b36423a6..fa51cb71de 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -176,11 +176,11 @@ private:
{
if (widget && !widget->d_func()->inDirtyList && !widget->data->in_destructor) {
QWidgetPrivate *widgetPrivate = widget->d_func();
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (widgetPrivate->graphicsEffect)
widgetPrivate->dirty = widgetPrivate->effectiveRectFor(rgn.boundingRect());
else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
widgetPrivate->dirty = rgn;
dirtyWidgets.append(widget);
widgetPrivate->inDirtyList = true;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 8bad65273e..593dc9e779 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -68,7 +68,9 @@
#include <qtabwidget.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include "qtreeview.h"
#include <private/qcommonstylepixmaps_p.h>
#include <private/qmath_p.h>
@@ -2002,7 +2004,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->restore();
break; }
#endif // QT_NO_SIZEGRIP
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case CE_RubberBand: {
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
QPixmap tiledPixmap(16, 16);
@@ -2030,7 +2032,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->restore();
}
break; }
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
#ifndef QT_NO_DOCKWIDGET
case CE_DockWidgetTitle:
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
@@ -5093,7 +5095,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
}
}
break;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case SH_RubberBand_Mask:
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
ret = 0;
@@ -5107,7 +5109,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
}
}
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
case SH_SpinControls_DisableOnBounds:
ret = 1;
break;
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index 0b0583ea94..299dbb9f82 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -49,6 +49,35 @@
QT_BEGIN_NAMESPACE
+namespace {
+class PainterStateGuard {
+ Q_DISABLE_COPY(PainterStateGuard)
+public:
+ explicit PainterStateGuard(QPainter *p) : m_painter(p) {}
+ ~PainterStateGuard()
+ {
+ for ( ; m_level > 0; --m_level)
+ m_painter->restore();
+ }
+
+ void save()
+ {
+ m_painter->save();
+ ++m_level;
+ }
+
+ void restore()
+ {
+ m_painter->restore();
+ --m_level;
+ }
+
+private:
+ QPainter *m_painter;
+ int m_level= 0;
+};
+} // namespace
+
/*!
\headerfile <qdrawutil.h>
\title Drawing Utility Functions
@@ -213,6 +242,21 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
qWarning("qDrawShadeRect: Invalid parameters");
return;
}
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ midLineWidth = qRound(devicePixelRatio * midLineWidth);
+ }
+
QPen oldPen = p->pen();
if (sunken)
p->setPen(pal.dark().color());
@@ -312,6 +356,20 @@ void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
qWarning("qDrawShadePanel: Invalid parameters");
}
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ }
+
QColor shade = pal.dark().color();
QColor light = pal.light().color();
if (fill) {
@@ -389,6 +447,19 @@ static void qDrawWinShades(QPainter *p,
{
if (w < 2 || h < 2) // can't do anything with that
return;
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ }
+
QPen oldPen = p->pen();
QPoint a[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) };
p->setPen(c1);
@@ -518,6 +589,20 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c,
if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
qWarning("qDrawPlainRect: Invalid parameters");
}
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ }
+
QPen oldPen = p->pen();
QBrush oldBrush = p->brush();
p->setPen(c);
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 704a226866..eb7a1599d6 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -967,11 +967,9 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
break;
case PE_PanelMenu: {
painter->save();
- QColor menuBackground = option->palette.base().color().lighter(108);
+ const QBrush menuBackground = option->palette.base().color().lighter(108);
QColor borderColor = option->palette.background().color().darker(160);
- painter->setPen(borderColor);
- painter->setBrush(menuBackground);
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+ qDrawPlainRect(painter, option->rect, borderColor, 1, &menuBackground);
painter->restore();
}
break;
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index a3bfbd2938..51fecd0d13 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -2793,7 +2793,7 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version)
a selected tab nor is it the selected tab.
*/
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
/*!
\class QStyleOptionRubberBand
\brief The QStyleOptionRubberBand class is used to describe the
@@ -2883,7 +2883,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
The default value is true.
*/
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
/*!
\class QStyleOptionTitleBar
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 0e76d53eea..a3ed35c762 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -49,7 +49,9 @@
#include <QtWidgets/qstyle.h>
#include <QtWidgets/qtabbar.h>
#include <QtWidgets/qtabwidget.h>
+#if QT_CONFIG(rubberband)
#include <QtWidgets/qrubberband.h>
+#endif
#include <QtWidgets/qframe.h>
#ifndef QT_NO_ITEMVIEWS
# include <QtCore/qabstractitemmodel.h>
@@ -467,7 +469,7 @@ protected:
typedef Q_DECL_DEPRECATED QStyleOptionToolBox QStyleOptionToolBoxV2;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
class Q_WIDGETS_EXPORT QStyleOptionRubberBand : public QStyleOption
{
public:
@@ -483,7 +485,7 @@ public:
protected:
QStyleOptionRubberBand(int version);
};
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
// -------------------------- Complex style options -------------------------------
class Q_WIDGETS_EXPORT QStyleOptionComplex : public QStyleOption
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index efbb972a06..f805e29db1 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -51,7 +51,9 @@
#include <private/qmenubar_p.h>
#include "qpaintengine.h"
#include "qpainter.h"
+#if QT_CONFIG(rubberband)
#include "qrubberband.h"
+#endif
#include "qstyleoption.h"
#include "qtabbar.h"
#include "qwidget.h"
@@ -606,7 +608,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
ret = 400;
break;
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case SH_RubberBand_Mask:
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
ret = 0;
@@ -622,7 +624,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
}
}
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
#if QT_CONFIG(wizard)
case SH_WizardStyle:
ret = QWizard::ModernStyle;
@@ -1080,7 +1082,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
const QWidget *widget) const
{
switch (ce) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case CE_RubberBand:
if (qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
// ### workaround for slow general painter path
@@ -1103,7 +1105,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
return;
}
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
#if !defined(QT_NO_MENU) && !defined(QT_NO_MAINWINDOW)
case CE_MenuBarEmptyArea:
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index e4f7640a10..22bdf08408 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -23,8 +23,10 @@ include(itemviews/itemviews.pri)
include(graphicsview/graphicsview.pri)
include(util/util.pri)
include(statemachine/statemachine.pri)
-include(effects/effects.pri)
+qtConfig(graphicseffect) {
+ include(effects/effects.pri)
+}
QMAKE_LIBS += $$QMAKE_LIBS_GUI
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 4a3abe0c32..22f3745b26 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -49,7 +49,9 @@
#include <qstylehints.h>
#include <qclipboard.h>
#include <qdatetime.h>
+#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
+#endif
#include <qevent.h>
#include <qmenu.h>
#include <qpainter.h>
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index a8a54d8d67..90dfbe1633 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -47,7 +47,9 @@
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <qlistview.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <qitemdelegate.h>
#include <qmap.h>
#include <qmenu.h>
@@ -615,7 +617,7 @@ int QComboBoxPrivateContainer::topMargin() const
{
if (const QListView *lview = qobject_cast<const QListView*>(view))
return lview->spacing();
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
if (const QTableView *tview = qobject_cast<const QTableView*>(view))
return tview->showGrid() ? 1 : 0;
#endif
@@ -630,7 +632,7 @@ int QComboBoxPrivateContainer::spacing() const
QListView *lview = qobject_cast<QListView*>(view);
if (lview)
return 2 * lview->spacing(); // QListView::spacing is the padding around the item.
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
QTableView *tview = qobject_cast<QTableView*>(view);
if (tview)
return tview->showGrid() ? 1 : 0;
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 46e6369e3c..6d1521c48b 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -54,8 +54,6 @@
#include <algorithm>
-#ifndef QT_NO_DATETIMEEDIT
-
//#define QDATETIMEEDIT_QDTEDEBUG
#ifdef QDATETIMEEDIT_QDTEDEBUG
# define QDTEDEBUG qDebug() << QString::fromLatin1("%1:%2").arg(__FILE__).arg(__LINE__)
@@ -2675,5 +2673,3 @@ void QCalendarPopup::hideEvent(QHideEvent *)
QT_END_NAMESPACE
#include "moc_qdatetimeedit.cpp"
#include "moc_qdatetimeedit_p.cpp"
-
-#endif // QT_NO_DATETIMEEDIT
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index 30e4a58bb3..b46434c1a4 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -45,10 +45,9 @@
#include <QtCore/qvariant.h>
#include <QtWidgets/qabstractspinbox.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(datetimeedit);
-#ifndef QT_NO_DATETIMEEDIT
+QT_BEGIN_NAMESPACE
class QDateTimeEditPrivate;
class QStyleOptionSpinBox;
@@ -228,8 +227,6 @@ Q_SIGNALS:
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections)
-#endif // QT_NO_DATETIMEEDIT
-
QT_END_NAMESPACE
#endif // QDATETIMEEDIT_H
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 5302d6d9a7..bc70780de9 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -63,8 +63,6 @@
#include "qdebug.h"
-#ifndef QT_NO_DATETIMEEDIT
-
QT_BEGIN_NAMESPACE
class QCalendarPopup;
@@ -181,6 +179,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_DATETIMEEDIT
-
#endif // QDATETIMEEDIT_P_H
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index e0269a3f02..e48ce301fb 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -49,7 +49,9 @@
#include "qtoolbar.h"
#include "qtoolbarlayout_p.h"
#include "qwidgetanimator_p.h"
+#if QT_CONFIG(rubberband)
#include "qrubberband.h"
+#endif
#include "qtabbar_p.h"
#include <qapplication.h>
@@ -2460,7 +2462,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
void QMainWindowLayout::updateGapIndicator()
{
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (!widgetAnimator.animating() && (!currentGapPos.isEmpty()
#if QT_CONFIG(dockwidget)
|| currentHoveredFloat
@@ -2490,7 +2492,7 @@ void QMainWindowLayout::updateGapIndicator()
} else if (gapIndicator) {
gapIndicator->hide();
}
-#endif //QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
}
void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index cc3b4e9261..6b75ef1caf 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -547,7 +547,7 @@ public:
QList<int> currentGapPos;
QRect currentGapRect;
QWidget *pluggingWidget;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QPointer<QRubberBand> gapIndicator;
#endif
#ifndef QT_NO_DOCKWIDGET
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 0dc45ddbc3..83b5068bba 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -669,7 +669,7 @@ QMdiAreaPrivate::QMdiAreaPrivate()
regularTiler(0),
iconTiler(0),
placer(0),
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
rubberBand(0),
#endif
#ifndef QT_NO_TABBAR
@@ -1033,7 +1033,7 @@ void QMdiAreaPrivate::activateHighlightedWindow()
activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder));
else
activateWindow(childWindows.at(indexToHighlighted));
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
hideRubberBand();
#endif
}
@@ -1137,7 +1137,7 @@ void QMdiAreaPrivate::updateActiveWindow(int removedIndex, bool activeRemoved)
}
if (indexToHighlighted >= 0) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// Hide rubber band if highlighted window is removed.
if (indexToHighlighted == removedIndex)
hideRubberBand();
@@ -1511,7 +1511,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)
if (!highlight)
return;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (!rubberBand) {
rubberBand = new QRubberBand(QRubberBand::Rectangle, q);
// For accessibility to identify this special widget.
@@ -1521,7 +1521,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)
#endif
// Only highlight if we're not switching back to the previously active window (Ctrl-Tab once).
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (tabToPreviousTimerId == -1)
showRubberBandFor(highlight);
#endif
@@ -2348,7 +2348,7 @@ void QMdiArea::timerEvent(QTimerEvent *timerEvent)
d->tabToPreviousTimerId = -1;
if (d->indexToHighlighted < 0)
return;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// We're not doing a "quick switch" ... show rubber band.
Q_ASSERT(d->indexToHighlighted < d->childWindows.size());
Q_ASSERT(d->rubberBand);
@@ -2591,7 +2591,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
if (keyPress)
area->d_func()->highlightNextSubWindow(keyEvent->key() == Qt::Key_Tab ? 1 : -1);
return true;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case Qt::Key_Escape:
area->d_func()->hideRubberBand();
break;
@@ -2640,7 +2640,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
case QEvent::Hide:
d->isSubWindowsTiled = false;
break;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case QEvent::Close:
if (d->childWindows.indexOf(subWindow) == d->indexToHighlighted)
d->hideRubberBand();
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index 353144a6ab..b77f3f63ea 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -144,7 +144,7 @@ public:
QMdi::Rearranger *regularTiler;
QMdi::Rearranger *iconTiler;
QMdi::Placer *placer;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRubberBand *rubberBand;
#endif
QMdiAreaTabBar *tabBar;
@@ -254,7 +254,7 @@ public:
subWindow->d_func()->setActive(active, changeFocus);
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
void showRubberBandFor(QMdiSubWindow *subWindow);
inline void hideRubberBand()
@@ -263,7 +263,7 @@ public:
rubberBand->hide();
indexToHighlighted = -1;
}
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
};
#endif // QT_NO_MDIAREA
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 664dd8d710..498744e81e 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -863,14 +863,14 @@ QMdiSubWindowPrivate::QMdiSubWindowPrivate()
#ifndef QT_NO_SIZEGRIP
sizeGrip(0),
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
rubberBand(0),
#endif
userMinimumSize(0,0),
resizeEnabled(true),
moveEnabled(true),
isInInteractiveMode(false),
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
isInRubberBandMode(false),
#endif
isShadeMode(false),
@@ -944,13 +944,13 @@ void QMdiSubWindowPrivate::_q_enterInteractiveMode()
oldGeometry = q->geometry();
isInInteractiveMode = true;
q->setFocus();
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if ((q->testOption(QMdiSubWindow::RubberBandResize)
&& (currentOperation == BottomRightResize || currentOperation == BottomLeftResize))
|| (q->testOption(QMdiSubWindow::RubberBandMove) && currentOperation == Move)) {
enterRubberBandMode();
} else
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
{
q->grabMouse();
}
@@ -977,7 +977,7 @@ void QMdiSubWindowPrivate::_q_processFocusChanged(QWidget *old, QWidget *now)
void QMdiSubWindowPrivate::leaveInteractiveMode()
{
Q_Q(QMdiSubWindow);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (isInRubberBandMode)
leaveRubberBandMode();
else
@@ -1881,7 +1881,7 @@ void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
ignoreWindowTitleChange = false;
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
void QMdiSubWindowPrivate::enterRubberBandMode()
{
Q_Q(QMdiSubWindow);
@@ -1913,7 +1913,7 @@ void QMdiSubWindowPrivate::leaveRubberBandMode()
rubberBand->hide();
currentOperation = None;
}
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
// Taken from the old QWorkspace (::readColors())
QPalette QMdiSubWindowPrivate::desktopPalette() const
@@ -2410,7 +2410,7 @@ void QMdiSubWindow::setOption(SubWindowOption option, bool on)
Q_D(QMdiSubWindow);
d->options.setFlag(option, on);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if ((option & (RubberBandResize | RubberBandMove)) && !on && d->isInRubberBandMode)
d->leaveRubberBandMode();
#endif
@@ -2709,7 +2709,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
d->oldGeometry = geometry();
d->currentOperation = isLeftToRight() ? QMdiSubWindowPrivate::BottomRightResize
: QMdiSubWindowPrivate::BottomLeftResize;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
d->enterRubberBandMode();
#endif
return true;
@@ -2823,7 +2823,7 @@ bool QMdiSubWindow::event(QEvent *event)
d->currentOperation = QMdiSubWindowPrivate::None;
d->activeSubControl = QStyle::SC_None;
d->hoveredSubControl = QStyle::SC_None;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->isInRubberBandMode)
d->leaveRubberBandMode();
#endif
@@ -3182,7 +3182,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
Q_D(QMdiSubWindow);
if (d->isInInteractiveMode)
d->leaveInteractiveMode();
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->isInRubberBandMode)
d->leaveRubberBandMode();
#endif
@@ -3197,7 +3197,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
d->mousePressPosition = mapToParent(mouseEvent->pos());
if (d->resizeEnabled || d->moveEnabled)
d->oldGeometry = geometry();
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if ((testOption(QMdiSubWindow::RubberBandResize) && d->isResizeOperation())
|| (testOption(QMdiSubWindow::RubberBandMove) && d->isMoveOperation())) {
d->enterRubberBandMode();
@@ -3277,7 +3277,7 @@ void QMdiSubWindow::mouseReleaseEvent(QMouseEvent *mouseEvent)
Q_D(QMdiSubWindow);
if (d->currentOperation != QMdiSubWindowPrivate::None) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->isInRubberBandMode && !d->isInInteractiveMode)
d->leaveRubberBandMode();
#endif
@@ -3392,13 +3392,13 @@ void QMdiSubWindow::keyPressEvent(QKeyEvent *keyEvent)
#ifndef QT_NO_CURSOR
QPoint newPosition = parentWidget()->mapFromGlobal(cursor().pos() + delta);
QRect oldGeometry =
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
d->isInRubberBandMode ? d->rubberBand->geometry() :
#endif
geometry();
d->setNewGeometry(newPosition);
QRect currentGeometry =
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
d->isInRubberBandMode ? d->rubberBand->geometry() :
#endif
geometry();
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 33fa73eb0d..71fcc38378 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -179,7 +179,7 @@ public:
#ifndef QT_NO_SIZEGRIP
QPointer<QSizeGrip> sizeGrip;
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRubberBand *rubberBand;
#endif
QPoint mousePressPosition;
@@ -190,7 +190,7 @@ public:
bool resizeEnabled;
bool moveEnabled;
bool isInInteractiveMode;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
bool isInRubberBandMode;
#endif
bool isShadeMode;
@@ -258,7 +258,7 @@ public:
void removeButtonsFromMenuBar();
#endif
void updateWindowTitle(bool requestFromChild);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
void enterRubberBandMode();
void leaveRubberBandMode();
#endif
@@ -310,7 +310,7 @@ public:
Q_Q(QMdiSubWindow);
Q_ASSERT(parent);
geometry->setSize(geometry->size().expandedTo(internalMinimumSize));
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (isInRubberBandMode)
rubberBand->setGeometry(*geometry);
else
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index c91f837093..ade8675db8 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -43,8 +43,6 @@
#include "qrubberband.h"
#include "qtimer.h"
-#ifndef QT_NO_RUBBERBAND
-
#include "qstyle.h"
#include "qstyleoption.h"
#if 0 // Used to be included in Qt4 for Q_WS_MAC
@@ -334,5 +332,3 @@ bool QRubberBand::event(QEvent *e)
QT_END_NAMESPACE
#include "moc_qrubberband.cpp"
-
-#endif // QT_NO_RUBBERBAND
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index 217261bf75..a05eb0d543 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(rubberband);
-#ifndef QT_NO_RUBBERBAND
+QT_BEGIN_NAMESPACE
class QRubberBandPrivate;
class QStyleOptionRubberBand;
@@ -91,8 +90,6 @@ inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah)
inline void QRubberBand::move(int ax, int ay)
{ setGeometry(ax, ay, width(), height()); }
-#endif // QT_NO_RUBBERBAND
-
QT_END_NAMESPACE
#endif // QRUBBERBAND_H
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 0c98c3875a..7d507aa7f4 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -47,7 +47,9 @@
#include "qlayout.h"
#include "qlist.h"
#include "qpainter.h"
+#if QT_CONFIG(rubberband)
#include "qrubberband.h"
+#endif
#include "qstyle.h"
#include "qstyleoption.h"
#include "qtextstream.h"
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index 0730fab824..34ae34121e 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -53,7 +53,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qframe_p.h"
-#include "qrubberband.h"
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index f4d8c357f6..aaa64c8b2f 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -48,7 +48,9 @@
#include <qmainwindow.h>
#include <qmenu.h>
#include <qmenubar.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include <qsignalmapper.h>
#include <qstylepainter.h>
#include <qtoolbutton.h>
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 905bc0f586..97df3427b0 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -973,12 +973,20 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
// calculate m_maxLength / m_maskData length
m_maxLength = 0;
QChar c = 0;
+ bool escaped = false;
for (int i=0; i<m_inputMask.length(); i++) {
c = m_inputMask.at(i);
- if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) {
- m_maxLength++;
- continue;
+ if (escaped) {
+ ++m_maxLength;
+ escaped = false;
+ continue;
}
+
+ if (c == '\\') {
+ escaped = true;
+ continue;
+ }
+
if (c != QLatin1Char('\\') && c != QLatin1Char('!') &&
c != QLatin1Char('<') && c != QLatin1Char('>') &&
c != QLatin1Char('{') && c != QLatin1Char('}') &&
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index 726235ef4e..610932c6ce 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -8,8 +8,6 @@ HEADERS += \
widgets/qcalendarwidget.h \
widgets/qcombobox.h \
widgets/qcombobox_p.h \
- widgets/qdatetimeedit.h \
- widgets/qdatetimeedit_p.h \
widgets/qdial.h \
widgets/qdockwidget.h \
widgets/qdockwidget_p.h \
@@ -32,7 +30,6 @@ HEADERS += \
widgets/qmenubar.h \
widgets/qmenubar_p.h \
widgets/qprogressbar.h \
- widgets/qrubberband.h \
widgets/qscrollbar.h \
widgets/qscrollbar_p.h \
widgets/qscrollarea_p.h \
@@ -72,7 +69,6 @@ SOURCES += \
widgets/qabstractspinbox.cpp \
widgets/qcalendarwidget.cpp \
widgets/qcombobox.cpp \
- widgets/qdatetimeedit.cpp \
widgets/qdial.cpp \
widgets/qdockwidget.cpp \
widgets/qdockarealayout.cpp \
@@ -89,7 +85,6 @@ SOURCES += \
widgets/qmenu.cpp \
widgets/qmenubar.cpp \
widgets/qprogressbar.cpp \
- widgets/qrubberband.cpp \
widgets/qscrollbar.cpp \
widgets/qsizegrip.cpp \
widgets/qslider.cpp \
@@ -150,6 +145,15 @@ qtConfig(commandlinkbutton) {
widgets/qcommandlinkbutton.cpp
}
+qtConfig(datetimeedit) {
+ HEADERS += \
+ widgets/qdatetimeedit.h \
+ widgets/qdatetimeedit_p.h
+
+ SOURCES += \
+ widgets/qdatetimeedit.cpp
+}
+
qtConfig(fontcombobox) {
HEADERS += widgets/qfontcombobox.h
SOURCES += widgets/qfontcombobox.cpp
@@ -197,6 +201,11 @@ qtConfig(dialogbuttonbox) {
widgets/qdialogbuttonbox.cpp
}
+qtConfig(rubberband) {
+ HEADERS += widgets/qrubberband.h
+ SOURCES += widgets/qrubberband.cpp
+}
+
qtConfig(splashscreen) {
HEADERS += \
widgets/qsplashscreen.h