summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorKevin Funk <kevin.funk@kdab.com>2017-09-18 11:49:52 +0200
committerKevin Funk <kevin.funk@kdab.com>2017-09-19 11:53:55 +0000
commit58c14c4a7edcecdd9d58b682a9360c83e2274ec5 (patch)
tree7f600686e4dd92681bec09ac745a9dcd4425844b /src/widgets/kernel
parent47c92fbb0b588b443cead18a5aad5a2b5ad9e4d7 (diff)
Replace Q_NULLPTR with nullptr where possible
Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qaction.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp6
-rw-r--r--src/widgets/kernel/qapplication.h4
-rw-r--r--src/widgets/kernel/qboxlayout.h2
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp6
-rw-r--r--src/widgets/kernel/qdesktopwidget.h2
-rw-r--r--src/widgets/kernel/qformlayout.h2
-rw-r--r--src/widgets/kernel/qgesture.h12
-rw-r--r--src/widgets/kernel/qopenglwidget.h2
-rw-r--r--src/widgets/kernel/qshortcut.h2
-rw-r--r--src/widgets/kernel/qtooltip.h2
-rw-r--r--src/widgets/kernel/qwhatsthis.h4
-rw-r--r--src/widgets/kernel/qwidget.cpp10
-rw-r--r--src/widgets/kernel/qwidget.h8
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp8
16 files changed, 37 insertions, 37 deletions
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index ed26558d56..2cb30d0fc9 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -161,7 +161,7 @@ public:
enum ActionEvent { Trigger, Hover };
void activate(ActionEvent event);
- bool showStatusText(QWidget *widget = Q_NULLPTR);
+ bool showStatusText(QWidget *widget = nullptr);
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index ee61a25b09..d141abce24 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2797,7 +2797,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
*/
QDesktopWidget *QApplication::desktop()
{
- CHECK_QAPP_INSTANCE(Q_NULLPTR)
+ CHECK_QAPP_INSTANCE(nullptr)
if (!qt_desktopWidget || // not created yet
!(qt_desktopWidget->windowType() == Qt::Desktop)) { // reparented away
qt_desktopWidget = new QDesktopWidget();
@@ -3277,7 +3277,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// sequence, so we reset wheel_widget in case no one accepts the event
// or if we didn't get (or missed) a ScrollEnd previously.
if (spontaneous && phase == Qt::ScrollBegin)
- QApplicationPrivate::wheel_widget = Q_NULLPTR;
+ QApplicationPrivate::wheel_widget = nullptr;
const QPoint &relpos = wheel->pos();
@@ -3327,7 +3327,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
d->notify_helper(QApplicationPrivate::wheel_widget, &we);
wheel->setAccepted(we.isAccepted());
if (phase == Qt::ScrollEnd)
- QApplicationPrivate::wheel_widget = Q_NULLPTR;
+ QApplicationPrivate::wheel_widget = nullptr;
}
}
break;
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index a147ecafb4..7a5d7ba1a9 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -110,11 +110,11 @@ public:
using QGuiApplication::palette;
static QPalette palette(const QWidget *);
static QPalette palette(const char *className);
- static void setPalette(const QPalette &, const char* className = Q_NULLPTR);
+ static void setPalette(const QPalette &, const char* className = nullptr);
static QFont font();
static QFont font(const QWidget*);
static QFont font(const char *className);
- static void setFont(const QFont &, const char* className = Q_NULLPTR);
+ static void setFont(const QFont &, const char* className = nullptr);
static QFontMetrics fontMetrics();
#if QT_VERSION < 0x060000 // remove these forwarders in Qt 6
diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index 9a0d993d5f..6bb8f8aafa 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -61,7 +61,7 @@ public:
enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop,
Down = TopToBottom, Up = BottomToTop };
- explicit QBoxLayout(Direction, QWidget *parent = Q_NULLPTR);
+ explicit QBoxLayout(Direction, QWidget *parent = nullptr);
~QBoxLayout();
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 6077ac38db..ff32540715 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
QDesktopScreenWidget::QDesktopScreenWidget(QScreen *screen, const QRect &geometry)
- : QWidget(Q_NULLPTR, Qt::Desktop), m_screen(screen)
+ : QWidget(nullptr, Qt::Desktop), m_screen(screen)
{
setVisible(false);
if (QWindow *winHandle = windowHandle())
@@ -114,7 +114,7 @@ QDesktopScreenWidget *QDesktopWidgetPrivate::widgetForScreen(QScreen *qScreen) c
if (widget->screen() == qScreen)
return widget;
}
- return Q_NULLPTR;
+ return nullptr;
}
void QDesktopWidgetPrivate::_q_updateScreens()
@@ -330,7 +330,7 @@ int QDesktopWidgetPrivate::screenNumber(const QWidget *w)
if (!w->isWindow())
frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0)));
- QScreen *widgetScreen = Q_NULLPTR;
+ QScreen *widgetScreen = nullptr;
int largestArea = 0;
foreach (QScreen *screen, screens) {
const QRect deviceIndependentScreenGeometry =
diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
index 2fb41cb208..97eef70263 100644
--- a/src/widgets/kernel/qdesktopwidget.h
+++ b/src/widgets/kernel/qdesktopwidget.h
@@ -65,7 +65,7 @@ public:
int screenCount() const;
int primaryScreen() const;
- int screenNumber(const QWidget *widget = Q_NULLPTR) const;
+ int screenNumber(const QWidget *widget = nullptr) const;
int screenNumber(const QPoint &) const;
QWidget *screen(int screen = -1);
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index 309993d9ad..40424f2a49 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -88,7 +88,7 @@ public:
QLayoutItem *fieldItem;
};
- explicit QFormLayout(QWidget *parent = Q_NULLPTR);
+ explicit QFormLayout(QWidget *parent = nullptr);
~QFormLayout();
void setFieldGrowthPolicy(FieldGrowthPolicy policy);
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 1eda611d64..c5b2cee83d 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -70,7 +70,7 @@ class Q_WIDGETS_EXPORT QGesture : public QObject
Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
public:
- explicit QGesture(QObject *parent = Q_NULLPTR);
+ explicit QGesture(QObject *parent = nullptr);
~QGesture();
Qt::GestureType gestureType() const;
@@ -114,7 +114,7 @@ class Q_WIDGETS_EXPORT QPanGesture : public QGesture
Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal verticalVelocity READ verticalVelocity WRITE setVerticalVelocity)
public:
- explicit QPanGesture(QObject *parent = Q_NULLPTR);
+ explicit QPanGesture(QObject *parent = nullptr);
~QPanGesture();
QPointF lastOffset() const;
@@ -162,7 +162,7 @@ public:
Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint)
public:
- explicit QPinchGesture(QObject *parent = Q_NULLPTR);
+ explicit QPinchGesture(QObject *parent = nullptr);
~QPinchGesture();
ChangeFlags totalChangeFlags() const;
@@ -218,7 +218,7 @@ public:
enum SwipeDirection { NoDirection, Left, Right, Up, Down };
Q_ENUM(SwipeDirection)
- explicit QSwipeGesture(QObject *parent = Q_NULLPTR);
+ explicit QSwipeGesture(QObject *parent = nullptr);
~QSwipeGesture();
SwipeDirection horizontalDirection() const;
@@ -239,7 +239,7 @@ class Q_WIDGETS_EXPORT QTapGesture : public QGesture
Q_PROPERTY(QPointF position READ position WRITE setPosition)
public:
- explicit QTapGesture(QObject *parent = Q_NULLPTR);
+ explicit QTapGesture(QObject *parent = nullptr);
~QTapGesture();
QPointF position() const;
@@ -257,7 +257,7 @@ class Q_WIDGETS_EXPORT QTapAndHoldGesture : public QGesture
Q_PROPERTY(QPointF position READ position WRITE setPosition)
public:
- explicit QTapAndHoldGesture(QObject *parent = Q_NULLPTR);
+ explicit QTapAndHoldGesture(QObject *parent = nullptr);
~QTapAndHoldGesture();
QPointF position() const;
diff --git a/src/widgets/kernel/qopenglwidget.h b/src/widgets/kernel/qopenglwidget.h
index f2d01c75d2..9eb4a9ba5a 100644
--- a/src/widgets/kernel/qopenglwidget.h
+++ b/src/widgets/kernel/qopenglwidget.h
@@ -63,7 +63,7 @@ public:
PartialUpdate
};
- explicit QOpenGLWidget(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit QOpenGLWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~QOpenGLWidget();
void setUpdateBehavior(UpdateBehavior updateBehavior);
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index bbf53bdbfd..6dcf4971b2 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -62,7 +62,7 @@ class Q_WIDGETS_EXPORT QShortcut : public QObject
public:
explicit QShortcut(QWidget *parent);
QShortcut(const QKeySequence& key, QWidget *parent,
- const char *member = Q_NULLPTR, const char *ambiguousMember = Q_NULLPTR,
+ const char *member = nullptr, const char *ambiguousMember = nullptr,
Qt::ShortcutContext context = Qt::WindowShortcut);
~QShortcut();
diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h
index 5e68eef0a7..edf1de0c1d 100644
--- a/src/widgets/kernel/qtooltip.h
+++ b/src/widgets/kernel/qtooltip.h
@@ -53,7 +53,7 @@ class Q_WIDGETS_EXPORT QToolTip
QToolTip() Q_DECL_EQ_DELETE;
public:
// ### Qt 6 - merge the three showText functions below
- static void showText(const QPoint &pos, const QString &text, QWidget *w = Q_NULLPTR);
+ static void showText(const QPoint &pos, const QString &text, QWidget *w = nullptr);
static void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect);
static void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecShowTime);
static inline void hideText() { showText(QPoint(), QString()); }
diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h
index 3211796d3e..1f0f82b2a2 100644
--- a/src/widgets/kernel/qwhatsthis.h
+++ b/src/widgets/kernel/qwhatsthis.h
@@ -59,10 +59,10 @@ public:
static bool inWhatsThisMode();
static void leaveWhatsThisMode();
- static void showText(const QPoint &pos, const QString &text, QWidget *w = Q_NULLPTR);
+ static void showText(const QPoint &pos, const QString &text, QWidget *w = nullptr);
static void hideText();
- static QAction *createAction(QObject *parent = Q_NULLPTR);
+ static QAction *createAction(QObject *parent = nullptr);
};
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index b38f046c21..c245c7e2e7 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1167,7 +1167,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
if (targetScreen >= 0) {
topData()->initialScreenIndex = targetScreen;
if (QWindow *window = q->windowHandle())
- window->setScreen(QGuiApplication::screens().value(targetScreen, Q_NULLPTR));
+ window->setScreen(QGuiApplication::screens().value(targetScreen, nullptr));
}
data.fstrut_dirty = true;
@@ -1459,7 +1459,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
screenNumber = q->windowType() != Qt::Desktop
? QDesktopWidgetPrivate::screenNumber(q) : 0;
}
- win->setScreen(QGuiApplication::screens().value(screenNumber, Q_NULLPTR));
+ win->setScreen(QGuiApplication::screens().value(screenNumber, nullptr));
}
QSurfaceFormat format = win->requestedFormat();
@@ -7891,7 +7891,7 @@ void QWidgetPrivate::show_helper()
const bool isWindow = q->isWindow();
#if QT_CONFIG(graphicsview)
- bool isEmbedded = isWindow && q->graphicsProxyWidget() != Q_NULLPTR;
+ bool isEmbedded = isWindow && q->graphicsProxyWidget() != nullptr;
#else
bool isEmbedded = false;
#endif
@@ -12446,7 +12446,7 @@ static inline bool canMapPosition(QWindow *window)
#if QT_CONFIG(graphicsview)
static inline QGraphicsProxyWidget *graphicsProxyWidget(const QWidget *w)
{
- QGraphicsProxyWidget *result = Q_NULLPTR;
+ QGraphicsProxyWidget *result = nullptr;
const QWidgetPrivate *d = qt_widget_private(const_cast<QWidget *>(w));
if (d->extra)
result = d->extra->proxyWidget;
@@ -12462,7 +12462,7 @@ struct MapToGlobalTransformResult {
static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w)
{
MapToGlobalTransformResult result;
- result.window = Q_NULLPTR;
+ result.window = nullptr;
for ( ; w ; w = w->parentWidget()) {
#if QT_CONFIG(graphicsview)
if (QGraphicsProxyWidget *qgpw = graphicsProxyWidget(w)) {
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 25d08993fb..5087d330ee 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -211,7 +211,7 @@ public:
};
Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
- explicit QWidget(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit QWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~QWidget();
int devType() const override;
@@ -596,7 +596,7 @@ public:
QWindow *windowHandle() const;
- static QWidget *createWindowContainer(QWindow *window, QWidget *parent=Q_NULLPTR, Qt::WindowFlags flags=Qt::WindowFlags());
+ static QWidget *createWindowContainer(QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags());
friend class QDesktopScreenWidget;
@@ -738,12 +738,12 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
#ifndef Q_QDOC
template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
{
- if (!o || !o->isWidgetType()) return Q_NULLPTR;
+ if (!o || !o->isWidgetType()) return nullptr;
return static_cast<QWidget*>(o);
}
template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
{
- if (!o || !o->isWidgetType()) return Q_NULLPTR;
+ if (!o || !o->isWidgetType()) return nullptr;
return static_cast<const QWidget*>(o);
}
#endif // !Q_QDOC
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index bb421927db..b851a5c0af 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -1060,7 +1060,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
{
Q_UNUSED(tlw);
Q_UNUSED(widget);
- return Q_NULLPTR;
+ return nullptr;
}
#endif // QT_NO_OPENGL
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index bf0e6bac73..e5027e35df 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -159,7 +159,7 @@ QObject *QWidgetWindow::focusObject() const
{
QWidget *windowWidget = m_widget;
if (!windowWidget)
- return Q_NULLPTR;
+ return nullptr;
// A window can't have a focus object if it's being destroyed.
if (QWidgetPrivate::get(windowWidget)->data.in_destructor)
@@ -410,7 +410,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
const QEnterEvent *ee = static_cast<QEnterEvent *>(event);
QWidget *child = m_widget->childAt(ee->pos());
QWidget *receiver = child ? child : m_widget.data();
- QWidget *leave = Q_NULLPTR;
+ QWidget *leave = nullptr;
if (QApplicationPrivate::inPopupMode() && receiver == m_widget
&& qt_last_mouse_receiver != m_widget) {
// This allows to deliver the leave event to the native widget
@@ -517,11 +517,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// Prevent negative mouse position on enter event - this event
// should be properly handled in "handleEnterLeaveEvent()".
if (receiverMapped.x() >= 0 && receiverMapped.y() >= 0) {
- QApplicationPrivate::dispatchEnterLeave(receiver, Q_NULLPTR, event->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(receiver, nullptr, event->screenPos());
qt_last_mouse_receiver = receiver;
}
} else {
- QApplicationPrivate::dispatchEnterLeave(Q_NULLPTR, qt_last_mouse_receiver, event->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(nullptr, qt_last_mouse_receiver, event->screenPos());
qt_last_mouse_receiver = receiver;
receiver = activePopupWidget;
}