diff options
author | Kevin Funk <kevin.funk@kdab.com> | 2019-03-12 11:46:26 +0100 |
---|---|---|
committer | Kevin Funk <kevin.funk@kdab.com> | 2019-03-14 07:37:52 +0000 |
commit | 41e7b71c410b77a81d09d3cc2e169ffd7975b4d2 (patch) | |
tree | fd0722a70d1aedf8567cc11babd10adcbbd1e797 /src/widgets/kernel | |
parent | b35eec360d4d88d094094fb54c101fad6cee5768 (diff) |
More nullptr usage in headers
Diff generated by running clang-tidy's modernize-use-nullptr checker on
the CMake-based Qt version.
Skipping src/3rdparty, examples/, tests/
Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication_p.h | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qgesture_p.h | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qlayout_p.h | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qlayoutengine_p.h | 6 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 32 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore_p.h | 6 | ||||
-rw-r--r-- | src/widgets/kernel/qwindowcontainer_p.h | 2 |
7 files changed, 29 insertions, 29 deletions
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 133279f977..98eb9b73c6 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -128,10 +128,10 @@ public: void notifyWindowIconChanged() override; //modality - bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const override; + bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = nullptr) const override; static bool isBlockedByModal(QWidget *widget); static bool modalState(); - static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0); + static bool tryModalHelper(QWidget *widget, QWidget **rettop = nullptr); #if 0 // Used to be included in Qt4 for Q_WS_MAC static QWidget *tryModalHelper_sys(QWidget *top); bool canQuit(); @@ -157,7 +157,7 @@ public: void openPopup(QWidget *popup); static void setFocusWidget(QWidget *focus, Qt::FocusReason reason); static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next, - bool *wrappingOccurred = 0); + bool *wrappingOccurred = nullptr); #if QT_CONFIG(graphicsview) // Maintain a list of all scenes to ensure font and palette propagation to @@ -238,7 +238,7 @@ public: return window; if (const QWidget *nativeParent = widget->nativeParentWidget()) return nativeParent->windowHandle(); - return 0; + return nullptr; } #ifdef Q_OS_WIN diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h index 636103c1e1..cbf8d60892 100644 --- a/src/widgets/kernel/qgesture_p.h +++ b/src/widgets/kernel/qgesture_p.h @@ -111,7 +111,7 @@ class QPinchGesturePrivate : public QGesturePrivate public: QPinchGesturePrivate() - : totalChangeFlags(0), changeFlags(0), + : totalChangeFlags(nullptr), changeFlags(nullptr), totalScaleFactor(1), lastScaleFactor(1), scaleFactor(1), totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0), isNewSequence(true) diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h index 8a1b12a6be..8e1d773355 100644 --- a/src/widgets/kernel/qlayout_p.h +++ b/src/widgets/kernel/qlayout_p.h @@ -80,7 +80,7 @@ public: static QWidgetItem *createWidgetItem(const QLayout *layout, QWidget *widget); static QSpacerItem *createSpacerItem(const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum); - virtual QLayoutItem* replaceAt(int index, QLayoutItem *newitem) { Q_UNUSED(index); Q_UNUSED(newitem); return 0; } + virtual QLayoutItem* replaceAt(int index, QLayoutItem *newitem) { Q_UNUSED(index); Q_UNUSED(newitem); return nullptr; } static QWidgetItemFactoryMethod widgetItemFactoryMethod; static QSpacerItemFactoryMethod spacerItemFactoryMethod; diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h index 812fa7cf3b..948c2424e6 100644 --- a/src/widgets/kernel/qlayoutengine_p.h +++ b/src/widgets/kernel/qlayoutengine_p.h @@ -105,9 +105,9 @@ Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i); Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidget *w); Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, const QSize &minSize, const QSize &maxSize, - const QSizePolicy &sizePolicy, Qt::Alignment align = 0); -Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align = 0); -Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align = 0); + const QSizePolicy &sizePolicy, Qt::Alignment align = nullptr); +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align = nullptr); +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align = nullptr); Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm); diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 797963b931..90c4c2a945 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -146,7 +146,7 @@ public: inline operator bool() const { - return (0 != m_ptr); + return (nullptr != m_ptr); } private: @@ -411,7 +411,7 @@ public: void render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags); void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, - QPainter *sharedPainter = 0, QWidgetBackingStore *backingStore = 0); + QPainter *sharedPainter = nullptr, QWidgetBackingStore *backingStore = nullptr); void sendPaintEvent(const QRegion &toBePainted); @@ -428,7 +428,7 @@ public: QRegion clipRegion() const; void setSystemClip(QPaintEngine *paintEngine, qreal devicePixelRatio, const QRegion ®ion); void subtractOpaqueChildren(QRegion &rgn, const QRect &clipRect) const; - void subtractOpaqueSiblings(QRegion &source, bool *hasDirtySiblingsAbove = 0, + void subtractOpaqueSiblings(QRegion &source, bool *hasDirtySiblingsAbove = nullptr, bool alsoNonOpaque = false) const; void clipToEffectiveMask(QRegion ®ion) const; void updateIsOpaque(); @@ -525,7 +525,7 @@ public: void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const; void setLayoutItemMargins(int left, int top, int right, int bottom); - void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0); + void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = nullptr); void updateContentsRect(); QMargins safeAreaMargins() const; @@ -555,7 +555,7 @@ public: QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget); //It's embedded if it has an ancestor if (ancestorProxy) { - if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != 0) { + if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != nullptr) { // One view, let be smart and return the viewport rect then the popup is aligned if (ancestorProxy->scene()->views().size() == 1) { QGraphicsView *view = ancestorProxy->scene()->views().at(0); @@ -586,7 +586,7 @@ public: } inline void restoreRedirected() - { redirectDev = 0; } + { redirectDev = nullptr; } inline void enforceNativeChildren() { @@ -652,7 +652,7 @@ public: QOpenGLContext *shareContext() const; - virtual QObject *focusObject() { return 0; } + virtual QObject *focusObject() { return nullptr; } #ifndef QT_NO_OPENGL virtual GLuint textureId() const { return 0; } @@ -660,7 +660,7 @@ public: Q_Q(QWidget); return q->testAttribute(Qt::WA_AlwaysStackOnTop) ? QPlatformTextureList::StacksOnTop - : QPlatformTextureList::Flags(0); + : QPlatformTextureList::Flags(nullptr); } virtual QImage grabFramebuffer() { return QImage(); } virtual void beginBackingStorePainting() { } @@ -904,7 +904,7 @@ struct QWidgetPaintContext { inline QWidgetPaintContext(QPaintDevice *d, const QRegion &r, const QPoint &o, int f, QPainter *p, QWidgetBackingStore *b) - : pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), backingStore(b), painter(0) {} + : pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), backingStore(b), painter(nullptr) {} QPaintDevice *pdev; QRegion rgn; @@ -920,14 +920,14 @@ class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: QWidgetEffectSourcePrivate(QWidget *widget) - : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false) + : QGraphicsEffectSourcePrivate(), m_widget(widget), context(nullptr), updateDueToGraphicsEffect(false) {} void detach() override - { m_widget->d_func()->graphicsEffect = 0; } + { m_widget->d_func()->graphicsEffect = nullptr; } const QGraphicsItem *graphicsItem() const override - { return 0; } + { return nullptr; } const QWidget *widget() const override { return m_widget; } @@ -953,7 +953,7 @@ public: } const QStyleOption *styleOption() const override - { return 0; } + { return nullptr; } QRect deviceRect() const override { return m_widget->window()->rect(); } @@ -983,14 +983,14 @@ inline QTLWExtra *QWidgetPrivate::topData() const inline QTLWExtra *QWidgetPrivate::maybeTopData() const { - return extra ? extra->topextra : 0; + return extra ? extra->topextra : nullptr; } inline QPainter *QWidgetPrivate::sharedPainter() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->sharedPainter : 0; + return x ? x->sharedPainter : nullptr; } inline void QWidgetPrivate::setSharedPainter(QPainter *painter) @@ -1011,7 +1011,7 @@ inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->backingStoreTracker.data() : 0; + return x ? x->backingStoreTracker.data() : nullptr; } inline QWidgetWindow *QWidgetPrivate::windowHandle() const diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index e7a2bca33a..9409ba7832 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -109,7 +109,7 @@ public: void sync(QWidget *exposedWidget, const QRegion &exposedRegion); void sync(); - void flush(QWidget *widget = 0); + void flush(QWidget *widget = nullptr); QBackingStore *backingStore() const { return store; } @@ -154,8 +154,8 @@ private: BeginPaintInfo *returnInfo, bool toCleanIsInTopLevelCoordinates = true); void endPaint(const QRegion &cleaned, QBackingStore *backingStore, BeginPaintInfo *beginPaintInfo); - QRegion dirtyRegion(QWidget *widget = 0) const; - QRegion staticContents(QWidget *widget = 0, const QRect &withinClipRect = QRect()) const; + QRegion dirtyRegion(QWidget *widget = nullptr) const; + QRegion staticContents(QWidget *widget = nullptr, const QRect &withinClipRect = QRect()) const; void markDirtyOnScreen(const QRegion &dirtyOnScreen, QWidget *widget, const QPoint &topLevelOffset); diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h index a8754232a8..c6de168c10 100644 --- a/src/widgets/kernel/qwindowcontainer_p.h +++ b/src/widgets/kernel/qwindowcontainer_p.h @@ -64,7 +64,7 @@ class Q_WIDGETS_EXPORT QWindowContainer : public QWidget Q_DECLARE_PRIVATE(QWindowContainer) public: - explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = 0, Qt::WindowFlags f = 0); + explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr); ~QWindowContainer(); QWindow *containedWindow() const; |