From ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 14:46:58 +0100 Subject: Tidy nullptr usage Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/kernel/qclipboard.cpp | 6 +- src/gui/kernel/qcursor.cpp | 14 ++-- src/gui/kernel/qdnd.cpp | 12 +-- src/gui/kernel/qdrag.cpp | 6 +- src/gui/kernel/qevent.cpp | 8 +- src/gui/kernel/qguiapplication.cpp | 106 ++++++++++++------------ src/gui/kernel/qguivariant.cpp | 16 ++-- src/gui/kernel/qkeymapper.cpp | 2 +- src/gui/kernel/qoffscreensurface.cpp | 14 ++-- src/gui/kernel/qopenglcontext.cpp | 56 ++++++------- src/gui/kernel/qopenglwindow.cpp | 6 +- src/gui/kernel/qpaintdevicewindow.cpp | 2 +- src/gui/kernel/qpalette.cpp | 2 +- src/gui/kernel/qplatformclipboard.cpp | 2 +- src/gui/kernel/qplatformcursor.cpp | 10 +-- src/gui/kernel/qplatforminputcontextfactory.cpp | 2 +- src/gui/kernel/qplatformintegration.cpp | 22 ++--- src/gui/kernel/qplatformintegrationplugin.cpp | 2 +- src/gui/kernel/qplatformnativeinterface.cpp | 20 ++--- src/gui/kernel/qplatformopenglcontext.cpp | 2 +- src/gui/kernel/qplatformscreen.cpp | 8 +- src/gui/kernel/qplatformtheme.cpp | 16 ++-- src/gui/kernel/qscreen.cpp | 2 +- src/gui/kernel/qsessionmanager.cpp | 2 +- src/gui/kernel/qshortcutmap.cpp | 12 +-- src/gui/kernel/qsimpledrag.cpp | 2 +- src/gui/kernel/qstylehints.cpp | 2 +- src/gui/kernel/qsurface.cpp | 2 +- src/gui/kernel/qwindow.cpp | 18 ++-- src/gui/kernel/qwindowsysteminterface.cpp | 2 +- 30 files changed, 188 insertions(+), 188 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 267c079ad9..db22ef2486 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -461,7 +461,7 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode) const QMimeData* QClipboard::mimeData(Mode mode) const { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); - if (!clipboard->supportsMode(mode)) return 0; + if (!clipboard->supportsMode(mode)) return nullptr; return clipboard->mimeData(mode); } @@ -488,7 +488,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); if (!clipboard->supportsMode(mode)) { - if (src != 0) { + if (src != nullptr) { qDebug("Data set on unsupported clipboard mode. QMimeData object will be deleted."); src->deleteLater(); } @@ -512,7 +512,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) */ void QClipboard::clear(Mode mode) { - setMimeData(0, mode); + setMimeData(nullptr, mode); } /*! diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 1ba8760a9d..4ae5412367 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -384,7 +384,7 @@ QDataStream &operator>>(QDataStream &s, QCursor &c) */ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY) - : d(0) + : d(nullptr) { QImage img = pixmap.toImage().convertToFormat(QImage::Format_Indexed8, Qt::ThresholdDither|Qt::AvoidDither); QBitmap bm = QBitmap::fromImage(img, Qt::ThresholdDither|Qt::AvoidDither); @@ -440,7 +440,7 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY) */ QCursor::QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY) - : d(0) + : d(nullptr) { d = QCursorData::setBitmap(bitmap, mask, hotX, hotY, 1.0); } @@ -452,7 +452,7 @@ QCursor::QCursor() { if (!QCursorData::initialized) { if (QCoreApplication::startingUp()) { - d = 0; + d = nullptr; return; } QCursorData::initialize(); @@ -470,7 +470,7 @@ QCursor::QCursor() \sa setShape() */ QCursor::QCursor(Qt::CursorShape shape) - : d(0) + : d(nullptr) { if (!QCursorData::initialized) QCursorData::initialize(); @@ -550,7 +550,7 @@ void QCursor::setShape(Qt::CursorShape shape) { if (!QCursorData::initialized) QCursorData::initialize(); - QCursorData *c = uint(shape) <= Qt::LastCursor ? qt_cursorTable[shape] : 0; + QCursorData *c = uint(shape) <= Qt::LastCursor ? qt_cursorTable[shape] : nullptr; if (!c) c = qt_cursorTable[0]; c->ref.ref(); @@ -675,7 +675,7 @@ QCursorData *qt_cursorTable[Qt::LastCursor + 1]; bool QCursorData::initialized = false; QCursorData::QCursorData(Qt::CursorShape s) - : ref(1), cshape(s), bm(0), bmm(0), hx(0), hy(0) + : ref(1), cshape(s), bm(nullptr), bmm(nullptr), hx(0), hy(0) { } @@ -695,7 +695,7 @@ void QCursorData::cleanup() // In case someone has a static QCursor defined with this shape if (!qt_cursorTable[shape]->ref.deref()) delete qt_cursorTable[shape]; - qt_cursorTable[shape] = 0; + qt_cursorTable[shape] = nullptr; } QCursorData::initialized = false; } diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index dd541af3b8..fe766c900e 100644 --- a/src/gui/kernel/qdnd.cpp +++ b/src/gui/kernel/qdnd.cpp @@ -48,19 +48,19 @@ QT_BEGIN_NAMESPACE // the universe's only drag manager -QDragManager *QDragManager::m_instance = 0; +QDragManager *QDragManager::m_instance = nullptr; QDragManager::QDragManager() - : QObject(qApp), m_currentDropTarget(0), + : QObject(qApp), m_currentDropTarget(nullptr), m_platformDrag(QGuiApplicationPrivate::platformIntegration()->drag()), - m_object(0) + m_object(nullptr) { Q_ASSERT(!m_instance); } QDragManager::~QDragManager() { - m_instance = 0; + m_instance = nullptr; } QDragManager *QDragManager::self() @@ -74,7 +74,7 @@ QObject *QDragManager::source() const { if (m_object) return m_object->source(); - return 0; + return nullptr; } void QDragManager::setCurrentTarget(QObject *target, bool dropped) @@ -111,7 +111,7 @@ Qt::DropAction QDragManager::drag(QDrag *o) m_object = o; - m_object->d_func()->target = 0; + m_object->d_func()->target = nullptr; QGuiApplicationPrivate::instance()->notifyDragStarted(m_object.data()); const Qt::DropAction result = m_platformDrag->drag(m_object); diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp index 8e2f7be23e..3712eace15 100644 --- a/src/gui/kernel/qdrag.cpp +++ b/src/gui/kernel/qdrag.cpp @@ -112,8 +112,8 @@ QDrag::QDrag(QObject *dragSource) { Q_D(QDrag); d->source = dragSource; - d->target = 0; - d->data = 0; + d->target = nullptr; + d->data = nullptr; d->hotspot = QPoint(-10, -10); d->executed_action = Qt::IgnoreAction; d->supported_actions = Qt::IgnoreAction; @@ -138,7 +138,7 @@ void QDrag::setMimeData(QMimeData *data) Q_D(QDrag); if (d->data == data) return; - if (d->data != 0) + if (d->data != nullptr) delete d->data; d->data = data; } diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index f555f4dc05..c69cc8ce6f 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2950,7 +2950,7 @@ QObject* QDropEvent::source() const { if (const QDragManager *manager = QDragManager::self()) return manager->source(); - return 0; + return nullptr; } @@ -4315,8 +4315,8 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType, Qt::TouchPointStates touchPointStates, const QList &touchPoints) : QInputEvent(eventType, modifiers), - _window(0), - _target(0), + _window(nullptr), + _target(nullptr), _device(device), _touchPointStates(touchPointStates), _touchPoints(touchPoints) @@ -5008,7 +5008,7 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags) The \a startPos is the position of a touch or mouse event that started the scrolling. */ QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos) - : QEvent(QEvent::ScrollPrepare), m_target(0), m_startPos(startPos) + : QEvent(QEvent::ScrollPrepare), m_target(nullptr), m_startPos(startPos) { Q_UNUSED(m_target); } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index ef31e475ea..6a0b01b6c3 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -141,7 +141,7 @@ Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier; QPointF QGuiApplicationPrivate::lastCursorPosition(qInf(), qInf()); -QWindow *QGuiApplicationPrivate::currentMouseWindow = 0; +QWindow *QGuiApplicationPrivate::currentMouseWindow = nullptr; QString QGuiApplicationPrivate::styleOverride; @@ -155,8 +155,8 @@ QPointer QGuiApplicationPrivate::currentDragWindow; QVector QGuiApplicationPrivate::tabletDevicePoints; -QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; -QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0; +QPlatformIntegration *QGuiApplicationPrivate::platform_integration = nullptr; +QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr; QList QGuiApplicationPrivate::generic_plugin_list; @@ -172,13 +172,13 @@ enum ApplicationResourceFlags static unsigned applicationResourceFlags = 0; -QIcon *QGuiApplicationPrivate::app_icon = 0; +QIcon *QGuiApplicationPrivate::app_icon = nullptr; -QString *QGuiApplicationPrivate::platform_name = 0; -QString *QGuiApplicationPrivate::displayName = 0; -QString *QGuiApplicationPrivate::desktopFileName = 0; +QString *QGuiApplicationPrivate::platform_name = nullptr; +QString *QGuiApplicationPrivate::displayName = nullptr; +QString *QGuiApplicationPrivate::desktopFileName = nullptr; -QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette +QPalette *QGuiApplicationPrivate::app_pal = nullptr; // default application palette ulong QGuiApplicationPrivate::mousePressTime = 0; Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton; @@ -188,30 +188,30 @@ int QGuiApplicationPrivate::mousePressY = 0; static int mouseDoubleClickDistance = -1; static int touchDoubleTapDistance = -1; -QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0; +QWindow *QGuiApplicationPrivate::currentMousePressWindow = nullptr; static Qt::LayoutDirection layout_direction = Qt::LayoutDirectionAuto; static bool force_reverse = false; -QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0; -QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = 0; +QGuiApplicationPrivate *QGuiApplicationPrivate::self = nullptr; +QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = nullptr; int QGuiApplicationPrivate::m_fakeMouseSourcePointId = 0; #ifndef QT_NO_CLIPBOARD -QClipboard *QGuiApplicationPrivate::qt_clipboard = 0; +QClipboard *QGuiApplicationPrivate::qt_clipboard = nullptr; #endif QList QGuiApplicationPrivate::screen_list; QWindowList QGuiApplicationPrivate::window_list; -QWindow *QGuiApplicationPrivate::focus_window = 0; +QWindow *QGuiApplicationPrivate::focus_window = nullptr; static QBasicMutex applicationFontMutex; -QFont *QGuiApplicationPrivate::app_font = 0; +QFont *QGuiApplicationPrivate::app_font = nullptr; QStyleHints *QGuiApplicationPrivate::styleHints = nullptr; bool QGuiApplicationPrivate::obey_desktop_settings = true; -QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0; +QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = nullptr; qreal QGuiApplicationPrivate::m_maxDevicePixelRatio = 0.0; @@ -243,7 +243,7 @@ static void initPalette() static inline void clearPalette() { delete QGuiApplicationPrivate::app_pal; - QGuiApplicationPrivate::app_pal = 0; + QGuiApplicationPrivate::app_pal = nullptr; } static void initFontUnlocked() @@ -261,7 +261,7 @@ static void initFontUnlocked() static inline void clearFontUnlocked() { delete QGuiApplicationPrivate::app_font; - QGuiApplicationPrivate::app_font = 0; + QGuiApplicationPrivate::app_font = nullptr; } static void initThemeHints() @@ -656,16 +656,16 @@ QGuiApplication::~QGuiApplication() Q_D(QGuiApplication); d->eventDispatcher->closingDown(); - d->eventDispatcher = 0; + d->eventDispatcher = nullptr; #ifndef QT_NO_CLIPBOARD delete QGuiApplicationPrivate::qt_clipboard; - QGuiApplicationPrivate::qt_clipboard = 0; + QGuiApplicationPrivate::qt_clipboard = nullptr; #endif #ifndef QT_NO_SESSIONMANAGER delete d->session_manager; - d->session_manager = 0; + d->session_manager = nullptr; #endif //QT_NO_SESSIONMANAGER clearPalette(); @@ -676,15 +676,15 @@ QGuiApplication::~QGuiApplication() #endif delete QGuiApplicationPrivate::app_icon; - QGuiApplicationPrivate::app_icon = 0; + QGuiApplicationPrivate::app_icon = nullptr; delete QGuiApplicationPrivate::platform_name; - QGuiApplicationPrivate::platform_name = 0; + QGuiApplicationPrivate::platform_name = nullptr; delete QGuiApplicationPrivate::displayName; - QGuiApplicationPrivate::displayName = 0; + QGuiApplicationPrivate::displayName = nullptr; delete QGuiApplicationPrivate::m_inputDeviceManager; - QGuiApplicationPrivate::m_inputDeviceManager = 0; + QGuiApplicationPrivate::m_inputDeviceManager = nullptr; delete QGuiApplicationPrivate::desktopFileName; - QGuiApplicationPrivate::desktopFileName = 0; + QGuiApplicationPrivate::desktopFileName = nullptr; QGuiApplicationPrivate::mouse_buttons = Qt::NoButton; QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier; QGuiApplicationPrivate::lastCursorPosition = {qInf(), qInf()}; @@ -704,7 +704,7 @@ QGuiApplication::~QGuiApplication() QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags) : QCoreApplicationPrivate(argc, argv, flags), - inputMethod(0), + inputMethod(nullptr), lastTouchType(QEvent::TouchEnd), ownGlobalShareContext(false) { @@ -797,7 +797,7 @@ QWindow *QGuiApplication::modalWindow() { CHECK_QAPP_INSTANCE(nullptr) if (QGuiApplicationPrivate::self->modalWindowList.isEmpty()) - return 0; + return nullptr; return QGuiApplicationPrivate::self->modalWindowList.first(); } @@ -844,7 +844,7 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal) self->modalWindowList.removeFirst(); QEvent e(QEvent::Leave); QGuiApplication::sendEvent(currentMouseWindow, &e); - currentMouseWindow = 0; + currentMouseWindow = nullptr; self->modalWindowList.prepend(modal); } } @@ -874,12 +874,12 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window) */ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const { - QWindow *unused = 0; + QWindow *unused = nullptr; if (!blockingWindow) blockingWindow = &unused; if (modalWindowList.isEmpty()) { - *blockingWindow = 0; + *blockingWindow = nullptr; return false; } @@ -889,7 +889,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking // A window is not blocked by another modal window if the two are // the same, or if the window is a child of the modal window. if (window == modalWindow || modalWindow->isAncestorOf(window, QWindow::IncludeTransients)) { - *blockingWindow = 0; + *blockingWindow = nullptr; return false; } @@ -930,7 +930,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking break; } } - *blockingWindow = 0; + *blockingWindow = nullptr; return false; } @@ -969,7 +969,7 @@ QObject *QGuiApplication::focusObject() { if (focusWindow()) return focusWindow()->focusObject(); - return 0; + return nullptr; } /*! @@ -1022,7 +1022,7 @@ QWindowList QGuiApplication::topLevelWindows() QScreen *QGuiApplication::primaryScreen() { if (QGuiApplicationPrivate::screen_list.isEmpty()) - return 0; + return nullptr; return QGuiApplicationPrivate::screen_list.at(0); } @@ -1450,7 +1450,7 @@ void QGuiApplicationPrivate::createPlatformIntegration() } if (j < argc) { - argv[j] = 0; + argv[j] = nullptr; argc = j; } @@ -1470,7 +1470,7 @@ void QGuiApplicationPrivate::createEventDispatcher() { Q_ASSERT(!eventDispatcher); - if (platform_integration == 0) + if (platform_integration == nullptr) createPlatformIntegration(); // The platform integration should not mess with the event dispatcher @@ -1481,7 +1481,7 @@ void QGuiApplicationPrivate::createEventDispatcher() void QGuiApplicationPrivate::eventDispatcherReady() { - if (platform_integration == 0) + if (platform_integration == nullptr) createPlatformIntegration(); platform_integration->initialize(); @@ -1578,7 +1578,7 @@ void QGuiApplicationPrivate::init() } if (j < argc) { - argv[j] = 0; + argv[j] = nullptr; argc = j; } @@ -1587,7 +1587,7 @@ void QGuiApplicationPrivate::init() if (!envPlugins.isEmpty()) pluginList += envPlugins.split(','); - if (platform_integration == 0) + if (platform_integration == nullptr) createPlatformIntegration(); initPalette(); @@ -1693,16 +1693,16 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() #ifndef QT_NO_OPENGL if (ownGlobalShareContext) { delete qt_gl_global_share_context(); - qt_gl_set_global_share_context(0); + qt_gl_set_global_share_context(nullptr); } #endif platform_integration->destroy(); delete platform_theme; - platform_theme = 0; + platform_theme = nullptr; delete platform_integration; - platform_integration = 0; + platform_integration = nullptr; window_list.clear(); screen_list.clear(); @@ -1793,7 +1793,7 @@ Qt::MouseButtons QGuiApplication::mouseButtons() QPlatformNativeInterface *QGuiApplication::platformNativeInterface() { QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); - return pi ? pi->nativeInterface() : 0; + return pi ? pi->nativeInterface() : nullptr; } /*! @@ -2144,7 +2144,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo window = currentMousePressWindow; } else if (currentMousePressWindow) { window = currentMousePressWindow; - currentMousePressWindow = 0; + currentMousePressWindow = nullptr; } QPointF delta = globalPoint - globalPoint.toPoint(); localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta; @@ -2357,7 +2357,7 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le return; } - currentMouseWindow = 0; + currentMouseWindow = nullptr; QEvent event(QEvent::Leave); QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event); @@ -2376,7 +2376,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate if (platformWindow->isAlertState()) platformWindow->setAlertState(false); - QObject *previousFocusObject = previous ? previous->focusObject() : 0; + QObject *previousFocusObject = previous ? previous->focusObject() : nullptr; if (previous) { QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange); @@ -2445,7 +2445,7 @@ void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterf if (QScreen *screen = wse->screen.data()) topLevelWindow->d_func()->setTopLevelScreen(screen, false /* recreate */); else // Fall back to default behavior, and try to find some appropriate screen - topLevelWindow->setScreen(0); + topLevelWindow->setScreen(nullptr); } // we may have changed scaling, so trigger resize event if needed if (window->handle()) { @@ -2871,7 +2871,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To break; } - Q_ASSERT(w.data() != 0); + Q_ASSERT(w.data() != nullptr); // make the *scene* functions return the same as the *screen* functions // Note: touchPoint is a reference to the one from activeTouchPoints, @@ -3247,12 +3247,12 @@ QPlatformDropQtResponse QGuiApplicationPrivate::processDrop(QWindow *w, const QM */ QClipboard * QGuiApplication::clipboard() { - if (QGuiApplicationPrivate::qt_clipboard == 0) { + if (QGuiApplicationPrivate::qt_clipboard == nullptr) { if (!qApp) { qWarning("QGuiApplication: Must construct a QGuiApplication before accessing a QClipboard"); - return 0; + return nullptr; } - QGuiApplicationPrivate::qt_clipboard = new QClipboard(0); + QGuiApplicationPrivate::qt_clipboard = new QClipboard(nullptr); } return QGuiApplicationPrivate::qt_clipboard; } @@ -3873,7 +3873,7 @@ Qt::LayoutDirection QGuiApplication::layoutDirection() QCursor *QGuiApplication::overrideCursor() { CHECK_QAPP_INSTANCE(nullptr) - return qGuiApp->d_func()->cursor_list.isEmpty() ? 0 : &qGuiApp->d_func()->cursor_list.first(); + return qGuiApp->d_func()->cursor_list.isEmpty() ? nullptr : &qGuiApp->d_func()->cursor_list.first(); } /*! @@ -3907,7 +3907,7 @@ static inline void unsetCursor(QWindow *w) { if (const QScreen *screen = w->screen()) if (QPlatformCursor *cursor = screen->handle()->cursor()) - cursor->changeCursor(0, w); + cursor->changeCursor(nullptr, w); } static inline void applyCursor(const QList &l, const QCursor &c) diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index edca8d9423..4ed9d032f6 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -103,13 +103,13 @@ static void construct(QVariant::Private *x, const void *copy) { const int type = x->type; QVariantConstructor constructor(x, copy); - QMetaTypeSwitcher::switcher(constructor, type, 0); + QMetaTypeSwitcher::switcher(constructor, type, nullptr); } static void clear(QVariant::Private *d) { QVariantDestructor destructor(d); - QMetaTypeSwitcher::switcher(destructor, d->type, 0); + QMetaTypeSwitcher::switcher(destructor, d->type, nullptr); } // This class is a hack that customizes access to QPolygon and QPolygonF @@ -129,7 +129,7 @@ public: static bool isNull(const QVariant::Private *d) { QGuiVariantIsNull isNull(d); - return QMetaTypeSwitcher::switcher(isNull, d->type, 0); + return QMetaTypeSwitcher::switcher(isNull, d->type, nullptr); } // This class is a hack that customizes access to QPixmap, QBitmap, QCursor and QIcon @@ -171,7 +171,7 @@ public: static bool compare(const QVariant::Private *a, const QVariant::Private *b) { QGuiVariantComparator comparator(a, b); - return QMetaTypeSwitcher::switcher(comparator, a->type, 0); + return QMetaTypeSwitcher::switcher(comparator, a->type, nullptr); } static bool convert(const QVariant::Private *d, int t, @@ -311,7 +311,7 @@ static void streamDebug(QDebug dbg, const QVariant &v) { QVariant::Private *d = const_cast(&v.data_ptr()); QVariantDebugStream stream(dbg, d); - QMetaTypeSwitcher::switcher(stream, d->type, 0); + QMetaTypeSwitcher::switcher(stream, d->type, nullptr); } #endif @@ -320,12 +320,12 @@ const QVariant::Handler qt_gui_variant_handler = { clear, isNull, #ifndef QT_NO_DATASTREAM - 0, - 0, + nullptr, + nullptr, #endif compare, convert, - 0, + nullptr, #if !defined(QT_NO_DEBUG_STREAM) streamDebug #else diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index 4893b1d57b..274574f561 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE Constructs a new key mapper. */ QKeyMapper::QKeyMapper() - : QObject(*new QKeyMapperPrivate, 0) + : QObject(*new QKeyMapperPrivate, nullptr) { } diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index 0cc11ca3bb..c74fe0b3a1 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -99,10 +99,10 @@ public: QOffscreenSurfacePrivate() : QObjectPrivate() , surfaceType(QSurface::OpenGLSurface) - , platformOffscreenSurface(0) - , offscreenWindow(0) + , platformOffscreenSurface(nullptr) + , offscreenWindow(nullptr) , requestedFormat(QSurfaceFormat::defaultFormat()) - , screen(0) + , screen(nullptr) , size(1, 1) , nativeHandle(nullptr) { @@ -235,11 +235,11 @@ void QOffscreenSurface::destroy() QGuiApplication::sendEvent(this, &e); delete d->platformOffscreenSurface; - d->platformOffscreenSurface = 0; + d->platformOffscreenSurface = nullptr; if (d->offscreenWindow) { d->offscreenWindow->destroy(); delete d->offscreenWindow; - d->offscreenWindow = 0; + d->offscreenWindow = nullptr; } d->nativeHandle = nullptr; @@ -341,7 +341,7 @@ void QOffscreenSurface::setScreen(QScreen *newScreen) if (!newScreen) newScreen = QCoreApplication::instance() ? QGuiApplication::primaryScreen() : nullptr; if (newScreen != d->screen) { - const bool wasCreated = d->platformOffscreenSurface != 0 || d->offscreenWindow != 0; + const bool wasCreated = d->platformOffscreenSurface != nullptr || d->offscreenWindow != nullptr; if (wasCreated) destroy(); if (d->screen) @@ -385,7 +385,7 @@ void QOffscreenSurface::screenDestroyed(QObject *object) { Q_D(QOffscreenSurface); if (object == static_cast(d->screen)) - setScreen(0); + setScreen(nullptr); } /*! diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 638eb1d12f..124b39f2a9 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -223,7 +223,7 @@ class QGuiGLThreadContext { public: QGuiGLThreadContext() - : context(0) + : context(nullptr) { } ~QGuiGLThreadContext() { @@ -234,7 +234,7 @@ public: }; Q_GLOBAL_STATIC(QThreadStorage, qwindow_context_storage); -static QOpenGLContext *global_share_context = 0; +static QOpenGLContext *global_share_context = nullptr; #ifndef QT_NO_DEBUG QHash QOpenGLContextPrivate::makeCurrentTracker; @@ -347,7 +347,7 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context if (!threadContext) { if (!QThread::currentThread()) { qWarning("No QTLS available. currentContext won't work"); - return 0; + return nullptr; } threadContext = new QGuiGLThreadContext; qwindow_context_storage()->setLocalData(threadContext); @@ -372,10 +372,10 @@ int QOpenGLContextPrivate::maxTextureSize() GLint size; GLint next = 64; - funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - QOpenGLFunctions_1_0 *gl1funcs = 0; - QOpenGLFunctions_3_2_Core *gl3funcs = 0; + QOpenGLFunctions_1_0 *gl1funcs = nullptr; + QOpenGLFunctions_3_2_Core *gl3funcs = nullptr; if (q->format().profile() == QSurfaceFormat::CoreProfile) gl3funcs = q->versionFunctions(); @@ -398,7 +398,7 @@ int QOpenGLContextPrivate::maxTextureSize() if (next > max_texture_size) break; - funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); if (gl1funcs) gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); else @@ -455,7 +455,7 @@ QPlatformOpenGLContext *QOpenGLContext::shareHandle() const Q_D(const QOpenGLContext); if (d->shareContext) return d->shareContext->handle(); - return 0; + return nullptr; } /*! @@ -517,8 +517,8 @@ void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object) { Q_Q(QOpenGLContext); if (object == static_cast(screen)) { - screen = 0; - q->setScreen(0); + screen = nullptr; + q->setScreen(nullptr); } } @@ -615,7 +615,7 @@ bool QOpenGLContext::create() d->platformGLContext->setContext(this); d->platformGLContext->initialize(); if (!d->platformGLContext->isSharing()) - d->shareContext = 0; + d->shareContext = nullptr; d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup; d->shareGroup->d_func()->addContext(this); return isValid(); @@ -649,15 +649,15 @@ void QOpenGLContext::destroy() doneCurrent(); if (d->shareGroup) d->shareGroup->d_func()->removeContext(this); - d->shareGroup = 0; + d->shareGroup = nullptr; delete d->platformGLContext; - d->platformGLContext = 0; + d->platformGLContext = nullptr; delete d->functions; - d->functions = 0; + d->functions = nullptr; for (QAbstractOpenGLFunctions *func : qAsConst(d->externalVersionFunctions)) { QAbstractOpenGLFunctionsPrivate *func_d = QAbstractOpenGLFunctionsPrivate::get(func); - func_d->owningContext = 0; + func_d->owningContext = nullptr; func_d->initialized = false; } d->externalVersionFunctions.clear(); @@ -665,7 +665,7 @@ void QOpenGLContext::destroy() d->versionFunctions.clear(); delete d->textureFunctions; - d->textureFunctions = 0; + d->textureFunctions = nullptr; d->nativeHandle = QVariant(); } @@ -823,7 +823,7 @@ QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionP #ifndef QT_OPENGL_ES_2 if (isOpenGLES()) { qWarning("versionFunctions: Not supported on OpenGL ES"); - return 0; + return nullptr; } #endif // QT_OPENGL_ES_2 @@ -838,16 +838,16 @@ QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionP // Check that context is compatible with requested version const QPair v = qMakePair(f.majorVersion(), f.minorVersion()); if (v < vp.version()) - return 0; + return nullptr; // If this context only offers core profile functions then we can't create // function objects for legacy or compatibility profile requests if (((vp.hasProfiles() && vp.profile() != QSurfaceFormat::CoreProfile) || vp.isLegacyVersion()) && f.profile() == QSurfaceFormat::CoreProfile) - return 0; + return nullptr; // Create object if suitable one not cached - QAbstractOpenGLFunctions* funcs = 0; + QAbstractOpenGLFunctions* funcs = nullptr; auto it = d->versionFunctions.constFind(vp); if (it == d->versionFunctions.constEnd()) { funcs = QOpenGLVersionFunctionsFactory::create(vp); @@ -1022,7 +1022,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) || qstrncmp(rendererString, "Adreno 6xx", 8) == 0 // Same as above but without the '(TM)' || qstrcmp(rendererString, "GC800 core") == 0 || qstrcmp(rendererString, "GC1000 core") == 0 - || strstr(rendererString, "GC2000") != 0 + || strstr(rendererString, "GC2000") != nullptr || qstrcmp(rendererString, "Immersion.16") == 0; } needsWorkaroundSet = true; @@ -1053,9 +1053,9 @@ void QOpenGLContext::doneCurrent() d->shareGroup->d_func()->deletePendingResources(this); d->platformGLContext->doneCurrent(); - QOpenGLContextPrivate::setCurrentContext(0); + QOpenGLContextPrivate::setCurrentContext(nullptr); - d->surface = 0; + d->surface = nullptr; } /*! @@ -1224,8 +1224,8 @@ void QOpenGLContext::deleteQGLContext() Q_D(QOpenGLContext); if (d->qGLContextDeleteFunction && d->qGLContextHandle) { d->qGLContextDeleteFunction(d->qGLContextHandle); - d->qGLContextDeleteFunction = 0; - d->qGLContextHandle = 0; + d->qGLContextDeleteFunction = nullptr; + d->qGLContextHandle = nullptr; } } @@ -1252,7 +1252,7 @@ void *QOpenGLContext::openGLModuleHandle() Q_ASSERT(ni); return ni->nativeResourceForIntegration(QByteArrayLiteral("glhandle")); #else - return 0; + return nullptr; #endif } @@ -1438,7 +1438,7 @@ QList QOpenGLContextGroup::shares() const QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup() { QOpenGLContext *current = QOpenGLContext::currentContext(); - return current ? current->shareGroup() : 0; + return current ? current->shareGroup() : nullptr; } void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx) @@ -1491,7 +1491,7 @@ void QOpenGLContextGroupPrivate::cleanup() while (it != end) { (*it)->invalidateResource(); - (*it)->m_group = 0; + (*it)->m_group = nullptr; ++it; } diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index 022a47c919..2ea8f43711 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -208,8 +208,8 @@ QOpenGLWindowPrivate::~QOpenGLWindowPrivate() Q_Q(QOpenGLWindow); if (q->isValid()) { q->makeCurrent(); // this works even when the platformwindow is destroyed - paintDevice.reset(0); - fbo.reset(0); + paintDevice.reset(nullptr); + fbo.reset(nullptr); blitter.destroy(); q->doneCurrent(); } @@ -692,7 +692,7 @@ QPaintDevice *QOpenGLWindow::redirected(QPoint *) const Q_D(const QOpenGLWindow); if (QOpenGLContext::currentContext() == d->context.data()) return d->paintDevice.data(); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp index 4521c2f62c..4f45fc5fde 100644 --- a/src/gui/kernel/qpaintdevicewindow.cpp +++ b/src/gui/kernel/qpaintdevicewindow.cpp @@ -219,7 +219,7 @@ QPaintDeviceWindow::QPaintDeviceWindow(QPaintDeviceWindowPrivate &dd, QWindow *p */ QPaintEngine *QPaintDeviceWindow::paintEngine() const { - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 61dccd77ac..fc063bc72c 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -536,7 +536,7 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button) \sa QApplication::setPalette(), QApplication::palette() */ QPalette::QPalette() - : d(0) + : d(nullptr) { data.current_group = Active; data.resolve_mask = 0; diff --git a/src/gui/kernel/qplatformclipboard.cpp b/src/gui/kernel/qplatformclipboard.cpp index ab2998b901..34c94dca3b 100644 --- a/src/gui/kernel/qplatformclipboard.cpp +++ b/src/gui/kernel/qplatformclipboard.cpp @@ -67,7 +67,7 @@ private: QClipboardData::QClipboardData() { - src = 0; + src = nullptr; } QClipboardData::~QClipboardData() diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp index 34c4549443..12065078c1 100644 --- a/src/gui/kernel/qplatformcursor.cpp +++ b/src/gui/kernel/qplatformcursor.cpp @@ -128,7 +128,7 @@ void QPlatformCursor::setPos(const QPoint &pos) qWarning("This plugin does not support QCursor::setPos()" "; emulating movement within the application."); } - QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove); + QWindowSystemInterface::handleMouseEvent(nullptr, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove); } // End of display and pointer event handling code @@ -431,7 +431,7 @@ void QPlatformCursorImage::createSystemCursor(int id) { if (!systemCursorTableInit) { for (int i = 0; i <= Qt::LastCursor; i++) - systemCursorTable[i] = 0; + systemCursorTable[i] = nullptr; systemCursorTableInit = true; } switch (id) { @@ -478,7 +478,7 @@ void QPlatformCursorImage::createSystemCursor(int id) case Qt::BlankCursor: systemCursorTable[Qt::BlankCursor] = - new QPlatformCursorImage(0, 0, 0, 0, 0, 0); + new QPlatformCursorImage(nullptr, nullptr, 0, 0, 0, 0); break; // 20x20 cursors @@ -548,14 +548,14 @@ void QPlatformCursorImage::createSystemCursor(int id) void QPlatformCursorImage::set(Qt::CursorShape id) { - QPlatformCursorImage *cursor = 0; + QPlatformCursorImage *cursor = nullptr; if (unsigned(id) <= unsigned(Qt::LastCursor)) { if (!systemCursorTable[id]) createSystemCursor(id); cursor = systemCursorTable[id]; } - if (cursor == 0) { + if (cursor == nullptr) { if (!systemCursorTable[Qt::ArrowCursor]) createSystemCursor(Qt::ArrowCursor); cursor = systemCursorTable[Qt::ArrowCursor]; diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp index df7b95d8df..749abaf27a 100644 --- a/src/gui/kernel/qplatforminputcontextfactory.cpp +++ b/src/gui/kernel/qplatforminputcontextfactory.cpp @@ -85,7 +85,7 @@ QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) #else Q_UNUSED(key); #endif - return 0; + return nullptr; } QPlatformInputContext *QPlatformInputContextFactory::create() diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index b3d3db0751..63f66e6bf7 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE */ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const { - static QPlatformFontDatabase *db = 0; + static QPlatformFontDatabase *db = nullptr; if (!db) { db = new QPlatformFontDatabase; } @@ -86,7 +86,7 @@ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const QPlatformClipboard *QPlatformIntegration::clipboard() const { - static QPlatformClipboard *clipboard = 0; + static QPlatformClipboard *clipboard = nullptr; if (!clipboard) { clipboard = new QPlatformClipboard; } @@ -104,7 +104,7 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const */ QPlatformDrag *QPlatformIntegration::drag() const { - static QSimpleDrag *drag = 0; + static QSimpleDrag *drag = nullptr; if (!drag) { drag = new QSimpleDrag; } @@ -114,12 +114,12 @@ QPlatformDrag *QPlatformIntegration::drag() const QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const { - return 0; + return nullptr; } QPlatformServices *QPlatformIntegration::services() const { - return 0; + return nullptr; } /*! @@ -303,7 +303,7 @@ QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenG { Q_UNUSED(context); qWarning("This plugin does not support createPlatformOpenGLContext!"); - return 0; + return nullptr; } #endif // QT_NO_OPENGL @@ -315,7 +315,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics { qWarning("This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!", cacheId); - return 0; + return nullptr; } /*! @@ -325,7 +325,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const { Q_UNUSED(paintDevice) - return 0; + return nullptr; } /*! @@ -357,7 +357,7 @@ void QPlatformIntegration::destroy() */ QPlatformInputContext *QPlatformIntegration::inputContext() const { - return 0; + return nullptr; } #ifndef QT_NO_ACCESSIBILITY @@ -370,7 +370,7 @@ QPlatformInputContext *QPlatformIntegration::inputContext() const */ QPlatformAccessibility *QPlatformIntegration::accessibility() const { - static QPlatformAccessibility *accessibility = 0; + static QPlatformAccessibility *accessibility = nullptr; if (Q_UNLIKELY(!accessibility)) { accessibility = new QPlatformAccessibility; } @@ -484,7 +484,7 @@ class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &n QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const { Q_UNUSED(surface) - return 0; + return nullptr; } #ifndef QT_NO_SESSIONMANAGER diff --git a/src/gui/kernel/qplatformintegrationplugin.cpp b/src/gui/kernel/qplatformintegrationplugin.cpp index 35e4d2797b..b100eacbb5 100644 --- a/src/gui/kernel/qplatformintegrationplugin.cpp +++ b/src/gui/kernel/qplatformintegrationplugin.cpp @@ -54,7 +54,7 @@ QPlatformIntegration *QPlatformIntegrationPlugin::create(const QString &key, con { Q_UNUSED(key) Q_UNUSED(paramList); - return 0; + return nullptr; } QPlatformIntegration *QPlatformIntegrationPlugin::create(const QString &key, const QStringList ¶mList, int &argc, char **argv) diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp index b24541d3ec..8c9e73fbc2 100644 --- a/src/gui/kernel/qplatformnativeinterface.cpp +++ b/src/gui/kernel/qplatformnativeinterface.cpp @@ -56,35 +56,35 @@ QT_BEGIN_NAMESPACE void *QPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { Q_UNUSED(resource); - return 0; + return nullptr; } void *QPlatformNativeInterface::nativeResourceForScreen(const QByteArray &resource, QScreen *screen) { Q_UNUSED(resource); Q_UNUSED(screen); - return 0; + return nullptr; } void *QPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { Q_UNUSED(resource); Q_UNUSED(window); - return 0; + return nullptr; } void *QPlatformNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { Q_UNUSED(resource); Q_UNUSED(context); - return 0; + return nullptr; } void * QPlatformNativeInterface::nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) { Q_UNUSED(resource); Q_UNUSED(backingStore); - return 0; + return nullptr; } #ifndef QT_NO_CURSOR @@ -99,31 +99,31 @@ void *QPlatformNativeInterface::nativeResourceForCursor(const QByteArray &resour QPlatformNativeInterface::NativeResourceForIntegrationFunction QPlatformNativeInterface::nativeResourceFunctionForIntegration(const QByteArray &resource) { Q_UNUSED(resource); - return 0; + return nullptr; } QPlatformNativeInterface::NativeResourceForContextFunction QPlatformNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource) { Q_UNUSED(resource); - return 0; + return nullptr; } QPlatformNativeInterface::NativeResourceForScreenFunction QPlatformNativeInterface::nativeResourceFunctionForScreen(const QByteArray &resource) { Q_UNUSED(resource); - return 0; + return nullptr; } QPlatformNativeInterface::NativeResourceForWindowFunction QPlatformNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource) { Q_UNUSED(resource); - return 0; + return nullptr; } QPlatformNativeInterface::NativeResourceForBackingStoreFunction QPlatformNativeInterface::nativeResourceFunctionForBackingStore(const QByteArray &resource) { Q_UNUSED(resource); - return 0; + return nullptr; } QFunctionPointer QPlatformNativeInterface::platformFunction(const QByteArray &function) const diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp index 07b5a0dda6..839ec008aa 100644 --- a/src/gui/kernel/qplatformopenglcontext.cpp +++ b/src/gui/kernel/qplatformopenglcontext.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE class QPlatformOpenGLContextPrivate { public: - QPlatformOpenGLContextPrivate() : context(0) {} + QPlatformOpenGLContextPrivate() : context(nullptr) {} QOpenGLContext *context; }; diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index e511a6f5c4..7c1e2158b1 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -54,7 +54,7 @@ QPlatformScreen::QPlatformScreen() : d_ptr(new QPlatformScreenPrivate) { Q_D(QPlatformScreen); - d->screen = 0; + d->screen = nullptr; } QPlatformScreen::~QPlatformScreen() @@ -99,7 +99,7 @@ QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const return w; } - return 0; + return nullptr; } /*! @@ -310,7 +310,7 @@ QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window // QTBUG 32681: It can happen during the transition between screens // when one screen is disconnected that the window doesn't have a screen. if (!window->screen()) - return 0; + return nullptr; return window->screen()->handle(); } @@ -395,7 +395,7 @@ QString QPlatformScreen::serialNumber() const */ QPlatformCursor *QPlatformScreen::cursor() const { - return 0; + return nullptr; } /*! diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index f906f808d8..71521c0339 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -354,7 +354,7 @@ const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePri #endif QPlatformThemePrivate::QPlatformThemePrivate() - : systemPalette(0) + : systemPalette(nullptr) { } QPlatformThemePrivate::~QPlatformThemePrivate() @@ -394,7 +394,7 @@ bool QPlatformTheme::usePlatformNativeDialog(DialogType type) const QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType type) const { Q_UNUSED(type); - return 0; + return nullptr; } const QPalette *QPlatformTheme::palette(Palette type) const @@ -405,13 +405,13 @@ const QPalette *QPlatformTheme::palette(Palette type) const const_cast(this)->d_ptr->initializeSystemPalette(); return d->systemPalette; } - return 0; + return nullptr; } const QFont *QPlatformTheme::font(Font type) const { Q_UNUSED(type) - return 0; + return nullptr; } QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const @@ -569,17 +569,17 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) QPlatformMenuItem *QPlatformTheme::createPlatformMenuItem() const { - return 0; + return nullptr; } QPlatformMenu *QPlatformTheme::createPlatformMenu() const { - return 0; + return nullptr; } QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const { - return 0; + return nullptr; } #ifndef QT_NO_SYSTEMTRAYICON @@ -589,7 +589,7 @@ QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const */ QPlatformSystemTrayIcon *QPlatformTheme::createPlatformSystemTrayIcon() const { - return 0; + return nullptr; } #endif diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 80de561297..9de59f8c7e 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE */ QScreen::QScreen(QPlatformScreen *screen) - : QObject(*new QScreenPrivate(), 0) + : QObject(*new QScreenPrivate(), nullptr) { Q_D(QScreen); d->setPlatformScreen(screen); diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp index e5e9c624b2..8747e02719 100644 --- a/src/gui/kernel/qsessionmanager.cpp +++ b/src/gui/kernel/qsessionmanager.cpp @@ -135,7 +135,7 @@ QSessionManagerPrivate::QSessionManagerPrivate(const QString &id, QSessionManagerPrivate::~QSessionManagerPrivate() { delete platformSessionManager; - platformSessionManager = 0; + platformSessionManager = nullptr; } QSessionManager::QSessionManager(QGuiApplication *app, QString &id, QString &key) diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 9ed450b031..a7ea20266b 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -65,11 +65,11 @@ Q_LOGGING_CATEGORY(lcShortcutMap, "qt.gui.shortcutmap") struct QShortcutEntry { QShortcutEntry() - : keyseq(0), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(0), contextMatcher(0) + : keyseq(0), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr) {} QShortcutEntry(const QKeySequence &k) - : keyseq(k), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(0), contextMatcher(0) + : keyseq(k), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr) {} QShortcutEntry(QObject *o, const QKeySequence &k, Qt::ShortcutContext c, int i, bool a, QShortcutMap::ContextMatcher m) @@ -184,7 +184,7 @@ int QShortcutMap::removeShortcut(int id, QObject *owner, const QKeySequence &key { Q_D(QShortcutMap); int itemsRemoved = 0; - bool allOwners = (owner == 0); + bool allOwners = (owner == nullptr); bool allKeys = key.isEmpty(); bool allIds = id == 0; @@ -228,7 +228,7 @@ int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const { Q_D(QShortcutMap); int itemsChanged = 0; - bool allOwners = (owner == 0); + bool allOwners = (owner == nullptr); bool allKeys = key.isEmpty(); bool allIds = id == 0; @@ -264,7 +264,7 @@ int QShortcutMap::setShortcutAutoRepeat(bool on, int id, QObject *owner, const Q { Q_D(QShortcutMap); int itemsChanged = 0; - bool allOwners = (owner == 0); + bool allOwners = (owner == nullptr); bool allKeys = key.isEmpty(); bool allIds = id == 0; @@ -638,7 +638,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e) d->prevSequence = curKey; } // Find next - const QShortcutEntry *current = 0, *next = 0; + const QShortcutEntry *current = nullptr, *next = nullptr; int i = 0, enabledShortcuts = 0; QVector ambiguousShortcuts; while(i < d->identicals.size()) { diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 803206477c..dec3cc399d 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -76,7 +76,7 @@ static QWindow* topLevelAt(const QPoint &pos) if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast(w)) return w; } - return 0; + return nullptr; } /*! diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 732ede90d0..7b3c70c51b 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -116,7 +116,7 @@ public: \sa QGuiApplication::styleHints() */ QStyleHints::QStyleHints() - : QObject(*new QStyleHintsPrivate(), 0) + : QObject(*new QStyleHintsPrivate(), nullptr) { } diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp index 709f28d431..85c576b21c 100644 --- a/src/gui/kernel/qsurface.cpp +++ b/src/gui/kernel/qsurface.cpp @@ -134,7 +134,7 @@ bool QSurface::supportsOpenGL() const Creates a surface with the given \a type. */ QSurface::QSurface(SurfaceClass type) - : m_type(type), m_reserved(0) + : m_type(type), m_reserved(nullptr) { } diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b71a0c54aa..74e0e6401e 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -156,7 +156,7 @@ QT_BEGIN_NAMESPACE \sa setScreen() */ QWindow::QWindow(QScreen *targetScreen) - : QObject(*new QWindowPrivate(), 0) + : QObject(*new QWindowPrivate(), nullptr) , QSurface(QSurface::Window) { Q_D(QWindow); @@ -223,7 +223,7 @@ QWindow::~QWindow() // some cases end up becoming the focus window again. Clear it again // here as a workaround. See QTBUG-75326. if (QGuiApplicationPrivate::focus_window == this) - QGuiApplicationPrivate::focus_window = 0; + QGuiApplicationPrivate::focus_window = nullptr; } void QWindowPrivate::init(QScreen *targetScreen) @@ -469,7 +469,7 @@ inline bool QWindowPrivate::windowRecreationRequired(QScreen *newScreen) const inline void QWindowPrivate::disconnectFromScreen() { if (topLevelScreen) - topLevelScreen = 0; + topLevelScreen = nullptr; } void QWindowPrivate::connectToScreen(QScreen *screen) @@ -732,7 +732,7 @@ void QWindow::setParent(QWindow *parent) if (parent) parent->create(); - d->platformWindow->setParent(parent ? parent->d_func()->platformWindow : 0); + d->platformWindow->setParent(parent ? parent->d_func()->platformWindow : nullptr); } QGuiApplicationPrivate::updateBlockedStatus(this); @@ -744,7 +744,7 @@ void QWindow::setParent(QWindow *parent) bool QWindow::isTopLevel() const { Q_D(const QWindow); - return d->parentWindow == 0; + return d->parentWindow == nullptr; } /*! @@ -2018,7 +2018,7 @@ void QWindow::setScreen(QScreen *newScreen) Q_D(QWindow); if (!newScreen) newScreen = QGuiApplication::primaryScreen(); - d->setTopLevelScreen(newScreen, newScreen != 0); + d->setTopLevelScreen(newScreen, newScreen != nullptr); } /*! @@ -2036,7 +2036,7 @@ void QWindow::setScreen(QScreen *newScreen) */ QAccessibleInterface *QWindow::accessibleRoot() const { - return 0; + return nullptr; } /*! @@ -2696,7 +2696,7 @@ QWindow *QWindow::fromWinId(WId id) { if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ForeignWindows)) { qWarning("QWindow::fromWinId(): platform plugin does not support foreign windows."); - return 0; + return nullptr; } QWindow *window = new QWindow; @@ -2770,7 +2770,7 @@ void QWindow::setCursor(const QCursor &cursor) void QWindow::unsetCursor() { Q_D(QWindow); - d->setCursor(0); + d->setCursor(nullptr); } /*! diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index ba04f8701d..c9a70897d6 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -179,7 +179,7 @@ void QWindowSystemInterfacePrivate::installWindowSystemEventHandler(QWindowSyste void QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(QWindowSystemEventHandler *handler) { if (eventHandler == handler) - eventHandler = 0; + eventHandler = nullptr; } QWindowSystemEventHandler::~QWindowSystemEventHandler() -- cgit v1.2.3