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/corelib/animation/qabstractanimation.cpp | 8 +- src/corelib/animation/qanimationgroup.cpp | 8 +- src/corelib/animation/qpropertyanimation.cpp | 2 +- .../animation/qsequentialanimationgroup.cpp | 6 +- src/corelib/animation/qvariantanimation.cpp | 6 +- src/corelib/codecs/qicucodec.cpp | 16 +- src/corelib/codecs/qisciicodec.cpp | 2 +- src/corelib/codecs/qsimplecodec.cpp | 66 +++--- src/corelib/global/qlibraryinfo.cpp | 12 +- src/corelib/global/qlogging.cpp | 2 +- src/corelib/io/qfile.cpp | 4 +- src/corelib/io/qfiledevice.cpp | 2 +- src/corelib/io/qfilesystemengine_unix.cpp | 4 +- src/corelib/io/qfilesystemwatcher.cpp | 2 +- src/corelib/io/qfilesystemwatcher_inotify.cpp | 2 +- src/corelib/io/qiodevice.cpp | 2 +- src/corelib/io/qnoncontiguousbytedevice.cpp | 20 +- src/corelib/io/qprocess.cpp | 26 +-- src/corelib/io/qprocess_unix.cpp | 24 +-- src/corelib/io/qresource.cpp | 6 +- src/corelib/io/qsavefile.cpp | 2 +- src/corelib/io/qsettings.cpp | 12 +- src/corelib/itemmodels/qabstractitemmodel.cpp | 20 +- src/corelib/itemmodels/qabstractproxymodel.cpp | 2 +- .../itemmodels/qconcatenatetablesproxymodel.cpp | 2 +- src/corelib/itemmodels/qitemselectionmodel.cpp | 2 +- src/corelib/kernel/qcoreapplication.cpp | 26 +-- src/corelib/kernel/qcoreevent.cpp | 2 +- src/corelib/kernel/qeventdispatcher_glib.cpp | 40 ++-- src/corelib/kernel/qeventdispatcher_unix.cpp | 2 +- src/corelib/kernel/qmetaobject.cpp | 80 +++---- src/corelib/kernel/qmetaobjectbuilder.cpp | 32 +-- src/corelib/kernel/qmetatype.cpp | 6 +- src/corelib/kernel/qmimedata.cpp | 2 +- src/corelib/kernel/qobject.cpp | 126 +++++------ src/corelib/kernel/qobjectcleanuphandler.cpp | 2 +- src/corelib/kernel/qsharedmemory.cpp | 2 +- src/corelib/kernel/qsharedmemory_systemv.cpp | 6 +- src/corelib/kernel/qsharedmemory_unix.cpp | 2 +- src/corelib/kernel/qtestsupport_core.cpp | 2 +- src/corelib/kernel/qtimer.cpp | 6 +- src/corelib/kernel/qtimerinfo_unix.cpp | 20 +- src/corelib/kernel/qtranslator.cpp | 38 ++-- src/corelib/kernel/qvariant.cpp | 2 +- src/corelib/mimetypes/qmimedatabase.cpp | 2 +- src/corelib/mimetypes/qmimeprovider.cpp | 4 +- src/corelib/plugin/qfactoryloader.cpp | 8 +- src/corelib/plugin/qlibrary.cpp | 34 +-- src/corelib/plugin/qlibrary_unix.cpp | 2 +- src/corelib/plugin/qpluginloader.cpp | 8 +- src/corelib/statemachine/qabstractstate.cpp | 6 +- src/corelib/statemachine/qabstracttransition.cpp | 4 +- src/corelib/statemachine/qeventtransition.cpp | 2 +- src/corelib/statemachine/qhistorystate.cpp | 2 +- src/corelib/statemachine/qsignaltransition.cpp | 2 +- src/corelib/statemachine/qstate.cpp | 20 +- src/corelib/statemachine/qstatemachine.cpp | 106 +++++----- src/corelib/text/qlocale.cpp | 8 +- src/corelib/text/qlocale_tools.cpp | 2 +- src/corelib/text/qregularexpression.cpp | 14 +- src/corelib/text/qtextboundaryfinder.cpp | 14 +- src/corelib/thread/qexception.cpp | 2 +- src/corelib/thread/qfutureinterface.cpp | 2 +- src/corelib/thread/qmutex.cpp | 6 +- src/corelib/thread/qmutex_linux.cpp | 4 +- src/corelib/thread/qorderedmutexlocker_p.h | 2 +- src/corelib/thread/qreadwritelock.cpp | 6 +- src/corelib/thread/qresultstore.cpp | 2 +- src/corelib/thread/qthread.cpp | 6 +- src/corelib/thread/qthread_unix.cpp | 24 +-- src/corelib/thread/qthreadstorage.cpp | 12 +- src/corelib/thread/qwaitcondition_unix.cpp | 2 +- src/corelib/time/qdatetime.cpp | 4 +- src/corelib/time/qdatetimeparser.cpp | 2 +- src/corelib/time/qtimezone.cpp | 2 +- src/corelib/time/qtimezoneprivate_icu.cpp | 12 +- src/corelib/time/qtimezoneprivate_tz.cpp | 2 +- src/corelib/tools/qarraydata.cpp | 2 +- src/corelib/tools/qeasingcurve.cpp | 18 +- src/dbus/qdbusabstractadaptor.cpp | 10 +- src/dbus/qdbusabstractinterface.cpp | 6 +- src/dbus/qdbusargument.cpp | 6 +- src/dbus/qdbusconnection.cpp | 32 +-- src/dbus/qdbuscontext.cpp | 4 +- src/dbus/qdbusdemarshaller.cpp | 2 +- src/dbus/qdbusintegrator.cpp | 84 ++++---- src/dbus/qdbusinterface.cpp | 4 +- src/dbus/qdbusinternalfilters.cpp | 2 +- src/dbus/qdbusmarshaller.cpp | 8 +- src/dbus/qdbusmessage.cpp | 28 +-- src/dbus/qdbusmetaobject.cpp | 20 +- src/dbus/qdbusmetatype.cpp | 12 +- src/dbus/qdbusmisc.cpp | 6 +- src/dbus/qdbuspendingcall.cpp | 6 +- src/dbus/qdbuspendingreply.cpp | 4 +- src/dbus/qdbusreply.cpp | 2 +- src/dbus/qdbusunixfiledescriptor.cpp | 4 +- src/dbus/qdbusutil.cpp | 16 +- src/gui/accessible/qaccessible.cpp | 20 +- src/gui/accessible/qaccessibleobject.cpp | 10 +- src/gui/accessible/qplatformaccessibility.cpp | 2 +- src/gui/animation/qguivariantanimation.cpp | 10 +- src/gui/image/qbmphandler.cpp | 4 +- src/gui/image/qicon.cpp | 16 +- src/gui/image/qiconloader.cpp | 2 +- src/gui/image/qimage.cpp | 46 ++-- src/gui/image/qimage_conversions.cpp | 8 +- src/gui/image/qimageiohandler.cpp | 2 +- src/gui/image/qimagereader.cpp | 12 +- src/gui/image/qimagereaderwriterhelpers.cpp | 6 +- src/gui/image/qimagewriter.cpp | 14 +- src/gui/image/qmovie.cpp | 2 +- src/gui/image/qpaintengine_pic.cpp | 6 +- src/gui/image/qpicture.cpp | 22 +- src/gui/image/qpixmap.cpp | 6 +- src/gui/image/qpixmap_blitter.cpp | 8 +- src/gui/image/qpixmapcache.cpp | 14 +- src/gui/image/qplatformpixmap.cpp | 2 +- src/gui/image/qpnghandler.cpp | 58 ++--- src/gui/image/qxpmhandler.cpp | 4 +- src/gui/itemmodels/qstandarditemmodel.cpp | 92 ++++---- 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 +- src/gui/opengl/qopengl.cpp | 2 +- src/gui/opengl/qopenglbuffer.cpp | 10 +- src/gui/opengl/qopenglcustomshaderstage.cpp | 8 +- src/gui/opengl/qopengldebug.cpp | 24 +-- src/gui/opengl/qopenglengineshadermanager.cpp | 20 +- src/gui/opengl/qopenglframebufferobject.cpp | 12 +- src/gui/opengl/qopenglfunctions.cpp | 6 +- src/gui/opengl/qopenglfunctions_1_0.cpp | 6 +- src/gui/opengl/qopenglfunctions_1_1.cpp | 10 +- src/gui/opengl/qopenglfunctions_1_2.cpp | 14 +- src/gui/opengl/qopenglfunctions_1_3.cpp | 18 +- src/gui/opengl/qopenglfunctions_1_4.cpp | 22 +- src/gui/opengl/qopenglfunctions_1_5.cpp | 24 +-- src/gui/opengl/qopenglfunctions_2_0.cpp | 26 +-- src/gui/opengl/qopenglfunctions_2_1.cpp | 28 +-- src/gui/opengl/qopenglfunctions_3_0.cpp | 30 +-- src/gui/opengl/qopenglfunctions_3_1.cpp | 22 +- .../opengl/qopenglfunctions_3_2_compatibility.cpp | 34 +-- src/gui/opengl/qopenglfunctions_3_2_core.cpp | 24 +-- .../opengl/qopenglfunctions_3_3_compatibility.cpp | 38 ++-- src/gui/opengl/qopenglfunctions_3_3_core.cpp | 26 +-- .../opengl/qopenglfunctions_4_0_compatibility.cpp | 40 ++-- src/gui/opengl/qopenglfunctions_4_0_core.cpp | 28 +-- .../opengl/qopenglfunctions_4_1_compatibility.cpp | 42 ++-- src/gui/opengl/qopenglfunctions_4_1_core.cpp | 30 +-- .../opengl/qopenglfunctions_4_2_compatibility.cpp | 44 ++-- src/gui/opengl/qopenglfunctions_4_2_core.cpp | 32 +-- .../opengl/qopenglfunctions_4_3_compatibility.cpp | 46 ++-- src/gui/opengl/qopenglfunctions_4_3_core.cpp | 34 +-- .../opengl/qopenglfunctions_4_4_compatibility.cpp | 48 ++--- src/gui/opengl/qopenglfunctions_4_4_core.cpp | 36 ++-- .../opengl/qopenglfunctions_4_5_compatibility.cpp | 52 ++--- src/gui/opengl/qopenglfunctions_4_5_core.cpp | 38 ++-- src/gui/opengl/qopenglpaintdevice.cpp | 2 +- src/gui/opengl/qopenglpaintengine.cpp | 20 +- src/gui/opengl/qopenglshaderprogram.cpp | 12 +- src/gui/opengl/qopengltexture.cpp | 32 +-- src/gui/opengl/qopengltextureglyphcache.cpp | 34 +-- src/gui/opengl/qopengltimerquery.cpp | 26 +-- src/gui/opengl/qopenglversionfunctions.cpp | 2 +- src/gui/opengl/qopenglversionfunctionsfactory.cpp | 2 +- src/gui/opengl/qopenglvertexarrayobject.cpp | 16 +- src/gui/painting/qblittable.cpp | 2 +- src/gui/painting/qbrush.cpp | 14 +- src/gui/painting/qcosmeticstroker.cpp | 6 +- src/gui/painting/qdrawhelper.cpp | 92 ++++---- src/gui/painting/qemulationpaintengine.cpp | 2 +- src/gui/painting/qimagescale.cpp | 4 +- src/gui/painting/qmemrotate.cpp | 6 +- src/gui/painting/qoutlinemapper.cpp | 2 +- src/gui/painting/qpagesize.cpp | 20 +- src/gui/painting/qpaintdevice.cpp | 6 +- src/gui/painting/qpaintengine.cpp | 12 +- src/gui/painting/qpaintengine_raster.cpp | 96 ++++----- src/gui/painting/qpaintengineex.cpp | 30 +-- src/gui/painting/qpainter.cpp | 54 ++--- src/gui/painting/qpainterpath.cpp | 6 +- src/gui/painting/qpathclipper.cpp | 10 +- src/gui/painting/qpathsimplifier.cpp | 42 ++-- src/gui/painting/qpdf.cpp | 18 +- src/gui/painting/qpdfwriter.cpp | 2 +- src/gui/painting/qpen.cpp | 2 +- src/gui/painting/qplatformbackingstore.cpp | 4 +- src/gui/painting/qrasterizer.cpp | 4 +- src/gui/painting/qregion.cpp | 74 +++---- src/gui/painting/qstroker.cpp | 10 +- src/gui/painting/qtextureglyphcache.cpp | 2 +- src/gui/painting/qtriangulatingstroker.cpp | 4 +- src/gui/painting/qtriangulator.cpp | 28 +-- src/gui/text/qabstracttextdocumentlayout.cpp | 2 +- src/gui/text/qdistancefield.cpp | 8 +- src/gui/text/qfont.cpp | 74 +++---- src/gui/text/qfontdatabase.cpp | 50 ++--- src/gui/text/qfontengine.cpp | 40 ++-- src/gui/text/qfontengine_qpf2.cpp | 8 +- src/gui/text/qfontmetrics.cpp | 82 ++++---- src/gui/text/qplatformfontdatabase.cpp | 2 +- src/gui/text/qrawfont.cpp | 6 +- src/gui/text/qstatictext.cpp | 4 +- src/gui/text/qsyntaxhighlighter.cpp | 4 +- src/gui/text/qtextcursor.cpp | 26 +-- src/gui/text/qtextdocument.cpp | 6 +- src/gui/text/qtextdocument_p.cpp | 18 +- src/gui/text/qtextdocumentfragment.cpp | 16 +- src/gui/text/qtextdocumentlayout.cpp | 24 +-- src/gui/text/qtextdocumentwriter.cpp | 6 +- src/gui/text/qtextengine.cpp | 44 ++-- src/gui/text/qtexthtmlparser.cpp | 6 +- src/gui/text/qtextimagehandler.cpp | 2 +- src/gui/text/qtextlayout.cpp | 8 +- src/gui/text/qtextobject.cpp | 16 +- src/gui/text/qtextodfwriter.cpp | 12 +- src/gui/text/qtextoption.cpp | 8 +- src/gui/text/qzip.cpp | 16 +- src/gui/util/qdesktopservices.cpp | 2 +- src/gui/util/qgridlayoutengine.cpp | 26 +-- src/gui/util/qtexturefiledata.cpp | 2 +- src/gui/vulkan/qvulkaninstance.cpp | 2 +- src/gui/vulkan/qvulkanwindow.cpp | 2 +- src/network/access/qabstractprotocolhandler.cpp | 2 +- src/network/access/qftp.cpp | 20 +- src/network/access/qhttpmultipart.cpp | 2 +- src/network/access/qhttpnetworkconnection.cpp | 16 +- .../access/qhttpnetworkconnectionchannel.cpp | 20 +- src/network/access/qhttpnetworkreply.cpp | 10 +- src/network/access/qhttpnetworkrequest.cpp | 2 +- src/network/access/qhttpprotocolhandler.cpp | 4 +- src/network/access/qhttpthreaddelegate.cpp | 18 +- .../access/qnetworkaccessauthenticationmanager.cpp | 2 +- src/network/access/qnetworkaccessbackend.cpp | 10 +- src/network/access/qnetworkaccesscache.cpp | 22 +- .../access/qnetworkaccessdebugpipebackend.cpp | 6 +- src/network/access/qnetworkaccessfilebackend.cpp | 6 +- src/network/access/qnetworkaccessftpbackend.cpp | 12 +- src/network/access/qnetworkcookie.cpp | 2 +- src/network/access/qnetworkdiskcache.cpp | 22 +- src/network/access/qnetworkreplyfileimpl.cpp | 2 +- src/network/access/qnetworkreplyimpl.cpp | 26 +-- src/network/access/qnetworkrequest.cpp | 6 +- src/network/access/qspdyprotocolhandler.cpp | 14 +- src/network/bearer/qnetworkconfigmanager.cpp | 2 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 4 +- src/network/bearer/qnetworkconfiguration.cpp | 2 +- src/network/bearer/qnetworksession.cpp | 2 +- src/network/kernel/qauthenticator.cpp | 10 +- src/network/kernel/qdnslookup.cpp | 4 +- src/network/kernel/qdnslookup_unix.cpp | 8 +- src/network/kernel/qhostaddress.cpp | 2 +- src/network/kernel/qhostinfo.cpp | 4 +- src/network/kernel/qhostinfo_unix.cpp | 8 +- src/network/kernel/qnetworkinterface.cpp | 2 +- src/network/kernel/qnetworkproxy.cpp | 12 +- src/network/kernel/qurlinfo.cpp | 10 +- src/network/socket/qabstractsocket.cpp | 6 +- src/network/socket/qabstractsocketengine.cpp | 6 +- src/network/socket/qhttpsocketengine.cpp | 16 +- src/network/socket/qlocalserver.cpp | 2 +- src/network/socket/qlocalserver_unix.cpp | 2 +- src/network/socket/qlocalsocket.cpp | 2 +- src/network/socket/qlocalsocket_unix.cpp | 8 +- src/network/socket/qnativesocketengine.cpp | 12 +- src/network/socket/qnativesocketengine_unix.cpp | 6 +- src/network/socket/qsocks5socketengine.cpp | 28 +-- src/network/socket/qtcpserver.cpp | 6 +- .../nativecontexts/qglxnativecontext.h | 6 +- .../eglconvenience/qeglconvenience.cpp | 6 +- .../eglconvenience/qeglplatformcontext.cpp | 10 +- .../fontconfig/qfontconfigdatabase.cpp | 72 +++---- .../fontconfig/qfontenginemultifontconfig.cpp | 4 +- .../fontdatabases/freetype/qfontengine_ft.cpp | 84 ++++---- .../glxconvenience/qglxconvenience.cpp | 4 +- .../input/integrityhid/qintegrityhidmanager.h | 2 +- src/plugins/bearer/qnetworksession_impl.cpp | 6 +- src/plugins/imageformats/gif/qgifhandler.cpp | 12 +- src/plugins/imageformats/jpeg/qjpeghandler.cpp | 8 +- src/plugins/platforms/eglfs/api/qeglfscontext.cpp | 2 +- src/plugins/platforms/eglfs/api/qeglfscursor.cpp | 2 +- .../platforms/eglfs/api/qeglfsintegration.cpp | 18 +- .../platforms/eglfs/api/qeglfsoffscreenwindow.cpp | 2 +- src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 4 +- src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 8 +- .../eglfs_kms/qeglfskmsgbmcursor.cpp | 4 +- .../eglfs_x11/qeglfsx11integration.cpp | 16 +- .../eglfs_x11/qeglfsx11integration.h | 2 +- src/plugins/platforms/eglfs/qeglfsmain.cpp | 2 +- src/plugins/platforms/offscreen/main.cpp | 2 +- .../platforms/offscreen/qoffscreencommon.cpp | 10 +- .../platforms/offscreen/qoffscreenintegration.cpp | 2 +- .../offscreen/qoffscreenintegration_x11.cpp | 12 +- .../platforms/offscreen/qoffscreenwindow.cpp | 2 +- src/plugins/platforms/vnc/main.cpp | 2 +- src/plugins/platforms/vnc/qvnc.cpp | 4 +- src/plugins/platforms/vnc/qvncclient.cpp | 2 +- src/plugins/platforms/vnc/qvncscreen.cpp | 2 +- .../xcb/gl_integrations/xcb_egl/qxcbeglcontext.h | 2 +- .../xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp | 2 +- .../gl_integrations/xcb_glx/qglxintegration.cpp | 52 ++--- .../gl_integrations/xcb_glx/qxcbglxintegration.cpp | 4 +- src/plugins/platforms/xcb/qxcbatom.cpp | 2 +- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 12 +- src/plugins/platforms/xcb/qxcbclipboard.cpp | 22 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 16 +- src/plugins/platforms/xcb/qxcbconnection.h | 2 +- src/plugins/platforms/xcb/qxcbconnection_basic.cpp | 4 +- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 +- src/plugins/platforms/xcb/qxcbcursor.cpp | 36 ++-- src/plugins/platforms/xcb/qxcbdrag.cpp | 20 +- src/plugins/platforms/xcb/qxcbimage.cpp | 8 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 4 +- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 4 +- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 10 +- src/plugins/platforms/xcb/qxcbscreen.cpp | 10 +- src/plugins/platforms/xcb/qxcbsessionmanager.cpp | 24 +-- .../platforms/xcb/qxcbsystemtraytracker.cpp | 4 +- src/plugins/platforms/xcb/qxcbvulkaninstance.cpp | 2 +- src/plugins/platforms/xcb/qxcbvulkanwindow.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 18 +- src/plugins/platforms/xcb/qxcbxsettings.cpp | 2 +- src/plugins/platformthemes/gtk3/main.cpp | 2 +- .../platformthemes/gtk3/qgtk3dialoghelpers.cpp | 8 +- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 4 +- src/plugins/platformthemes/gtk3/qgtk3theme.cpp | 10 +- src/plugins/sqldrivers/mysql/qsql_mysql_p.h | 4 +- src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h | 4 +- src/plugins/sqldrivers/tds/qsql_tds_p.h | 4 +- src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 2 +- src/printsupport/dialogs/qprintdialog_unix.cpp | 2 +- src/printsupport/kernel/qpaintengine_alpha.cpp | 12 +- src/printsupport/kernel/qplatformprintplugin.h | 2 +- src/printsupport/kernel/qprinter_p.h | 10 +- src/sql/kernel/qsqldatabase.cpp | 6 +- src/sql/kernel/qsqldriver.cpp | 2 +- src/sql/models/qsqlrelationaltablemodel.cpp | 14 +- src/tools/moc/generator.cpp | 2 +- src/tools/moc/parser.cpp | 2 +- src/tools/moc/preprocessor.cpp | 2 +- src/widgets/accessible/complexwidgets.cpp | 18 +- src/widgets/accessible/itemviews.cpp | 50 ++--- src/widgets/accessible/qaccessiblemenu.cpp | 14 +- src/widgets/accessible/qaccessiblewidget.cpp | 8 +- .../accessible/qaccessiblewidgetfactory.cpp | 6 +- src/widgets/accessible/qaccessiblewidgets.cpp | 28 +-- src/widgets/accessible/simplewidgets.cpp | 4 +- src/widgets/dialogs/qcolordialog.cpp | 22 +- src/widgets/dialogs/qdialog.cpp | 14 +- src/widgets/dialogs/qerrormessage.cpp | 10 +- src/widgets/dialogs/qfiledialog.cpp | 44 ++-- src/widgets/dialogs/qfilesystemmodel.cpp | 6 +- src/widgets/dialogs/qfontdialog.cpp | 20 +- src/widgets/dialogs/qinputdialog.cpp | 10 +- src/widgets/dialogs/qmessagebox.cpp | 56 ++--- src/widgets/dialogs/qprogressdialog.cpp | 22 +- src/widgets/dialogs/qsidebar.cpp | 6 +- src/widgets/dialogs/qwizard.cpp | 38 ++-- src/widgets/effects/qgraphicseffect.cpp | 2 +- src/widgets/effects/qpixmapfilter.cpp | 10 +- src/widgets/graphicsview/qgraphicsanchorlayout.cpp | 4 +- .../graphicsview/qgraphicsanchorlayout_p.cpp | 50 ++--- src/widgets/graphicsview/qgraphicsgridlayout.cpp | 8 +- src/widgets/graphicsview/qgraphicsitem.cpp | 84 ++++---- .../graphicsview/qgraphicsitemanimation.cpp | 2 +- src/widgets/graphicsview/qgraphicslayout_p.cpp | 2 +- src/widgets/graphicsview/qgraphicslayoutitem.cpp | 2 +- .../graphicsview/qgraphicslayoutstyleinfo.cpp | 2 +- src/widgets/graphicsview/qgraphicslinearlayout.cpp | 10 +- src/widgets/graphicsview/qgraphicsproxywidget.cpp | 52 ++--- src/widgets/graphicsview/qgraphicsscene.cpp | 144 ++++++------- src/widgets/graphicsview/qgraphicssceneevent.cpp | 6 +- src/widgets/graphicsview/qgraphicstransform.cpp | 4 +- src/widgets/graphicsview/qgraphicsview.cpp | 30 +-- src/widgets/graphicsview/qgraphicswidget.cpp | 24 +-- src/widgets/graphicsview/qgraphicswidget_p.cpp | 8 +- src/widgets/graphicsview/qsimplex_p.cpp | 10 +- src/widgets/itemviews/qabstractitemdelegate.cpp | 2 +- src/widgets/itemviews/qabstractitemview.cpp | 48 ++--- src/widgets/itemviews/qcolumnview.cpp | 12 +- src/widgets/itemviews/qdatawidgetmapper.cpp | 8 +- src/widgets/itemviews/qdirmodel.cpp | 20 +- src/widgets/itemviews/qheaderview.cpp | 18 +- src/widgets/itemviews/qitemdelegate.cpp | 18 +- src/widgets/itemviews/qitemeditorfactory.cpp | 14 +- src/widgets/itemviews/qlistview.cpp | 14 +- src/widgets/itemviews/qlistwidget.cpp | 22 +- src/widgets/itemviews/qstyleditemdelegate.cpp | 10 +- src/widgets/itemviews/qtablewidget.cpp | 60 +++--- src/widgets/itemviews/qtreeview.cpp | 18 +- src/widgets/itemviews/qtreewidget.cpp | 56 ++--- src/widgets/itemviews/qtreewidgetitemiterator.cpp | 16 +- src/widgets/kernel/qaction.cpp | 2 +- src/widgets/kernel/qactiongroup.cpp | 6 +- src/widgets/kernel/qapplication.cpp | 174 +++++++-------- src/widgets/kernel/qboxlayout.cpp | 20 +- src/widgets/kernel/qdesktopwidget.cpp | 2 +- src/widgets/kernel/qformlayout.cpp | 70 +++--- src/widgets/kernel/qgesture.cpp | 4 +- src/widgets/kernel/qgesturemanager.cpp | 18 +- src/widgets/kernel/qgridlayout.cpp | 28 +-- src/widgets/kernel/qlayout.cpp | 26 +-- src/widgets/kernel/qlayoutengine.cpp | 2 +- src/widgets/kernel/qlayoutitem.cpp | 4 +- src/widgets/kernel/qopenglwidget.cpp | 26 +-- src/widgets/kernel/qstackedlayout.cpp | 14 +- src/widgets/kernel/qtooltip.cpp | 16 +- src/widgets/kernel/qwhatsthis.cpp | 16 +- src/widgets/kernel/qwidget.cpp | 190 ++++++++--------- src/widgets/kernel/qwidget_p.h | 2 +- src/widgets/kernel/qwidgetaction.cpp | 8 +- src/widgets/kernel/qwidgetrepaintmanager.cpp | 16 +- src/widgets/kernel/qwidgetsvariant.cpp | 6 +- src/widgets/kernel/qwidgetwindow.cpp | 34 +-- src/widgets/kernel/qwindowcontainer.cpp | 10 +- src/widgets/statemachine/qguistatemachine.cpp | 2 +- src/widgets/styles/qcommonstyle.cpp | 30 +-- src/widgets/styles/qproxystyle.cpp | 2 +- src/widgets/styles/qstylefactory.cpp | 2 +- src/widgets/styles/qstylehelper.cpp | 2 +- src/widgets/styles/qstyleoption.cpp | 6 +- src/widgets/styles/qstylesheetstyle.cpp | 110 +++++----- src/widgets/util/qcolormap.cpp | 4 +- src/widgets/util/qcompleter.cpp | 2 +- src/widgets/util/qflickgesture.cpp | 36 ++-- src/widgets/util/qscroller.cpp | 10 +- src/widgets/util/qscrollerproperties.cpp | 6 +- src/widgets/util/qsystemtrayicon.cpp | 8 +- src/widgets/util/qsystemtrayicon_x11.cpp | 4 +- src/widgets/util/qundogroup.cpp | 26 +-- src/widgets/util/qundostack.cpp | 18 +- src/widgets/util/qundoview.cpp | 32 +-- src/widgets/widgets/qabstractbutton.cpp | 10 +- src/widgets/widgets/qabstractscrollarea.cpp | 22 +- src/widgets/widgets/qabstractspinbox.cpp | 10 +- src/widgets/widgets/qbuttongroup.cpp | 6 +- src/widgets/widgets/qcalendarwidget.cpp | 38 ++-- src/widgets/widgets/qdatetimeedit.cpp | 6 +- src/widgets/widgets/qdialogbuttonbox.cpp | 22 +- src/widgets/widgets/qdockarealayout.cpp | 234 ++++++++++----------- src/widgets/widgets/qdockwidget.cpp | 80 +++---- src/widgets/widgets/qeffects.cpp | 14 +- src/widgets/widgets/qfocusframe.cpp | 18 +- src/widgets/widgets/qgroupbox.cpp | 4 +- src/widgets/widgets/qlcdnumber.cpp | 6 +- src/widgets/widgets/qlineedit.cpp | 14 +- src/widgets/widgets/qlineedit_p.cpp | 6 +- src/widgets/widgets/qlineedit_p.h | 2 +- src/widgets/widgets/qmainwindow.cpp | 16 +- src/widgets/widgets/qmainwindowlayout.cpp | 88 ++++---- src/widgets/widgets/qmdiarea.cpp | 68 +++--- src/widgets/widgets/qmdisubwindow.cpp | 96 ++++----- src/widgets/widgets/qmenu.cpp | 156 +++++++------- src/widgets/widgets/qmenubar.cpp | 112 +++++----- src/widgets/widgets/qplaintextedit.cpp | 10 +- src/widgets/widgets/qpushbutton.cpp | 6 +- src/widgets/widgets/qscrollarea.cpp | 6 +- src/widgets/widgets/qscrollbar.cpp | 18 +- src/widgets/widgets/qsizegrip.cpp | 2 +- src/widgets/widgets/qsplashscreen.cpp | 6 +- src/widgets/widgets/qsplitter.cpp | 4 +- src/widgets/widgets/qstackedwidget.cpp | 2 +- src/widgets/widgets/qstatusbar.cpp | 22 +- src/widgets/widgets/qtabbar.cpp | 42 ++-- src/widgets/widgets/qtabbar_p.h | 4 +- src/widgets/widgets/qtabwidget.cpp | 10 +- src/widgets/widgets/qtextedit.cpp | 2 +- src/widgets/widgets/qtoolbar.cpp | 62 +++--- src/widgets/widgets/qtoolbararealayout.cpp | 40 ++-- src/widgets/widgets/qtoolbarlayout.cpp | 34 +-- src/widgets/widgets/qtoolbox.cpp | 16 +- src/widgets/widgets/qtoolbutton.cpp | 14 +- src/widgets/widgets/qwidgetanimator.cpp | 2 +- src/widgets/widgets/qwidgetlinecontrol.cpp | 2 +- src/widgets/widgets/qwidgettextcontrol.cpp | 12 +- 502 files changed, 4329 insertions(+), 4329 deletions(-) (limited to 'src') diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 46b01449d4..b7136dc055 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -220,7 +220,7 @@ QUnifiedTimer::QUnifiedTimer() : QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), currentAnimationIdx(0), insideTick(false), insideRestart(false), consistentTiming(false), slowMode(false), startTimersPending(false), stopTimerPending(false), - slowdownFactor(5.0f), profilerCallback(0), + slowdownFactor(5.0f), profilerCallback(nullptr), driverStartTime(0), temporalDrift(0) { time.invalidate(); @@ -922,7 +922,7 @@ qint64 QAnimationDriver::elapsed() const The default animation driver just spins the timer... */ QDefaultAnimationDriver::QDefaultAnimationDriver(QUnifiedTimer *timer) - : QAnimationDriver(0), m_unified_timer(timer) + : QAnimationDriver(nullptr), m_unified_timer(timer) { connect(this, SIGNAL(started()), this, SLOT(startTimer())); connect(this, SIGNAL(stopped()), this, SLOT(stopTimer())); @@ -1035,7 +1035,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) \sa QVariantAnimation, QAnimationGroup */ QAbstractAnimation::QAbstractAnimation(QObject *parent) - : QObject(*new QAbstractAnimationPrivate, 0) + : QObject(*new QAbstractAnimationPrivate, nullptr) { // Allow auto-add on reparent setParent(parent); @@ -1045,7 +1045,7 @@ QAbstractAnimation::QAbstractAnimation(QObject *parent) \internal */ QAbstractAnimation::QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent) - : QObject(dd, 0) + : QObject(dd, nullptr) { // Allow auto-add on reparent setParent(parent); diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp index 69e2cfc9bc..729f55d68f 100644 --- a/src/corelib/animation/qanimationgroup.cpp +++ b/src/corelib/animation/qanimationgroup.cpp @@ -133,7 +133,7 @@ QAbstractAnimation *QAnimationGroup::animationAt(int index) const if (index < 0 || index >= d->animations.size()) { qWarning("QAnimationGroup::animationAt: index is out of bounds"); - return 0; + return nullptr; } return d->animations.at(index); @@ -243,14 +243,14 @@ QAbstractAnimation *QAnimationGroup::takeAnimation(int index) Q_D(QAnimationGroup); if (index < 0 || index >= d->animations.size()) { qWarning("QAnimationGroup::takeAnimation: no animation at index %d", index); - return 0; + return nullptr; } QAbstractAnimation *animation = d->animations.at(index); - QAbstractAnimationPrivate::get(animation)->group = 0; + QAbstractAnimationPrivate::get(animation)->group = nullptr; // ### removing from list before doing setParent to avoid inifinite recursion // in ChildRemoved event d->animations.removeAt(index); - animation->setParent(0); + animation->setParent(nullptr); d->animationRemoved(index, animation); return animation; } diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 2a3572d441..c71a77e073 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -259,7 +259,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState, QVariantAnimation::updateState(newState, oldState); - QPropertyAnimation *animToStop = 0; + QPropertyAnimation *animToStop = nullptr; { static QBasicMutex mutex; auto locker = qt_unique_lock(mutex); diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 66e346a2fe..98ac04a14f 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -282,7 +282,7 @@ QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs) if (index < 0 || index > d->animations.size()) { qWarning("QSequentialAnimationGroup::insertPause: index is out of bounds"); - return 0; + return nullptr; } QPauseAnimation *pause = new QPauseAnimation(msecs); @@ -430,7 +430,7 @@ void QSequentialAnimationGroupPrivate::setCurrentAnimation(int index, bool inter if (index == -1) { Q_ASSERT(animations.isEmpty()); currentAnimationIndex = -1; - currentAnimation = 0; + currentAnimation = nullptr; return; } @@ -503,7 +503,7 @@ void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished() */ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) { - if (currentAnimation == 0) + if (currentAnimation == nullptr) setCurrentAnimation(0); // initialize the current animation if (currentAnimationIndex == index diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 216c015732..98b02f0202 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -209,7 +209,7 @@ void QVariantAnimationPrivate::updateInterpolator() if (type == currentInterval.end.second.userType()) interpolator = getInterpolator(type); else - interpolator = 0; + interpolator = nullptr; //we make sure that the interpolator is always set to something if (!interpolator) @@ -445,7 +445,7 @@ QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int in { QInterpolatorVector *interpolators = registeredInterpolators(); const auto locker = qt_scoped_lock(registeredInterpolatorsMutex); - QVariantAnimation::Interpolator ret = 0; + QVariantAnimation::Interpolator ret = nullptr; if (interpolationType < interpolators->count()) { ret = interpolators->at(interpolationType); if (ret) return ret; @@ -479,7 +479,7 @@ QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int in case QMetaType::QRectF: return castToInterpolator(_q_interpolateVariant); default: - return 0; //this type is not handled + return nullptr; //this type is not handled } } diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp index 5a778c2638..f9092277b2 100644 --- a/src/corelib/codecs/qicucodec.cpp +++ b/src/corelib/codecs/qicucodec.cpp @@ -381,7 +381,7 @@ static QTextCodec *loadQtCodec(const char *name) return QIsciiCodec::create(name); #endif - return 0; + return nullptr; } /// \threadsafe @@ -438,7 +438,7 @@ QTextCodec *QIcuCodec::defaultCodecUnlocked() { QCoreGlobalData *globalData = QCoreGlobalData::instance(); if (!globalData) - return 0; + return nullptr; QTextCodec *c = globalData->codecForLocale.loadAcquire(); if (c) return c; @@ -523,13 +523,13 @@ QTextCodec *QIcuCodec::codecForNameUnlocked(const char *name) return c; if (qt_only) - return 0; + return nullptr; // check whether there is really a converter for the name available. UConverter *conv = ucnv_open(standardName, &error); if (!conv) { qDebug("codecForName: ucnv_open failed %s %s", standardName, u_errorName(error)); - return 0; + return nullptr; } //qDebug() << "QIcuCodec: Standard name for " << name << "is" << standardName; ucnv_close(conv); @@ -552,7 +552,7 @@ QTextCodec *QIcuCodec::codecForMibUnlocked(int mib) if (mib == 2107) return codecForNameUnlocked("TSCII"); - return 0; + return nullptr; } @@ -567,7 +567,7 @@ QIcuCodec::~QIcuCodec() UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const { - UConverter *conv = 0; + UConverter *conv = nullptr; if (state) { if (!state->d) { // first time @@ -609,7 +609,7 @@ QString QIcuCodec::convertToUnicode(const char *chars, int length, QTextCodec::C ucnv_toUnicode(conv, &uc, ucEnd, &chars, end, - 0, false, &error); + nullptr, false, &error); if (!U_SUCCESS(error) && error != U_BUFFER_OVERFLOW_ERROR) { qDebug("convertToUnicode failed: %s", u_errorName(error)); break; @@ -646,7 +646,7 @@ QByteArray QIcuCodec::convertFromUnicode(const QChar *unicode, int length, QText ucnv_fromUnicode(conv, &ch, chEnd, &uc, end, - 0, false, &error); + nullptr, false, &error); if (!U_SUCCESS(error)) qDebug("convertFromUnicode failed: %s", u_errorName(error)); convertedChars = ch - string.data(); diff --git a/src/corelib/codecs/qisciicodec.cpp b/src/corelib/codecs/qisciicodec.cpp index d9a86d77c7..9689818559 100644 --- a/src/corelib/codecs/qisciicodec.cpp +++ b/src/corelib/codecs/qisciicodec.cpp @@ -74,7 +74,7 @@ QTextCodec *QIsciiCodec::create(const char *name) if (qTextCodecNameMatch(name, codecs[i].name)) return new QIsciiCodec(i); } - return 0; + return nullptr; } QIsciiCodec::~QIsciiCodec() diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp index 16a9b8a7c3..4e82620003 100644 --- a/src/corelib/codecs/qsimplecodec.cpp +++ b/src/corelib/codecs/qsimplecodec.cpp @@ -51,7 +51,7 @@ static const struct { quint16 values[128]; } unicodevalues[QSimpleTextCodec::numSimpleCodecs] = { // from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt - { "KOI8-R", { "csKOI8R", 0 }, 2084, + { "KOI8-R", { "csKOI8R", nullptr }, 2084, { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248, @@ -72,7 +72,7 @@ static const struct { // it should be 0x2022 (BULLET). // from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt - { "KOI8-U", { "KOI8-RU", 0 }, 2088, + { "KOI8-U", { "KOI8-RU", nullptr }, 2088, { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, @@ -97,7 +97,7 @@ static const struct { // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do (awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done // then I inserted the files manually. - { "ISO-8859-2", {"latin2", "iso-ir-101", "csISOLatin2", 0 }, 5, + { "ISO-8859-2", {"latin2", "iso-ir-101", "csISOLatin2", nullptr }, 5, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -114,7 +114,7 @@ static const struct { 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, - { "ISO-8859-3", { "latin3", "iso-ir-109", "csISOLatin3", 0 }, 6, + { "ISO-8859-3", { "latin3", "iso-ir-109", "csISOLatin3", nullptr }, 6, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -131,7 +131,7 @@ static const struct { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} }, - { "ISO-8859-4", { "latin4", "iso-ir-110", "csISOLatin4", 0 }, 7, + { "ISO-8859-4", { "latin4", "iso-ir-110", "csISOLatin4", nullptr }, 7, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -148,7 +148,7 @@ static const struct { 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} }, - { "ISO-8859-5", { "cyrillic", "iso-ir-144", "csISOLatinCyrillic", 0 }, 8, + { "ISO-8859-5", { "cyrillic", "iso-ir-144", "csISOLatinCyrillic", nullptr }, 8, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -165,7 +165,7 @@ static const struct { 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} }, - { "ISO-8859-6", { "ISO-8859-6-I", "ECMA-114", "ASMO-708", "arabic", "iso-ir-127", "csISOLatinArabic", 0 }, 82, + { "ISO-8859-6", { "ISO-8859-6-I", "ECMA-114", "ASMO-708", "arabic", "iso-ir-127", "csISOLatinArabic", nullptr }, 82, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -182,7 +182,7 @@ static const struct { 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, - { "ISO-8859-7", { "ECMA-118", "greek", "iso-ir-126", "csISOLatinGreek", 0 }, 10, + { "ISO-8859-7", { "ECMA-118", "greek", "iso-ir-126", "csISOLatinGreek", nullptr }, 10, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -199,7 +199,7 @@ static const struct { 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, - { "ISO-8859-8", { "ISO 8859-8-I", "iso-ir-138", "hebrew", "csISOLatinHebrew", 0 }, 85, + { "ISO-8859-8", { "ISO 8859-8-I", "iso-ir-138", "hebrew", "csISOLatinHebrew", nullptr }, 85, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -216,7 +216,7 @@ static const struct { 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, - { "ISO-8859-9", { "iso-ir-148", "latin5", "csISOLatin5", 0 }, 12, + { "ISO-8859-9", { "iso-ir-148", "latin5", "csISOLatin5", nullptr }, 12, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -233,7 +233,7 @@ static const struct { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, - { "ISO-8859-10", { "iso-ir-157", "latin6", "ISO-8859-10:1992", "csISOLatin6", 0 }, 13, + { "ISO-8859-10", { "iso-ir-157", "latin6", "ISO-8859-10:1992", "csISOLatin6", nullptr }, 13, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -250,7 +250,7 @@ static const struct { 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} }, - { "ISO-8859-13", { 0 }, 109, + { "ISO-8859-13", { nullptr }, 109, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -267,7 +267,7 @@ static const struct { 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} }, - { "ISO-8859-14", { "iso-ir-199", "latin8", "iso-celtic", 0 }, 110, + { "ISO-8859-14", { "iso-ir-199", "latin8", "iso-celtic", nullptr }, 110, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -284,7 +284,7 @@ static const struct { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} }, - { "ISO-8859-16", { "iso-ir-226", "latin10", 0 }, 112, + { "ISO-8859-16", { "iso-ir-226", "latin10", nullptr }, 112, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, @@ -305,7 +305,7 @@ static const struct { // next bits generated again from tables on the Unicode 3.0 CD. // $ for a in CP* ; do (awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done - { "IBM850", { "CP850", "csPC850Multilingual", 0 }, 2009, + { "IBM850", { "CP850", "csPC850Multilingual", nullptr }, 2009, { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, @@ -322,7 +322,7 @@ static const struct { 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0} }, - { "IBM874", { "CP874", 0 }, -874, //### what is the mib? + { "IBM874", { "CP874", nullptr }, -874, //### what is the mib? { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -339,7 +339,7 @@ static const struct { 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, - { "IBM866", { "CP866", "csIBM866", 0 }, 2086, + { "IBM866", { "CP866", "csIBM866", nullptr }, 2086, { 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, @@ -357,7 +357,7 @@ static const struct { 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0} }, - { "windows-1250", { "CP1250", 0 }, 2250, + { "windows-1250", { "CP1250", nullptr }, 2250, { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, 0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -374,7 +374,7 @@ static const struct { 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, - { "windows-1251", { "CP1251", 0 }, 2251, + { "windows-1251", { "CP1251", nullptr }, 2251, { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -391,7 +391,7 @@ static const struct { 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F} }, - { "windows-1252", { "CP1252", 0 }, 2252, + { "windows-1252", { "CP1252", nullptr }, 2252, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -408,7 +408,7 @@ static const struct { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, - { "windows-1253", {"CP1253", 0 }, 2253, + { "windows-1253", {"CP1253", nullptr }, 2253, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -425,7 +425,7 @@ static const struct { 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, - { "windows-1254", { "CP1254", 0 }, 2254, + { "windows-1254", { "CP1254", nullptr }, 2254, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -442,7 +442,7 @@ static const struct { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, - { "windows-1255", { "CP1255", 0 }, 2255, + { "windows-1255", { "CP1255", nullptr }, 2255, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -459,7 +459,7 @@ static const struct { 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD} }, - { "windows-1256", { "CP1256", 0 }, 2256, + { "windows-1256", { "CP1256", nullptr }, 2256, { 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -476,7 +476,7 @@ static const struct { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2} }, - { "windows-1257", { "CP1257", 0 }, 2257, + { "windows-1257", { "CP1257", nullptr }, 2257, { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0x00A8, 0x02C7, 0x00B8, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -493,7 +493,7 @@ static const struct { 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9} }, - { "windows-1258", { "CP1258", 0 }, 2258, + { "windows-1258", { "CP1258", nullptr }, 2258, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0xFFFD, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -511,7 +511,7 @@ static const struct { 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} }, - { "macintosh", { "Apple Roman", "MacRoman", 0 }, 2027, + { "macintosh", { "Apple Roman", "MacRoman", nullptr }, 2027, { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, @@ -532,7 +532,7 @@ static const struct { // This one is based on the charmap file // /usr/share/i18n/charmaps/SAMI-WS2.gz, which is manually adapted // to this format by Boerre Gaup - { "WINSAMI2", { "WS2", 0 }, -165, + { "WINSAMI2", { "WS2", nullptr }, -165, { 0x20AC, 0xFFFD, 0x010C, 0x0192, 0x010D, 0x01B7, 0x0292, 0x01EE, 0x01EF, 0x0110, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -555,7 +555,7 @@ static const struct { // to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too. // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; (cut -c25- < TIS-620 ; cat /tmp/digits) | awk '/^x[89ABCDEF]/{ print $1, $2 }' | sed -e 's///' | sort | uniq -w4 | cut -c5- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/tis-620 - { "TIS-620", { "ISO 8859-11", 0 }, 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent) + { "TIS-620", { "ISO 8859-11", nullptr }, 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent) { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -582,7 +582,7 @@ static const struct { Alias: r8 Alias: csHPRoman8 */ - { "hp-roman8", { "roman8", "csHPRoman8", 0 }, 2004, + { "hp-roman8", { "roman8", "csHPRoman8", nullptr }, 2004, { 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, @@ -603,7 +603,7 @@ static const struct { // if you add more chacater sets at the end, change LAST_MIB above }; -QSimpleTextCodec::QSimpleTextCodec(int i) : forwardIndex(i), reverseMap(0) +QSimpleTextCodec::QSimpleTextCodec(int i) : forwardIndex(i), reverseMap(nullptr) { } @@ -640,7 +640,7 @@ static QByteArray *buildReverseMap(int forwardIndex) QString QSimpleTextCodec::convertToUnicode(const char* chars, int len, ConverterState *) const { - if (len <= 0 || chars == 0) + if (len <= 0 || chars == nullptr) return QString(); const unsigned char * c = (const unsigned char *)chars; @@ -665,7 +665,7 @@ QByteArray QSimpleTextCodec::convertFromUnicode(const QChar *in, int length, Con QByteArray *rmap = reverseMap.loadAcquire(); if (!rmap){ rmap = buildReverseMap(this->forwardIndex); - if (!reverseMap.testAndSetRelease(0, rmap)) { + if (!reverseMap.testAndSetRelease(nullptr, rmap)) { delete rmap; rmap = reverseMap.loadAcquire(); } diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1ebffd9f49..ecd26233cd 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -124,12 +124,12 @@ public: QLibrarySettings *ls = qt_library_settings(); if (ls) { #ifndef QT_BUILD_QMAKE - if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != 0) + if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != nullptr) ls->load(); #endif return ls->settings.data(); } else { - return 0; + return nullptr; } } }; @@ -146,7 +146,7 @@ void QLibrarySettings::load() // If we get any settings here, those won't change when the application shows up. settings.reset(QLibraryInfoPrivate::findConfiguration()); #ifndef QT_BUILD_QMAKE - reloadOnQAppAvailable = (settings.data() == 0 && QCoreApplication::instance() == 0); + reloadOnQAppAvailable = (settings.data() == nullptr && QCoreApplication::instance() == nullptr); bool haveDevicePaths; bool haveEffectivePaths; bool havePaths; @@ -169,7 +169,7 @@ void QLibrarySettings::load() || children.contains(QLatin1String("Paths")); #ifndef QT_BUILD_QMAKE if (!havePaths) - settings.reset(0); + settings.reset(nullptr); #else } else { haveDevicePaths = false; @@ -212,7 +212,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() return new QSettings(qtconfig, QSettings::IniFormat); } #endif - return 0; //no luck + return nullptr; //no luck } #endif // settings @@ -750,7 +750,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) // will binary-patch the Qt installation paths -- in such scenarios, Qt // will be built with a dummy path, thus the compile-time result of // strlen is meaningless. - const char * volatile path = 0; + const char * volatile path = nullptr; if (loc == PrefixPath) { path = getPrefix( #ifdef QT_BUILD_QMAKE diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 17f2246082..c9209bd8e3 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1315,7 +1315,7 @@ static QStringList backtraceFramesForLogMessage(int frameCount) if (function.startsWith(QLatin1String("_Z"))) { QScopedPointer demangled( - abi::__cxa_demangle(function.toUtf8(), 0, 0, 0)); + abi::__cxa_demangle(function.toUtf8(), nullptr, nullptr, nullptr)); if (demangled) function = QString::fromUtf8(qCleanupFuncinfo(demangled.data())); } diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 95f03ef816..5320ae2986 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -251,7 +251,7 @@ QFile::QFile(QFilePrivate &dd) Constructs a QFile object. */ QFile::QFile() - : QFileDevice(*new QFilePrivate, 0) + : QFileDevice(*new QFilePrivate, nullptr) { } /*! @@ -265,7 +265,7 @@ QFile::QFile(QObject *parent) Constructs a new file object to represent the file with the given \a name. */ QFile::QFile(const QString &name) - : QFileDevice(*new QFilePrivate, 0) + : QFileDevice(*new QFilePrivate, nullptr) { Q_D(QFile); d->fileName = name; diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index ee619d99cc..b0aba3193c 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -202,7 +202,7 @@ QFileDevice::QFileDevice(QFileDevicePrivate &dd) \internal */ QFileDevice::QFileDevice() - : QIODevice(*new QFileDevicePrivate, 0) + : QIODevice(*new QFileDevicePrivate, nullptr) { } /*! diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index c3abec8989..2e81f93bcf 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -1076,14 +1076,14 @@ bool QFileSystemEngine::cloneFile(int srcfd, int dstfd, const QFileSystemMetaDat // sendfile(2) is limited in the kernel to 2G - 4k const size_t SendfileSize = 0x7ffff000; - ssize_t n = ::sendfile(dstfd, srcfd, NULL, SendfileSize); + ssize_t n = ::sendfile(dstfd, srcfd, nullptr, SendfileSize); if (n == -1) { // if we got an error here, give up and try at an upper layer return false; } while (n) { - n = ::sendfile(dstfd, srcfd, NULL, SendfileSize); + n = ::sendfile(dstfd, srcfd, nullptr, SendfileSize); if (n == -1) { // uh oh, this is probably a real error (like ENOSPC), but we have // no way to notify QFile of partial success, so just erase any work diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 54460aff77..86c8963cb6 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -88,7 +88,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject } QFileSystemWatcherPrivate::QFileSystemWatcherPrivate() - : native(0), poller(0) + : native(nullptr), poller(nullptr) { } diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index ca1f6cc359..888af998a5 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -242,7 +242,7 @@ QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject if (fd == -1) { fd = inotify_init(); if (fd == -1) - return 0; + return nullptr; } return new QInotifyFileSystemWatcherEngine(fd, parent); } diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index e26508e631..b89cab5e3c 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -461,7 +461,7 @@ QIODevice::QIODevice(QIODevicePrivate &dd) */ QIODevice::QIODevice() - : QObject(*new QIODevicePrivate, 0) + : QObject(*new QIODevicePrivate, nullptr) { #if defined QIODEVICE_DEBUG QFile *file = qobject_cast(this); diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp index d1806aa12b..df0197e8eb 100644 --- a/src/corelib/io/qnoncontiguousbytedevice.cpp +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE \internal */ -QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0) +QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)nullptr) { } @@ -188,7 +188,7 @@ const char* QNonContiguousByteDeviceByteArrayImpl::readPointer(qint64 maximumLen { if (atEnd()) { len = -1; - return 0; + return nullptr; } if (maximumLength != -1) @@ -241,7 +241,7 @@ const char* QNonContiguousByteDeviceRingBufferImpl::readPointer(qint64 maximumLe { if (atEnd()) { len = -1; - return 0; + return nullptr; } const char *returnValue = ringBuffer->readPointerAtPosition(currentPosition, len); @@ -282,7 +282,7 @@ qint64 QNonContiguousByteDeviceRingBufferImpl::size() const QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d) : QNonContiguousByteDevice(), - currentReadBuffer(0), currentReadBufferSize(16*1024), + currentReadBuffer(nullptr), currentReadBufferSize(16*1024), currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0), eof(false) { @@ -301,10 +301,10 @@ const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLeng { if (eof == true) { len = -1; - return 0; + return nullptr; } - if (currentReadBuffer == 0) + if (currentReadBuffer == nullptr) currentReadBuffer = new QByteArray(currentReadBufferSize, '\0'); // lazy alloc if (maximumLength == -1) @@ -323,7 +323,7 @@ const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLeng // size was unknown before, emit a readProgress with the final size if (size() == -1) emit readProgress(totalAdvancements, totalAdvancements); - return 0; + return nullptr; } currentReadBufferAmount = haveRead; @@ -349,7 +349,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount) if (currentReadBufferPosition > currentReadBufferAmount) { qint64 i = currentReadBufferPosition - currentReadBufferAmount; while (i > 0) { - if (device->getChar(0) == false) { + if (device->getChar(nullptr) == false) { emit readProgress(totalAdvancements - i, size()); return false; // ### FIXME handle eof } @@ -377,7 +377,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset() totalAdvancements = 0; //reset the progress counter if (currentReadBuffer) { delete currentReadBuffer; - currentReadBuffer = 0; + currentReadBuffer = nullptr; } currentReadBufferAmount = 0; currentReadBufferPosition = 0; @@ -405,7 +405,7 @@ qint64 QNonContiguousByteDeviceIoDeviceImpl::pos() const return device->pos(); } -QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)0) +QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)nullptr) { byteDevice = bd; connect(bd, SIGNAL(readyRead()), SIGNAL(readyRead())); diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 35ca2542f7..ad2e7fb6b8 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -216,7 +216,7 @@ void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other) environment variables to be removed. */ QProcessEnvironment::QProcessEnvironment() - : d(0) + : d(nullptr) { } @@ -436,18 +436,18 @@ void QProcessPrivate::Channel::clear() case PipeSource: Q_ASSERT(process); process->stdinChannel.type = Normal; - process->stdinChannel.process = 0; + process->stdinChannel.process = nullptr; break; case PipeSink: Q_ASSERT(process); process->stdoutChannel.type = Normal; - process->stdoutChannel.process = 0; + process->stdoutChannel.process = nullptr; break; } type = Normal; file.clear(); - process = 0; + process = nullptr; } /*! @@ -869,8 +869,8 @@ QProcessPrivate::QProcessPrivate() sequenceNumber = 0; exitCode = 0; exitStatus = QProcess::NormalExit; - startupSocketNotifier = 0; - deathNotifier = 0; + startupSocketNotifier = nullptr; + deathNotifier = nullptr; childStartedPipe[0] = INVALID_Q_PIPE; childStartedPipe[1] = INVALID_Q_PIPE; forkfd = -1; @@ -924,23 +924,23 @@ void QProcessPrivate::cleanup() if (stdoutChannel.notifier) { delete stdoutChannel.notifier; - stdoutChannel.notifier = 0; + stdoutChannel.notifier = nullptr; } if (stderrChannel.notifier) { delete stderrChannel.notifier; - stderrChannel.notifier = 0; + stderrChannel.notifier = nullptr; } if (stdinChannel.notifier) { delete stdinChannel.notifier; - stdinChannel.notifier = 0; + stdinChannel.notifier = nullptr; } if (startupSocketNotifier) { delete startupSocketNotifier; - startupSocketNotifier = 0; + startupSocketNotifier = nullptr; } if (deathNotifier) { delete deathNotifier; - deathNotifier = 0; + deathNotifier = nullptr; } closeChannel(&stdoutChannel); closeChannel(&stderrChannel); @@ -1229,7 +1229,7 @@ void QProcessPrivate::closeWriteChannel() #endif if (stdinChannel.notifier) { delete stdinChannel.notifier; - stdinChannel.notifier = 0; + stdinChannel.notifier = nullptr; } #ifdef Q_OS_WIN // ### Find a better fix, feeding the process little by little @@ -2615,7 +2615,7 @@ QT_END_INCLUDE_NAMESPACE QStringList QProcess::systemEnvironment() { QStringList tmp; - char *entry = 0; + char *entry = nullptr; int count = 0; while ((entry = environ[count++])) tmp << QString::fromLocal8Bit(entry); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 9edb4a6d11..9cd3bd531b 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -338,11 +338,11 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Map &environme { *envc = 0; if (environment.isEmpty()) - return 0; + return nullptr; char **envp = new char *[environment.count() + 2]; - envp[environment.count()] = 0; - envp[environment.count() + 1] = 0; + envp[environment.count()] = nullptr; + envp[environment.count() + 1] = nullptr; auto it = environment.constBegin(); const auto end = environment.constEnd(); @@ -390,7 +390,7 @@ void QProcessPrivate::startProcess() // Create argument list with right number of elements, and set the final // one to 0. char **argv = new char *[arguments.count() + 2]; - argv[arguments.count() + 1] = 0; + argv[arguments.count() + 1] = nullptr; // Encode the program name. QByteArray encodedProgramName = QFile::encodeName(program); @@ -437,13 +437,13 @@ void QProcessPrivate::startProcess() // Duplicate the environment. int envc = 0; - char **envp = 0; + char **envp = nullptr; if (environment.d.constData()) { envp = _q_dupEnvironment(environment.d.constData()->vars, &envc); } // Encode the working directory if it's non-empty, otherwise just pass 0. - const char *workingDirPtr = 0; + const char *workingDirPtr = nullptr; QByteArray encodedWorkingDirectory; if (!workingDirectory.isEmpty()) { encodedWorkingDirectory = QFile::encodeName(workingDirectory); @@ -596,7 +596,7 @@ bool QProcessPrivate::processStarted(QString *errorMessage) if (startupSocketNotifier) { startupSocketNotifier->setEnabled(false); startupSocketNotifier->deleteLater(); - startupSocketNotifier = 0; + startupSocketNotifier = nullptr; } qt_safe_close(childStartedPipe[0]); childStartedPipe[0] = -1; @@ -889,7 +889,7 @@ bool QProcessPrivate::waitForDeadChild() crashed = info.code != CLD_EXITED; delete deathNotifier; - deathNotifier = 0; + deathNotifier = nullptr; EINTR_LOOP(ret, forkfd_close(forkfd)); forkfd = -1; // Child is dead, don't try to kill it anymore @@ -935,7 +935,7 @@ bool QProcessPrivate::startDetached(qint64 *pid) struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; - ::sigaction(SIGPIPE, &noaction, 0); + ::sigaction(SIGPIPE, &noaction, nullptr); ::setsid(); @@ -964,7 +964,7 @@ bool QProcessPrivate::startDetached(qint64 *pid) char **argv = new char *[arguments.size() + 2]; for (int i = 0; i < arguments.size(); ++i) argv[i + 1] = ::strdup(QFile::encodeName(arguments.at(i)).constData()); - argv[arguments.size() + 1] = 0; + argv[arguments.size() + 1] = nullptr; // Duplicate the environment. int envc = 0; @@ -991,7 +991,7 @@ bool QProcessPrivate::startDetached(qint64 *pid) struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; - ::sigaction(SIGPIPE, &noaction, 0); + ::sigaction(SIGPIPE, &noaction, nullptr); // '\1' means execv failed char c = '\1'; @@ -1002,7 +1002,7 @@ bool QProcessPrivate::startDetached(qint64 *pid) struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; - ::sigaction(SIGPIPE, &noaction, 0); + ::sigaction(SIGPIPE, &noaction, nullptr); // '\2' means internal error char c = '\2'; diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 0a145b2be4..3664a63050 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1584,7 +1584,7 @@ QAbstractFileEngine::Iterator *QResourceFileEngine::beginEntryList(QDir::Filters */ QAbstractFileEngine::Iterator *QResourceFileEngine::endEntryList() { - return 0; + return nullptr; } bool QResourceFileEngine::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) @@ -1594,7 +1594,7 @@ bool QResourceFileEngine::extension(Extension extension, const ExtensionOption * const MapExtensionOption *options = (const MapExtensionOption*)(option); MapExtensionReturn *returnValue = static_cast(output); returnValue->address = d->map(options->offset, options->size, options->flags); - return (returnValue->address != 0); + return (returnValue->address != nullptr); } if (extension == UnMapExtension) { const UnMapExtensionOption *options = (const UnMapExtensionOption*)option; @@ -1623,7 +1623,7 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory if (offset < 0 || size <= 0 || !resource.isValid() || add_overflow(offset, size, &end) || end > max) { q->setError(QFile::UnspecifiedError, QString()); - return 0; + return nullptr; } const uchar *address = resource.data(); diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index 0a884a7df9..067ccda3df 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -116,7 +116,7 @@ QSaveFile::QSaveFile(const QString &name) Constructs a new file object to represent the file with the given \a name. */ QSaveFile::QSaveFile(const QString &name) - : QFileDevice(*new QSaveFilePrivate, 0) + : QFileDevice(*new QSaveFilePrivate, nullptr) { Q_D(QSaveFile); d->fileName = name; diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index dcc9340473..9fc45e307d 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -206,7 +206,7 @@ QConfFile *QConfFile::fromName(const QString &fileName, bool _userPerms) ConfFileHash *usedHash = usedHashFunc(); ConfFileCache *unusedCache = unusedCacheFunc(); - QConfFile *confFile = 0; + QConfFile *confFile = nullptr; const auto locker = qt_scoped_lock(settingsGlobalMutex); if (!(confFile = usedHash->value(absPath))) { @@ -230,7 +230,7 @@ void QConfFile::clearCache() // QSettingsPrivate QSettingsPrivate::QSettingsPrivate(QSettings::Format format) - : format(format), scope(QSettings::UserScope /* nothing better to put */), iniCodec(0), fallbacks(true), + : format(format), scope(QSettings::UserScope /* nothing better to put */), iniCodec(nullptr), fallbacks(true), pendingChanges(false), status(QSettings::NoError) { } @@ -238,7 +238,7 @@ QSettingsPrivate::QSettingsPrivate(QSettings::Format format) QSettingsPrivate::QSettingsPrivate(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application) : format(format), scope(scope), organizationName(organization), applicationName(application), - iniCodec(0), fallbacks(true), pendingChanges(false), status(QSettings::NoError) + iniCodec(nullptr), fallbacks(true), pendingChanges(false), status(QSettings::NoError) { } @@ -924,8 +924,8 @@ QStringList QSettingsPrivate::splitArgs(const QString &s, int idx) void QConfFileSettingsPrivate::initFormat() { extension = (format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"); - readFunc = 0; - writeFunc = 0; + readFunc = nullptr; + writeFunc = nullptr; #if defined(Q_OS_MAC) caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : IniCaseSensitivity; #else @@ -3338,7 +3338,7 @@ bool QSettings::contains(const QString &key) const { Q_D(const QSettings); QString k = d->actualKey(key); - return d->get(k, 0); + return d->get(k, nullptr); } /*! diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index fa975ce117..46ac703615 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -61,7 +61,7 @@ Q_LOGGING_CATEGORY(lcCheckIndex, "qt.core.qabstractitemmodel.checkindex") QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &index) { Q_ASSERT(index.isValid()); // we will _never_ insert an invalid index in the list - QPersistentModelIndexData *d = 0; + QPersistentModelIndexData *d = nullptr; QAbstractItemModel *model = const_cast(index.model()); QHash &indexes = model->d_func()->persistent.indexes; const auto it = indexes.constFind(index); @@ -136,7 +136,7 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data) */ QPersistentModelIndex::QPersistentModelIndex() - : d(0) + : d(nullptr) { } @@ -158,7 +158,7 @@ QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex &other) */ QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index) - : d(0) + : d(nullptr) { if (index.isValid()) { d = QPersistentModelIndexData::create(index); @@ -176,7 +176,7 @@ QPersistentModelIndex::~QPersistentModelIndex() { if (d && !d->ref.deref()) { QPersistentModelIndexData::destroy(d); - d = 0; + d = nullptr; } } @@ -257,7 +257,7 @@ QPersistentModelIndex &QPersistentModelIndex::operator=(const QModelIndex &other d = QPersistentModelIndexData::create(other); if (d) d->ref.ref(); } else { - d = 0; + d = nullptr; } return *this; } @@ -344,7 +344,7 @@ void *QPersistentModelIndex::internalPointer() const { if (d) return d->index.internalPointer(); - return 0; + return nullptr; } /*! @@ -442,7 +442,7 @@ const QAbstractItemModel *QPersistentModelIndex::model() const { if (d) return d->index.model(); - return 0; + return nullptr; } /*! @@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QPersistentModelIndex &idx) class QEmptyItemModel : public QAbstractItemModel { public: - explicit QEmptyItemModel(QObject *parent = 0) : QAbstractItemModel(parent) {} + explicit QEmptyItemModel(QObject *parent = nullptr) : QAbstractItemModel(parent) {} QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); } QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); } int rowCount(const QModelIndex &) const override { return 0; } @@ -1950,10 +1950,10 @@ QStringList QAbstractItemModel::mimeTypes() const QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const { if (indexes.count() <= 0) - return 0; + return nullptr; QStringList types = mimeTypes(); if (types.isEmpty()) - return 0; + return nullptr; QMimeData *data = new QMimeData(); QString format = types.at(0); QByteArray encoded; diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp index c863406afd..87559cd6b2 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.cpp +++ b/src/corelib/itemmodels/qabstractproxymodel.cpp @@ -159,7 +159,7 @@ QAbstractItemModel *QAbstractProxyModel::sourceModel() const { Q_D(const QAbstractProxyModel); if (d->model == QAbstractItemModelPrivate::staticEmptyModel()) - return 0; + return nullptr; return d->model; } diff --git a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp index 0319d215a1..3afa132483 100644 --- a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp +++ b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp @@ -497,7 +497,7 @@ void QConcatenateTablesProxyModel::removeSourceModel(QAbstractItemModel *sourceM { Q_D(QConcatenateTablesProxyModel); Q_ASSERT(d->m_models.contains(sourceModel)); - disconnect(sourceModel, 0, this, 0); + disconnect(sourceModel, nullptr, this, nullptr); const int rowsRemoved = sourceModel->rowCount(); const int rowsPrior = d->computeRowsPrior(sourceModel); // location of removed section diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index c93a4d15b9..f4402c88dc 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -656,7 +656,7 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *m) SLOT(_q_layoutChanged(QList,QAbstractItemModel::LayoutChangeHint)) }, { SIGNAL(modelReset()), SLOT(reset()) }, - { 0, 0 } + { nullptr, nullptr } }; if (model == m) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 32efa727b8..34f54d8f94 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -530,10 +530,10 @@ void QCoreApplicationPrivate::eventDispatcherReady() { } -QBasicAtomicPointer QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(0); +QBasicAtomicPointer QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(nullptr); QThread *QCoreApplicationPrivate::mainThread() { - Q_ASSERT(theMainThread.loadRelaxed() != 0); + Q_ASSERT(theMainThread.loadRelaxed() != nullptr); return theMainThread.loadRelaxed(); } @@ -690,7 +690,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p) #ifdef QT_NO_QOBJECT : d_ptr(&p) #else - : QObject(p, 0) + : QObject(p, nullptr) #endif { d_func()->q_ptr = this; @@ -1139,7 +1139,7 @@ bool QCoreApplication::notify(QObject *receiver, QEvent *event) static bool doNotify(QObject *receiver, QEvent *event) { - if (receiver == 0) { // serious error + if (receiver == nullptr) { // serious error qWarning("QCoreApplication::notify: Unexpected null receiver"); return true; } @@ -1388,7 +1388,7 @@ void QCoreApplicationPrivate::execCleanup() if (!aboutToQuitEmitted) emit q_func()->aboutToQuit(QCoreApplication::QPrivateSignal()); aboutToQuitEmitted = true; - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } @@ -1531,7 +1531,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority) { Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type()); - if (receiver == 0) { + if (receiver == nullptr) { qWarning("QCoreApplication::postEvent: Unexpected null receiver"); delete event; return; @@ -1635,7 +1635,7 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven for (int i = 0; i < postedEvents->size(); ++i) { const QPostEvent &cur = postedEvents->at(i); if (cur.receiver != receiver - || cur.event == 0 + || cur.event == nullptr || cur.event->type() != event->type()) continue; // found an event for this receiver @@ -1784,7 +1784,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type // null out the event so if sendPostedEvents recurses, it // will ignore this one, as it's been re-posted. - const_cast(pe).event = 0; + const_cast(pe).event = nullptr; // re-post the copied event so it isn't lost data->postEventList.addEvent(pe_copy); @@ -1804,7 +1804,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type // next, update the data structure so that we're ready // for the next event. - const_cast(pe).event = 0; + const_cast(pe).event = nullptr; locker.unlock(); const auto relocker = qScopeGuard([&locker] { locker.lock(); }); @@ -1867,7 +1867,7 @@ void QCoreApplication::removePostedEvents(QObject *receiver, int eventType) --pe.receiver->d_func()->postedEvents; pe.event->posted = false; events.append(pe.event); - const_cast(pe).event = 0; + const_cast(pe).event = nullptr; } else if (!data->postEventList.recursion) { if (i != j) qSwap(data->postEventList[i], data->postEventList[j]); @@ -1929,7 +1929,7 @@ void QCoreApplicationPrivate::removePostedEvent(QEvent * event) --pe.receiver->d_func()->postedEvents; pe.event->posted = false; delete pe.event; - const_cast(pe).event = 0; + const_cast(pe).event = nullptr; return; } } @@ -2204,7 +2204,7 @@ QString QCoreApplication::translate(const char *context, const char *sourceText, // Declared in qglobal.h QString qtTrId(const char *id, int n) { - return QCoreApplication::translate(0, id, 0, n); + return QCoreApplication::translate(nullptr, id, nullptr, n); } bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator) @@ -2956,7 +2956,7 @@ QAbstractEventDispatcher *QCoreApplication::eventDispatcher() { if (QCoreApplicationPrivate::theMainThread.loadAcquire()) return QCoreApplicationPrivate::theMainThread.loadRelaxed()->eventDispatcher(); - return 0; + return nullptr; } /*! diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 4cfc749386..e3326f00d7 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -295,7 +295,7 @@ QT_BEGIN_NAMESPACE Contructs an event object of type \a type. */ QEvent::QEvent(Type type) - : d(0), t(type), posted(false), spont(false), m_accept(true) + : d(nullptr), t(type), posted(false), spont(false), m_accept(true) { Q_TRACE(QEvent_ctor, this, t); } diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index d9746ef6e2..92f3553247 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -114,9 +114,9 @@ static GSourceFuncs socketNotifierSourceFuncs = { socketNotifierSourcePrepare, socketNotifierSourceCheck, socketNotifierSourceDispatch, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr }; struct GTimerSource @@ -188,9 +188,9 @@ static GSourceFuncs timerSourceFuncs = { timerSourcePrepare, timerSourceCheck, timerSourceDispatch, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr }; struct GIdleTimerSource @@ -227,7 +227,7 @@ static gboolean idleTimerSourceCheck(GSource *source) static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer) { GTimerSource *timerSource = reinterpret_cast(source)->timerSource; - (void) timerSourceDispatch(&timerSource->source, 0, 0); + (void) timerSourceDispatch(&timerSource->source, nullptr, nullptr); return true; } @@ -235,9 +235,9 @@ static GSourceFuncs idleTimerSourceFuncs = { idleTimerSourcePrepare, idleTimerSourceCheck, idleTimerSourceDispatch, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr }; struct GPostEventSource @@ -267,7 +267,7 @@ static gboolean postEventSourcePrepare(GSource *s, gint *timeout) static gboolean postEventSourceCheck(GSource *source) { - return postEventSourcePrepare(source, 0); + return postEventSourcePrepare(source, nullptr); } static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer) @@ -283,9 +283,9 @@ static GSourceFuncs postEventSourceFuncs = { postEventSourcePrepare, postEventSourceCheck, postEventSourceDispatch, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr }; @@ -372,10 +372,10 @@ QEventDispatcherGlib::~QEventDispatcherGlib() d->timerSource->timerList.~QTimerInfoList(); g_source_destroy(&d->timerSource->source); g_source_unref(&d->timerSource->source); - d->timerSource = 0; + d->timerSource = nullptr; g_source_destroy(&d->idleTimerSource->source); g_source_unref(&d->idleTimerSource->source); - d->idleTimerSource = 0; + d->idleTimerSource = nullptr; // destroy socket notifier source for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) { @@ -386,19 +386,19 @@ QEventDispatcherGlib::~QEventDispatcherGlib() d->socketNotifierSource->pollfds.~QList(); g_source_destroy(&d->socketNotifierSource->source); g_source_unref(&d->socketNotifierSource->source); - d->socketNotifierSource = 0; + d->socketNotifierSource = nullptr; // destroy post event source g_source_destroy(&d->postEventSource->source); g_source_unref(&d->postEventSource->source); - d->postEventSource = 0; + d->postEventSource = nullptr; - Q_ASSERT(d->mainContext != 0); + Q_ASSERT(d->mainContext != nullptr); #if GLIB_CHECK_VERSION (2, 22, 0) g_main_context_pop_thread_default (d->mainContext); #endif g_main_context_unref(d->mainContext); - d->mainContext = 0; + d->mainContext = nullptr; } bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 2492d70005..0165ce9075 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -465,7 +465,7 @@ bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags) emit awake(); auto threadData = d->threadData.loadRelaxed(); - QCoreApplicationPrivate::sendPostedEvents(0, 0, threadData); + QCoreApplicationPrivate::sendPostedEvents(nullptr, 0, threadData); const bool include_timers = (flags & QEventLoop::X11ExcludeTimers) == 0; const bool include_notifiers = (flags & QEventLoop::ExcludeSocketNotifiers) == 0; diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 5cb30a74ac..fad47eee13 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -282,14 +282,14 @@ QObject *QMetaObject::newInstance(QGenericArgument val0, idx = indexOfConstructor(norm.constData()); } if (idx < 0) - return 0; + return nullptr; - QObject *returnValue = 0; + QObject *returnValue = nullptr; void *param[] = {&returnValue, val0.data(), val1.data(), val2.data(), val3.data(), val4.data(), val5.data(), val6.data(), val7.data(), val8.data(), val9.data()}; if (static_metacall(CreateInstance, idx, param) >= 0) - return 0; + return nullptr; return returnValue; } @@ -301,7 +301,7 @@ int QMetaObject::static_metacall(Call cl, int idx, void **argv) const Q_ASSERT(priv(d.data)->revision >= 6); if (!d.static_metacall) return 0; - d.static_metacall(0, cl, idx, argv); + d.static_metacall(nullptr, cl, idx, argv); return -1; } @@ -691,7 +691,7 @@ static void argumentTypesFromString(const char *str, const char *end, QByteArray QMetaObjectPrivate::decodeMethodSignature( const char *signature, QArgumentTypeArray &types) { - Q_ASSERT(signature != 0); + Q_ASSERT(signature != nullptr); const char *lparens = strchr(signature, '('); if (!lparens) return QByteArray(); @@ -844,7 +844,7 @@ int QMetaObjectPrivate::indexOfConstructor(const QMetaObject *m, const QByteArra */ int QMetaObjectPrivate::absoluteSignalCount(const QMetaObject *m) { - Q_ASSERT(m != 0); + Q_ASSERT(m != nullptr); int n = priv(m->d.data)->signalCount; for (m = m->d.superdata; m; m = m->d.superdata) n += priv(m->d.data)->signalCount; @@ -881,7 +881,7 @@ QMetaMethod QMetaObjectPrivate::signal(const QMetaObject *m, int signal_index) QMetaMethod result; if (signal_index < 0) return result; - Q_ASSERT(m != 0); + Q_ASSERT(m != nullptr); int i = signal_index; i -= signalOffset(m); if (i < 0 && m->d.superdata) @@ -1031,7 +1031,7 @@ int QMetaObject::indexOfProperty(const char *name) const QAbstractDynamicMetaObject *me = const_cast(static_cast(this)); - return me->createProperty(name, 0); + return me->createProperty(name, nullptr); } return -1; @@ -1145,7 +1145,7 @@ QMetaProperty QMetaObject::property(int index) const if (!result.menum.isValid()) { const char *enum_name = type; const char *scope_name = objectClassName(this); - char *scope_buffer = 0; + char *scope_buffer = nullptr; const char *colon = strrchr(enum_name, ':'); // ':' will always appear in pairs @@ -1159,7 +1159,7 @@ QMetaProperty QMetaObject::property(int index) const enum_name = colon+1; } - const QMetaObject *scope = 0; + const QMetaObject *scope = nullptr; if (qstrcmp(scope_name, "Qt") == 0) scope = &QObject::staticQtMetaObject; else @@ -1542,14 +1542,14 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase * return false; } - QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, 1)); + QCoreApplication::postEvent(object, new QMetaCallEvent(slot, nullptr, -1, 1)); } else if (type == Qt::BlockingQueuedConnection) { #if QT_CONFIG(thread) if (currentThread == objectThread) qWarning("QMetaObject::invokeMethod: Dead lock detected"); QSemaphore semaphore; - QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, argv, &semaphore)); + QCoreApplication::postEvent(object, new QMetaCallEvent(slot, nullptr, -1, argv, &semaphore)); semaphore.acquire(); #endif // QT_CONFIG(thread) } else { @@ -1988,7 +1988,7 @@ QList QMetaMethod::parameterNames() const const char *QMetaMethod::typeName() const { if (!mobj) - return 0; + return nullptr; return QMetaMethodPrivate::get(this)->rawReturnTypeName(); } @@ -2020,7 +2020,7 @@ const char *QMetaMethod::typeName() const const char *QMetaMethod::tag() const { if (!mobj) - return 0; + return nullptr; return QMetaMethodPrivate::get(this)->tag().constData(); } @@ -2303,7 +2303,7 @@ bool QMetaMethod::invoke(QObject *object, return false; } - QScopedPointer event(new QMetaCallEvent(idx_offset, idx_relative, callFunction, 0, -1, paramCount)); + QScopedPointer event(new QMetaCallEvent(idx_offset, idx_relative, callFunction, nullptr, -1, paramCount)); int *types = event->types(); void **args = event->args(); @@ -2340,7 +2340,7 @@ bool QMetaMethod::invoke(QObject *object, QSemaphore semaphore; QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction, - 0, -1, param, &semaphore)); + nullptr, -1, param, &semaphore)); semaphore.acquire(); #endif // QT_CONFIG(thread) } @@ -2563,7 +2563,7 @@ bool QMetaMethod::invokeOnGadget(void* gadget, QGenericReturnArgument returnValu const char *QMetaEnum::name() const { if (!mobj) - return 0; + return nullptr; return rawStringData(mobj, mobj->d.data[handle]); } @@ -2582,7 +2582,7 @@ const char *QMetaEnum::name() const const char *QMetaEnum::enumName() const { if (!mobj) - return 0; + return nullptr; const bool rev8p = priv(mobj->d.data)->revision >= 8; if (rev8p) return rawStringData(mobj, mobj->d.data[handle + 1]); @@ -2610,13 +2610,13 @@ int QMetaEnum::keyCount() const const char *QMetaEnum::key(int index) const { if (!mobj) - return 0; + return nullptr; const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2; int count = mobj->d.data[handle + offset]; int data = mobj->d.data[handle + offset + 1]; if (index >= 0 && index < count) return rawStringData(mobj, mobj->d.data[data + 2*index]); - return 0; + return nullptr; } /*! @@ -2679,7 +2679,7 @@ bool QMetaEnum::isScoped() const */ const char *QMetaEnum::scope() const { - return mobj ? objectClassName(mobj) : 0; + return mobj ? objectClassName(mobj) : nullptr; } /*! @@ -2695,7 +2695,7 @@ const char *QMetaEnum::scope() const */ int QMetaEnum::keyToValue(const char *key, bool *ok) const { - if (ok != 0) + if (ok != nullptr) *ok = false; if (!mobj || !key) return -1; @@ -2715,7 +2715,7 @@ int QMetaEnum::keyToValue(const char *key, bool *ok) const const QByteArray className = stringData(mobj, priv(mobj->d.data)->className); if ((!scope || (className.size() == int(scope) && strncmp(qualified_key, className.constData(), scope) == 0)) && strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0) { - if (ok != 0) + if (ok != nullptr) *ok = true; return mobj->d.data[data + 2*i + 1]; } @@ -2734,14 +2734,14 @@ int QMetaEnum::keyToValue(const char *key, bool *ok) const const char* QMetaEnum::valueToKey(int value) const { if (!mobj) - return 0; + return nullptr; const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2; int count = mobj->d.data[handle + offset]; int data = mobj->d.data[handle + offset + 1]; for (int i = 0; i < count; ++i) if (value == (int)mobj->d.data[data + 2*i + 1]) return rawStringData(mobj, mobj->d.data[data + 2*i]); - return 0; + return nullptr; } /*! @@ -2756,11 +2756,11 @@ const char* QMetaEnum::valueToKey(int value) const */ int QMetaEnum::keysToValue(const char *keys, bool *ok) const { - if (ok != 0) + if (ok != nullptr) *ok = false; if (!mobj || !keys) return -1; - if (ok != 0) + if (ok != nullptr) *ok = true; const QString keysString = QString::fromLatin1(keys); const QVector splitKeys = keysString.splitRef(QLatin1Char('|')); @@ -2793,7 +2793,7 @@ int QMetaEnum::keysToValue(const char *keys, bool *ok) const } } if (i < 0) { - if (ok != 0) + if (ok != nullptr) *ok = false; value |= -1; } @@ -2896,7 +2896,7 @@ static QByteArray qualifiedName(const QMetaEnum &e) \internal */ QMetaProperty::QMetaProperty() - : mobj(0), handle(0), idx(0) + : mobj(nullptr), handle(0), idx(0) { } @@ -2909,7 +2909,7 @@ QMetaProperty::QMetaProperty() const char *QMetaProperty::name() const { if (!mobj) - return 0; + return nullptr; int handle = priv(mobj->d.data)->propertyData + 3*idx; return rawStringData(mobj, mobj->d.data[handle]); } @@ -2922,7 +2922,7 @@ const char *QMetaProperty::name() const const char *QMetaProperty::typeName() const { if (!mobj) - return 0; + return nullptr; int handle = priv(mobj->d.data)->propertyData + 3*idx; return rawTypeNameFromTypeInfo(mobj, mobj->d.data[handle + 1]); } @@ -3112,7 +3112,7 @@ QVariant QMetaProperty::read(const QObject *object) const t = enumMetaTypeId; } else { int handle = priv(mobj->d.data)->propertyData + 3*idx; - const char *typeName = 0; + const char *typeName = nullptr; Q_ASSERT(priv(mobj->d.data)->revision >= 7); uint typeInfo = mobj->d.data[handle + 1]; if (!(typeInfo & IsUnresolvedType)) @@ -3138,11 +3138,11 @@ QVariant QMetaProperty::read(const QObject *object) const // changed: result stored directly in value int status = -1; QVariant value; - void *argv[] = { 0, &value, &status }; + void *argv[] = { nullptr, &value, &status }; if (t == QMetaType::QVariant) { argv[0] = &value; } else { - value = QVariant(t, (void*)0); + value = QVariant(t, (void*)nullptr); argv[0] = value.data(); } if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall) { @@ -3196,7 +3196,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const v.convert(QVariant::Int); } else { int handle = priv(mobj->d.data)->propertyData + 3*idx; - const char *typeName = 0; + const char *typeName = nullptr; Q_ASSERT(priv(mobj->d.data)->revision >= 7); uint typeInfo = mobj->d.data[handle + 1]; if (!(typeInfo & IsUnresolvedType)) @@ -3213,7 +3213,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const if (!value.isValid()) { if (isResettable()) return reset(object); - v = QVariant(t, 0); + v = QVariant(t, nullptr); } else if (!v.convert(t)) { return false; } @@ -3229,7 +3229,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const // the flags variable is used by the declarative module to implement // interception of property writes. int flags = 0; - void *argv[] = { 0, &v, &status, &flags }; + void *argv[] = { nullptr, &v, &status, &flags }; if (t == QMetaType::QVariant) argv[0] = &v; else @@ -3254,7 +3254,7 @@ bool QMetaProperty::reset(QObject *object) const { if (!object || !mobj || !isResettable()) return false; - void *argv[] = { 0 }; + void *argv[] = { nullptr }; if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall) mobj->d.static_metacall(object, QMetaObject::ResetProperty, idx, argv); else @@ -3638,7 +3638,7 @@ bool QMetaProperty::isEditable(const QObject *object) const const char *QMetaClassInfo::name() const { if (!mobj) - return 0; + return nullptr; return rawStringData(mobj, mobj->d.data[handle]); } @@ -3650,7 +3650,7 @@ const char *QMetaClassInfo::name() const const char* QMetaClassInfo::value() const { if (!mobj) - return 0; + return nullptr; return rawStringData(mobj, mobj->d.data[handle + 1]); } diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index f77c4ce32f..4ecc340787 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -210,7 +210,7 @@ public: : flags(0) { superClass = &QObject::staticMetaObject; - staticMetacallFunction = 0; + staticMetacallFunction = nullptr; } bool hasRevisionedProperties() const; @@ -749,7 +749,7 @@ void QMetaObjectBuilder::addMetaObject Q_ASSERT(priv(prototype->d.data)->revision >= 2); const auto *objects = prototype->d.relatedMetaObjects; if (objects) { - while (*objects != 0) { + while (*objects != nullptr) { addRelatedMetaObject(*objects); ++objects; } @@ -831,7 +831,7 @@ const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const if (index >= 0 && index < d->relatedMetaObjects.size()) return d->relatedMetaObjects[index]; else - return 0; + return nullptr; } /*! @@ -1196,8 +1196,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, ALIGN(size, int); if (buf) { if (!relocatable) meta->d.superdata = d->superClass; - meta->d.relatedMetaObjects = 0; - meta->d.extradata = 0; + meta->d.relatedMetaObjects = nullptr; + meta->d.extradata = nullptr; meta->d.static_metacall = d->staticMetacallFunction; } @@ -1494,7 +1494,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, */ QMetaObject *QMetaObjectBuilder::toMetaObject() const { - int size = buildMetaObject(d, 0, 0, false); + int size = buildMetaObject(d, nullptr, 0, false); char *buf = reinterpret_cast(malloc(size)); memset(buf, 0, size); buildMetaObject(d, buf, size, false); @@ -1517,7 +1517,7 @@ QMetaObject *QMetaObjectBuilder::toMetaObject() const */ QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const { - int size = buildMetaObject(d, 0, 0, true); + int size = buildMetaObject(d, nullptr, 0, true); if (size == -1) { if (ok) *ok = false; return QByteArray(); @@ -1555,9 +1555,9 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output, output->d.superdata = superclass; output->d.stringdata = reinterpret_cast(buf + stringdataOffset); output->d.data = reinterpret_cast(buf + dataOffset); - output->d.extradata = 0; - output->d.relatedMetaObjects = 0; - output->d.static_metacall = 0; + output->d.extradata = nullptr; + output->d.relatedMetaObjects = nullptr; + output->d.static_metacall = nullptr; } /*! @@ -1720,14 +1720,14 @@ void QMetaObjectBuilder::deserialize d->enumerators.clear(); d->constructors.clear(); d->relatedMetaObjects.clear(); - d->staticMetacallFunction = 0; + d->staticMetacallFunction = nullptr; // Read the class and super class names. stream >> d->className; stream >> name; if (name.isEmpty()) { - d->superClass = 0; - } else if ((cl = resolveClassName(references, name)) != 0) { + d->superClass = nullptr; + } else if ((cl = resolveClassName(references, name)) != nullptr) { d->superClass = cl; } else { stream.setStatus(QDataStream::ReadCorruptData); @@ -1877,7 +1877,7 @@ QMetaMethodBuilderPrivate *QMetaMethodBuilder::d_func() const else if (_mobj && -_index >= 1 && -_index <= int(_mobj->d->constructors.size())) return &(_mobj->d->constructors[(-_index) - 1]); else - return 0; + return nullptr; } /*! @@ -2116,7 +2116,7 @@ QMetaPropertyBuilderPrivate *QMetaPropertyBuilder::d_func() const if (_mobj && _index >= 0 && _index < int(_mobj->d->properties.size())) return &(_mobj->d->properties[_index]); else - return 0; + return nullptr; } /*! @@ -2588,7 +2588,7 @@ QMetaEnumBuilderPrivate *QMetaEnumBuilder::d_func() const if (_mobj && _index >= 0 && _index < int(_mobj->d->enumerators.size())) return &(_mobj->d->enumerators[_index]); else - return 0; + return nullptr; } /*! diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 356a675517..3f0b8900e4 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1113,8 +1113,8 @@ static int registerNormalizedType(const NS(QByteArray) &normalizedTypeName, QCustomTypeInfo inf; inf.typeName = normalizedTypeName; #ifndef QT_NO_DATASTREAM - inf.loadOp = 0; - inf.saveOp = 0; + inf.loadOp = nullptr; + inf.saveOp = nullptr; #endif inf.alias = -1; inf.typedConstructor = typedConstructor; @@ -1955,7 +1955,7 @@ public: return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject : nullptr; - return 0; + return nullptr; } }; diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index 9a98db21d3..00e5183eb1 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -319,7 +319,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty Constructs a new MIME data object with no data in it. */ QMimeData::QMimeData() - : QObject(*new QMimeDataPrivate, 0) + : QObject(*new QMimeDataPrivate, nullptr) { } diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cee885c0fe..a2c5d7db75 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -109,7 +109,7 @@ static int *queuedConnectionTypes(const QList &typeNames) "(Make sure '%s' is registered using qRegisterMetaType().)", typeName.constData(), typeName.constData()); delete [] types; - return 0; + return nullptr; } } types[typeNames.count()] = 0; @@ -133,7 +133,7 @@ static int *queuedConnectionTypes(const QArgumentType *argumentTypes, int argc) qWarning("QObject::connect: Cannot queue arguments of type '%s'\n" "(Make sure '%s' is registered using qRegisterMetaType().)", type.name().constData(), type.name().constData()); - return 0; + return nullptr; } } types[argc] = 0; @@ -160,13 +160,13 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) {} #endif -void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0; -void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = 0; -void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0; -void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0; -int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0; -bool (*QAbstractDeclarativeData::isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int) = 0; -void (*QAbstractDeclarativeData::setWidgetParent)(QObject *, QObject *) = 0; +void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = nullptr; +void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = nullptr; +void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = nullptr; +void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = nullptr; +int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = nullptr; +bool (*QAbstractDeclarativeData::isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int) = nullptr; +void (*QAbstractDeclarativeData::setWidgetParent)(QObject *, QObject *) = nullptr; /*! \fn QObjectData::QObjectData() @@ -182,7 +182,7 @@ QMetaObject *QObjectData::dynamicMetaObject() const } QObjectPrivate::QObjectPrivate(int version) - : threadData(0), currentChildBeingDeleted(0) + : threadData(nullptr), currentChildBeingDeleted(nullptr) { #ifdef QT_BUILD_INTERNAL // Don't check the version parameter in internal builds. @@ -195,8 +195,8 @@ QObjectPrivate::QObjectPrivate(int version) #endif // QObjectData initialization - q_ptr = 0; - parent = 0; // no parent yet. It is set by setParent() + q_ptr = nullptr; + parent = nullptr; // no parent yet. It is set by setParent() isWidget = false; // assume not a widget object blockSig = false; // not blocking signals wasDeleted = false; // double-delete catcher @@ -204,8 +204,8 @@ QObjectPrivate::QObjectPrivate(int version) sendChildEvents = true; // if we should send ChildAdded and ChildRemoved events to parent receiveChildEvents = true; postedEvents = 0; - extraData = 0; - metaObject = 0; + extraData = nullptr; + metaObject = nullptr; isWindow = false; deleteLaterCalled = false; } @@ -926,8 +926,8 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent) d->threadData.storeRelaxed(threadData); if (parent) { QT_TRY { - if (!check_parent_thread(parent, parent ? parent->d_func()->threadData.loadRelaxed() : 0, threadData)) - parent = 0; + if (!check_parent_thread(parent, parent ? parent->d_func()->threadData.loadRelaxed() : nullptr, threadData)) + parent = nullptr; if (d->isWidget) { if (parent) { d->parent = parent; @@ -1095,7 +1095,7 @@ QObject::~QObject() Q_TRACE(QObject_dtor, this); if (d->parent) // remove it from parent object - d->setParent_helper(0); + d->setParent_helper(nullptr); } QObjectPrivate::Connection::~Connection() @@ -1541,7 +1541,7 @@ void QObject::moveToThread(QThread *targetThread) return; } - if (d->parent != 0) { + if (d->parent != nullptr) { qWarning("QObject::moveToThread: Cannot move objects with a parent"); return; } @@ -1618,7 +1618,7 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData if (pe.receiver == q) { // move this post event to the targetList targetData->postEventList.addEvent(pe); - const_cast(pe).event = 0; + const_cast(pe).event = nullptr; ++eventsMoved; } } @@ -2065,7 +2065,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options) { if (!parent) - return 0; + return nullptr; const QObjectList &children = parent->children(); QObject *obj; int i; @@ -2081,7 +2081,7 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const return obj; } } - return 0; + return nullptr; } /*! @@ -2109,7 +2109,7 @@ void QObjectPrivate::deleteChildren() delete currentChildBeingDeleted; } children.clear(); - currentChildBeingDeleted = 0; + currentChildBeingDeleted = nullptr; isDeletingChildren = false; } @@ -2161,7 +2161,7 @@ void QObjectPrivate::setParent_helper(QObject *o) // object hierarchies are constrained to a single thread if (threadData != parent->d_func()->threadData) { qWarning("QObject::setParent: Cannot set parent, new parent is in a different thread"); - parent = 0; + parent = nullptr; return; } parent->d_func()->children.append(q); @@ -2232,7 +2232,7 @@ void QObject::installEventFilter(QObject *obj) d->extraData = new QObjectPrivate::ExtraData; // clean up unused items in the list - d->extraData->eventFilters.removeAll((QObject*)0); + d->extraData->eventFilters.removeAll((QObject*)nullptr); d->extraData->eventFilters.removeAll(obj); d->extraData->eventFilters.prepend(obj); } @@ -2256,7 +2256,7 @@ void QObject::removeEventFilter(QObject *obj) if (d->extraData) { for (int i = 0; i < d->extraData->eventFilters.count(); ++i) { if (d->extraData->eventFilters.at(i) == obj) - d->extraData->eventFilters[i] = 0; + d->extraData->eventFilters[i] = nullptr; } } } @@ -2379,7 +2379,7 @@ void QObject::deleteLater() const char *qFlagLocation(const char *method) { QThreadData *currentThreadData = QThreadData::current(false); - if (currentThreadData != 0) + if (currentThreadData != nullptr) currentThreadData->flaggedSignatures.store(method); return method; } @@ -2398,7 +2398,7 @@ static const char * extract_location(const char *member) if (*location != '\0') return location; } - return 0; + return nullptr; } static bool check_signal_macro(const QObject *sender, const char *signal, @@ -2437,7 +2437,7 @@ static void err_method_notfound(const QObject *object, case QSIGNAL_CODE: type = "signal"; break; } const char *loc = extract_location(method); - if (strchr(method,')') == 0) // common typing mistake + if (strchr(method,')') == nullptr) // common typing mistake qWarning("QObject::%s: Parentheses expected, %s %s::%s%s%s", func, type, object->metaObject()->className(), method+1, loc ? " in ": "", loc ? loc : ""); @@ -2497,7 +2497,7 @@ QObject *QObject::sender() const return cd->currentSender->sender; } - return 0; + return nullptr; } /*! @@ -2676,7 +2676,7 @@ void QMetaObjectPrivate::memberIndexes(const QObject *obj, return; const QMetaObject *m = obj->metaObject(); // Check that member is member of obj class - while (m != 0 && m != member.mobj) + while (m != nullptr && m != member.mobj) m = m->d.superdata; if (!m) return; @@ -2787,18 +2787,18 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign const QObject *receiver, const char *method, Qt::ConnectionType type) { - if (sender == 0 || receiver == 0 || signal == 0 || method == 0) { + if (sender == nullptr || receiver == nullptr || signal == nullptr || method == nullptr) { qWarning("QObject::connect: Cannot connect %s::%s to %s::%s", sender ? sender->metaObject()->className() : "(null)", (signal && *signal) ? signal+1 : "(null)", receiver ? receiver->metaObject()->className() : "(null)", (method && *method) ? method+1 : "(null)"); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } QByteArray tmp_signal_name; if (!check_signal_macro(sender, signal, "connect", "bind")) - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); const QMetaObject *smeta = sender->metaObject(); const char *signal_arg = signal; ++signal; //skip code @@ -2821,7 +2821,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign if (signal_index < 0) { err_method_notfound(sender, signal_arg, "connect"); err_info_about_objects("connect", sender, receiver); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } signal_index = QMetaObjectPrivate::originalClone(smeta, signal_index); signal_index += QMetaObjectPrivate::signalOffset(smeta); @@ -2830,7 +2830,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign int membcode = extract_code(method); if (!check_method_code(membcode, receiver, method, "connect")) - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); const char *method_arg = method; ++method; // skip code @@ -2873,7 +2873,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign if (method_index_relative < 0) { err_method_notfound(receiver, method_arg, "connect"); err_info_about_objects("connect", sender, receiver); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } if (!QMetaObjectPrivate::checkConnectArgs(signalTypes.size(), signalTypes.constData(), @@ -2882,13 +2882,13 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign "\n %s::%s --> %s::%s", sender->metaObject()->className(), signal, receiver->metaObject()->className(), method); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } - int *types = 0; + int *types = nullptr; if ((type == Qt::QueuedConnection) && !(types = queuedConnectionTypes(signalTypes.constData(), signalTypes.size()))) { - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } #ifndef QT_NO_DEBUG @@ -2925,8 +2925,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) { - if (sender == 0 - || receiver == 0 + if (sender == nullptr + || receiver == nullptr || signal.methodType() != QMetaMethod::Signal || method.methodType() == QMetaMethod::Constructor) { qWarning("QObject::connect: Cannot connect %s::%s to %s::%s", @@ -2934,7 +2934,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho signal.methodSignature().constData(), receiver ? receiver->metaObject()->className() : "(null)", method.methodSignature().constData() ); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } int signal_index; @@ -2950,12 +2950,12 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho if (signal_index == -1) { qWarning("QObject::connect: Can't find signal %s on instance of class %s", signal.methodSignature().constData(), smeta->className()); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } if (method_index == -1) { qWarning("QObject::connect: Can't find method %s on instance of class %s", method.methodSignature().constData(), rmeta->className()); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } if (!QMetaObject::checkConnectArgs(signal.methodSignature().constData(), method.methodSignature().constData())) { @@ -2963,19 +2963,19 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho "\n %s::%s --> %s::%s", smeta->className(), signal.methodSignature().constData(), rmeta->className(), method.methodSignature().constData()); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } - int *types = 0; + int *types = nullptr; if ((type == Qt::QueuedConnection) && !(types = queuedConnectionTypes(signal.parameterTypes()))) - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); #ifndef QT_NO_DEBUG check_and_warn_compat(smeta, signal, rmeta, method); #endif QMetaObject::Connection handle = QMetaObject::Connection(QMetaObjectPrivate::connect( - sender, signal_index, signal.enclosingMetaObject(), receiver, method_index, 0, type, types)); + sender, signal_index, signal.enclosingMetaObject(), receiver, method_index, nullptr, type, types)); return handle; } @@ -3058,7 +3058,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho bool QObject::disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) { - if (sender == 0 || (receiver == 0 && method != 0)) { + if (sender == nullptr || (receiver == nullptr && method != nullptr)) { qWarning("QObject::disconnect: Unexpected null parameter"); return false; } @@ -3130,7 +3130,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, } if (!method) { - res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, -1, 0); + res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, -1, nullptr); } else { const QMetaObject *rmeta = receiver->metaObject(); do { @@ -3141,7 +3141,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, rmeta = rmeta->superClass(); if (method_index < 0) break; - res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, method_index, 0); + res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, method_index, nullptr); method_found = true; } while ((rmeta = rmeta->superClass())); } @@ -3193,7 +3193,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) { - if (sender == 0 || (receiver == 0 && method.mobj != 0)) { + if (sender == nullptr || (receiver == nullptr && method.mobj != nullptr)) { qWarning("QObject::disconnect: Unexpected null parameter"); return false; } @@ -3242,7 +3242,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, return false; } - if (!QMetaObjectPrivate::disconnect(sender, signal_index, signal.mobj, receiver, method_index, 0)) + if (!QMetaObjectPrivate::disconnect(sender, signal_index, signal.mobj, receiver, method_index, nullptr)) return false; if (!signal.isValid()) { @@ -3381,7 +3381,7 @@ QMetaObject::Connection QMetaObject::connect(const QObject *sender, int signal_i signal_index = methodIndexToSignalIndex(&smeta, signal_index); return Connection(QMetaObjectPrivate::connect(sender, signal_index, smeta, receiver, method_index, - 0, //FIXME, we could speed this connection up by computing the relative index + nullptr, //FIXME, we could speed this connection up by computing the relative index type, types)); } @@ -3457,7 +3457,7 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, const QMetaObject *smeta = sender->metaObject(); signal_index = methodIndexToSignalIndex(&smeta, signal_index); return QMetaObjectPrivate::disconnect(sender, signal_index, smeta, - receiver, method_index, 0); + receiver, method_index, nullptr); } /*! @@ -3473,7 +3473,7 @@ bool QMetaObject::disconnectOne(const QObject *sender, int signal_index, const QMetaObject *smeta = sender->metaObject(); signal_index = methodIndexToSignalIndex(&smeta, signal_index); return QMetaObjectPrivate::disconnect(sender, signal_index, smeta, - receiver, method_index, 0, + receiver, method_index, nullptr, QMetaObjectPrivate::DisconnectOne); } @@ -3682,7 +3682,7 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect argumentTypes = queuedConnectionTypes(m.parameterTypes()); if (!argumentTypes) // cannot queue arguments argumentTypes = &DIRECT_CONNECTION_ONLY; - if (!c->argumentTypes.testAndSetOrdered(0, argumentTypes)) { + if (!c->argumentTypes.testAndSetOrdered(nullptr, argumentTypes)) { if (argumentTypes != &DIRECT_CONNECTION_ONLY) delete [] argumentTypes; argumentTypes = c->argumentTypes.loadRelaxed(); @@ -4293,10 +4293,10 @@ QObjectUserData* QObject::userData(uint id) const { Q_D(const QObject); if (!d->extraData) - return 0; + return nullptr; if ((int)id < d->extraData->userData.size()) return d->extraData->userData.at(id); - return 0; + return nullptr; } #endif // QT_NO_USERDATA @@ -4952,7 +4952,7 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa if (!senderMetaObject) { qWarning("QObject::connect: signal not found in %s", sender->metaObject()->className()); slotObj->destroyIfLastRef(); - return QMetaObject::Connection(0); + return QMetaObject::Connection(nullptr); } signal_index += QMetaObjectPrivate::signalOffset(senderMetaObject); return QObjectPrivate::connectImpl(sender, signal_index, receiver, slot, slotObj, type, types, senderMetaObject); @@ -5138,7 +5138,7 @@ bool QObject::disconnect(const QMetaObject::Connection &connection) bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject) { - if (sender == 0 || (receiver == 0 && slot != 0)) { + if (sender == nullptr || (receiver == nullptr && slot != nullptr)) { qWarning("QObject::disconnect: Unexpected null parameter"); return false; } @@ -5178,7 +5178,7 @@ QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signa const QMetaObject *senderMetaObject = sender->metaObject(); signal_index = methodIndexToSignalIndex(&senderMetaObject, signal_index); - return QObjectPrivate::connectImpl(sender, signal_index, sender, /*slot*/0, slotObj, type, /*types*/0, senderMetaObject); + return QObjectPrivate::connectImpl(sender, signal_index, sender, /*slot*/nullptr, slotObj, type, /*types*/nullptr, senderMetaObject); } /*! @@ -5235,7 +5235,7 @@ QMetaObject::Connection& QMetaObject::Connection::operator=(const QMetaObject::C Creates a Connection instance. */ -QMetaObject::Connection::Connection() : d_ptr(0) {} +QMetaObject::Connection::Connection() : d_ptr(nullptr) {} /*! Destructor for QMetaObject::Connection. diff --git a/src/corelib/kernel/qobjectcleanuphandler.cpp b/src/corelib/kernel/qobjectcleanuphandler.cpp index b6c62af4b3..8bf0e1fcab 100644 --- a/src/corelib/kernel/qobjectcleanuphandler.cpp +++ b/src/corelib/kernel/qobjectcleanuphandler.cpp @@ -94,7 +94,7 @@ QObjectCleanupHandler::~QObjectCleanupHandler() QObject *QObjectCleanupHandler::add(QObject* object) { if (!object) - return 0; + return nullptr; connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*))); cleanupObjects.insert(0, object); diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index 39f3002394..2d65e0bbe4 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -441,7 +441,7 @@ bool QSharedMemory::attach(AccessMode mode) bool QSharedMemory::isAttached() const { Q_D(const QSharedMemory); - return (0 != d->memory); + return (nullptr != d->memory); } /*! diff --git a/src/corelib/kernel/qsharedmemory_systemv.cpp b/src/corelib/kernel/qsharedmemory_systemv.cpp index fea4a65b5c..0ba5f65641 100644 --- a/src/corelib/kernel/qsharedmemory_systemv.cpp +++ b/src/corelib/kernel/qsharedmemory_systemv.cpp @@ -182,9 +182,9 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode) } // grab the memory - memory = shmat(id, 0, (mode == QSharedMemory::ReadOnly ? SHM_RDONLY : 0)); + memory = shmat(id, nullptr, (mode == QSharedMemory::ReadOnly ? SHM_RDONLY : 0)); if ((void*) - 1 == memory) { - memory = 0; + memory = nullptr; setErrorString(QLatin1String("QSharedMemory::attach (shmat)")); return false; } @@ -216,7 +216,7 @@ bool QSharedMemoryPrivate::detach() } return false; } - memory = 0; + memory = nullptr; size = 0; // Get the number of current attachments diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index f6d7e78441..bc0f3b03ca 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -68,7 +68,7 @@ QSharedMemoryPrivate::QSharedMemoryPrivate() : #ifndef QT_NO_QOBJECT QObjectPrivate(), #endif - memory(0), size(0), error(QSharedMemory::NoError), + memory(nullptr), size(0), error(QSharedMemory::NoError), #ifndef QT_NO_SYSTEMSEMAPHORE systemSemaphore(QString()), lockedByMe(false), #endif diff --git a/src/corelib/kernel/qtestsupport_core.cpp b/src/corelib/kernel/qtestsupport_core.cpp index 7bd81ed498..8498f7f025 100644 --- a/src/corelib/kernel/qtestsupport_core.cpp +++ b/src/corelib/kernel/qtestsupport_core.cpp @@ -55,7 +55,7 @@ Q_CORE_EXPORT void QTestPrivate::qSleep(int ms) Sleep(uint(ms)); #else struct timespec ts = { time_t(ms / 1000), (ms % 1000) * 1000 * 1000 }; - nanosleep(&ts, NULL); + nanosleep(&ts, nullptr); #endif } diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 948f697dc5..f843fc4236 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -277,7 +277,7 @@ protected: }; QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char *member) - : QObject(QAbstractEventDispatcher::instance()), hasValidReceiver(true), slotObj(0) + : QObject(QAbstractEventDispatcher::instance()), hasValidReceiver(true), slotObj(nullptr) { timerId = startTimer(msec, timerType); connect(this, SIGNAL(timeout()), r, member); @@ -290,7 +290,7 @@ QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObj if (r && thread() != r->thread()) { // Avoid leaking the QSingleShotTimer instance in case the application exits before the timer fires connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &QObject::deleteLater); - setParent(0); + setParent(nullptr); moveToThread(r->thread()); } } @@ -316,7 +316,7 @@ void QSingleShotTimer::timerEvent(QTimerEvent *) if (Q_LIKELY(!receiver.isNull() || !hasValidReceiver)) { // We allocate only the return type - we previously checked the function had // no arguments. - void *args[1] = { 0 }; + void *args[1] = { nullptr }; slotObj->call(const_cast(receiver.data()), args); } } else { diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp index 39010c19cb..b425ca3dcb 100644 --- a/src/corelib/kernel/qtimerinfo_unix.cpp +++ b/src/corelib/kernel/qtimerinfo_unix.cpp @@ -83,7 +83,7 @@ QTimerInfoList::QTimerInfoList() } #endif - firstTimerInfo = 0; + firstTimerInfo = nullptr; } timespec QTimerInfoList::updateCurrentTime() @@ -389,7 +389,7 @@ bool QTimerInfoList::timerWait(timespec &tm) repairTimersIfNeeded(); // Find first waiting timer not already active - QTimerInfo *t = 0; + QTimerInfo *t = nullptr; for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { if (!(*it)->activateRef) { t = *it; @@ -450,7 +450,7 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time t->interval = interval; t->timerType = timerType; t->obj = object; - t->activateRef = 0; + t->activateRef = nullptr; timespec expected = updateCurrentTime() + interval; @@ -514,9 +514,9 @@ bool QTimerInfoList::unregisterTimer(int timerId) // found it removeAt(i); if (t == firstTimerInfo) - firstTimerInfo = 0; + firstTimerInfo = nullptr; if (t->activateRef) - *(t->activateRef) = 0; + *(t->activateRef) = nullptr; delete t; return true; } @@ -535,9 +535,9 @@ bool QTimerInfoList::unregisterTimers(QObject *object) // object found removeAt(i); if (t == firstTimerInfo) - firstTimerInfo = 0; + firstTimerInfo = nullptr; if (t->activateRef) - *(t->activateRef) = 0; + *(t->activateRef) = nullptr; delete t; // move back one so that we don't skip the new current item --i; @@ -571,7 +571,7 @@ int QTimerInfoList::activateTimers() return 0; // nothing to do int n_act = 0, maxCount = 0; - firstTimerInfo = 0; + firstTimerInfo = nullptr; timespec currentTime = updateCurrentTime(); // qDebug() << "Thread" << QThread::currentThreadId() << "woken up at" << currentTime; @@ -643,11 +643,11 @@ int QTimerInfoList::activateTimers() QCoreApplication::sendEvent(currentTimerInfo->obj, &e); if (currentTimerInfo) - currentTimerInfo->activateRef = 0; + currentTimerInfo->activateRef = nullptr; } } - firstTimerInfo = 0; + firstTimerInfo = nullptr; // qDebug() << "Thread" << QThread::currentThreadId() << "activated" << n_act << "timers"; return n_act; } diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index ddb96ecad6..93d75feafa 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -289,8 +289,8 @@ public: #if defined(QT_USE_MMAP) used_mmap(0), #endif - unmapPointer(0), unmapLength(0), resource(0), - messageArray(0), offsetArray(0), contextArray(0), numerusRulesArray(0), + unmapPointer(nullptr), unmapLength(0), resource(nullptr), + messageArray(nullptr), offsetArray(nullptr), contextArray(nullptr), numerusRulesArray(nullptr), messageLength(0), offsetLength(0), contextLength(0), numerusRulesLength(0) {} #if defined(QT_USE_MMAP) @@ -539,7 +539,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo ok = true; } else { delete resource; - resource = 0; + resource = nullptr; } } @@ -610,8 +610,8 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo delete [] unmapPointer; delete d->resource; - d->resource = 0; - d->unmapPointer = 0; + d->resource = nullptr; + d->unmapPointer = nullptr; d->unmapLength = 0; return false; @@ -874,10 +874,10 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString } if (!ok) { - messageArray = 0; - contextArray = 0; - offsetArray = 0; - numerusRulesArray = 0; + messageArray = nullptr; + contextArray = nullptr; + offsetArray = nullptr; + numerusRulesArray = nullptr; messageLength = 0; contextLength = 0; offsetLength = 0; @@ -890,7 +890,7 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString static QString getMessage(const uchar *m, const uchar *end, const char *context, const char *sourceText, const char *comment, uint numerus) { - const uchar *tn = 0; + const uchar *tn = nullptr; uint tn_length = 0; const uint sourceTextLen = uint(strlen(sourceText)); const uint contextLen = uint(strlen(context)); @@ -957,11 +957,11 @@ end: QString QTranslatorPrivate::do_translate(const char *context, const char *sourceText, const char *comment, int n) const { - if (context == 0) + if (context == nullptr) context = ""; - if (sourceText == 0) + if (sourceText == nullptr) sourceText = ""; - if (comment == 0) + if (comment == nullptr) comment = ""; uint numerus = 0; @@ -1076,13 +1076,13 @@ void QTranslatorPrivate::clear() } delete resource; - resource = 0; - unmapPointer = 0; + resource = nullptr; + unmapPointer = nullptr; unmapLength = 0; - messageArray = 0; - contextArray = 0; - offsetArray = 0; - numerusRulesArray = 0; + messageArray = nullptr; + contextArray = nullptr; + offsetArray = nullptr; + numerusRulesArray = nullptr; messageLength = 0; contextLength = 0; offsetLength = 0; diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index d1eb463514..455dd5069f 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2523,7 +2523,7 @@ void QVariant::load(QDataStream &s) return; } } - create(typeId, 0); + create(typeId, nullptr); d.is_null = is_null; if (!isValid()) { diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index 24a7a35ea5..1fbcc31fae 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -487,7 +487,7 @@ QMimeDatabase::QMimeDatabase() : */ QMimeDatabase::~QMimeDatabase() { - d = 0; + d = nullptr; } /*! diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index a3a6b9615c..c61759025c 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -130,7 +130,7 @@ bool QMimeBinaryProvider::CacheFile::reload() if (file.isOpen()) { file.close(); } - data = 0; + data = nullptr; return load(); } @@ -306,7 +306,7 @@ bool QMimeBinaryProvider::matchMagicRule(QMimeBinaryProvider::CacheFile *cacheFi const int valueLength = cacheFile->getUint32(off + 12); const int valueOffset = cacheFile->getUint32(off + 16); const int maskOffset = cacheFile->getUint32(off + 20); - const char *mask = maskOffset ? cacheFile->getCharStar(maskOffset) : NULL; + const char *mask = maskOffset ? cacheFile->getCharStar(maskOffset) : nullptr; if (!QMimeMagicRule::matchSubstring(dataPtr, dataSize, rangeStart, rangeLength, valueLength, cacheFile->getCharStar(valueOffset), mask)) continue; diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 18f10c9b43..14de8db1c6 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -212,7 +212,7 @@ void QFactoryLoader::update() QStringList(QLatin1String("libplugins_%1_*.so").arg(d->suffix)), #endif QDir::Files); - QLibraryPrivate *library = 0; + QLibraryPrivate *library = nullptr; for (int j = 0; j < plugins.count(); ++j) { QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); @@ -383,7 +383,7 @@ QObject *QFactoryLoader::instance(int index) const { Q_D(const QFactoryLoader); if (index < 0) - return 0; + return nullptr; #if QT_CONFIG(library) QMutexLocker lock(&d->mutex); @@ -399,7 +399,7 @@ QObject *QFactoryLoader::instance(int index) const return obj; } } - return 0; + return nullptr; } index -= d->libraryList.size(); lock.unlock(); @@ -416,7 +416,7 @@ QObject *QFactoryLoader::instance(int index) const --index; } - return 0; + return nullptr; } QMultiMap QFactoryLoader::keyMap() const diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index eeaa3c18ec..b3a95d4f26 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -256,7 +256,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib) qsizetype fdlen = qMin(file.size(), MaxMemoryMapSize); const char *filedata = reinterpret_cast(file.map(0, fdlen)); - if (filedata == 0) { + if (filedata == nullptr) { // Try reading the data into memory instead (up to 64 MB). data = file.read(64 * 1024 * 1024); filedata = data.constData(); @@ -387,12 +387,12 @@ private: }; static QBasicMutex qt_library_mutex; -static QLibraryStore *qt_library_data = 0; +static QLibraryStore *qt_library_data = nullptr; static bool qt_library_data_once; QLibraryStore::~QLibraryStore() { - qt_library_data = 0; + qt_library_data = nullptr; } inline void QLibraryStore::cleanup() @@ -459,7 +459,7 @@ inline QLibraryPrivate *QLibraryStore::findOrCreate(const QString &fileName, con QLibraryStore *data = instance(); // check if this library is already loaded - QLibraryPrivate *lib = 0; + QLibraryPrivate *lib = nullptr; if (Q_LIKELY(data)) { lib = data->libraryMap.value(fileName); if (lib) @@ -498,7 +498,7 @@ inline void QLibraryStore::releaseLibrary(QLibraryPrivate *lib) } QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString &version, QLibrary::LoadHints loadHints) - : pHnd(0), fileName(canonicalFileName), fullVersion(version), instance(0), + : pHnd(nullptr), fileName(canonicalFileName), fullVersion(version), instance(nullptr), libraryRefCount(0), libraryUnloadCount(0), pluginState(MightBeAPlugin) { loadHintsInt.storeRelaxed(loadHints); @@ -528,7 +528,7 @@ void QLibraryPrivate::mergeLoadHints(QLibrary::LoadHints lh) QFunctionPointer QLibraryPrivate::resolve(const char *symbol) { if (!pHnd) - return 0; + return nullptr; return resolve_sys(symbol); } @@ -584,12 +584,12 @@ bool QLibraryPrivate::unload(UnloadFlag flag) //when the library is unloaded, we release the reference on it so that 'this' //can get deleted libraryRefCount.deref(); - pHnd = 0; - instance = 0; + pHnd = nullptr; + instance = nullptr; } } - return (pHnd == 0); + return (pHnd == nullptr); } void QLibraryPrivate::release() @@ -847,7 +847,7 @@ bool QLibrary::isLoaded() const Constructs a library with the given \a parent. */ QLibrary::QLibrary(QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { } @@ -862,7 +862,7 @@ QLibrary::QLibrary(QObject *parent) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { setFileName(fileName); } @@ -879,7 +879,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { setFileNameAndVersion(fileName, verNum); } @@ -895,7 +895,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { setFileNameAndVersion(fileName, version); } @@ -942,7 +942,7 @@ void QLibrary::setFileName(const QString &fileName) if (d) { lh = d->loadHints(); d->release(); - d = 0; + d = nullptr; did_load = false; } d = QLibraryPrivate::findOrCreate(fileName, QString(), lh); @@ -970,7 +970,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, int verNum) if (d) { lh = d->loadHints(); d->release(); - d = 0; + d = nullptr; did_load = false; } d = QLibraryPrivate::findOrCreate(fileName, verNum >= 0 ? QString::number(verNum) : QString(), lh); @@ -991,7 +991,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver if (d) { lh = d->loadHints(); d->release(); - d = 0; + d = nullptr; did_load = false; } d = QLibraryPrivate::findOrCreate(fileName, version, lh); @@ -1020,7 +1020,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver QFunctionPointer QLibrary::resolve(const char *symbol) { if (!isLoaded() && !load()) - return 0; + return nullptr; return d->resolve(symbol); } diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index f0de1010d7..6eb84b327b 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -277,7 +277,7 @@ bool QLibraryPrivate::load_sys() qualifiedFileName = attempt; errorString.clear(); } - return (pHnd != 0); + return (pHnd != nullptr); } bool QLibraryPrivate::unload_sys() diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index c2443dbdda..aed1704d5f 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -136,7 +136,7 @@ QT_BEGIN_NAMESPACE Constructs a plugin loader with the given \a parent. */ QPluginLoader::QPluginLoader(QObject *parent) - : QObject(parent), d(0), did_load(false) + : QObject(parent), d(nullptr), did_load(false) { } @@ -152,7 +152,7 @@ QPluginLoader::QPluginLoader(QObject *parent) \sa setFileName() */ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent) - : QObject(parent), d(0), did_load(false) + : QObject(parent), d(nullptr), did_load(false) { setFileName(fileName); setLoadHints(QLibrary::PreventUnloadHint); @@ -195,7 +195,7 @@ QPluginLoader::~QPluginLoader() QObject *QPluginLoader::instance() { if (!isLoaded() && !load()) - return 0; + return nullptr; if (!d->inst && d->instance) d->inst = d->instance(); return d->inst.data(); @@ -363,7 +363,7 @@ void QPluginLoader::setFileName(const QString &fileName) if (d) { lh = d->loadHints(); d->release(); - d = 0; + d = nullptr; did_load = false; } diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp index 0db44bc427..10f54c3e18 100644 --- a/src/corelib/statemachine/qabstractstate.cpp +++ b/src/corelib/statemachine/qabstractstate.cpp @@ -84,19 +84,19 @@ QT_BEGIN_NAMESPACE QAbstractStatePrivate::QAbstractStatePrivate(StateType type) - : stateType(type), isMachine(false), active(false), parentState(0) + : stateType(type), isMachine(false), active(false), parentState(nullptr) { } QStateMachine *QAbstractStatePrivate::machine() const { QObject *par = parent; - while (par != 0) { + while (par != nullptr) { if (QStateMachine *mach = qobject_cast(par)) return mach; par = par->parent(); } - return 0; + return nullptr; } void QAbstractStatePrivate::callOnEntry(QEvent *e) diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index d841fd3c8b..df70b54721 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -144,7 +144,7 @@ QStateMachine *QAbstractTransitionPrivate::machine() const Q_Q(const QAbstractTransition); if (QHistoryState *parent = qobject_cast(q->parent())) return parent->machine(); - return 0; + return nullptr; } bool QAbstractTransitionPrivate::callEventTest(QEvent *e) @@ -223,7 +223,7 @@ void QAbstractTransition::setTargetState(QAbstractState* target) { Q_D(QAbstractTransition); if ((d->targetStates.size() == 1 && target == d->targetStates.at(0).data()) || - (d->targetStates.isEmpty() && target == 0)) { + (d->targetStates.isEmpty() && target == nullptr)) { return; } if (!target) diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp index a90f147773..5dcbcfff47 100644 --- a/src/corelib/statemachine/qeventtransition.cpp +++ b/src/corelib/statemachine/qeventtransition.cpp @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE */ QEventTransitionPrivate::QEventTransitionPrivate() { - object = 0; + object = nullptr; eventType = QEvent::None; registered = false; } diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp index ccf04d4799..e5b8075b96 100644 --- a/src/corelib/statemachine/qhistorystate.cpp +++ b/src/corelib/statemachine/qhistorystate.cpp @@ -147,7 +147,7 @@ protected: QHistoryStatePrivate::QHistoryStatePrivate() : QAbstractStatePrivate(HistoryState) - , defaultTransition(0) + , defaultTransition(nullptr) , historyType(QHistoryState::ShallowHistory) { } diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index 59e0c0d788..8e57695fd7 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE QSignalTransitionPrivate::QSignalTransitionPrivate() { - sender = 0; + sender = nullptr; signalIndex = -1; } diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 62dd4f0284..f641d25a96 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -146,7 +146,7 @@ QT_BEGIN_NAMESPACE QStatePrivate::QStatePrivate() : QAbstractStatePrivate(StandardState), - errorState(0), initialState(0), childMode(QState::ExclusiveStates), + errorState(nullptr), initialState(nullptr), childMode(QState::ExclusiveStates), childStatesListNeedsRefresh(true), transitionsListNeedsRefresh(true) { } @@ -293,11 +293,11 @@ QAbstractState *QState::errorState() const void QState::setErrorState(QAbstractState *state) { Q_D(QState); - if (state != 0 && qobject_cast(state)) { + if (state != nullptr && qobject_cast(state)) { qWarning("QStateMachine::setErrorState: root state cannot be error state"); return; } - if (state != 0 && (!state->machine() || ((state->machine() != machine()) && !qobject_cast(this)))) { + if (state != nullptr && (!state->machine() || ((state->machine() != machine()) && !qobject_cast(this)))) { qWarning("QState::setErrorState: error state cannot belong " "to a different state machine"); return; @@ -360,15 +360,15 @@ QSignalTransition *QState::addTransition(const QObject *sender, const char *sign { if (!sender) { qWarning("QState::addTransition: sender cannot be null"); - return 0; + return nullptr; } if (!signal) { qWarning("QState::addTransition: signal cannot be null"); - return 0; + return nullptr; } if (!target) { qWarning("QState::addTransition: cannot add transition to null state"); - return 0; + return nullptr; } int offset = (*signal == '0'+QSIGNAL_CODE) ? 1 : 0; const QMetaObject *meta = sender->metaObject(); @@ -376,7 +376,7 @@ QSignalTransition *QState::addTransition(const QObject *sender, const char *sign if (meta->indexOfSignal(QMetaObject::normalizedSignature(signal+offset)) == -1) { qWarning("QState::addTransition: no such signal %s::%s", meta->className(), signal+offset); - return 0; + return nullptr; } } QSignalTransition *trans = new QSignalTransition(sender, signal); @@ -409,7 +409,7 @@ QAbstractTransition *QState::addTransition(QAbstractState *target) { if (!target) { qWarning("QState::addTransition: cannot add transition to null state"); - return 0; + return nullptr; } UnconditionalTransition *trans = new UnconditionalTransition(target); addTransition(trans); @@ -438,7 +438,7 @@ void QState::removeTransition(QAbstractTransition *transition) QStateMachinePrivate *mach = QStateMachinePrivate::get(d->machine()); if (mach) mach->unregisterTransition(transition); - transition->setParent(0); + transition->setParent(nullptr); } /*! @@ -544,7 +544,7 @@ bool QState::event(QEvent *e) d->childStatesListNeedsRefresh = true; d->transitionsListNeedsRefresh = true; if ((e->type() == QEvent::ChildRemoved) && (static_cast(e)->child() == d->initialState)) - d->initialState = 0; + d->initialState = nullptr; } return QAbstractState::event(e); } diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 44e4e151cb..9d2505ba2e 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -197,7 +197,7 @@ struct CalculationCache { bool transitionDomainIsKnown : 1; TransitionInfo() - : transitionDomain(0) + : transitionDomain(nullptr) , effectiveTargetStatesIsKnown(false) , exitSetIsKnown(false) , transitionDomainIsKnown(false) @@ -289,9 +289,9 @@ child of a child, etc.) Otherwise returns 'false'. */ static inline bool isDescendant(const QAbstractState *state1, const QAbstractState *state2) { - Q_ASSERT(state1 != 0); + Q_ASSERT(state1 != nullptr); - for (QAbstractState *it = state1->parentState(); it != 0; it = it->parentState()) { + for (QAbstractState *it = state1->parentState(); it != nullptr; it = it->parentState()) { if (it == state2) return true; } @@ -311,7 +311,7 @@ static bool containsDecendantOf(const QSet &states, const QAbs static int descendantDepth(const QAbstractState *state, const QAbstractState *ancestor) { int depth = 0; - for (const QAbstractState *it = state; it != 0; it = it->parentState()) { + for (const QAbstractState *it = state; it != nullptr; it = it->parentState()) { if (it == ancestor) break; ++depth; @@ -332,7 +332,7 @@ this returns the empty set. */ static QVector getProperAncestors(const QAbstractState *state, const QAbstractState *upperBound) { - Q_ASSERT(state != 0); + Q_ASSERT(state != nullptr); QVector result; result.reserve(16); for (QState *it = state->parentState(); it && it != upperBound; it = it->parentState()) { @@ -405,7 +405,7 @@ QStateMachinePrivate::QStateMachinePrivate() stopProcessingReason = EventQueueEmpty; error = QStateMachine::NoError; globalRestorePolicy = QState::DontRestoreProperties; - signalEventGenerator = 0; + signalEventGenerator = nullptr; #if QT_CONFIG(animation) animated = true; #endif @@ -437,7 +437,7 @@ static QEvent *cloneEvent(QEvent *e) Q_ASSERT_X(false, "cloneEvent()", "not implemented"); break; } - return 0; + return nullptr; } const QStateMachinePrivate::Handler qt_kernel_statemachine_handler = { @@ -474,10 +474,10 @@ bool QStateMachinePrivate::transitionStateEntryLessThan(QAbstractTransition *t1, } else if (isDescendant(s2, s1)) { return false; } else { - Q_ASSERT(s1->machine() != 0); + Q_ASSERT(s1->machine() != nullptr); QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); QState *lca = mach->findLCA(QList() << s1 << s2); - Q_ASSERT(lca != 0); + Q_ASSERT(lca != nullptr); int s1Depth = descendantDepth(s1, lca); int s2Depth = descendantDepth(s2, lca); if (s1Depth == s2Depth) @@ -497,10 +497,10 @@ bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState } else if (isDescendant(s2, s1)) { return true; } else { - Q_ASSERT(s1->machine() != 0); + Q_ASSERT(s1->machine() != nullptr); QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); QState *lca = mach->findLCA(QList() << s1 << s2); - Q_ASSERT(lca != 0); + Q_ASSERT(lca != nullptr); return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); } } @@ -515,10 +515,10 @@ bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState } else if (isDescendant(s2, s1)) { return false; } else { - Q_ASSERT(s1->machine() != 0); + Q_ASSERT(s1->machine() != nullptr); QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); QState *lca = mach->findLCA(QList() << s1 << s2); - Q_ASSERT(lca != 0); + Q_ASSERT(lca != nullptr); return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1)); } } @@ -526,7 +526,7 @@ bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState QState *QStateMachinePrivate::findLCA(const QList &states, bool onlyCompound) { if (states.isEmpty()) - return 0; + return nullptr; QVector ancestors = getProperAncestors(states.at(0), rootState()->parentState()); for (int i = 0; i < ancestors.size(); ++i) { QState *anc = ancestors.at(i); @@ -792,7 +792,7 @@ QSet QStateMachinePrivate::computeExitSet_Unordered(QAbstractTr lst.prepend(t->sourceState()); domain = findLCCA(lst); - Q_ASSERT(domain != 0); + Q_ASSERT(domain != nullptr); } for (QAbstractState* s : qAsConst(configuration)) { @@ -918,7 +918,7 @@ QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t Q_ASSERT(cache); if (effectiveTargetStates.isEmpty()) - return 0; + return nullptr; QAbstractState *domain = nullptr; if (cache->transitionDomain(t, &domain)) @@ -1234,28 +1234,28 @@ QState *QStateMachinePrivate::toStandardState(QAbstractState *state) { if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)) return static_cast(state); - return 0; + return nullptr; } const QState *QStateMachinePrivate::toStandardState(const QAbstractState *state) { if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)) return static_cast(state); - return 0; + return nullptr; } QFinalState *QStateMachinePrivate::toFinalState(QAbstractState *state) { if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::FinalState)) return static_cast(state); - return 0; + return nullptr; } QHistoryState *QStateMachinePrivate::toHistoryState(QAbstractState *state) { if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::HistoryState)) return static_cast(state); - return 0; + return nullptr; } bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const @@ -1455,13 +1455,13 @@ QHash > QStateMachinePrivate::comp QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context) { // Find error state recursively in parent hierarchy if not set explicitly for context state - QAbstractState *errorState = 0; - if (context != 0) { + QAbstractState *errorState = nullptr; + if (context != nullptr) { QState *s = toStandardState(context); - if (s != 0) + if (s != nullptr) errorState = s->errorState(); - if (errorState == 0) + if (errorState == nullptr) errorState = findErrorState(context->parentState()); } @@ -1475,21 +1475,21 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta error = errorCode; switch (errorCode) { case QStateMachine::NoInitialStateError: - Q_ASSERT(currentContext != 0); + Q_ASSERT(currentContext != nullptr); errorString = QStateMachine::tr("Missing initial state in compound state '%1'") .arg(currentContext->objectName()); break; case QStateMachine::NoDefaultStateInHistoryStateError: - Q_ASSERT(currentContext != 0); + Q_ASSERT(currentContext != nullptr); errorString = QStateMachine::tr("Missing default state in history state '%1'") .arg(currentContext->objectName()); break; case QStateMachine::NoCommonAncestorForTransitionError: - Q_ASSERT(currentContext != 0); + Q_ASSERT(currentContext != nullptr); errorString = QStateMachine::tr("No common ancestor for targets and source of transition from state '%1'") .arg(currentContext->objectName()); @@ -1513,11 +1513,11 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta // Avoid infinite loop if the error state itself has an error if (currentContext == currentErrorState) - currentErrorState = 0; + currentErrorState = nullptr; Q_ASSERT(currentErrorState != rootState()); - if (currentErrorState != 0) { + if (currentErrorState != nullptr) { #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": entering error state" << currentErrorState << "from" << currentContext; #endif @@ -1549,7 +1549,7 @@ QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation, } } else { QPropertyAnimation *animation = qobject_cast(abstractAnimation); - if (animation != 0 + if (animation != nullptr && prop.object == animation->targetObject() && prop.propertyName == animation->propertyName()) { @@ -1568,7 +1568,7 @@ void QStateMachinePrivate::_q_animationFinished() { Q_Q(QStateMachine); QAbstractAnimation *anim = qobject_cast(q->sender()); - Q_ASSERT(anim != 0); + Q_ASSERT(anim != nullptr); QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished())); if (resetAnimationEndValues.contains(anim)) { qobject_cast(anim)->setEndValue(QVariant()); // ### generalize @@ -1576,7 +1576,7 @@ void QStateMachinePrivate::_q_animationFinished() } QAbstractState *state = stateForAnimation.take(anim); - Q_ASSERT(state != 0); + Q_ASSERT(state != nullptr); #ifndef QT_NO_PROPERTIES // Set the final property value. @@ -1638,7 +1638,7 @@ void QStateMachinePrivate::terminateActiveAnimations(QAbstractState *state, resetAnimationEndValues.remove(anim); } QPropertyAssignment assn = propertyForAnimation.take(anim); - Q_ASSERT(assn.object != 0); + Q_ASSERT(assn.object != nullptr); // If there is no property assignment that sets this property, // set the property to its target value. bool found = false; @@ -1745,7 +1745,7 @@ QAbstractTransition *QStateMachinePrivate::createInitialTransition() const }; QState *root = rootState(); - Q_ASSERT(root != 0); + Q_ASSERT(root != nullptr); QList targets; switch (root->childMode()) { case QState::ExclusiveStates: @@ -1891,26 +1891,26 @@ void QStateMachinePrivate::_q_process() enabledTransitions = selectTransitions(e, &calculationCache); if (enabledTransitions.isEmpty()) { delete e; - e = 0; + e = nullptr; } - while (enabledTransitions.isEmpty() && ((e = dequeueInternalEvent()) != 0)) { + while (enabledTransitions.isEmpty() && ((e = dequeueInternalEvent()) != nullptr)) { #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": dequeued internal event" << e << "of type" << e->type(); #endif enabledTransitions = selectTransitions(e, &calculationCache); if (enabledTransitions.isEmpty()) { delete e; - e = 0; + e = nullptr; } } - while (enabledTransitions.isEmpty() && ((e = dequeueExternalEvent()) != 0)) { + while (enabledTransitions.isEmpty() && ((e = dequeueExternalEvent()) != nullptr)) { #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": dequeued external event" << e << "of type" << e->type(); #endif enabledTransitions = selectTransitions(e, &calculationCache); if (enabledTransitions.isEmpty()) { delete e; - e = 0; + e = nullptr; } } if (enabledTransitions.isEmpty()) { @@ -2009,7 +2009,7 @@ QEvent *QStateMachinePrivate::dequeueInternalEvent() { QMutexLocker locker(&internalEventMutex); if (internalEventQueue.isEmpty()) - return 0; + return nullptr; return internalEventQueue.takeFirst(); } @@ -2017,7 +2017,7 @@ QEvent *QStateMachinePrivate::dequeueExternalEvent() { QMutexLocker locker(&externalEventMutex); if (externalEventQueue.isEmpty()) - return 0; + return nullptr; return externalEventQueue.takeFirst(); } @@ -2175,15 +2175,15 @@ void QStateMachinePrivate::goToState(QAbstractState *targetState) return; Q_ASSERT(state == Running); - QState *sourceState = 0; + QState *sourceState = nullptr; QSet::const_iterator it; for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { sourceState = toStandardState(*it); - if (sourceState != 0) + if (sourceState != nullptr) break; } - Q_ASSERT(sourceState != 0); + Q_ASSERT(sourceState != nullptr); // Reuse previous GoToStateTransition in case of several calls to // goToState() in a row. GoToStateTransition *trans = sourceState->findChild(); @@ -2327,7 +2327,7 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit Q_ASSERT(connectedSignalIndexes.size() > signalIndex); Q_ASSERT(connectedSignalIndexes.at(signalIndex) != 0); if (--connectedSignalIndexes[signalIndex] == 0) { - Q_ASSERT(signalEventGenerator != 0); + Q_ASSERT(signalEventGenerator != nullptr); static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset(); QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, generatorMethodOffset); int sum = 0; @@ -2454,7 +2454,7 @@ void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalInd Constructs a new state machine with the given \a parent. */ QStateMachine::QStateMachine(QObject *parent) - : QState(*new QStateMachinePrivate, /*parentState=*/0) + : QState(*new QStateMachinePrivate, /*parentState=*/nullptr) { // Can't pass the parent to the QState constructor, as it expects a QState // But this works as expected regardless of whether parent is a QState or not @@ -2472,7 +2472,7 @@ QStateMachine::QStateMachine(QObject *parent) state machine is invalid, and might work incorrectly. */ QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent) - : QState(*new QStateMachinePrivate, /*parentState=*/0) + : QState(*new QStateMachinePrivate, /*parentState=*/nullptr) { Q_D(QStateMachine); d->childMode = childMode; @@ -2495,7 +2495,7 @@ QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent) \internal */ QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent) - : QState(dd, /*parentState=*/0) + : QState(dd, /*parentState=*/nullptr) { setParent(parent); } @@ -2637,7 +2637,7 @@ void QStateMachine::removeState(QAbstractState *state) state, QAbstractStatePrivate::get(state)->machine(), this); return; } - state->setParent(0); + state->setParent(nullptr); } bool QStateMachine::isRunning() const @@ -2661,7 +2661,7 @@ void QStateMachine::start() { Q_D(QStateMachine); - if ((childMode() == QState::ExclusiveStates) && (initialState() == 0)) { + if ((childMode() == QState::ExclusiveStates) && (initialState() == nullptr)) { qWarning("QStateMachine::start: No initial state set for machine. Refusing to start."); return; } @@ -2897,7 +2897,7 @@ bool QStateMachine::event(QEvent *e) d->delayedEventsMutex.lock(); int id = d->timerIdToDelayedEventId.take(tid); QStateMachinePrivate::DelayedEvent ee = d->delayedEvents.take(id); - if (ee.event != 0) { + if (ee.event != nullptr) { Q_ASSERT(ee.timerId == tid); killTimer(tid); d->delayedEventIdFreeList.release(id); @@ -3103,7 +3103,7 @@ void QSignalEventGenerator::qt_static_metacall(QObject *_o, QMetaObject::Call _c const QMetaObject QSignalEventGenerator::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_QSignalEventGenerator.data, - qt_meta_data_QSignalEventGenerator, qt_static_metacall, 0, 0 } + qt_meta_data_QSignalEventGenerator, qt_static_metacall, nullptr, nullptr } }; const QMetaObject *QSignalEventGenerator::metaObject() const @@ -3113,7 +3113,7 @@ const QMetaObject *QSignalEventGenerator::metaObject() const void *QSignalEventGenerator::qt_metacast(const char *_clname) { - if (!_clname) return 0; + if (!_clname) return nullptr; if (!strcmp(_clname, qt_meta_stringdata_QSignalEventGenerator.stringdata)) return static_cast(const_cast< QSignalEventGenerator*>(this)); return QObject::qt_metacast(_clname); diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 75a5bc802e..694d491273 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_SYSTEMLOCALE -static QSystemLocale *_systemLocale = 0; +static QSystemLocale *_systemLocale = nullptr; class QSystemLocaleSingleton: public QSystemLocale { public: @@ -695,7 +695,7 @@ QSystemLocale::QSystemLocale(bool) QSystemLocale::~QSystemLocale() { if (_systemLocale == this) { - _systemLocale = 0; + _systemLocale = nullptr; globalLocaleData.m_language_id = 0; } @@ -2429,7 +2429,7 @@ QTime QLocale::toTime(const QString &string, const QString &format, QCalendar ca QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format)) - dt.fromString(string, 0, &time); + dt.fromString(string, nullptr, &time); #else Q_UNUSED(cal); Q_UNUSED(string); @@ -2468,7 +2468,7 @@ QDate QLocale::toDate(const QString &string, const QString &format, QCalendar ca QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format)) - dt.fromString(string, &date, 0); + dt.fromString(string, &date, nullptr); #else Q_UNUSED(string); Q_UNUSED(format); diff --git a/src/corelib/text/qlocale_tools.cpp b/src/corelib/text/qlocale_tools.cpp index c246028b4d..0da769d694 100644 --- a/src/corelib/text/qlocale_tools.cpp +++ b/src/corelib/text/qlocale_tools.cpp @@ -322,7 +322,7 @@ double qt_asciiToDouble(const char *num, int numLen, bool &ok, int &processed, conv_flags = double_conversion::StringToDoubleConverter::ALLOW_LEADING_SPACES | double_conversion::StringToDoubleConverter::ALLOW_TRAILING_SPACES; } - double_conversion::StringToDoubleConverter conv(conv_flags, 0.0, qt_qnan(), 0, 0); + double_conversion::StringToDoubleConverter conv(conv_flags, 0.0, qt_qnan(), nullptr, nullptr); d = conv.StringToDouble(num, numLen, &processed); if (!qIsFinite(d)) { diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index d0bdc0d45c..e05bef450b 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -831,7 +831,7 @@ struct QRegularExpressionPrivate : QSharedData QRegularExpression::MatchType matchType, QRegularExpression::MatchOptions matchOptions, CheckSubjectStringOption checkSubjectStringOption = CheckSubjectString, - const QRegularExpressionMatchPrivate *previous = 0) const; + const QRegularExpressionMatchPrivate *previous = nullptr) const; int captureIndexForName(QStringView name) const; @@ -990,7 +990,7 @@ void QRegularExpressionPrivate::compilePattern() options, &errorCode, &patternErrorOffset, - NULL); + nullptr); if (!compiledPattern) { errorOffset = static_cast(patternErrorOffset); @@ -1049,7 +1049,7 @@ public: { // The default JIT stack size in PCRE is 32K, // we allocate from 32K up to 512K. - stack = pcre2_jit_stack_create_16(32 * 1024, 512 * 1024, NULL); + stack = pcre2_jit_stack_create_16(32 * 1024, 512 * 1024, nullptr); } /*! \internal @@ -1073,7 +1073,7 @@ static pcre2_jit_stack_16 *qtPcreCallback(void *) if (jitStacks()->hasLocalData()) return jitStacks()->localData()->stack; - return 0; + return nullptr; } /*! @@ -1240,9 +1240,9 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString previousMatchWasEmpty = true; } - pcre2_match_context_16 *matchContext = pcre2_match_context_create_16(NULL); - pcre2_jit_stack_assign_16(matchContext, &qtPcreCallback, NULL); - pcre2_match_data_16 *matchData = pcre2_match_data_create_from_pattern_16(compiledPattern, NULL); + pcre2_match_context_16 *matchContext = pcre2_match_context_create_16(nullptr); + pcre2_jit_stack_assign_16(matchContext, &qtPcreCallback, nullptr); + pcre2_match_data_16 *matchData = pcre2_match_data_create_from_pattern_16(compiledPattern, nullptr); const unsigned short * const subjectUtf16 = subject.utf16() + subjectStart; diff --git a/src/corelib/text/qtextboundaryfinder.cpp b/src/corelib/text/qtextboundaryfinder.cpp index 070b041220..ebdba6b2c5 100644 --- a/src/corelib/text/qtextboundaryfinder.cpp +++ b/src/corelib/text/qtextboundaryfinder.cpp @@ -161,10 +161,10 @@ static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int */ QTextBoundaryFinder::QTextBoundaryFinder() : t(Grapheme) - , chars(0) + , chars(nullptr) , length(0) , freePrivate(true) - , d(0) + , d(nullptr) { } @@ -178,7 +178,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(const QTextBoundaryFinder &other) , length(other.length) , pos(other.pos) , freePrivate(true) - , d(0) + , d(nullptr) { if (other.d) { Q_ASSERT(length > 0); @@ -199,7 +199,7 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o if (other.d) { Q_ASSERT(other.length > 0); uint newCapacity = (other.length + 1) * sizeof(QCharAttributes); - QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) realloc(freePrivate ? d : 0, newCapacity); + QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) realloc(freePrivate ? d : nullptr, newCapacity); Q_CHECK_PTR(newD); freePrivate = true; d = newD; @@ -216,7 +216,7 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o } else { if (freePrivate) free(d); - d = 0; + d = nullptr; } return *this; @@ -242,7 +242,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QString &strin , length(string.length()) , pos(0) , freePrivate(true) - , d(0) + , d(nullptr) { if (length > 0) { d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes)); @@ -271,7 +271,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QChar *chars, , length(length) , pos(0) , freePrivate(true) - , d(0) + , d(nullptr) { if (!chars) { length = 0; diff --git a/src/corelib/thread/qexception.cpp b/src/corelib/thread/qexception.cpp index a3e30d5a7a..f9c63085b7 100644 --- a/src/corelib/thread/qexception.cpp +++ b/src/corelib/thread/qexception.cpp @@ -199,7 +199,7 @@ void ExceptionStore::setException(const QException &e) bool ExceptionStore::hasException() const { - return (exceptionHolder.exception() != 0); + return (exceptionHolder.exception() != nullptr); } ExceptionHolder ExceptionStore::exception() diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index 6430f38a3b..f1fd40e7b6 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -471,7 +471,7 @@ bool QFutureInterfaceBase::derefT() const QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState) : refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0), state(initialState), - manualProgress(false), m_expectedResultCount(0), runnable(0), m_pool(0) + manualProgress(false), m_expectedResultCount(0), runnable(nullptr), m_pool(nullptr) { progressTime.invalidate(); } diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 9e52f286ee..f3883278e3 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -70,7 +70,7 @@ class QRecursiveMutexPrivate : public QMutexData { public: QRecursiveMutexPrivate() - : QMutexData(QMutex::Recursive), owner(0), count(0) {} + : QMutexData(QMutex::Recursive), owner(nullptr), count(0) {} // written to by the thread that first owns 'mutex'; // read during attempts to acquire ownership of 'mutex' from any other thread: @@ -186,7 +186,7 @@ public: */ QMutex::QMutex(RecursionMode mode) { - d_ptr.storeRelaxed(mode == Recursive ? new QRecursiveMutexPrivate : 0); + d_ptr.storeRelaxed(mode == Recursive ? new QRecursiveMutexPrivate : nullptr); } /*! @@ -799,7 +799,7 @@ inline void QRecursiveMutexPrivate::unlock() noexcept if (count > 0) { count--; } else { - owner.storeRelaxed(0); + owner.storeRelaxed(nullptr); mutex.QBasicMutex::unlock(); } } diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp index 3270875471..72002838cf 100644 --- a/src/corelib/thread/qmutex_linux.cpp +++ b/src/corelib/thread/qmutex_linux.cpp @@ -106,7 +106,7 @@ static inline QMutexData *dummyFutexValue() } template static inline -bool lockInternal_helper(QBasicAtomicPointer &d_ptr, int timeout = -1, QElapsedTimer *elapsedTimer = 0) noexcept +bool lockInternal_helper(QBasicAtomicPointer &d_ptr, int timeout = -1, QElapsedTimer *elapsedTimer = nullptr) noexcept { if (!IsTimed) timeout = -1; @@ -175,7 +175,7 @@ void QBasicMutex::unlockInternal() noexcept Q_UNUSED(d); Q_ASSERT(!isRecursive()); - d_ptr.storeRelease(0); + d_ptr.storeRelease(nullptr); futexWakeOne(d_ptr); } diff --git a/src/corelib/thread/qorderedmutexlocker_p.h b/src/corelib/thread/qorderedmutexlocker_p.h index 570c526225..83edfd5879 100644 --- a/src/corelib/thread/qorderedmutexlocker_p.h +++ b/src/corelib/thread/qorderedmutexlocker_p.h @@ -69,7 +69,7 @@ class QOrderedMutexLocker public: QOrderedMutexLocker(QBasicMutex *m1, QBasicMutex *m2) : mtx1((m1 == m2) ? m1 : (std::less()(m1, m2) ? m1 : m2)), - mtx2((m1 == m2) ? 0 : (std::less()(m1, m2) ? m2 : m1)), + mtx2((m1 == m2) ? nullptr : (std::less()(m1, m2) ? m2 : m1)), locked(false) { relock(); diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp index c8463de402..8c28507d5a 100644 --- a/src/corelib/thread/qreadwritelock.cpp +++ b/src/corelib/thread/qreadwritelock.cpp @@ -227,7 +227,7 @@ bool QReadWriteLock::tryLockForRead(int timeout) return true; while (true) { - if (d == 0) { + if (d == nullptr) { if (!d_ptr.testAndSetAcquire(nullptr, dummyLockedForRead, d)) continue; return true; @@ -341,7 +341,7 @@ bool QReadWriteLock::tryLockForWrite(int timeout) return true; while (true) { - if (d == 0) { + if (d == nullptr) { if (!d_ptr.testAndSetAcquire(d, dummyLockedForWrite, d)) continue; return true; @@ -581,7 +581,7 @@ void QReadWriteLockPrivate::recursiveUnlock() if (self == currentWriter) { if (--writerCount > 0) return; - currentWriter = 0; + currentWriter = nullptr; } else { auto it = currentReaders.find(self); if (it == currentReaders.end()) { diff --git a/src/corelib/thread/qresultstore.cpp b/src/corelib/thread/qresultstore.cpp index 1b3bc20eca..0b82b938e1 100644 --- a/src/corelib/thread/qresultstore.cpp +++ b/src/corelib/thread/qresultstore.cpp @@ -192,7 +192,7 @@ int ResultStoreBase::addResults(int index, const void *results, int vectorSize, ResultItem filteredIn(results, vectorSize); insertResultItem(index, filteredIn); } - ResultItem filteredAway(0, totalCount - vectorSize); + ResultItem filteredAway(nullptr, totalCount - vectorSize); return insertResultItem(index + vectorSize, filteredAway); } } diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 791b765880..d3bb372b00 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE QThreadData::QThreadData(int initialRefCount) : _ref(initialRefCount), loopLevel(0), scopeLevel(0), - eventDispatcher(0), + eventDispatcher(nullptr), quitNow(false), canWait(true), isAdopted(false), requiresCoreApplication(true) { // fprintf(stderr, "QThreadData %p created\n", this); @@ -399,7 +399,7 @@ QThreadPrivate::~QThreadPrivate() QThread *QThread::currentThread() { QThreadData *data = QThreadData::current(); - Q_ASSERT(data != 0); + Q_ASSERT(data != nullptr); return data->thread.loadAcquire(); } @@ -451,7 +451,7 @@ QThread::~QThread() if (d->running && !d->finished && !d->data->isAdopted) qFatal("QThread: Destroyed while thread is still running"); - d->data->thread = 0; + d->data->thread = nullptr; } } diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 62f0179802..1da68b3130 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -109,7 +109,7 @@ Q_STATIC_ASSERT(sizeof(pthread_t) <= sizeof(Qt::HANDLE)); enum { ThreadPriorityResetFlag = 0x80000000 }; -static thread_local QThreadData *currentThreadData = 0; +static thread_local QThreadData *currentThreadData = nullptr; static pthread_once_t current_thread_data_once = PTHREAD_ONCE_INIT; static pthread_key_t current_thread_data_key; @@ -144,7 +144,7 @@ static void destroy_current_thread_data(void *p) #if defined(Q_OS_VXWORKS) (void *)1); #else - 0); + nullptr); #endif } @@ -182,8 +182,8 @@ static void set_thread_data(QThreadData *data) static void clear_thread_data() { - currentThreadData = 0; - pthread_setspecific(current_thread_data_key, 0); + currentThreadData = nullptr; + pthread_setspecific(current_thread_data_key, nullptr); } template @@ -226,7 +226,7 @@ QThreadData *QThreadData::current(bool createIfNecessary) } QT_CATCH(...) { clear_thread_data(); data->deref(); - data = 0; + data = nullptr; QT_RETHROW; } data->deref(); @@ -294,7 +294,7 @@ static void setCurrentThreadName(const char *name) void *QThreadPrivate::start(void *arg) { #if !defined(Q_OS_ANDROID) - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, nullptr); #endif pthread_cleanup_push(QThreadPrivate::finish, arg); @@ -336,7 +336,7 @@ void *QThreadPrivate::start(void *arg) emit thr->started(QThread::QPrivateSignal()); #if !defined(Q_OS_ANDROID) - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, nullptr); pthread_testcancel(); #endif thr->run(); @@ -360,7 +360,7 @@ void *QThreadPrivate::start(void *arg) // thrown. pthread_cleanup_pop(1); - return 0; + return nullptr; } void QThreadPrivate::finish(void *arg) @@ -379,13 +379,13 @@ void QThreadPrivate::finish(void *arg) void *data = &d->data->tls; locker.unlock(); emit thr->finished(QThread::QPrivateSignal()); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QThreadStorageData::finish((void **)data); locker.relock(); QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.loadRelaxed(); if (eventDispatcher) { - d->data->eventDispatcher = 0; + d->data->eventDispatcher = nullptr; locker.unlock(); eventDispatcher->closingDown(); delete eventDispatcher; @@ -774,14 +774,14 @@ bool QThread::wait(QDeadlineTimer deadline) void QThread::setTerminationEnabled(bool enabled) { QThread *thr = currentThread(); - Q_ASSERT_X(thr != 0, "QThread::setTerminationEnabled()", + Q_ASSERT_X(thr != nullptr, "QThread::setTerminationEnabled()", "Current thread was not started with QThread."); Q_UNUSED(thr) #if defined(Q_OS_ANDROID) Q_UNUSED(enabled); #else - pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL); + pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, nullptr); if (enabled) pthread_testcancel(); #endif diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index fdc484d2d2..464559ffa5 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -116,7 +116,7 @@ void **QThreadStorageData::get() const QThreadData *data = QThreadData::current(); if (!data) { qWarning("QThreadStorage::get: QThreadStorage can only be used with threads started with QThread"); - return 0; + return nullptr; } QVector &tls = data->tls; if (tls.size() <= id) @@ -128,7 +128,7 @@ void **QThreadStorageData::get() const *v, data->thread.loadRelaxed()); - return *v ? v : 0; + return *v ? v : nullptr; } void **QThreadStorageData::set(void *p) @@ -136,7 +136,7 @@ void **QThreadStorageData::set(void *p) QThreadData *data = QThreadData::current(); if (!data) { qWarning("QThreadStorage::set: QThreadStorage can only be used with threads started with QThread"); - return 0; + return nullptr; } QVector &tls = data->tls; if (tls.size() <= id) @@ -144,7 +144,7 @@ void **QThreadStorageData::set(void *p) void *&value = tls[id]; // delete any previous data - if (value != 0) { + if (value != nullptr) { DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p", id, value, @@ -156,7 +156,7 @@ void **QThreadStorageData::set(void *p) locker.unlock(); void *q = value; - value = 0; + value = nullptr; if (destructor) destructor(q); @@ -178,7 +178,7 @@ void QThreadStorageData::finish(void **p) while (!tls->isEmpty()) { void *&value = tls->last(); void *q = value; - value = 0; + value = nullptr; int i = tls->size() - 1; tls->resize(i); diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp index a8dfb9999c..80f9e780e7 100644 --- a/src/corelib/thread/qwaitcondition_unix.cpp +++ b/src/corelib/thread/qwaitcondition_unix.cpp @@ -173,7 +173,7 @@ public: QWaitCondition::QWaitCondition() { d = new QWaitConditionPrivate; - report_error(pthread_mutex_init(&d->mutex, NULL), "QWaitCondition", "mutex init"); + report_error(pthread_mutex_init(&d->mutex, nullptr), "QWaitCondition", "mutex init"); qt_initialize_pthread_cond(&d->cond, "QWaitCondition"); d->waiters = d->wakeups = 0; } diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index c833c18809..979b8c9aeb 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -1769,7 +1769,7 @@ QDate QDate::fromString(const QString &string, const QString &format, QCalendar QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 if (dt.parseFormat(format)) - dt.fromString(string, &date, 0); + dt.fromString(string, &date, nullptr); #else Q_UNUSED(string); Q_UNUSED(format); @@ -2499,7 +2499,7 @@ QTime QTime::fromString(const QString &string, const QString &format) QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, QCalendar()); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 if (dt.parseFormat(format)) - dt.fromString(string, 0, &time); + dt.fromString(string, nullptr, &time); #else Q_UNUSED(string); Q_UNUSED(format); diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 2501bbaab7..a487534528 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -1152,7 +1152,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue, } pos += separator.size(); sectionNodes[index].pos = pos; - int *current = 0; + int *current = nullptr; const SectionNode sn = sectionNodes.at(index); ParsedSection sect; diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp index 410a16e3c5..3d2078087b 100644 --- a/src/corelib/time/qtimezone.cpp +++ b/src/corelib/time/qtimezone.cpp @@ -318,7 +318,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); */ QTimeZone::QTimeZone() noexcept - : d(0) + : d(nullptr) { } diff --git a/src/corelib/time/qtimezoneprivate_icu.cpp b/src/corelib/time/qtimezoneprivate_icu.cpp index 5570ce7571..8a92bbb387 100644 --- a/src/corelib/time/qtimezoneprivate_icu.cpp +++ b/src/corelib/time/qtimezoneprivate_icu.cpp @@ -273,7 +273,7 @@ static int ucalDaylightOffset(const QByteArray &id) // Create the system default time zone QIcuTimeZonePrivate::QIcuTimeZonePrivate() - : m_ucal(0) + : m_ucal(nullptr) { // TODO No ICU C API to obtain sysem tz, assume default hasn't been changed init(ucalDefaultTimeZoneId()); @@ -281,7 +281,7 @@ QIcuTimeZonePrivate::QIcuTimeZonePrivate() // Create a named time zone QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QByteArray &ianaId) - : m_ucal(0) + : m_ucal(nullptr) { // Need to check validity here as ICu will create a GMT tz if name is invalid if (availableTimeZoneIds().contains(ianaId)) @@ -289,14 +289,14 @@ QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QByteArray &ianaId) } QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QIcuTimeZonePrivate &other) - : QTimeZonePrivate(other), m_ucal(0) + : QTimeZonePrivate(other), m_ucal(nullptr) { // Clone the ucal so we don't close the shared object UErrorCode status = U_ZERO_ERROR; m_ucal = ucal_clone(other.m_ucal, &status); if (!U_SUCCESS(status)) { m_id.clear(); - m_ucal = 0; + m_ucal = nullptr; } } @@ -322,7 +322,7 @@ void QIcuTimeZonePrivate::init(const QByteArray &ianaId) if (!U_SUCCESS(status)) { m_id.clear(); - m_ucal = 0; + m_ucal = nullptr; } } @@ -493,7 +493,7 @@ QList QIcuTimeZonePrivate::availableTimeZoneIds(int offsetFromUtc) c // TODO Available directly in C++ api but not C api, from 4.8 onwards new filter method works #if U_ICU_VERSION_MAJOR_NUM >= 49 || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM == 8) UErrorCode status = U_ZERO_ERROR; - UEnumeration *uenum = ucal_openTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, 0, + UEnumeration *uenum = ucal_openTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, nullptr, &offsetFromUtc, &status); QList result; if (U_SUCCESS(status)) diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp index 3c2695a789..5e55c6897d 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -512,7 +512,7 @@ PosixZone PosixZone::parse(const char *&pos, const char *end) if (zoneEnd < end && (zoneEnd[0] == '+' || zoneEnd[0] == '-')) ++zoneEnd; while (zoneEnd < end) { - if (strchr(offsetChars, char(*zoneEnd)) == NULL) + if (strchr(offsetChars, char(*zoneEnd)) == nullptr) break; ++zoneEnd; } diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index 36a221f728..3879b48cbb 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -265,7 +265,7 @@ void QArrayData::deallocate(QArrayData *data, size_t objectSize, return; #endif - Q_ASSERT_X(data == 0 || !data->ref.isStatic(), "QArrayData::deallocate", + Q_ASSERT_X(data == nullptr || !data->ref.isStatic(), "QArrayData::deallocate", "Static data cannot be deleted"); ::free(data); } diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 52c8d13fe3..7f9b6ef39f 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -443,12 +443,12 @@ class QEasingCurvePrivate public: QEasingCurvePrivate() : type(QEasingCurve::Linear), - config(0), + config(nullptr), func(&easeNone) { } QEasingCurvePrivate(const QEasingCurvePrivate &other) : type(other.type), - config(other.config ? other.config->copy() : 0), + config(other.config ? other.config->copy() : nullptr), func(other.func) { } ~QEasingCurvePrivate() { delete config; } @@ -590,7 +590,7 @@ struct BezierEase : public QEasingCurveFunction if (!(x < 1)) return 1; - SingleCubicBezier *singleCubicBezier = 0; + SingleCubicBezier *singleCubicBezier = nullptr; getBezierSegment(singleCubicBezier, x); return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x)); @@ -1097,7 +1097,7 @@ static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve) case QEasingCurve::CosineCurve: return &easeCosineCurve; default: - return 0; + return nullptr; }; } @@ -1127,7 +1127,7 @@ static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type) return new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158)); } - return 0; + return nullptr; } /*! @@ -1422,7 +1422,7 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) tcbPoints = std::move(config->_tcbPoints); delete config; - config = 0; + config = nullptr; } if (isConfigFunction(newType) || (amp != -1.0) || (period != -1.0) || (overshoot != -1.0) || @@ -1436,11 +1436,11 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) config->_o = overshoot; config->_bezierCurves = std::move(bezierCurves); config->_tcbPoints = std::move(tcbPoints); - func = 0; + func = nullptr; } else if (newType != QEasingCurve::Custom) { func = curveToFunc(newType); } - Q_ASSERT((func == 0) == (config != 0)); + Q_ASSERT((func == nullptr) == (config != nullptr)); type = newType; } @@ -1487,7 +1487,7 @@ void QEasingCurve::setCustomType(EasingFunction func) */ QEasingCurve::EasingFunction QEasingCurve::customType() const { - return d_ptr->type == Custom ? d_ptr->func : 0; + return d_ptr->type == Custom ? d_ptr->func : nullptr; } /*! diff --git a/src/dbus/qdbusabstractadaptor.cpp b/src/dbus/qdbusabstractadaptor.cpp index 993607a643..bf0e33e26e 100644 --- a/src/dbus/qdbusabstractadaptor.cpp +++ b/src/dbus/qdbusabstractadaptor.cpp @@ -72,7 +72,7 @@ int QDBusAdaptorConnector::relaySlotMethodIndex() QDBusAdaptorConnector *qDBusFindAdaptorConnector(QObject *obj) { if (!obj) - return 0; + return nullptr; const QObjectList &children = obj->children(); QObjectList::ConstIterator it = children.constBegin(); QObjectList::ConstIterator end = children.constEnd(); @@ -83,7 +83,7 @@ QDBusAdaptorConnector *qDBusFindAdaptorConnector(QObject *obj) return connector; } } - return 0; + return nullptr; } QDBusAdaptorConnector *qDBusFindAdaptorConnector(QDBusAbstractAdaptor *adaptor) @@ -411,7 +411,7 @@ void QDBusAdaptorConnector::qt_static_metacall(QObject *_o, QMetaObject::Call _c const QMetaObject QDBusAdaptorConnector::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_QDBusAdaptorConnector.data, - qt_meta_data_QDBusAdaptorConnector, qt_static_metacall, 0, 0 } + qt_meta_data_QDBusAdaptorConnector, qt_static_metacall, nullptr, nullptr } }; const QMetaObject *QDBusAdaptorConnector::metaObject() const @@ -421,7 +421,7 @@ const QMetaObject *QDBusAdaptorConnector::metaObject() const void *QDBusAdaptorConnector::qt_metacast(const char *_clname) { - if (!_clname) return 0; + if (!_clname) return nullptr; if (!strcmp(_clname, qt_meta_stringdata_QDBusAdaptorConnector.stringdata)) return static_cast(const_cast< QDBusAdaptorConnector*>(this)); return QObject::qt_metacast(_clname); @@ -443,7 +443,7 @@ int QDBusAdaptorConnector::qt_metacall(QMetaObject::Call _c, int _id, void **_a) // SIGNAL 0 void QDBusAdaptorConnector::relaySignal(QObject * _t1, const QMetaObject * _t2, int _t3, const QVariantList & _t4) { - void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; QMetaObject::activate(this, &staticMetaObject, 0, _a); } diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 87de784fc0..b628c2b560 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -159,7 +159,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu const char *expectedSignature = ""; if (int(mp.type()) != QMetaType::QVariant) { expectedSignature = QDBusMetaType::typeToSignature(type); - if (expectedSignature == 0) { + if (expectedSignature == nullptr) { qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be " "used to read property %s.%s", mp.typeName(), qPrintable(interface), mp.name()); @@ -190,7 +190,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu } QByteArray foundSignature; - const char *foundType = 0; + const char *foundType = nullptr; QVariant value = qvariant_cast(reply.arguments().at(0)).variant(); if (value.userType() == type || type == QMetaType::QVariant @@ -597,7 +597,7 @@ bool QDBusAbstractInterface::callWithCallback(const QString &method, QObject *receiver, const char *slot) { - return callWithCallback(method, args, receiver, slot, 0); + return callWithCallback(method, args, receiver, slot, nullptr); } /*! diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 764bc24165..5a0f0f013b 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -74,11 +74,11 @@ QByteArray QDBusArgumentPrivate::createSignature(int id) marshaller->ba = &signature; // run it - void *null = 0; + void *null = nullptr; QVariant v(id, null); QDBusArgument arg(marshaller); QDBusMetaType::marshall(arg, v.userType(), v.constData()); - arg.d = 0; + arg.d = nullptr; // delete it bool ok = marshaller->ok; @@ -290,7 +290,7 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d) QDBusArgument::QDBusArgument() { if (!qdbus_loadLibDBus()) { - d = 0; + d = nullptr; return; } diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index b93dabb3a7..412b428bdc 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -101,7 +101,7 @@ QDBusConnectionPrivate *QDBusConnectionManager::busConnection(QDBusConnection::B Q_ASSERT(type == QDBusConnection::SessionBus || type == QDBusConnection::SystemBus); if (!qdbus_loadLibDBus()) - return 0; + return nullptr; // we'll start in suspended delivery mode if we're in the main thread // (the event loop will resume delivery) @@ -124,7 +124,7 @@ QDBusConnectionPrivate *QDBusConnectionManager::connection(const QString &name) void QDBusConnectionManager::removeConnection(const QString &name) { - QDBusConnectionPrivate *d = 0; + QDBusConnectionPrivate *d = nullptr; d = connectionHash.take(name); if (d && !d->ref.deref()) d->deleteLater(); @@ -251,7 +251,7 @@ void QDBusConnectionManager::executeConnectionRequest(QDBusConnectionManager::Co return; d = new QDBusConnectionPrivate; - DBusConnection *c = 0; + DBusConnection *c = nullptr; QDBusErrorInternal error; switch (data->type) { case ConnectionRequestData::ConnectToStandardBus: @@ -275,7 +275,7 @@ void QDBusConnectionManager::executeConnectionRequest(QDBusConnectionManager::Co // register on the bus if (!q_dbus_bus_register(c, error)) { q_dbus_connection_unref(c); - c = 0; + c = nullptr; } } break; @@ -427,7 +427,7 @@ void QDBusConnectionManager::createServer(const QString &address, void *server) QDBusConnection::QDBusConnection(const QString &name) { if (name.isEmpty() || _q_manager.isDestroyed()) { - d = 0; + d = nullptr; } else { const auto locker = qt_scoped_lock(_q_manager()->mutex); d = _q_manager()->connection(name); @@ -492,7 +492,7 @@ QDBusConnection &QDBusConnection::operator=(const QDBusConnection &other) QDBusConnection QDBusConnection::connectToBus(BusType type, const QString &name) { if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) { - QDBusConnectionPrivate *d = 0; + QDBusConnectionPrivate *d = nullptr; return QDBusConnection(d); } return QDBusConnection(_q_manager()->connectToBus(type, name, false)); @@ -506,7 +506,7 @@ QDBusConnection QDBusConnection::connectToBus(const QString &address, const QString &name) { if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) { - QDBusConnectionPrivate *d = 0; + QDBusConnectionPrivate *d = nullptr; return QDBusConnection(d); } return QDBusConnection(_q_manager()->connectToBus(address, name)); @@ -521,7 +521,7 @@ QDBusConnection QDBusConnection::connectToPeer(const QString &address, const QString &name) { if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) { - QDBusConnectionPrivate *d = 0; + QDBusConnectionPrivate *d = nullptr; return QDBusConnection(d); } return QDBusConnection(_q_manager()->connectToPeer(address, name)); @@ -616,7 +616,7 @@ bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *rec d->lastError = err; return false; } - return d->sendWithReplyAsync(message, receiver, returnMethod, errorMethod, timeout) != 0; + return d->sendWithReplyAsync(message, receiver, returnMethod, errorMethod, timeout) != nullptr; } /*! @@ -639,7 +639,7 @@ bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *rec bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *receiver, const char *returnMethod, int timeout) const { - return callWithCallback(message, receiver, returnMethod, 0, timeout); + return callWithCallback(message, receiver, returnMethod, nullptr, timeout); } /*! @@ -705,10 +705,10 @@ QDBusMessage QDBusConnection::call(const QDBusMessage &message, QDBus::CallMode QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int timeout) const { if (!d || !d->connection) { - return QDBusPendingCall(0); // null pointer -> disconnected + return QDBusPendingCall(nullptr); // null pointer -> disconnected } - QDBusPendingCallPrivate *priv = d->sendWithReplyAsync(message, 0, 0, 0, timeout); + QDBusPendingCallPrivate *priv = d->sendWithReplyAsync(message, nullptr, nullptr, nullptr, timeout); return QDBusPendingCall(priv); } @@ -1015,7 +1015,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const Q_ASSERT_X(QDBusUtil::isValidObjectPath(path), "QDBusConnection::registeredObject", "Invalid object path given"); if (!d || !d->connection || !QDBusUtil::isValidObjectPath(path)) - return 0; + return nullptr; auto pathComponents = path.splitRef(QLatin1Char('/')); if (pathComponents.constLast().isEmpty()) @@ -1040,7 +1040,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const node = it; ++i; } - return 0; + return nullptr; } @@ -1052,7 +1052,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const QDBusConnectionInterface *QDBusConnection::interface() const { if (!d || d->mode != QDBusConnectionPrivate::ClientMode) - return 0; + return nullptr; return d->busService; } @@ -1068,7 +1068,7 @@ QDBusConnectionInterface *QDBusConnection::interface() const */ void *QDBusConnection::internalPointer() const { - return d ? d->connection : 0; + return d ? d->connection : nullptr; } /*! diff --git a/src/dbus/qdbuscontext.cpp b/src/dbus/qdbuscontext.cpp index 5b21c4fa74..de0482be70 100644 --- a/src/dbus/qdbuscontext.cpp +++ b/src/dbus/qdbuscontext.cpp @@ -64,7 +64,7 @@ QDBusContextPrivate *QDBusContextPrivate::set(QObject *obj, QDBusContextPrivate return old; } - return 0; + return nullptr; } /*! @@ -104,7 +104,7 @@ QDBusContextPrivate *QDBusContextPrivate::set(QObject *obj, QDBusContextPrivate Constructs an empty QDBusContext. */ QDBusContext::QDBusContext() - : d_ptr(0) + : d_ptr(nullptr) { } diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp index 6befb33d61..c9da593ad2 100644 --- a/src/dbus/qdbusdemarshaller.cpp +++ b/src/dbus/qdbusdemarshaller.cpp @@ -295,7 +295,7 @@ QVariant QDBusDemarshaller::toVariantInternal() // qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'", // q_dbus_message_iter_get_arg_type(&iterator), // q_dbus_message_iter_get_arg_type(&iterator)); - char *ptr = 0; + char *ptr = nullptr; ptr += q_dbus_message_iter_get_arg_type(&iterator); q_dbus_message_iter_next(&iterator); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index fb4f927a87..bca02be59e 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -127,7 +127,7 @@ void qdbusDefaultThreadDebug(int action, int condition, QDBusConnectionPrivate * "condition unknown") << "in connection" << conn; } -qdbusThreadDebugFunc qdbusThreadDebug = 0; +qdbusThreadDebugFunc qdbusThreadDebug = nullptr; #endif typedef QVarLengthArray QDBusSpyHookList; @@ -400,7 +400,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, // match node = it; else - node = 0; + node = nullptr; start = end + 1; } @@ -413,7 +413,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, else // there really is no object here // we're just looking at an unused space in the QVector - node = 0; + node = nullptr; } return node; } @@ -440,7 +440,7 @@ static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *ro const QObjectList children = obj->children(); // find a child with the proper name - QObject *next = 0; + QObject *next = nullptr; QObjectList::ConstIterator it = children.constBegin(); QObjectList::ConstIterator end = children.constEnd(); for ( ; it != end; ++it) @@ -458,7 +458,7 @@ static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *ro } // object not found - return 0; + return nullptr; } static QDBusConnectionPrivate::ArgMatchRules matchArgsForService(const QString &service, QDBusServiceWatcher::WatchMode mode) @@ -599,7 +599,7 @@ static void huntAndDestroy(QObject *needle, QDBusConnectionPrivate::ObjectTreeNo haystack.children.end()); if (needle == haystack.obj) { - haystack.obj = 0; + haystack.obj = nullptr; haystack.flags = 0; } } @@ -609,7 +609,7 @@ static void huntAndUnregister(const QVector &pathComponents, int i, { if (pathComponents.count() == i) { // found it - node->obj = 0; + node->obj = nullptr; node->flags = 0; if (mode == QDBusConnection::UnregisterTree) { @@ -660,7 +660,7 @@ static void huntAndEmit(DBusConnection *connection, DBusMessage *msg, qDBusDebug() << QThread::currentThread() << "emitting signal at" << p; DBusMessage *msg2 = q_dbus_message_copy(msg); q_dbus_message_set_path(msg2, p); - q_dbus_connection_send(connection, msg2, 0); + q_dbus_connection_send(connection, msg2, nullptr); q_dbus_message_unref(msg2); } } @@ -727,12 +727,12 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags, ++i; // make sure that the output parameters have signatures too - if (returnType != QMetaType::UnknownType && returnType != QMetaType::Void && QDBusMetaType::typeToSignature(returnType) == 0) + if (returnType != QMetaType::UnknownType && returnType != QMetaType::Void && QDBusMetaType::typeToSignature(returnType) == nullptr) continue; bool ok = true; for (int j = i; ok && j < metaTypes.count(); ++j) - if (QDBusMetaType::typeToSignature(metaTypes.at(i)) == 0) + if (QDBusMetaType::typeToSignature(metaTypes.at(i)) == nullptr) ok = false; if (!ok) continue; @@ -790,13 +790,13 @@ QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPriv --n; if (msg.arguments().count() < n) - return 0; // too few arguments + return nullptr; // too few arguments // check that types match for (int i = 0; i < n; ++i) if (metaTypes.at(i + 1) != msg.arguments().at(i).userType() && msg.arguments().at(i).userType() != qMetaTypeId()) - return 0; // no match + return nullptr; // no match // we can deliver // prepare for the call @@ -944,7 +944,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q params.append(const_cast(arg.constData())); else if (arg.userType() == qMetaTypeId()) { // convert to what the function expects - void *null = 0; + void *null = nullptr; auxParameters.append(QVariant(id, null)); const QDBusArgument &in = @@ -972,7 +972,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q // output arguments const int numMetaTypes = metaTypes.count(); QVariantList outputArgs; - void *null = 0; + void *null = nullptr; if (metaTypes[0] != QMetaType::Void && metaTypes[0] != QMetaType::UnknownType) { outputArgs.reserve(numMetaTypes - i + 1); QVariant arg(metaTypes[0], null); @@ -1026,8 +1026,8 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q extern bool qDBusInitThreads(); QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) - : QObject(p), ref(1), mode(InvalidMode), busService(0), - connection(0), + : QObject(p), ref(1), mode(InvalidMode), busService(nullptr), + connection(nullptr), rootNode(QString(QLatin1Char('/'))), anonymousAuthenticationAllowed(false), dispatchEnabled(true) @@ -1087,11 +1087,11 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() } if (connection) q_dbus_connection_unref(connection); - connection = 0; + connection = nullptr; } else if (lastMode == ServerMode) { if (server) q_dbus_server_unref(server); - server = 0; + server = nullptr; } } @@ -1531,7 +1531,7 @@ void QDBusConnectionPrivate::handleObjectCall(const QDBusMessage &msg) // user code, if necessary. ObjectTreeNode result; int usedLength; - QThread *objThread = 0; + QThread *objThread = nullptr; QSemaphore sem; bool semWait; @@ -1718,7 +1718,7 @@ void QDBusConnectionPrivate::setServer(QDBusServer *object, DBusServer *s, const qDBusAddWatch, qDBusRemoveWatch, qDBusToggleWatch, - this, 0); + this, nullptr); //qDebug() << "watch_functions_set" << watch_functions_set; Q_UNUSED(watch_functions_set); @@ -1726,13 +1726,13 @@ void QDBusConnectionPrivate::setServer(QDBusServer *object, DBusServer *s, const qDBusAddTimeout, qDBusRemoveTimeout, qDBusToggleTimeout, - this, 0); + this, nullptr); //qDebug() << "time_functions_set" << time_functions_set; Q_UNUSED(time_functions_set); - q_dbus_server_set_new_connection_function(server, qDBusNewConnection, this, 0); + q_dbus_server_set_new_connection_function(server, qDBusNewConnection, this, nullptr); - dbus_bool_t data_set = q_dbus_server_set_data(server, server_slot, this, 0); + dbus_bool_t data_set = q_dbus_server_set_data(server, server_slot, this, nullptr); //qDebug() << "data_set" << data_set; Q_UNUSED(data_set); } @@ -1752,16 +1752,16 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal qDBusAddWatch, qDBusRemoveWatch, qDBusToggleWatch, - this, 0); + this, nullptr); q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout, qDBusToggleTimeout, - this, 0); - q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); + this, nullptr); + q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, nullptr); q_dbus_connection_add_filter(connection, qDBusSignalFilter, - this, 0); + this, nullptr); watchForDBusDisconnection(); @@ -1772,7 +1772,7 @@ static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnecti { QDBusConnection::ConnectionCapabilities result; typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int); - static can_send_type_t can_send_type = 0; + static can_send_type_t can_send_type = nullptr; #if defined(QT_LINKED_LIBDBUS) # if DBUS_VERSION-0 >= 0x010400 @@ -1809,11 +1809,11 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError q_dbus_connection_set_exit_on_disconnect(connection, false); q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch, - qDBusToggleWatch, this, 0); + qDBusToggleWatch, this, nullptr); q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout, - qDBusToggleTimeout, this, 0); - q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); - q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); + qDBusToggleTimeout, this, nullptr); + q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, nullptr); + q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, nullptr); // Initialize the hooks for the NameAcquired and NameLost signals // we don't use connectSignal here because we don't need the rules to be sent to the bus @@ -1904,7 +1904,7 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call) if (call->pending) { q_dbus_pending_call_unref(call->pending); - call->pending = 0; + call->pending = nullptr; } // Are there any watchers? @@ -2046,7 +2046,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, { QDBusBlockingCallWatcher watcher(message); - QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, 0, 0, 0, timeout); + QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, nullptr, nullptr, nullptr, timeout); Q_ASSERT(pcall); if (pcall->replyMessage.type() == QDBusMessage::InvalidMessage) { @@ -2161,7 +2161,7 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *message, int timeout) { QDBusError error; - DBusPendingCall *pending = 0; + DBusPendingCall *pending = nullptr; DBusMessage *msg = static_cast(message); bool isNoReply = !pcall; Q_ASSERT(isNoReply == !!q_dbus_message_get_no_reply(msg)); @@ -2175,7 +2175,7 @@ void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void * q_dbus_message_unref(msg); pcall->pending = pending; - q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0); + q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, nullptr); // DBus won't notify us when a peer disconnects or server terminates so we need to track these ourselves if (mode == QDBusConnectionPrivate::PeerMode || mode == QDBusConnectionPrivate::ClientMode) @@ -2261,7 +2261,7 @@ bool QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook if (connection) { if (mode != QDBusConnectionPrivate::PeerMode) { qDBusDebug() << this << "Adding rule:" << hook.matchRule; - q_dbus_bus_add_match(connection, hook.matchRule, NULL); + q_dbus_bus_add_match(connection, hook.matchRule, nullptr); // Successfully connected the signal // Do we need to watch for this name? @@ -2274,7 +2274,7 @@ bool QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook q_dbus_bus_add_match(connection, buildMatchRule(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(), QDBusUtil::nameOwnerChanged(), rules, QString()), - NULL); + nullptr); data.owner = getNameOwnerNoCache(hook.service); qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" << data.owner << ")"; @@ -2362,7 +2362,7 @@ QDBusConnectionPrivate::removeSignalHookNoLock(SignalHookHash::Iterator it) if (connection && erase) { if (mode != QDBusConnectionPrivate::PeerMode) { qDBusDebug() << this << "Removing rule:" << hook.matchRule; - q_dbus_bus_remove_match(connection, hook.matchRule, NULL); + q_dbus_bus_remove_match(connection, hook.matchRule, nullptr); // Successfully disconnected the signal // Were we watching for this name? @@ -2375,7 +2375,7 @@ QDBusConnectionPrivate::removeSignalHookNoLock(SignalHookHash::Iterator it) q_dbus_bus_remove_match(connection, buildMatchRule(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(), QDBusUtil::nameOwnerChanged(), rules, QString()), - NULL); + nullptr); } } } @@ -2575,7 +2575,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa // it doesn't exist yet, we have to create it QDBusWriteLocker locker(FindMetaObject2Action, this); - QDBusMetaObject *mo = 0; + QDBusMetaObject *mo = nullptr; if (!interface.isEmpty()) mo = cachedMetaObjects.value(interface, 0); if (mo) @@ -2591,7 +2591,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa error = QDBusError(reply); lastError = error; if (reply.type() != QDBusMessage::ErrorMessage || error.type() != QDBusError::UnknownMethod) - return 0; // error + return nullptr; // error } // release the lock and return diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp index b53c639b6d..72b9d42247 100644 --- a/src/dbus/qdbusinterface.cpp +++ b/src/dbus/qdbusinterface.cpp @@ -149,7 +149,7 @@ static void copyArgument(void *to, int id, const QVariant &arg) QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p, const QString &iface, const QDBusConnection &con) - : QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(0) + : QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(nullptr) { // QDBusAbstractInterfacePrivate's constructor checked the parameters for us if (connection.isConnected()) { @@ -245,7 +245,7 @@ const QMetaObject *QDBusInterface::metaObject() const */ void *QDBusInterface::qt_metacast(const char *_clname) { - if (!_clname) return 0; + if (!_clname) return nullptr; if (!strcmp(_clname, "QDBusInterface")) return static_cast(const_cast(this)); if (d_func()->interface.toLatin1() == _clname) diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp index edee4fc1e5..74cc470596 100644 --- a/src/dbus/qdbusinternalfilters.cpp +++ b/src/dbus/qdbusinternalfilters.cpp @@ -358,7 +358,7 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) { // we have to demarshall before writing - void *null = 0; + void *null = nullptr; QVariant other(id, null); if (!QDBusMetaType::demarshall(qvariant_cast(value), id, other.data())) { qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp index 8e0b3e4598..46b41d1c07 100644 --- a/src/dbus/qdbusmarshaller.cpp +++ b/src/dbus/qdbusmarshaller.cpp @@ -197,7 +197,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg) } QByteArray tmpSignature; - const char *signature = 0; + const char *signature = nullptr; if (id == QDBusMetaTypeId::argument()) { // take the signature from the QDBusArgument object we're marshalling tmpSignature = @@ -243,7 +243,7 @@ inline void QDBusMarshaller::append(const QStringList &arg) inline QDBusMarshaller *QDBusMarshaller::beginStructure() { - return beginCommon(DBUS_TYPE_STRUCT, 0); + return beginCommon(DBUS_TYPE_STRUCT, nullptr); } inline QDBusMarshaller *QDBusMarshaller::beginArray(int id) @@ -301,7 +301,7 @@ inline QDBusMarshaller *QDBusMarshaller::beginMap(int kid, int vid) inline QDBusMarshaller *QDBusMarshaller::beginMapEntry() { - return beginCommon(DBUS_TYPE_DICT_ENTRY, 0); + return beginCommon(DBUS_TYPE_DICT_ENTRY, nullptr); } void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature) @@ -572,7 +572,7 @@ bool QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller *demarshaller) QDBusMarshaller mrecursed(capabilities); // create on the stack makes it autoclose QByteArray subSignature; - const char *sig = 0; + const char *sig = nullptr; if (code == DBUS_TYPE_VARIANT || code == DBUS_TYPE_ARRAY) { subSignature = drecursed->currentSignature().toLatin1(); if (!subSignature.isEmpty()) diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 3e8f2eaf3f..71cdec93ca 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -64,11 +64,11 @@ Q_STATIC_ASSERT(QDBusMessage::SignalMessage == DBUS_MESSAGE_TYPE_SIGNAL); static inline const char *data(const QByteArray &arr) { - return arr.isEmpty() ? 0 : arr.constData(); + return arr.isEmpty() ? nullptr : arr.constData(); } QDBusMessagePrivate::QDBusMessagePrivate() - : msg(0), reply(0), localReply(0), ref(1), type(QDBusMessage::InvalidMessage), + : msg(nullptr), reply(nullptr), localReply(nullptr), ref(1), type(QDBusMessage::InvalidMessage), delayedReply(false), localMessage(false), parametersValidated(false), autoStartService(true), interactiveAuthorizationAllowed(false) @@ -113,10 +113,10 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB { if (!qdbus_loadLibDBus()) { *error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library")); - return 0; + return nullptr; } - DBusMessage *msg = 0; + DBusMessage *msg = nullptr; const QDBusMessagePrivate *d_ptr = message.d_ptr; switch (d_ptr->type) { @@ -127,13 +127,13 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB // only service and interface can be empty -> path and name must not be empty if (!d_ptr->parametersValidated) { if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) - return 0; + return nullptr; if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) - return 0; + return nullptr; if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) - return 0; + return nullptr; if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) - return 0; + return nullptr; } msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(), @@ -153,7 +153,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB // error name can't be empty if (!d_ptr->parametersValidated && !QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error)) - return 0; + return nullptr; msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR); q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8()); @@ -166,13 +166,13 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB // only the service name can be empty here if (!d_ptr->parametersValidated) { if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) - return 0; + return nullptr; if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) - return 0; + return nullptr; if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) - return 0; + return nullptr; if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) - return 0; + return nullptr; } msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(), @@ -203,7 +203,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB // not ok; q_dbus_message_unref(msg); *error = QDBusError(QDBusError::Failed, QLatin1String("Marshalling failed: ") + marshaller.errorString); - return 0; + return nullptr; } /* diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 806cf7b415..74e17ced77 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -138,7 +138,7 @@ static int registerComplexDBusType(const char *typeName) static void *construct(void *, const void *) { qFatal("Cannot construct placeholder type QDBusRawType"); - return 0; + return nullptr; } }; @@ -147,7 +147,7 @@ static int registerComplexDBusType(const char *typeName) QDBusRawTypeHandler::construct, sizeof(void *), QMetaType::MovableType, - 0); + nullptr); } Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false; @@ -544,9 +544,9 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj) // put the metaobject together obj->d.data = uint_data; - obj->d.relatedMetaObjects = 0; - obj->d.static_metacall = 0; - obj->d.extradata = 0; + obj->d.relatedMetaObjects = nullptr; + obj->d.static_metacall = nullptr; + obj->d.extradata = nullptr; obj->d.stringdata = reinterpret_cast(string_data); obj->d.superdata = &QDBusAbstractInterface::staticMetaObject; } @@ -587,7 +587,7 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con error = QDBusError(); QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml); - QDBusMetaObject *we = 0; + QDBusMetaObject *we = nullptr; QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin(); QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd(); for ( ; it != end; ++it) { @@ -621,7 +621,7 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con if (parsed.isEmpty()) { // object didn't return introspection we = new QDBusMetaObject; - QDBusMetaObjectGenerator generator(interface, 0); + QDBusMetaObjectGenerator generator(interface, nullptr); generator.write(we); we->cached = false; return we; @@ -651,7 +651,7 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con error = QDBusError(QDBusError::UnknownInterface, QLatin1String("Interface '%1' was not found") .arg(interface)); - return 0; + return nullptr; } QDBusMetaObject::QDBusMetaObject() @@ -670,7 +670,7 @@ const int *QDBusMetaObject::inputTypesForMethod(int id) const int handle = priv(d.data)->methodDBusData + id*intsPerMethod; return reinterpret_cast(d.data + d.data[handle]); } - return 0; + return nullptr; } const int *QDBusMetaObject::outputTypesForMethod(int id) const @@ -680,7 +680,7 @@ const int *QDBusMetaObject::outputTypesForMethod(int id) const int handle = priv(d.data)->methodDBusData + id*intsPerMethod; return reinterpret_cast(d.data + d.data[handle + 1]); } - return 0; + return nullptr; } int QDBusMetaObject::propertyMetaType(int id) const diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index 58ce4f8930..e3804f74f8 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE class QDBusCustomTypeInfo { public: - QDBusCustomTypeInfo() : signature(), marshall(0), demarshall(0) + QDBusCustomTypeInfo() : signature(), marshall(nullptr), demarshall(nullptr) { } // Suggestion: @@ -78,7 +78,7 @@ public: }; template -inline static void registerHelper(T * = 0) +inline static void registerHelper(T * = nullptr) { void (*mf)(QDBusArgument &, const T *) = qDBusMarshallHelper; void (*df)(const QDBusArgument &, T *) = qDBusDemarshallHelper; @@ -259,7 +259,7 @@ bool QDBusMetaType::marshall(QDBusArgument &arg, int id, const void *data) const QDBusCustomTypeInfo &info = (*ct).at(id); if (!info.marshall) { - mf = 0; // make gcc happy + mf = nullptr; // make gcc happy return false; } else mf = info.marshall; @@ -288,7 +288,7 @@ bool QDBusMetaType::demarshall(const QDBusArgument &arg, int id, void *data) const QDBusCustomTypeInfo &info = (*ct).at(id); if (!info.demarshall) { - df = 0; // make gcc happy + df = nullptr; // make gcc happy return false; } else df = info.demarshall; @@ -460,7 +460,7 @@ const char *QDBusMetaType::typeToSignature(int type) { QReadLocker locker(customTypesLock()); if (type >= ct->size()) - return 0; // type not registered with us + return nullptr; // type not registered with us const QDBusCustomTypeInfo &info = (*ct).at(type); @@ -468,7 +468,7 @@ const char *QDBusMetaType::typeToSignature(int type) return info.signature; if (!info.marshall) - return 0; // type not registered with us + return nullptr; // type not registered with us } // call to user code to construct the signature type diff --git a/src/dbus/qdbusmisc.cpp b/src/dbus/qdbusmisc.cpp index eb8f61c783..c321b7524d 100644 --- a/src/dbus/qdbusmisc.cpp +++ b/src/dbus/qdbusmisc.cpp @@ -62,7 +62,7 @@ bool qDBusCheckAsyncTag(const char *tag) return false; const char *p = strstr(tag, noReplyTag); - if (p != NULL && + if (p != nullptr && (p == tag || *(p-1) == ' ') && (p[sizeof noReplyTag - 1] == '\0' || p[sizeof noReplyTag - 1] == ' ')) return true; @@ -167,7 +167,7 @@ int qDBusParametersForMethod(const QList ¶meterTypes, QVector ¶meterTypes, QVectorreplyMessage = msg; d->ref.storeRelaxed(1); } diff --git a/src/dbus/qdbuspendingreply.cpp b/src/dbus/qdbuspendingreply.cpp index ec49bafb60..cf13a134c5 100644 --- a/src/dbus/qdbuspendingreply.cpp +++ b/src/dbus/qdbuspendingreply.cpp @@ -247,7 +247,7 @@ */ QDBusPendingReplyData::QDBusPendingReplyData() - : QDBusPendingCall(0) // initialize base class empty + : QDBusPendingCall(nullptr) // initialize base class empty { } @@ -262,7 +262,7 @@ void QDBusPendingReplyData::assign(const QDBusPendingCall &other) void QDBusPendingReplyData::assign(const QDBusMessage &message) { - d = new QDBusPendingCallPrivate(QDBusMessage(), 0); // drops the reference to the old one + d = new QDBusPendingCallPrivate(QDBusMessage(), nullptr); // drops the reference to the old one d->replyMessage = message; } diff --git a/src/dbus/qdbusreply.cpp b/src/dbus/qdbusreply.cpp index cf1a70508c..cd7193e02f 100644 --- a/src/dbus/qdbusreply.cpp +++ b/src/dbus/qdbusreply.cpp @@ -202,7 +202,7 @@ void qDBusReplyFill(const QDBusMessage &reply, QDBusError &error, QVariant &data } const char *expectedSignature = QDBusMetaType::typeToSignature(data.userType()); - const char *receivedType = 0; + const char *receivedType = nullptr; QByteArray receivedSignature; if (reply.arguments().count() >= 1) { diff --git a/src/dbus/qdbusunixfiledescriptor.cpp b/src/dbus/qdbusunixfiledescriptor.cpp index 73d1db2680..87cabb93f6 100644 --- a/src/dbus/qdbusunixfiledescriptor.cpp +++ b/src/dbus/qdbusunixfiledescriptor.cpp @@ -135,7 +135,7 @@ QExplicitlySharedDataPointer::~QExplicitlyShared \sa fileDescriptor(), isValid() */ QDBusUnixFileDescriptor::QDBusUnixFileDescriptor() - : d(0) + : d(nullptr) { } @@ -153,7 +153,7 @@ QDBusUnixFileDescriptor::QDBusUnixFileDescriptor() \sa setFileDescriptor(), fileDescriptor() */ QDBusUnixFileDescriptor::QDBusUnixFileDescriptor(int fileDescriptor) - : d(0) + : d(nullptr) { if (fileDescriptor != -1) setFileDescriptor(fileDescriptor); diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index dc94897ac4..09311d1ad4 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -246,12 +246,12 @@ static const char fixedTypes[] = "ybnqiuxtdh"; static bool isBasicType(int c) { - return c != DBUS_TYPE_INVALID && strchr(basicTypes, c) != NULL; + return c != DBUS_TYPE_INVALID && strchr(basicTypes, c) != nullptr; } static bool isFixedType(int c) { - return c != DBUS_TYPE_INVALID && strchr(fixedTypes, c) != NULL; + return c != DBUS_TYPE_INVALID && strchr(fixedTypes, c) != nullptr; } // Returns a pointer to one-past-end of this type if it's valid; @@ -260,10 +260,10 @@ static const char *validateSingleType(const char *signature) { char c = *signature; if (c == DBUS_TYPE_INVALID) - return 0; + return nullptr; // is it one of the one-letter types? - if (strchr(oneLetterTypes, c) != NULL) + if (strchr(oneLetterTypes, c) != nullptr) return signature + 1; // is it an array? @@ -277,9 +277,9 @@ static const char *validateSingleType(const char *signature) // and a free value c = *++signature; if (!isBasicType(c)) - return 0; + return nullptr; signature = validateSingleType(signature + 1); - return signature && *signature == DBUS_DICT_ENTRY_END_CHAR ? signature + 1 : 0; + return signature && *signature == DBUS_DICT_ENTRY_END_CHAR ? signature + 1 : nullptr; } return validateSingleType(signature); @@ -291,14 +291,14 @@ static const char *validateSingleType(const char *signature) while (true) { signature = validateSingleType(signature); if (!signature) - return 0; + return nullptr; if (*signature == DBUS_STRUCT_END_CHAR) return signature + 1; } } // invalid/unknown type - return 0; + return nullptr; } /*! diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index db47a3abc1..7922d6fb06 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -478,15 +478,15 @@ Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins) Q_GLOBAL_STATIC(QList, qAccessibleFactories) Q_GLOBAL_STATIC(QList, qAccessibleActivationObservers) -QAccessible::UpdateHandler QAccessible::updateHandler = 0; -QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; +QAccessible::UpdateHandler QAccessible::updateHandler = nullptr; +QAccessible::RootObjectHandler QAccessible::rootObjectHandler = nullptr; static bool cleanupAdded = false; static QPlatformAccessibility *platformAccessibility() { QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); - return pfIntegration ? pfIntegration->accessibility() : 0; + return pfIntegration ? pfIntegration->accessibility() : nullptr; } /*! @@ -673,7 +673,7 @@ void QAccessible::removeActivationObserver(ActivationObserver *observer) QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) { if (!object) - return 0; + return nullptr; if (Id id = QAccessibleCache::instance()->objectToId.value(object)) return QAccessibleCache::instance()->interfaceForId(id); @@ -696,7 +696,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) // Find a QAccessiblePlugin (factory) for the class name. If there's // no entry in the cache try to create it using the plugin loader. if (!qAccessiblePlugins()->contains(cn)) { - QAccessiblePlugin *factory = 0; // 0 means "no plugin found". This is cached as well. + QAccessiblePlugin *factory = nullptr; // 0 means "no plugin found". This is cached as well. const int index = loader()->indexOf(cn); if (index != -1) factory = qobject_cast(loader()->instance(index)); @@ -724,7 +724,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) return appInterface; } - return 0; + return nullptr; } /*! @@ -1113,7 +1113,7 @@ QAccessibleInterface::relations(QAccessible::Relation /*match = QAccessible::All */ QAccessibleInterface *QAccessibleInterface::focusChild() const { - return 0; + return nullptr; } /*! @@ -1758,12 +1758,12 @@ QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent() */ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const { - if (m_object == 0) + if (m_object == nullptr) return QAccessible::accessibleInterface(m_uniqueId); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); if (!iface || !iface->isValid()) - return 0; + return nullptr; if (m_child >= 0) { QAccessibleInterface *child = iface->child(m_child); @@ -1791,7 +1791,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const */ QWindow *QAccessibleInterface::window() const { - return 0; + return nullptr; } /*! diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index 2ef8502ad5..771cfda574 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -128,7 +128,7 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const if (childIface->isValid() && childIface->rect().contains(x,y)) return childIface; } - return 0; + return nullptr; } /*! @@ -152,7 +152,7 @@ QWindow *QAccessibleApplication::window() const { // an application can have several windows, and AFAIK we don't need // to notify about changes on the application. - return 0; + return nullptr; } // all toplevel windows except popups and the desktop @@ -190,7 +190,7 @@ int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) cons QAccessibleInterface *QAccessibleApplication::parent() const { - return 0; + return nullptr; } QAccessibleInterface *QAccessibleApplication::child(int index) const @@ -198,7 +198,7 @@ QAccessibleInterface *QAccessibleApplication::child(int index) const const QObjectList tlo(topLevelObjects()); if (index >= 0 && index < tlo.count()) return QAccessible::queryAccessibleInterface(tlo.at(index)); - return 0; + return nullptr; } @@ -207,7 +207,7 @@ QAccessibleInterface *QAccessibleApplication::focusChild() const { if (QWindow *window = QGuiApplication::focusWindow()) return window->accessibleRoot(); - return 0; + return nullptr; } /*! \reimp */ diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp index 8c806d47b8..4813b83963 100644 --- a/src/gui/accessible/qplatformaccessibility.cpp +++ b/src/gui/accessible/qplatformaccessibility.cpp @@ -114,7 +114,7 @@ void QPlatformAccessibility::initialize() typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; const PluginKeyMap keyMap = bridgeloader()->keyMap(); - QAccessibleBridgePlugin *factory = 0; + QAccessibleBridgePlugin *factory = nullptr; int i = -1; const PluginKeyMapConstIterator cend = keyMap.constEnd(); for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp index a5b6d8b95c..8afe77ed46 100644 --- a/src/gui/animation/qguivariantanimation.cpp +++ b/src/gui/animation/qguivariantanimation.cpp @@ -75,15 +75,15 @@ static void qUnregisterGuiGetInterpolator() { // casts required by Sun CC 5.5 qRegisterAnimationInterpolator( - (QVariant (*)(const QColor &, const QColor &, qreal))0); + (QVariant (*)(const QColor &, const QColor &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QVector2D &, const QVector2D &, qreal))0); + (QVariant (*)(const QVector2D &, const QVector2D &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QVector3D &, const QVector3D &, qreal))0); + (QVariant (*)(const QVector3D &, const QVector3D &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QVector4D &, const QVector4D &, qreal))0); + (QVariant (*)(const QVector4D &, const QVector4D &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0); + (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))nullptr); } Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator) diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 7f8e072322..32b6131309 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -414,7 +414,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset, *p++ = tmp >> 4; } if ((((c & 3) + 1) & 2) == 2) - d->getChar(0); // align on word boundary + d->getChar(nullptr); // align on word boundary x += c; } } else { // encoded mode @@ -494,7 +494,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset, if (d->read((char *)p, b) != b) return false; if ((b & 1) == 1) - d->getChar(0); // align on word boundary + d->getChar(nullptr); // align on word boundary x += b; p += b; } diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 84e387e317..19be066d23 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -132,7 +132,7 @@ static void qt_cleanup_icon_cache() if Qt::AA_UseHighDpiPixmaps is not set this function returns 1.0 to keep non-hihdpi aware code working. */ -static qreal qt_effective_device_pixel_ratio(QWindow *window = 0) +static qreal qt_effective_device_pixel_ratio(QWindow *window = nullptr) { if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps)) return qreal(1.0); @@ -228,7 +228,7 @@ static QPixmapIconEngineEntry *bestSizeMatch( const QSize &size, QPixmapIconEngi QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state) { - QPixmapIconEngineEntry *pe = 0; + QPixmapIconEngineEntry *pe = nullptr; for (int i = 0; i < pixmaps.count(); ++i) if (pixmaps.at(i).mode == mode && pixmaps.at(i).state == state) { if (pe) @@ -674,7 +674,7 @@ QFactoryLoader *qt_iconEngineFactoryLoader() Constructs a null icon. */ QIcon::QIcon() noexcept - : d(0) + : d(nullptr) { } @@ -682,7 +682,7 @@ QIcon::QIcon() noexcept Constructs an icon from a \a pixmap. */ QIcon::QIcon(const QPixmap &pixmap) - :d(0) + :d(nullptr) { addPixmap(pixmap); } @@ -723,7 +723,7 @@ QIcon::QIcon(const QIcon &other) complete list of the supported file formats. */ QIcon::QIcon(const QString &fileName) - : d(0) + : d(nullptr) { addFile(fileName); } @@ -838,7 +838,7 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const { if (!d) return QPixmap(); - return pixmap(0, size, mode, state); + return pixmap(nullptr, size, mode, state); } /*! @@ -878,7 +878,7 @@ QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const { if (!d) return QSize(); - return actualSize(0, size, mode, state); + return actualSize(nullptr, size, mode, state); } /*! @@ -1008,7 +1008,7 @@ void QIcon::detach() if (d->engine->isNull()) { if (!d->ref.deref()) delete d; - d = 0; + d = nullptr; return; } else if (d->ref.loadRelaxed() != 1) { QIconPrivate *x = new QIconPrivate(d->engine->clone()); diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 27c82bc09f..e67b387981 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -714,7 +714,7 @@ QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QThemeIconInfo &in // Find the minimum distance icon int minimalSize = INT_MAX; - QIconLoaderEngineEntry *closestMatch = 0; + QIconLoaderEngineEntry *closestMatch = nullptr; for (int i = 0; i < numEntries; ++i) { QIconLoaderEngineEntry *entry = info.entries.at(i); int distance = directorySizeDistance(entry->dir, iconsize, scale); diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 869e206524..99d64737c5 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE static inline bool isLocked(QImageData *data) { - return data != 0 && data->is_locked; + return data != nullptr && data->is_locked; } #if defined(Q_CC_DEC) && defined(__alpha) && (__DECCXX_VER-0 >= 50190001) @@ -99,15 +99,15 @@ static int next_qimage_serial_number() } QImageData::QImageData() - : ref(0), width(0), height(0), depth(0), nbytes(0), devicePixelRatio(1.0), data(0), + : ref(0), width(0), height(0), depth(0), nbytes(0), devicePixelRatio(1.0), data(nullptr), format(QImage::Format_ARGB32), bytes_per_line(0), ser_no(next_qimage_serial_number()), detach_no(0), dpmx(qt_defaultDpiX() * 100 / qreal(2.54)), dpmy(qt_defaultDpiY() * 100 / qreal(2.54)), offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false), - is_cached(false), is_locked(false), cleanupFunction(0), cleanupInfo(0), - paintEngine(0) + is_cached(false), is_locked(false), cleanupFunction(nullptr), cleanupInfo(nullptr), + paintEngine(nullptr) { } @@ -170,7 +170,7 @@ QImageData::~QImageData() delete paintEngine; if (data && own_data) free(data); - data = 0; + data = nullptr; } #if defined(_M_ARM) @@ -746,7 +746,7 @@ bool QImageData::checkForAlphaPixels() const QImage::QImage() noexcept : QPaintDevice() { - d = 0; + d = nullptr; } /*! @@ -955,7 +955,7 @@ QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Forma QImage::QImage(const QString &fileName, const char *format) : QPaintDevice() { - d = 0; + d = nullptr; load(fileName, format); } @@ -981,10 +981,10 @@ extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *so QImage::QImage(const char * const xpm[]) : QPaintDevice() { - d = 0; + d = nullptr; if (!xpm) return; - if (!qt_read_xpm_image_or_array(0, xpm, *this)) + if (!qt_read_xpm_image_or_array(nullptr, xpm, *this)) // Issue: Warning because the constructor may be ambigious qWarning("QImage::QImage(), XPM is not supported"); } @@ -1003,7 +1003,7 @@ QImage::QImage(const QImage &image) : QPaintDevice() { if (image.paintingActive() || isLocked(image.d)) { - d = 0; + d = nullptr; image.copy().swap(*this); } else { d = image.d; @@ -1593,13 +1593,13 @@ void QImage::setColor(int i, QRgb c) uchar *QImage::scanLine(int i) { if (!d) - return 0; + return nullptr; detach(); // In case detach() ran out of memory if (!d) - return 0; + return nullptr; return d->data + i * d->bytes_per_line; } @@ -1610,7 +1610,7 @@ uchar *QImage::scanLine(int i) const uchar *QImage::scanLine(int i) const { if (!d) - return 0; + return nullptr; Q_ASSERT(i >= 0 && i < height()); return d->data + i * d->bytes_per_line; @@ -1633,7 +1633,7 @@ const uchar *QImage::scanLine(int i) const const uchar *QImage::constScanLine(int i) const { if (!d) - return 0; + return nullptr; Q_ASSERT(i >= 0 && i < height()); return d->data + i * d->bytes_per_line; @@ -1653,12 +1653,12 @@ const uchar *QImage::constScanLine(int i) const uchar *QImage::bits() { if (!d) - return 0; + return nullptr; detach(); // In case detach ran out of memory... if (!d) - return 0; + return nullptr; return d->data; } @@ -1672,7 +1672,7 @@ uchar *QImage::bits() */ const uchar *QImage::bits() const { - return d ? d->data : 0; + return d ? d->data : nullptr; } @@ -1688,7 +1688,7 @@ const uchar *QImage::bits() const */ const uchar *QImage::constBits() const { - return d ? d->data : 0; + return d ? d->data : nullptr; } /*! @@ -3027,11 +3027,11 @@ QImage QImage::createHeuristicMask(bool clipTight) const while(!done) { done = true; ypn = m.scanLine(0); - ypc = 0; + ypc = nullptr; for (y = 0; y < h; y++) { ypp = ypc; ypc = ypn; - ypn = (y == h-1) ? 0 : m.scanLine(y+1); + ypn = (y == h-1) ? nullptr : m.scanLine(y+1); const QRgb *p = (const QRgb *)scanLine(y); for (x = 0; x < w; x++) { // slowness here - it's possible to do six of these tests @@ -3053,11 +3053,11 @@ QImage QImage::createHeuristicMask(bool clipTight) const if (!clipTight) { ypn = m.scanLine(0); - ypc = 0; + ypc = nullptr; for (y = 0; y < h; y++) { ypp = ypc; ypc = ypn; - ypn = (y == h-1) ? 0 : m.scanLine(y+1); + ypn = (y == h-1) ? nullptr : m.scanLine(y+1); const QRgb *p = (const QRgb *)scanLine(y); for (x = 0; x < w; x++) { if ((*p & 0x00ffffff) != background) { @@ -4122,7 +4122,7 @@ void QImage::setText(const QString &key, const QString &value) QPaintEngine *QImage::paintEngine() const { if (!d) - return 0; + return nullptr; if (!d->paintEngine) { QPaintDevice *paintDevice = const_cast(this); diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 8f33a13b95..27088698ec 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -198,7 +198,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio store = destLayout->storeFromRGB32; } QDitherInfo dither; - QDitherInfo *ditherPtr = 0; + QDitherInfo *ditherPtr = nullptr; if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither) ditherPtr = &dither; @@ -212,8 +212,8 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio buffer = reinterpret_cast(destData) + x; else l = qMin(l, BufferSize); - const uint *ptr = fetch(buffer, srcData, x, l, 0, ditherPtr); - store(destData, ptr, x, l, 0, ditherPtr); + const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr); + store(destData, ptr, x, l, nullptr, ditherPtr); x += l; } srcData += src->bytes_per_line; @@ -314,7 +314,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im store = destLayout->storeFromRGB32; } QDitherInfo dither; - QDitherInfo *ditherPtr = 0; + QDitherInfo *ditherPtr = nullptr; if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither) ditherPtr = &dither; diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp index a4f927a462..0c9083a16e 100644 --- a/src/gui/image/qimageiohandler.cpp +++ b/src/gui/image/qimageiohandler.cpp @@ -288,7 +288,7 @@ public: QImageIOHandlerPrivate::QImageIOHandlerPrivate(QImageIOHandler *q) { - device = 0; + device = nullptr; q_ptr = q; } diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index dff24b449a..5e3b608d20 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -179,10 +179,10 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, bool ignoresFormatAndExtension) { if (!autoDetectImageFormat && format.isEmpty()) - return 0; + return nullptr; QByteArray form = format.toLower(); - QImageIOHandler *handler = 0; + QImageIOHandler *handler = nullptr; QByteArray suffix; #ifndef QT_NO_IMAGEFORMATPLUGIN @@ -450,7 +450,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, qDebug("QImageReader::createReadHandler: no handlers found. giving up."); #endif // no handler: give up. - return 0; + return nullptr; } handler->setDevice(device); @@ -500,9 +500,9 @@ public: QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq) : autoDetectImageFormat(true), ignoresFormatAndExtension(false) { - device = 0; + device = nullptr; deleteDevice = false; - handler = 0; + handler = nullptr; quality = -1; imageReaderError = QImageReader::UnknownError; autoTransform = UsePluginDefault; @@ -571,7 +571,7 @@ bool QImageReaderPrivate::initHandler() } // assign a handler - if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == 0) { + if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == nullptr) { imageReaderError = QImageReader::UnsupportedFormatError; errorString = QImageReader::tr("Unsupported image format"); return false; diff --git a/src/gui/image/qimagereaderwriterhelpers.cpp b/src/gui/image/qimagereaderwriterhelpers.cpp index a5b7fb6449..dd56d887a7 100644 --- a/src/gui/image/qimagereaderwriterhelpers.cpp +++ b/src/gui/image/qimagereaderwriterhelpers.cpp @@ -63,7 +63,7 @@ static void appendImagePluginFormats(QFactoryLoader *loader, const PluginKeyMap keyMap = loader->keyMap(); const PluginKeyMapConstIterator cend = keyMap.constEnd(); int i = -1; - QImageIOPlugin *plugin = 0; + QImageIOPlugin *plugin = nullptr; result->reserve(result->size() + keyMap.size()); for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { if (it.key() != i) { @@ -71,7 +71,7 @@ static void appendImagePluginFormats(QFactoryLoader *loader, plugin = qobject_cast(loader->instance(i)); } const QByteArray key = it.value().toLatin1(); - if (plugin && (plugin->capabilities(0, key) & cap) != 0) + if (plugin && (plugin->capabilities(nullptr, key) & cap) != 0) result->append(key); } } @@ -92,7 +92,7 @@ static void appendImagePluginMimeTypes(QFactoryLoader *loader, const int keyCount = keys.size(); for (int k = 0; k < keyCount; ++k) { const QByteArray key = keys.at(k).toString().toLatin1(); - if (plugin && (plugin->capabilities(0, key) & cap) != 0) { + if (plugin && (plugin->capabilities(nullptr, key) & cap) != 0) { result->append(mimeTypes.at(k).toString().toLatin1()); if (resultKeys) resultKeys->append(key); diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index ec66588ddf..9dcc955fe2 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -139,7 +139,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, { QByteArray form = format.toLower(); QByteArray suffix; - QImageIOHandler *handler = 0; + QImageIOHandler *handler = nullptr; #ifndef QT_NO_IMAGEFORMATPLUGIN typedef QMultiMap PluginKeyMap; @@ -226,7 +226,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, #endif // QT_NO_IMAGEFORMATPLUGIN if (!handler) - return 0; + return nullptr; handler->setDevice(device); if (!testFormat.isEmpty()) @@ -270,9 +270,9 @@ public: */ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq) { - device = 0; + device = nullptr; deleteDevice = false; - handler = 0; + handler = nullptr; quality = -1; compression = -1; gamma = 0.0; @@ -304,7 +304,7 @@ bool QImageWriterPrivate::canWriteHelper() errorString = QImageWriter::tr("Device not writable"); return false; } - if (!handler && (handler = createWriteHandlerHelper(device, format)) == 0) { + if (!handler && (handler = createWriteHandlerHelper(device, format)) == nullptr) { imageWriterError = QImageWriter::UnsupportedFormatError; errorString = QImageWriter::tr("Unsupported image format"); return false; @@ -403,7 +403,7 @@ void QImageWriter::setDevice(QIODevice *device) d->device = device; d->deleteDevice = false; delete d->handler; - d->handler = 0; + d->handler = nullptr; } /*! @@ -823,7 +823,7 @@ QString QImageWriter::errorString() const */ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const { - if (!d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == 0) { + if (!d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == nullptr) { d->imageWriterError = QImageWriter::UnsupportedFormatError; d->errorString = QImageWriter::tr("Unsupported image format"); return false; diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index 25fce050a1..79019d0fdf 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -272,7 +272,7 @@ public: /*! \internal */ QMoviePrivate::QMoviePrivate(QMovie *qq) - : reader(0), speed(100), movieState(QMovie::NotRunning), + : reader(nullptr), speed(100), movieState(QMovie::NotRunning), currentFrameNumber(-1), nextFrameNumber(0), greatestFrameNumber(-1), nextDelay(0), playCounter(-1), cacheMode(QMovie::CacheNone), haveReadAll(false), isFirstIteration(true) diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp index 6a87a01a87..e89cac452a 100644 --- a/src/gui/image/qpaintengine_pic.cpp +++ b/src/gui/image/qpaintengine_pic.cpp @@ -73,14 +73,14 @@ QPicturePaintEngine::QPicturePaintEngine() : QPaintEngine(*(new QPicturePaintEnginePrivate), AllFeatures) { Q_D(QPicturePaintEngine); - d->pt = 0; + d->pt = nullptr; } QPicturePaintEngine::QPicturePaintEngine(QPaintEnginePrivate &dptr) : QPaintEngine(dptr, AllFeatures) { Q_D(QPicturePaintEngine); - d->pt = 0; + d->pt = nullptr; } QPicturePaintEngine::~QPicturePaintEngine() @@ -484,7 +484,7 @@ void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) #endif const QTextItemInt &si = static_cast(ti); - if (si.chars == 0) + if (si.chars == nullptr) QPaintEngine::drawTextItem(p, ti); // Draw as path if (d->pic_d->formatMajor >= 9) { diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 978a07b9f9..3a32cc7f15 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -458,7 +458,7 @@ public: QFakeDevice() { dpi_x = qt_defaultDpiX(); dpi_y = qt_defaultDpiY(); } void setDpiX(int dpi) { dpi_x = dpi; } void setDpiY(int dpi) { dpi_y = dpi; } - QPaintEngine *paintEngine() const override { return 0; } + QPaintEngine *paintEngine() const override { return nullptr; } int metric(PaintDeviceMetric m) const override { switch(m) { @@ -709,11 +709,11 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) QFontMetrics fm(fnt); QPointF pt(p.x(), p.y() - fm.ascent()); - qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/0, - str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); + qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/nullptr, + str, /*brect=*/nullptr, /*tabstops=*/0, /*...*/nullptr, /*tabarraylen=*/0, painter); } else { - qt_format_text(font, QRectF(p, QSizeF(1, 1)), Qt::TextSingleLine | Qt::TextDontClip, /*opt*/0, - str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); + qt_format_text(font, QRectF(p, QSizeF(1, 1)), Qt::TextSingleLine | Qt::TextDontClip, /*opt*/nullptr, + str, /*brect=*/nullptr, /*tabstops=*/0, /*...*/nullptr, /*tabarraylen=*/0, painter); } break; @@ -1369,11 +1369,11 @@ QPictureIO::QPictureIO(const QString &fileName, const char* format) void QPictureIO::init() { d = new QPictureIOData(); - d->parameters = 0; + d->parameters = nullptr; d->quality = -1; // default quality of the current format d->gamma=0.0f; d->iostat = 0; - d->iodev = 0; + d->iodev = nullptr; } /*! @@ -1467,7 +1467,7 @@ static QPictureHandler *get_picture_handler(const char *format) return list->at(i); } } - return 0; // no such handler + return nullptr; // no such handler } @@ -1887,7 +1887,7 @@ bool QPictureIO::read() if (picture_format.isEmpty()) { if (file.isOpen()) { // unknown format file.close(); - d->iodev = 0; + d->iodev = nullptr; } return false; } @@ -1913,7 +1913,7 @@ bool QPictureIO::read() if (file.isOpen()) { // picture was read using file file.close(); - d->iodev = 0; + d->iodev = nullptr; } return d->iostat == 0; // picture successfully read? } @@ -1957,7 +1957,7 @@ bool QPictureIO::write() (*h->write_picture)(this); if (file.isOpen()) { // picture was written using file file.close(); - d->iodev = 0; + d->iodev = nullptr; } return d->iostat == 0; // picture successfully written? } diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index b6e41f16a5..3fce64cb20 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -94,7 +94,7 @@ void QPixmap::doInit(int w, int h, int type) if ((w > 0 && h > 0) || type == QPlatformPixmap::BitmapType) data = QPlatformPixmap::create(w, h, (QPlatformPixmap::PixelType) type); else - data = 0; + data = nullptr; } /*! @@ -780,7 +780,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) { - if (len == 0 || buf == 0) { + if (len == 0 || buf == nullptr) { data.reset(); return false; } @@ -1455,7 +1455,7 @@ int QPixmap::metric(PaintDeviceMetric metric) const */ QPaintEngine *QPixmap::paintEngine() const { - return data ? data->paintEngine() : 0; + return data ? data->paintEngine() : nullptr; } /*! diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 649a25250c..aeed1e3b34 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -92,8 +92,8 @@ void QBlittablePlatformPixmap::setBlittable(QBlittable *blittable) void QBlittablePlatformPixmap::resize(int width, int height) { - m_blittable.reset(0); - m_engine.reset(0); + m_blittable.reset(nullptr); + m_engine.reset(nullptr); d = QGuiApplication::primaryScreen()->depth(); w = width; h = height; @@ -145,8 +145,8 @@ void QBlittablePlatformPixmap::fill(const QColor &color) // if we could just change the format, e.g. when going from // RGB32 -> ARGB8888. if (color.alpha() != 255 && !hasAlphaChannel()) { - m_blittable.reset(0); - m_engine.reset(0); + m_blittable.reset(nullptr); + m_engine.reset(nullptr); m_alpha = true; } diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 483d6d79a2..9709df9e0c 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -126,7 +126,7 @@ static inline bool qt_pixmapcache_thread_test() /*! Constructs an empty Key object. */ -QPixmapCache::Key::Key() : d(0) +QPixmapCache::Key::Key() : d(nullptr) { } @@ -259,9 +259,9 @@ uint qHash(const QPixmapCache::Key &k) } QPMCache::QPMCache() - : QObject(0), + : QObject(nullptr), QCache(cache_limit_default), - keyArray(0), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false) + keyArray(nullptr), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false) { } QPMCache::~QPMCache() @@ -325,7 +325,7 @@ QPixmap *QPMCache::object(const QString &key) const QPixmapCache::Key cacheKey = cacheKeys.value(key); if (!cacheKey.d || !cacheKey.d->isValid) { const_cast(this)->cacheKeys.remove(key); - return 0; + return nullptr; } QPixmap *ptr = QCache::object(cacheKey); //We didn't find the pixmap in the cache, the key is not valid anymore @@ -453,7 +453,7 @@ void QPMCache::releaseKey(const QPixmapCache::Key &key) void QPMCache::clear() { free(keyArray); - keyArray = 0; + keyArray = nullptr; freeKey = 0; keyArraySize = 0; //Mark all keys as invalid @@ -539,7 +539,7 @@ bool QPixmapCache::find(const QString &key, QPixmap *pixmap) QPixmap *ptr = pm_cache()->object(key); if (ptr && pixmap) *pixmap = *ptr; - return ptr != 0; + return ptr != nullptr; } /*! @@ -561,7 +561,7 @@ bool QPixmapCache::find(const Key &key, QPixmap *pixmap) QPixmap *ptr = pm_cache()->object(key); if (ptr && pixmap) *pixmap = *ptr; - return ptr != 0; + return ptr != nullptr; } /*! diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp index a2e01147c4..493f55514e 100644 --- a/src/gui/image/qplatformpixmap.cpp +++ b/src/gui/image/qplatformpixmap.cpp @@ -266,7 +266,7 @@ QImage QPlatformPixmap::toImage(const QRect &rect) const QImage* QPlatformPixmap::buffer() { - return 0; + return nullptr; } diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index d6caf6773a..251f09fe52 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -109,7 +109,7 @@ public: }; QPngHandlerPrivate(QPngHandler *qq) - : gamma(0.0), fileGamma(0.0), quality(50), compression(50), colorSpaceState(Undefined), png_ptr(0), info_ptr(0), end_info(0), state(Ready), q(qq) + : gamma(0.0), fileGamma(0.0), quality(50), compression(50), colorSpaceState(Undefined), png_ptr(nullptr), info_ptr(nullptr), end_info(nullptr), state(Ready), q(qq) { } float gamma; @@ -134,18 +134,18 @@ public: struct AllocatedMemoryPointers { AllocatedMemoryPointers() - : row_pointers(0), accRow(0), inRow(0), outRow(0) + : row_pointers(nullptr), accRow(nullptr), inRow(nullptr), outRow(nullptr) { } void deallocate() { delete [] row_pointers; - row_pointers = 0; + row_pointers = nullptr; delete [] accRow; - accRow = 0; + accRow = nullptr; delete [] inRow; - inRow = 0; + inRow = nullptr; delete [] outRow; - outRow = 0; + outRow = nullptr; } png_byte **row_pointers; @@ -245,13 +245,13 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal png_uint_32 height = 0; int bit_depth = 0; int color_type = 0; - png_bytep trans_alpha = 0; - png_color_16p trans_color_p = 0; + png_bytep trans_alpha = nullptr; + png_color_16p trans_color_p = nullptr; int num_trans; - png_colorp palette = 0; + png_colorp palette = nullptr; int num_palette; int interlace_method = PNG_INTERLACE_LAST; - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, nullptr, nullptr); png_set_interlace_handling(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY) { @@ -343,7 +343,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal if (bit_depth != 1) png_set_packing(png_ptr); png_read_update_info(png_ptr, info_ptr); - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr); QImage::Format format = bit_depth == 1 ? QImage::Format_Mono : QImage::Format_Indexed8; if (image.size() != QSize(width, height) || image.format() != format) { image = QImage(width, height, format); @@ -452,7 +452,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i int bit_depth = 0; int color_type = 0; int unit_type = PNG_OFFSET_PIXEL; - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr); png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type); uchar *data = outImage->bits(); int bpl = outImage->bytesPerLine(); @@ -478,7 +478,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i amp.accRow[i] = rval*amp.inRow[i]; // Accumulate the next input rows for (rval = iysz-rval; rval > 0; rval-=oysz) { - png_read_row(png_ptr, amp.inRow, NULL); + png_read_row(png_ptr, amp.inRow, nullptr); quint32 fact = qMin(oysz, quint32(rval)); for (quint32 i=0; i < ibw; i++) amp.accRow[i] += fact*amp.inRow[i]; @@ -558,11 +558,11 @@ void QPngHandlerPrivate::readPngTexts(png_info *info) bool QPngHandlerPrivate::readPngHeader() { state = Error; - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0); + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,nullptr,nullptr,nullptr); if (!png_ptr) return false; - png_set_error_fn(png_ptr, 0, 0, qt_png_warning); + png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning); #if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW) // Trade off a little bit of memory for better compatibility with existing images @@ -572,21 +572,21 @@ bool QPngHandlerPrivate::readPngHeader() info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_read_struct(&png_ptr, 0, 0); - png_ptr = 0; + png_destroy_read_struct(&png_ptr, nullptr, nullptr); + png_ptr = nullptr; return false; } end_info = png_create_info_struct(png_ptr); if (!end_info) { - png_destroy_read_struct(&png_ptr, &info_ptr, 0); - png_ptr = 0; + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); + png_ptr = nullptr; return false; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - png_ptr = 0; + png_ptr = nullptr; return false; } @@ -670,7 +670,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage) if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - png_ptr = 0; + png_ptr = nullptr; amp.deallocate(); state = Error; return false; @@ -689,7 +689,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage) if (outImage->isNull()) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - png_ptr = 0; + png_ptr = nullptr; amp.deallocate(); state = Error; return false; @@ -706,7 +706,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage) int bit_depth = 0; int color_type = 0; int unit_type = PNG_OFFSET_PIXEL; - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr); png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type); uchar *data = outImage->bits(); int bpl = outImage->bytesPerLine(); @@ -747,7 +747,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage) outImage->setText(readTexts.at(i), readTexts.at(i+1)); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - png_ptr = 0; + png_ptr = nullptr; amp.deallocate(); state = Ready; @@ -767,7 +767,7 @@ QImage::Format QPngHandlerPrivate::readImageFormat() int bit_depth = 0, color_type = 0; png_colorp palette; int num_palette; - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr); if (color_type == PNG_COLOR_TYPE_GRAY) { // Black & White or grayscale if (bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1) { @@ -910,16 +910,16 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const png_structp png_ptr; png_infop info_ptr; - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,nullptr,nullptr,nullptr); if (!png_ptr) { return false; } - png_set_error_fn(png_ptr, 0, 0, qt_png_warning); + png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning); info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_write_struct(&png_ptr, 0); + png_destroy_write_struct(&png_ptr, nullptr); return false; } @@ -1022,7 +1022,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const png_set_PLTE(png_ptr, info_ptr, palette, num_palette); if (num_trans) { - png_set_tRNS(png_ptr, info_ptr, trans, num_trans, 0); + png_set_tRNS(png_ptr, info_ptr, trans, num_trans, nullptr); } } diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index cf105b250a..f9424b62bb 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -1175,7 +1175,7 @@ QXpmHandler::QXpmHandler() bool QXpmHandler::readHeader() { state = Error; - if (!read_xpm_header(device(), 0, index, buffer, &cpp, &ncols, &width, &height)) + if (!read_xpm_header(device(), nullptr, index, buffer, &cpp, &ncols, &width, &height)) return false; state = ReadHeader; return true; @@ -1191,7 +1191,7 @@ bool QXpmHandler::readImage(QImage *image) return false; } - if (!read_xpm_body(device(), 0, index, buffer, cpp, ncols, width, height, *image)) { + if (!read_xpm_body(device(), nullptr, index, buffer, cpp, ncols, width, height, *image)) { state = Error; return false; } diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 2390c62b9f..2998808b54 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -130,7 +130,7 @@ void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item, } if (item) { - if (item->d_func()->parent == 0) { + if (item->d_func()->parent == nullptr) { item->d_func()->setParentAndModel(q, model); } else { qWarning("QStandardItem::setChild: Ignoring duplicate insertion of item %p", @@ -139,7 +139,7 @@ void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item, } } if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; children.replace(index, item); if (item) @@ -412,7 +412,7 @@ void QStandardItemPrivate::setModel(QStandardItemModel *mod) */ QStandardItemModelPrivate::QStandardItemModelPrivate() : root(new QStandardItem), - itemPrototype(0), + itemPrototype(nullptr), sortRole(Qt::DisplayRole) { root->setFlags(Qt::ItemIsDropEnabled); @@ -510,12 +510,12 @@ bool QStandardItemPrivate::insertRows(int row, int count, const QListd_func()->parent == 0) { + if (item->d_func()->parent == nullptr) { item->d_func()->setParentAndModel(q, model); } else { qWarning("QStandardItem::insertRows: Ignoring duplicate insertion of item %p", item); - item = 0; + item = nullptr; } } children.replace(index, item); @@ -555,12 +555,12 @@ bool QStandardItemPrivate::insertColumns(int column, int count, const QListd_func()->parent == 0) { + if (item->d_func()->parent == nullptr) { item->d_func()->setParentAndModel(q, model); } else { qWarning("QStandardItem::insertColumns: Ignoring duplicate insertion of item %p", item); - item = 0; + item = nullptr; } } int r = i / count; @@ -583,7 +583,7 @@ void QStandardItemModelPrivate::itemChanged(QStandardItem *item, const QVectord_func()->parent == 0) { + if (item->d_func()->parent == nullptr) { // Header item int idx = columnHeaderItems.indexOf(item); if (idx != -1) { @@ -679,7 +679,7 @@ void QStandardItemModelPrivate::rowsRemoved(QStandardItem *parent, for (int i = row; i < row + count; ++i) { QStandardItem *oldItem = rowHeaderItems.at(i); if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; } rowHeaderItems.remove(row, count); @@ -698,7 +698,7 @@ void QStandardItemModelPrivate::columnsRemoved(QStandardItem *parent, for (int i = column; i < column + count; ++i) { QStandardItem *oldItem = columnHeaderItems.at(i); if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; } columnHeaderItems.remove(column, count); @@ -870,7 +870,7 @@ QStandardItem::~QStandardItem() Q_D(QStandardItem); for (QStandardItem *child : qAsConst(d->children)) { if (child) - child->d_func()->setModel(0); + child->d_func()->setModel(nullptr); delete child; } d->children.clear(); @@ -890,7 +890,7 @@ QStandardItem *QStandardItem::parent() const Q_D(const QStandardItem); if (!d->model || (d->model->d_func()->root.data() != d->parent)) return d->parent; - return 0; + return nullptr; } /*! @@ -1794,7 +1794,7 @@ void QStandardItem::removeRows(int row, int count) for (int j = i; j < n+i; ++j) { QStandardItem *oldItem = d->children.at(j); if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; } d->children.remove(qMax(i, 0), n); @@ -1821,7 +1821,7 @@ void QStandardItem::removeColumns(int column, int count) for (int j=i; jchildren.at(j); if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; } d->children.remove(i, count); @@ -1874,7 +1874,7 @@ QStandardItem *QStandardItem::child(int row, int column) const Q_D(const QStandardItem); int index = d->childIndex(row, column); if (index == -1) - return 0; + return nullptr; return d->children.at(index); } @@ -1891,12 +1891,12 @@ QStandardItem *QStandardItem::child(int row, int column) const QStandardItem *QStandardItem::takeChild(int row, int column) { Q_D(QStandardItem); - QStandardItem *item = 0; + QStandardItem *item = nullptr; int index = d->childIndex(row, column); if (index != -1) { item = d->children.at(index); if (item) - item->d_func()->setParentAndModel(0, 0); + item->d_func()->setParentAndModel(nullptr, nullptr); d->children.replace(index, 0); } return item; @@ -1925,7 +1925,7 @@ QList QStandardItem::takeRow(int row) for (int column = 0; column < col_count; ++column) { QStandardItem *ch = d->children.at(index + column); if (ch) - ch->d_func()->setParentAndModel(0, 0); + ch->d_func()->setParentAndModel(nullptr, nullptr); items.append(ch); } d->children.remove(index, col_count); @@ -1958,7 +1958,7 @@ QList QStandardItem::takeColumn(int column) int index = d->childIndex(row, column); QStandardItem *ch = d->children.at(index); if (ch) - ch->d_func()->setParentAndModel(0, 0); + ch->d_func()->setParentAndModel(nullptr, nullptr); d->children.remove(index); items.prepend(ch); } @@ -2291,13 +2291,13 @@ QStandardItem *QStandardItemModel::itemFromIndex(const QModelIndex &index) const { Q_D(const QStandardItemModel); if ((index.row() < 0) || (index.column() < 0) || (index.model() != this)) - return 0; + return nullptr; QStandardItem *parent = static_cast(index.internalPointer()); - if (parent == 0) - return 0; + if (parent == nullptr) + return nullptr; QStandardItem *item = parent->child(index.row(), index.column()); // lazy part - if (item == 0) { + if (item == nullptr) { item = d->createItem(); parent->d_func()->setChild(index.row(), index.column(), item); } @@ -2432,7 +2432,7 @@ void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem *item return; if (item) { - if (item->model() == 0) { + if (item->model() == nullptr) { item->d_func()->setModel(this); } else { qWarning("QStandardItem::setHorizontalHeaderItem: Ignoring duplicate insertion of item %p", @@ -2442,7 +2442,7 @@ void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem *item } if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; d->columnHeaderItems.replace(column, item); @@ -2461,7 +2461,7 @@ QStandardItem *QStandardItemModel::horizontalHeaderItem(int column) const { Q_D(const QStandardItemModel); if ((column < 0) || (column >= columnCount())) - return 0; + return nullptr; return d->columnHeaderItems.at(column); } @@ -2488,7 +2488,7 @@ void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem *item) return; if (item) { - if (item->model() == 0) { + if (item->model() == nullptr) { item->d_func()->setModel(this); } else { qWarning("QStandardItem::setVerticalHeaderItem: Ignoring duplicate insertion of item %p", @@ -2498,7 +2498,7 @@ void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem *item) } if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; d->rowHeaderItems.replace(row, item); @@ -2517,7 +2517,7 @@ QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const { Q_D(const QStandardItemModel); if ((row < 0) || (row >= rowCount())) - return 0; + return nullptr; return d->rowHeaderItems.at(row); } @@ -2757,10 +2757,10 @@ QStandardItem *QStandardItemModel::takeHorizontalHeaderItem(int column) { Q_D(QStandardItemModel); if ((column < 0) || (column >= columnCount())) - return 0; + return nullptr; QStandardItem *headerItem = d->columnHeaderItems.at(column); if (headerItem) { - headerItem->d_func()->setParentAndModel(0, 0); + headerItem->d_func()->setParentAndModel(nullptr, nullptr); d->columnHeaderItems.replace(column, 0); } return headerItem; @@ -2779,10 +2779,10 @@ QStandardItem *QStandardItemModel::takeVerticalHeaderItem(int row) { Q_D(QStandardItemModel); if ((row < 0) || (row >= rowCount())) - return 0; + return nullptr; QStandardItem *headerItem = d->rowHeaderItems.at(row); if (headerItem) { - headerItem->d_func()->setParentAndModel(0, 0); + headerItem->d_func()->setParentAndModel(nullptr, nullptr); d->rowHeaderItems.replace(row, 0); } return headerItem; @@ -2876,7 +2876,7 @@ QVariant QStandardItemModel::headerData(int section, Qt::Orientation orientation || ((orientation == Qt::Vertical) && (section >= rowCount()))) { return QVariant(); } - QStandardItem *headerItem = 0; + QStandardItem *headerItem = nullptr; if (orientation == Qt::Horizontal) headerItem = d->columnHeaderItems.at(section); else if (orientation == Qt::Vertical) @@ -2902,7 +2902,7 @@ QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex &pa { Q_D(const QStandardItemModel); QStandardItem *parentItem = d->itemFromIndex(parent); - if ((parentItem == 0) + if ((parentItem == nullptr) || (row < 0) || (column < 0) || (row >= parentItem->rowCount()) @@ -2919,7 +2919,7 @@ bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex { Q_D(QStandardItemModel); QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root.data(); - if (item == 0) + if (item == nullptr) return false; return item->d_func()->insertColumns(column, count, QList()); } @@ -2931,7 +2931,7 @@ bool QStandardItemModel::insertRows(int row, int count, const QModelIndex &paren { Q_D(QStandardItemModel); QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root.data(); - if (item == 0) + if (item == nullptr) return false; return item->d_func()->insertRows(row, count, QList()); } @@ -2967,7 +2967,7 @@ bool QStandardItemModel::removeColumns(int column, int count, const QModelIndex { Q_D(QStandardItemModel); QStandardItem *item = d->itemFromIndex(parent); - if ((item == 0) || (count < 1) || (column < 0) || ((column + count) > item->columnCount())) + if ((item == nullptr) || (count < 1) || (column < 0) || ((column + count) > item->columnCount())) return false; item->removeColumns(column, count); return true; @@ -2980,7 +2980,7 @@ bool QStandardItemModel::removeRows(int row, int count, const QModelIndex &paren { Q_D(QStandardItemModel); QStandardItem *item = d->itemFromIndex(parent); - if ((item == 0) || (count < 1) || (row < 0) || ((row + count) > item->rowCount())) + if ((item == nullptr) || (count < 1) || (row < 0) || ((row + count) > item->rowCount())) return false; item->removeRows(row, count); return true; @@ -3004,7 +3004,7 @@ bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value if (!index.isValid()) return false; QStandardItem *item = itemFromIndex(index); - if (item == 0) + if (item == nullptr) return false; item->setData(value, role); return true; @@ -3047,17 +3047,17 @@ bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation, || ((orientation == Qt::Vertical) && (section >= rowCount()))) { return false; } - QStandardItem *headerItem = 0; + QStandardItem *headerItem = nullptr; if (orientation == Qt::Horizontal) { headerItem = d->columnHeaderItems.at(section); - if (headerItem == 0) { + if (headerItem == nullptr) { headerItem = d->createItem(); headerItem->d_func()->setModel(this); d->columnHeaderItems.replace(section, headerItem); } } else if (orientation == Qt::Vertical) { headerItem = d->rowHeaderItems.at(section); - if (headerItem == 0) { + if (headerItem == nullptr) { headerItem = d->createItem(); headerItem->d_func()->setModel(this); d->rowHeaderItems.replace(section, headerItem); @@ -3076,7 +3076,7 @@ bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation, bool QStandardItemModel::setItemData(const QModelIndex &index, const QMap &roles) { QStandardItem *item = itemFromIndex(index); - if (item == 0) + if (item == nullptr) return false; item->d_func()->setItemData(roles); return true; @@ -3106,7 +3106,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const { QMimeData *data = QAbstractItemModel::mimeData(indexes); if(!data) - return 0; + return nullptr; const QString format = qStandardItemModelDataListMimeType(); if (!mimeTypes().contains(format)) @@ -3124,7 +3124,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const stack.push(item); } else { qWarning("QStandardItemModel::mimeData: No item associated with invalid index"); - return 0; + return nullptr; } } 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() diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 667d16317f..adca536797 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -72,7 +72,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher() return; } QOpenGLFunctions *funcs = ctx->functions(); - const char *extensionStr = 0; + const char *extensionStr = nullptr; if (ctx->isOpenGLES() || ctx->format().majorVersion() < 3) extensionStr = reinterpret_cast(funcs->glGetString(GL_EXTENSIONS)); diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index 5ad16a8438..5387cc06e3 100644 --- a/src/gui/opengl/qopenglbuffer.cpp +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -143,10 +143,10 @@ public: QOpenGLBufferPrivate(QOpenGLBuffer::Type t) : ref(1), type(t), - guard(0), + guard(nullptr), usagePattern(QOpenGLBuffer::StaticDraw), actualUsagePattern(QOpenGLBuffer::StaticDraw), - funcs(0) + funcs(nullptr) { } @@ -323,10 +323,10 @@ void QOpenGLBuffer::destroy() Q_D(QOpenGLBuffer); if (d->guard) { d->guard->free(); - d->guard = 0; + d->guard = nullptr; } delete d->funcs; - d->funcs = 0; + d->funcs = nullptr; } /*! @@ -586,7 +586,7 @@ void *QOpenGLBuffer::mapRange(int offset, int count, QOpenGLBuffer::RangeAccessF qWarning("QOpenGLBuffer::mapRange(): buffer not created"); #endif if (!d->guard || !d->guard->id()) - return 0; + return nullptr; return d->funcs->glMapBufferRange(d->type, offset, count, access); } diff --git a/src/gui/opengl/qopenglcustomshaderstage.cpp b/src/gui/opengl/qopenglcustomshaderstage.cpp index baa44f86b0..a95a0a5767 100644 --- a/src/gui/opengl/qopenglcustomshaderstage.cpp +++ b/src/gui/opengl/qopenglcustomshaderstage.cpp @@ -48,7 +48,7 @@ class QOpenGLCustomShaderStagePrivate { public: QOpenGLCustomShaderStagePrivate() : - m_manager(0) {} + m_manager(nullptr) {} QPointer m_manager; QByteArray m_source; @@ -110,8 +110,8 @@ void QOpenGLCustomShaderStage::removeFromPainter(QPainter* p) // Just set the stage to null, don't call removeCustomStage(). // This should leave the program in a compiled/linked state // if the next custom shader stage is this one again. - d->m_manager->setCustomStage(0); - d->m_manager = 0; + d->m_manager->setCustomStage(nullptr); + d->m_manager = nullptr; } QByteArray QOpenGLCustomShaderStage::source() const @@ -125,7 +125,7 @@ QByteArray QOpenGLCustomShaderStage::source() const void QOpenGLCustomShaderStage::setInactive() { Q_D(QOpenGLCustomShaderStage); - d->m_manager = 0; + d->m_manager = nullptr; } void QOpenGLCustomShaderStage::setSource(const QByteArray& s) diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index 462a4fdb3b..310006feaf 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -1108,14 +1108,14 @@ public: \internal */ QOpenGLDebugLoggerPrivate::QOpenGLDebugLoggerPrivate() - : glDebugMessageControl(0), - glDebugMessageInsert(0), - glDebugMessageCallback(0), - glGetDebugMessageLog(0), - glPushDebugGroup(0), - glPopDebugGroup(0), - oldDebugCallbackFunction(0), - context(0), + : glDebugMessageControl(nullptr), + glDebugMessageInsert(nullptr), + glDebugMessageCallback(nullptr), + glGetDebugMessageLog(nullptr), + glPushDebugGroup(nullptr), + glPopDebugGroup(nullptr), + oldDebugCallbackFunction(nullptr), + context(nullptr), maxMessageLength(0), loggingMode(QOpenGLDebugLogger::AsynchronousLogging), initialized(false), @@ -1228,7 +1228,7 @@ void QOpenGLDebugLoggerPrivate::controlDebugMessages(QOpenGLDebugMessage::Source const GLsizei idCount = ids.count(); // The GL_KHR_debug extension says that if idCount is 0, idPtr must be ignored. // Unfortunately, some bugged drivers do NOT ignore it, so pass NULL in case. - const GLuint * const idPtr = idCount ? ids.constData() : 0; + const GLuint * const idPtr = idCount ? ids.constData() : nullptr; for (GLenum source : glSources) for (GLenum type : glTypes) @@ -1247,7 +1247,7 @@ void QOpenGLDebugLoggerPrivate::_q_contextAboutToBeDestroyed() // Save the current context and its surface in case we need to set them back QOpenGLContext *currentContext = QOpenGLContext::currentContext(); - QSurface *currentSurface = 0; + QSurface *currentSurface = nullptr; QScopedPointer offscreenSurface; @@ -1275,7 +1275,7 @@ void QOpenGLDebugLoggerPrivate::_q_contextAboutToBeDestroyed() } QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); - context = 0; + context = nullptr; initialized = false; } @@ -1356,7 +1356,7 @@ bool QOpenGLDebugLogger::initialize() disconnect(d->context, SIGNAL(aboutToBeDestroyed()), this, SLOT(_q_contextAboutToBeDestroyed())); d->initialized = false; - d->context = 0; + d->context = nullptr; if (!context->hasExtension(QByteArrayLiteral("GL_KHR_debug"))) return false; diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp index 1e5a10c99c..a569975486 100644 --- a/src/gui/opengl/qopenglengineshadermanager.cpp +++ b/src/gui/opengl/qopenglengineshadermanager.cpp @@ -72,7 +72,7 @@ public: void invalidateResource() override { delete m_shaders; - m_shaders = 0; + m_shaders = nullptr; } void freeResource(QOpenGLContext *) override @@ -94,7 +94,7 @@ public: shaders = new QOpenGLMultiGroupSharedResource; QOpenGLEngineSharedShadersResource *resource = shaders->value(context); - return resource ? resource->shaders() : 0; + return resource ? resource->shaders() : nullptr; } private: @@ -116,8 +116,8 @@ const char* QOpenGLEngineSharedShaders::qShaderSnippets[] = { }; QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context) - : blitShaderProg(0) - , simpleShaderProg(0) + : blitShaderProg(nullptr) + , simpleShaderProg(nullptr) { /* @@ -341,12 +341,12 @@ QOpenGLEngineSharedShaders::~QOpenGLEngineSharedShaders() if (blitShaderProg) { delete blitShaderProg; - blitShaderProg = 0; + blitShaderProg = nullptr; } if (simpleShaderProg) { delete simpleShaderProg; - simpleShaderProg = 0; + simpleShaderProg = nullptr; } } @@ -507,8 +507,8 @@ QOpenGLEngineShaderManager::QOpenGLEngineShaderManager(QOpenGLContext* context) opacityMode(NoOpacity), maskType(NoMask), compositionMode(QPainter::CompositionMode_SourceOver), - customSrcStage(0), - currentShaderProg(0) + customSrcStage(nullptr), + currentShaderProg(nullptr) { sharedShaders = QOpenGLEngineSharedShaders::shadersForContext(context); } @@ -627,7 +627,7 @@ void QOpenGLEngineShaderManager::removeCustomStage() { if (customSrcStage) customSrcStage->setInactive(); - customSrcStage = 0; + customSrcStage = nullptr; shaderProgNeedsChanging = true; } @@ -684,7 +684,7 @@ bool QOpenGLEngineShaderManager::useCorrectShaderProg() if (!shaderProgNeedsChanging) return false; - bool useCustomSrc = customSrcStage != 0; + bool useCustomSrc = customSrcStage != nullptr; if (useCustomSrc && srcPixelType != QOpenGLEngineShaderManager::ImageSrc && srcPixelType != Qt::TexturePattern) { useCustomSrc = false; qWarning("QOpenGLEngineShaderManager - Ignoring custom shader stage for non image src"); diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index bb0dbdc9bd..d7a6d32218 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -551,7 +551,7 @@ void QOpenGLFramebufferObjectPrivate::initTexture(int idx) pixelType = GL_UNSIGNED_SHORT; funcs.glTexImage2D(target, 0, color.internalFormat, color.size.width(), color.size.height(), 0, - GL_RGBA, pixelType, NULL); + GL_RGBA, pixelType, nullptr); if (format.mipmap()) { int width = color.size.width(); int height = color.size.height(); @@ -561,7 +561,7 @@ void QOpenGLFramebufferObjectPrivate::initTexture(int idx) height = qMax(1, height >> 1); ++level; funcs.glTexImage2D(target, level, color.internalFormat, width, height, 0, - GL_RGBA, pixelType, NULL); + GL_RGBA, pixelType, nullptr); } } funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + idx, @@ -640,8 +640,8 @@ void QOpenGLFramebufferObjectPrivate::initDepthStencilAttachments(QOpenGLContext stencil_buffer_guard->free(); } - depth_buffer_guard = 0; - stencil_buffer_guard = 0; + depth_buffer_guard = nullptr; + stencil_buffer_guard = nullptr; GLuint depth_buffer = 0; GLuint stencil_buffer = 0; @@ -1284,7 +1284,7 @@ GLuint QOpenGLFramebufferObject::takeTexture(int colorAttachmentIndex) id = guard ? guard->id() : 0; // Do not call free() on texture_guard, just null it out. // This way the texture will not be deleted when the guard is destroyed. - guard = 0; + guard = nullptr; } return id; } @@ -1564,7 +1564,7 @@ bool QOpenGLFramebufferObject::bindDefault() qWarning("QOpenGLFramebufferObject::bindDefault() called without current context."); #endif - return ctx != 0; + return ctx != nullptr; } /*! diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 3e9eb3dd0a..11ca802ee6 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -182,7 +182,7 @@ struct QOpenGLFunctionsPrivateEx : public QOpenGLExtensionsPrivate, public QOpen Q_GLOBAL_STATIC(QOpenGLMultiGroupSharedResource, qt_gl_functions_resource) -static QOpenGLFunctionsPrivateEx *qt_gl_functions(QOpenGLContext *context = 0) +static QOpenGLFunctionsPrivateEx *qt_gl_functions(QOpenGLContext *context = nullptr) { if (!context) context = QOpenGLContext::currentContext(); @@ -200,7 +200,7 @@ static QOpenGLFunctionsPrivateEx *qt_gl_functions(QOpenGLContext *context = 0) \sa initializeOpenGLFunctions() */ QOpenGLFunctions::QOpenGLFunctions() - : d_ptr(0) + : d_ptr(nullptr) { } @@ -218,7 +218,7 @@ QOpenGLFunctions::QOpenGLFunctions() \sa initializeOpenGLFunctions() */ QOpenGLFunctions::QOpenGLFunctions(QOpenGLContext *context) - : d_ptr(0) + : d_ptr(nullptr) { if (context && QOpenGLContextGroup::currentContextGroup() == context->shareGroup()) d_ptr = qt_gl_functions(context); diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp index f017c68fd9..f9d93ce210 100644 --- a/src/gui/opengl/qopenglfunctions_1_0.cpp +++ b/src/gui/opengl/qopenglfunctions_1_0.cpp @@ -67,8 +67,8 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_1_0::QOpenGLFunctions_1_0() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_0_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_0_Deprecated(nullptr) { } @@ -98,7 +98,7 @@ bool QOpenGLFunctions_1_0::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp index a819d499f8..b0f7538d48 100644 --- a/src/gui/opengl/qopenglfunctions_1_1.cpp +++ b/src/gui/opengl/qopenglfunctions_1_1.cpp @@ -67,10 +67,10 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_1_1::QOpenGLFunctions_1_1() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) { } @@ -108,7 +108,7 @@ bool QOpenGLFunctions_1_1::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp index 61db2b4e0f..5f137b0237 100644 --- a/src/gui/opengl/qopenglfunctions_1_2.cpp +++ b/src/gui/opengl/qopenglfunctions_1_2.cpp @@ -67,12 +67,12 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_1_2::QOpenGLFunctions_1_2() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) { } @@ -118,7 +118,7 @@ bool QOpenGLFunctions_1_2::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp index acc223ea74..0b5ff2fee5 100644 --- a/src/gui/opengl/qopenglfunctions_1_3.cpp +++ b/src/gui/opengl/qopenglfunctions_1_3.cpp @@ -67,14 +67,14 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_1_3::QOpenGLFunctions_1_3() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) { } @@ -128,7 +128,7 @@ bool QOpenGLFunctions_1_3::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_1_4.cpp b/src/gui/opengl/qopenglfunctions_1_4.cpp index 8e2349dc08..9419c1aa85 100644 --- a/src/gui/opengl/qopenglfunctions_1_4.cpp +++ b/src/gui/opengl/qopenglfunctions_1_4.cpp @@ -67,16 +67,16 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_1_4::QOpenGLFunctions_1_4() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) { } @@ -138,7 +138,7 @@ bool QOpenGLFunctions_1_4::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp index cd81cf8b35..3fa7668a36 100644 --- a/src/gui/opengl/qopenglfunctions_1_5.cpp +++ b/src/gui/opengl/qopenglfunctions_1_5.cpp @@ -67,17 +67,17 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_1_5::QOpenGLFunctions_1_5() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) { } @@ -143,7 +143,7 @@ bool QOpenGLFunctions_1_5::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp index 97a8c72fa6..29eb055a1d 100644 --- a/src/gui/opengl/qopenglfunctions_2_0.cpp +++ b/src/gui/opengl/qopenglfunctions_2_0.cpp @@ -67,18 +67,18 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_2_0::QOpenGLFunctions_2_0() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) { } @@ -149,7 +149,7 @@ bool QOpenGLFunctions_2_0::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp index 00bdc1bbba..8a7170dd7d 100644 --- a/src/gui/opengl/qopenglfunctions_2_1.cpp +++ b/src/gui/opengl/qopenglfunctions_2_1.cpp @@ -67,19 +67,19 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_2_1::QOpenGLFunctions_2_1() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) { } @@ -154,7 +154,7 @@ bool QOpenGLFunctions_2_1::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp index 2c239dba1f..7d0e900659 100644 --- a/src/gui/opengl/qopenglfunctions_3_0.cpp +++ b/src/gui/opengl/qopenglfunctions_3_0.cpp @@ -67,20 +67,20 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_3_0::QOpenGLFunctions_3_0() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) , m_reserved_3_0_Deprecated(nullptr) { @@ -160,7 +160,7 @@ bool QOpenGLFunctions_3_0::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp index f62f555c8e..c25b124af8 100644 --- a/src/gui/opengl/qopenglfunctions_3_1.cpp +++ b/src/gui/opengl/qopenglfunctions_3_1.cpp @@ -67,16 +67,16 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_3_1::QOpenGLFunctions_3_1() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) { } @@ -138,7 +138,7 @@ bool QOpenGLFunctions_3_1::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp index ba7be2d893..3e4fd96dc2 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp @@ -67,22 +67,22 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) , m_reserved_3_0_Deprecated(nullptr) { @@ -170,7 +170,7 @@ bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp index 4c1e3eb3da..ea89fc9e48 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp +++ b/src/gui/opengl/qopenglfunctions_3_2_core.cpp @@ -67,17 +67,17 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_3_2_Core::QOpenGLFunctions_3_2_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) { } @@ -143,7 +143,7 @@ bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp index c750c6e0cc..a26d7d99b1 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp @@ -67,25 +67,25 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) - , d_3_3_Deprecated(0) + , d_3_3_Deprecated(nullptr) { } @@ -179,7 +179,7 @@ bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp index 5723509e32..277ad1eb14 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp +++ b/src/gui/opengl/qopenglfunctions_3_3_core.cpp @@ -67,18 +67,18 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_3_3_Core::QOpenGLFunctions_3_3_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) { } @@ -148,7 +148,7 @@ bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp index 6ae7643eb5..655f1e6fd4 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp @@ -67,26 +67,26 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) - , d_3_3_Deprecated(0) + , d_3_3_Deprecated(nullptr) { } @@ -184,7 +184,7 @@ bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp index cd4fdb8b2b..60453d147c 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_0_core.cpp @@ -67,19 +67,19 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_0_Core::QOpenGLFunctions_4_0_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) { } @@ -153,7 +153,7 @@ bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp index d104c74bc2..bdea8b5ba9 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp @@ -67,27 +67,27 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) - , d_3_3_Deprecated(0) + , d_3_3_Deprecated(nullptr) { } @@ -189,7 +189,7 @@ bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.cpp b/src/gui/opengl/qopenglfunctions_4_1_core.cpp index 7527aba620..b21742d9c1 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_1_core.cpp @@ -67,20 +67,20 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_1_Core::QOpenGLFunctions_4_1_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) { } @@ -158,7 +158,7 @@ bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp index a5b1b37495..41ab9ae762 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp @@ -67,28 +67,28 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) - , d_3_3_Deprecated(0) + , d_3_3_Deprecated(nullptr) { } @@ -194,7 +194,7 @@ bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp index 1381236926..38dbe1b596 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_2_core.cpp @@ -67,21 +67,21 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_2_Core::QOpenGLFunctions_4_2_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) { } @@ -163,7 +163,7 @@ bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp index 5c0c711d1c..1b23d08ee2 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp @@ -67,29 +67,29 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) - , d_4_3_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) + , d_4_3_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) , m_reserved_2_0_Deprecated(nullptr) - , d_3_3_Deprecated(0) + , d_3_3_Deprecated(nullptr) { } @@ -199,7 +199,7 @@ bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp index 34460b841e..8a867471b8 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_3_core.cpp @@ -67,22 +67,22 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_3_Core::QOpenGLFunctions_4_3_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) - , d_4_3_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) + , d_4_3_Core(nullptr) { } @@ -168,7 +168,7 @@ bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp index 907994a3c4..4fc4b50100 100644 --- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp @@ -67,29 +67,29 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_4_Compatibility::QOpenGLFunctions_4_4_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) - , d_4_3_Core(0) - , d_4_4_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) - , d_3_3_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) + , d_4_3_Core(nullptr) + , d_4_4_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) + , d_3_3_Deprecated(nullptr) { } @@ -203,7 +203,7 @@ bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp index 76c0323f6d..6169c7f455 100644 --- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_4_core.cpp @@ -67,23 +67,23 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) - , d_4_3_Core(0) - , d_4_4_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) + , d_4_3_Core(nullptr) + , d_4_4_Core(nullptr) { } @@ -173,7 +173,7 @@ bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp index c415bb06ff..02af443498 100644 --- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp @@ -67,31 +67,31 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_5_Compatibility::QOpenGLFunctions_4_5_Compatibility() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) - , d_4_3_Core(0) - , d_4_4_Core(0) - , d_4_5_Core(0) - , d_1_0_Deprecated(0) - , d_1_1_Deprecated(0) - , d_1_2_Deprecated(0) - , d_1_3_Deprecated(0) - , d_1_4_Deprecated(0) - , d_3_3_Deprecated(0) - , d_4_5_Deprecated(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) + , d_4_3_Core(nullptr) + , d_4_4_Core(nullptr) + , d_4_5_Core(nullptr) + , d_1_0_Deprecated(nullptr) + , d_1_1_Deprecated(nullptr) + , d_1_2_Deprecated(nullptr) + , d_1_3_Deprecated(nullptr) + , d_1_4_Deprecated(nullptr) + , d_3_3_Deprecated(nullptr) + , d_4_5_Deprecated(nullptr) { } @@ -213,7 +213,7 @@ bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.cpp b/src/gui/opengl/qopenglfunctions_4_5_core.cpp index 4dfac3579c..9c0369e5f2 100644 --- a/src/gui/opengl/qopenglfunctions_4_5_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_5_core.cpp @@ -67,24 +67,24 @@ QT_BEGIN_NAMESPACE QOpenGLFunctions_4_5_Core::QOpenGLFunctions_4_5_Core() : QAbstractOpenGLFunctions() - , d_1_0_Core(0) - , d_1_1_Core(0) - , d_1_2_Core(0) - , d_1_3_Core(0) - , d_1_4_Core(0) - , d_1_5_Core(0) - , d_2_0_Core(0) - , d_2_1_Core(0) - , d_3_0_Core(0) - , d_3_1_Core(0) - , d_3_2_Core(0) - , d_3_3_Core(0) - , d_4_0_Core(0) - , d_4_1_Core(0) - , d_4_2_Core(0) - , d_4_3_Core(0) - , d_4_4_Core(0) - , d_4_5_Core(0) + , d_1_0_Core(nullptr) + , d_1_1_Core(nullptr) + , d_1_2_Core(nullptr) + , d_1_3_Core(nullptr) + , d_1_4_Core(nullptr) + , d_1_5_Core(nullptr) + , d_2_0_Core(nullptr) + , d_2_1_Core(nullptr) + , d_3_0_Core(nullptr) + , d_3_1_Core(nullptr) + , d_3_2_Core(nullptr) + , d_3_3_Core(nullptr) + , d_4_0_Core(nullptr) + , d_4_1_Core(nullptr) + , d_4_2_Core(nullptr) + , d_4_3_Core(nullptr) + , d_4_4_Core(nullptr) + , d_4_5_Core(nullptr) { } @@ -178,7 +178,7 @@ bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions() { // Associate with private implementation, creating if necessary // Function pointers in the backends are resolved at creation time - QOpenGLVersionFunctionsBackend* d = 0; + QOpenGLVersionFunctionsBackend* d = nullptr; d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus()); d_1_0_Core = static_cast(d); d->refs.ref(); diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index 3a0c02feb0..3920a10467 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -171,7 +171,7 @@ QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz) , dpmy(qt_defaultDpiY() * 100. / 2.54) , devicePixelRatio(1.0) , flipped(false) - , engine(0) + , engine(nullptr) { } diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 20cc2b5ae5..a82edbb073 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -881,7 +881,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) Q_ASSERT(cache->ibo == 0); #else free(cache->vertices); - Q_ASSERT(cache->indices == 0); + Q_ASSERT(cache->indices == nullptr); #endif updateCache = true; } @@ -909,7 +909,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) #else cache->vertices = (float *) malloc(floatSizeInBytes); memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes); - cache->indices = 0; + cache->indices = nullptr; #endif } @@ -1359,7 +1359,7 @@ void QOpenGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) return; QOpenGL2PaintEngineState *s = state(); - if (qt_pen_is_cosmetic(pen, state()->renderHints) && !qt_scaleForTransform(s->transform(), 0)) { + if (qt_pen_is_cosmetic(pen, state()->renderHints) && !qt_scaleForTransform(s->transform(), nullptr)) { // QTriangulatingStroker class is not meant to support cosmetically sheared strokes. QPaintEngineEx::stroke(path, pen); return; @@ -1427,7 +1427,7 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra); fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2, - 0, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode); + nullptr, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode); funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); @@ -1772,7 +1772,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly QOpenGLTextureGlyphCache *cache = (QOpenGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphFormat, glyphCacheTransform); - if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == 0) { + if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == nullptr) { cache = new QOpenGLTextureGlyphCache(glyphFormat, glyphCacheTransform); fe->setGlyphCache(cacheKey, cache); recreateVertexArrays = true; @@ -1780,7 +1780,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly if (staticTextItem->userDataNeedsUpdate) { recreateVertexArrays = true; - } else if (staticTextItem->userData() == 0) { + } else if (staticTextItem->userData() == nullptr) { recreateVertexArrays = true; } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) { recreateVertexArrays = true; @@ -1845,9 +1845,9 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly QOpenGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray; if (staticTextItem->useBackendOptimizations) { - QOpenGLStaticTextUserData *userData = 0; + QOpenGLStaticTextUserData *userData = nullptr; - if (staticTextItem->userData() == 0 + if (staticTextItem->userData() == nullptr || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) { userData = new QOpenGLStaticTextUserData(); @@ -2273,12 +2273,12 @@ bool QOpenGL2PaintEngineEx::end() d->funcs.glUseProgram(0); d->transferMode(BrushDrawingMode); - ctx->d_func()->active_engine = 0; + ctx->d_func()->active_engine = nullptr; d->resetGLState(); delete d->shaderManager; - d->shaderManager = 0; + d->shaderManager = nullptr; d->currentBrush = QBrush(); #ifdef QT_OPENGL_CACHE_AS_VBOS diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 4986ca573d..7e89d9c8d4 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -249,7 +249,7 @@ class QOpenGLShaderPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QOpenGLShader) public: QOpenGLShaderPrivate(QOpenGLContext *ctx, QOpenGLShader::ShaderType type) - : shaderGuard(0) + : shaderGuard(nullptr) , shaderType(type) , compiled(false) , glfuncs(new QOpenGLExtraFunctions(ctx)) @@ -374,8 +374,8 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q) // Get info and source code lengths GLint infoLogLength = 0; GLint sourceCodeLength = 0; - char *logBuffer = 0; - char *sourceCodeBuffer = 0; + char *logBuffer = nullptr; + char *sourceCodeBuffer = nullptr; // Get the compilation info log glfuncs->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength); @@ -425,7 +425,7 @@ void QOpenGLShaderPrivate::deleteShader() { if (shaderGuard) { shaderGuard->free(); - shaderGuard = 0; + shaderGuard = nullptr; } } @@ -783,13 +783,13 @@ class QOpenGLShaderProgramPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QOpenGLShaderProgram) public: QOpenGLShaderProgramPrivate() - : programGuard(0) + : programGuard(nullptr) , linked(false) , inited(false) , removingShaders(false) , glfuncs(new QOpenGLExtraFunctions) #ifndef QT_OPENGL_ES_2 - , tessellationFuncs(0) + , tessellationFuncs(nullptr) #endif , linkBinaryRecursion(false) { diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 61a6202017..cf4a8dee8d 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget, QOpenGLTexture *qq) : q_ptr(qq), - context(0), + context(nullptr), target(textureTarget), textureId(0), format(QOpenGLTexture::NoFormat), @@ -82,8 +82,8 @@ QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarge textureView(false), autoGenerateMipMaps(true), storageAllocated(false), - texFuncs(0), - functions(0) + texFuncs(nullptr), + functions(nullptr) { dimensions[0] = dimensions[1] = dimensions[2] = 1; @@ -208,8 +208,8 @@ void QOpenGLTexturePrivate::destroy() functions->glDeleteTextures(1, &textureId); - context = 0; - functions = 0; + context = nullptr; + functions = nullptr; textureId = 0; format = QOpenGLTexture::NoFormat; formatClass = QOpenGLTexture::NoFormatClass; @@ -231,7 +231,7 @@ void QOpenGLTexturePrivate::destroy() textureView = false; autoGenerateMipMaps = true; storageAllocated = false; - texFuncs = 0; + texFuncs = nullptr; swizzleMask[0] = QOpenGLTexture::RedValue; swizzleMask[1] = QOpenGLTexture::GreenValue; @@ -1141,7 +1141,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, - pixelFormat, pixelType, 0); + pixelFormat, pixelType, nullptr); } else { qWarning("1D textures are not supported"); return; @@ -1156,7 +1156,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p mipLevelSize(level, dimensions[0]), layers, 0, - pixelFormat, pixelType, 0); + pixelFormat, pixelType, nullptr); } else { qWarning("1D array textures are not supported"); return; @@ -1170,7 +1170,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, - pixelFormat, pixelType, 0); + pixelFormat, pixelType, nullptr); break; case QOpenGLTexture::TargetCubeMap: { @@ -1190,7 +1190,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, - pixelFormat, pixelType, 0); + pixelFormat, pixelType, nullptr); } } break; @@ -1204,7 +1204,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p mipLevelSize(level, dimensions[1]), layers, 0, - pixelFormat, pixelType, 0); + pixelFormat, pixelType, nullptr); } else { qWarning("Array textures are not supported"); return; @@ -1220,7 +1220,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p mipLevelSize(level, dimensions[1]), 6 * layers, 0, - pixelFormat, pixelType, 0); + pixelFormat, pixelType, nullptr); } else { qWarning("Cubemap Array textures are not supported"); return; @@ -1235,7 +1235,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p mipLevelSize(level, dimensions[1]), mipLevelSize(level, dimensions[2]), 0, - pixelFormat, pixelType, 0); + pixelFormat, pixelType, nullptr); } else { qWarning("3D textures are not supported"); return; @@ -1924,7 +1924,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target if (!viewTargetCompatible) { qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view targets"); - return 0; + return nullptr; } // Check the formats are compatible @@ -2057,7 +2057,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target if (!viewFormatCompatible) { qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view formats"); - return 0; + return nullptr; } @@ -3387,7 +3387,7 @@ QOpenGLTexture *QOpenGLTexture::createTextureView(Target target, Q_D(const QOpenGLTexture); if (!isStorageAllocated()) { qWarning("Cannot set create a texture view of a texture that does not have storage allocated."); - return 0; + return nullptr; } Q_ASSERT(maximumMipmapLevel >= minimumMipmapLevel); Q_ASSERT(maximumLayer >= minimumLayer); diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 490dc99749..41027d26e0 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -55,9 +55,9 @@ static int next_qopengltextureglyphcache_serial_number() QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color) : QImageTextureGlyphCache(format, matrix, color) - , m_textureResource(0) - , pex(0) - , m_blitProgram(0) + , m_textureResource(nullptr) + , pex(nullptr) + , m_blitProgram(nullptr) , m_filterMode(Nearest) , m_serialNumber(next_qopengltextureglyphcache_serial_number()) , m_buffer(QOpenGLBuffer::VertexBuffer) @@ -102,7 +102,7 @@ static inline bool isCoreProfile() void QOpenGLTextureGlyphCache::createTextureData(int width, int height) { QOpenGLContext *ctx = const_cast(QOpenGLContext::currentContext()); - if (ctx == 0) { + if (ctx == nullptr) { qWarning("QOpenGLTextureGlyphCache::createTextureData: Called with no context"); return; } @@ -121,7 +121,7 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height) if (m_textureResource && !m_textureResource->m_texture) { delete m_textureResource; - m_textureResource = 0; + m_textureResource = nullptr; } if (!m_textureResource) @@ -276,7 +276,7 @@ static void load_glyph_image_region_to_texture(QOpenGLContext *ctx, void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) { QOpenGLContext *ctx = QOpenGLContext::currentContext(); - if (ctx == 0) { + if (ctx == nullptr) { qWarning("QOpenGLTextureGlyphCache::resizeTextureData: Called with no context"); return; } @@ -313,7 +313,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) funcs->glGenTextures(1, &tmp_texture); funcs->glBindTexture(GL_TEXTURE_2D, tmp_texture); funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, nullptr); funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -326,7 +326,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) funcs->glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); funcs->glBindTexture(GL_TEXTURE_2D, oldTexture); - if (pex != 0) + if (pex != nullptr) pex->transferMode(BrushDrawingMode); funcs->glDisable(GL_STENCIL_TEST); @@ -336,9 +336,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) funcs->glViewport(0, 0, oldWidth, oldHeight); - QOpenGLShaderProgram *blitProgram = 0; - if (pex == 0) { - if (m_blitProgram == 0) { + QOpenGLShaderProgram *blitProgram = nullptr; + if (pex == nullptr) { + if (m_blitProgram == nullptr) { m_blitProgram = new QOpenGLShaderProgram; const bool isCoreProfile = ctx->format().profile() == QSurfaceFormat::CoreProfile; @@ -408,7 +408,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) funcs->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo); - if (pex != 0) { + if (pex != nullptr) { funcs->glViewport(0, 0, pex->width, pex->height); pex->updateClipScissorTest(); } else { @@ -424,7 +424,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) { QOpenGLContext *ctx = QOpenGLContext::currentContext(); - if (ctx == 0) { + if (ctx == nullptr) { qWarning("QOpenGLTextureGlyphCache::fillTexture: Called with no context"); return; } @@ -447,7 +447,7 @@ int QOpenGLTextureGlyphCache::glyphPadding() const int QOpenGLTextureGlyphCache::maxTextureWidth() const { QOpenGLContext *ctx = const_cast(QOpenGLContext::currentContext()); - if (ctx == 0) + if (ctx == nullptr) return QImageTextureGlyphCache::maxTextureWidth(); else return ctx->d_func()->maxTextureSize(); @@ -456,7 +456,7 @@ int QOpenGLTextureGlyphCache::maxTextureWidth() const int QOpenGLTextureGlyphCache::maxTextureHeight() const { QOpenGLContext *ctx = const_cast(QOpenGLContext::currentContext()); - if (ctx == 0) + if (ctx == nullptr) return QImageTextureGlyphCache::maxTextureHeight(); if (ctx->d_func()->workaround_brokenTexSubImage) @@ -469,10 +469,10 @@ void QOpenGLTextureGlyphCache::clear() { if (m_textureResource) m_textureResource->free(); - m_textureResource = 0; + m_textureResource = nullptr; delete m_blitProgram; - m_blitProgram = 0; + m_blitProgram = nullptr; m_w = 0; m_h = 0; diff --git a/src/gui/opengl/qopengltimerquery.cpp b/src/gui/opengl/qopengltimerquery.cpp index afd2e7887a..a4e10b42f7 100644 --- a/src/gui/opengl/qopengltimerquery.cpp +++ b/src/gui/opengl/qopengltimerquery.cpp @@ -77,8 +77,8 @@ class QOpenGLTimerQueryPrivate : public QObjectPrivate public: QOpenGLTimerQueryPrivate() : QObjectPrivate(), - context(0), - ext(0), + context(nullptr), + ext(nullptr), timeInterval(0), timer(0) { @@ -168,7 +168,7 @@ void QOpenGLTimerQueryPrivate::destroy() core->glDeleteQueries(1, &timer); timer = 0; - context = 0; + context = nullptr; } // GL_TIME_ELAPSED_EXT is not defined on OS X 10.6 @@ -310,14 +310,14 @@ QOpenGLTimerQuery::~QOpenGLTimerQuery() QOpenGLContext* ctx = QOpenGLContext::currentContext(); Q_D(QOpenGLTimerQuery); - QOpenGLContext *oldContext = 0; + QOpenGLContext *oldContext = nullptr; if (d->context != ctx) { oldContext = ctx; if (d->context->makeCurrent(oldContext->surface())) { ctx = d->context; } else { qWarning("QOpenGLTimerQuery::~QOpenGLTimerQuery() failed to make query objects's context current"); - ctx = 0; + ctx = nullptr; } } @@ -468,9 +468,9 @@ public: : QObjectPrivate(), timers(), timeSamples(), - context(0), - core(0), - ext(0), + context(nullptr), + core(nullptr), + ext(nullptr), requestedSampleCount(2), currentSample(-1), timerQueryActive(false) @@ -556,10 +556,10 @@ void QOpenGLTimeMonitorPrivate::destroy() core->glDeleteQueries(timers.size(), timers.data()); timers.clear(); delete core; - core = 0; + core = nullptr; delete ext; - ext = 0; - context = 0; + ext = nullptr; + context = nullptr; } void QOpenGLTimeMonitorPrivate::recordSample() @@ -701,14 +701,14 @@ QOpenGLTimeMonitor::~QOpenGLTimeMonitor() QOpenGLContext* ctx = QOpenGLContext::currentContext(); Q_D(QOpenGLTimeMonitor); - QOpenGLContext *oldContext = 0; + QOpenGLContext *oldContext = nullptr; if (d->context != ctx) { oldContext = ctx; if (d->context->makeCurrent(oldContext->surface())) { ctx = d->context; } else { qWarning("QOpenGLTimeMonitor::~QOpenGLTimeMonitor() failed to make time monitor's context current"); - ctx = 0; + ctx = nullptr; } } diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp index a3d3bb6bd1..5a108335a9 100644 --- a/src/gui/opengl/qopenglversionfunctions.cpp +++ b/src/gui/opengl/qopenglversionfunctions.cpp @@ -68,7 +68,7 @@ void CLASS::init() \ } QOpenGLVersionFunctionsStorage::QOpenGLVersionFunctionsStorage() - : backends(0) + : backends(nullptr) { } diff --git a/src/gui/opengl/qopenglversionfunctionsfactory.cpp b/src/gui/opengl/qopenglversionfunctionsfactory.cpp index fff5eea29c..ca7daedf34 100644 --- a/src/gui/opengl/qopenglversionfunctionsfactory.cpp +++ b/src/gui/opengl/qopenglversionfunctionsfactory.cpp @@ -153,7 +153,7 @@ QAbstractOpenGLFunctions *QOpenGLVersionFunctionsFactory::create(const QOpenGLVe else if (major == 1 && minor == 0) return new QOpenGLFunctions_1_0; } - return 0; + return nullptr; #else Q_UNUSED(versionProfile); return new QOpenGLFunctions_ES2; diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index f0837aff96..f15fe06ee8 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -101,7 +101,7 @@ public: QOpenGLVertexArrayObjectPrivate() : vao(0) , vaoFuncsType(NotSupported) - , context(0) + , context(nullptr) { } @@ -167,7 +167,7 @@ bool QOpenGLVertexArrayObjectPrivate::create() vaoFuncs.helper->glGenVertexArrays(1, &vao); } } else { - vaoFuncs.core_3_0 = 0; + vaoFuncs.core_3_0 = nullptr; vaoFuncsType = NotSupported; QSurfaceFormat format = ctx->format(); #ifndef QT_OPENGL_ES_2 @@ -200,17 +200,17 @@ void QOpenGLVertexArrayObjectPrivate::destroy() Q_Q(QOpenGLVertexArrayObject); QOpenGLContext *ctx = QOpenGLContext::currentContext(); - QOpenGLContext *oldContext = 0; - QSurface *oldContextSurface = 0; + QOpenGLContext *oldContext = nullptr; + QSurface *oldContextSurface = nullptr; QScopedPointer offscreenSurface; if (context && context != ctx) { oldContext = ctx; - oldContextSurface = ctx ? ctx->surface() : 0; + oldContextSurface = ctx ? ctx->surface() : nullptr; // Before going through the effort of creating an offscreen surface // check that we are on the GUI thread because otherwise many platforms // will not able to create that offscreen surface. if (QThread::currentThread() != qGuiApp->thread()) { - ctx = 0; + ctx = nullptr; } else { // Cannot just make the current surface current again with another context. // The format may be incompatible and some platforms (iOS) may impose @@ -223,14 +223,14 @@ void QOpenGLVertexArrayObjectPrivate::destroy() ctx = context; } else { qWarning("QOpenGLVertexArrayObject::destroy() failed to make VAO's context current"); - ctx = 0; + ctx = nullptr; } } } if (context) { QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); - context = 0; + context = nullptr; } if (vao && ctx) { diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp index 8e2013c24f..494104251f 100644 --- a/src/gui/painting/qblittable.cpp +++ b/src/gui/painting/qblittable.cpp @@ -46,7 +46,7 @@ class QBlittablePrivate { public: QBlittablePrivate(const QSize &size, QBlittable::Capabilities caps) - : caps(caps), m_size(size), locked(false), cachedImg(0) + : caps(caps), m_size(size), locked(false), cachedImg(nullptr) {} QBlittable::Capabilities caps; QSize m_size; diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index abb3268dfa..b23fb45952 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -179,7 +179,7 @@ struct QTexturedBrushData : public QBrushData { QTexturedBrushData() { m_has_pixmap_texture = false; - m_pixmap = 0; + m_pixmap = nullptr; } ~QTexturedBrushData() { delete m_pixmap; @@ -189,7 +189,7 @@ struct QTexturedBrushData : public QBrushData delete m_pixmap; if (pm.isNull()) { - m_pixmap = 0; + m_pixmap = nullptr; m_has_pixmap_texture = false; } else { m_pixmap = new QPixmap(pm); @@ -202,7 +202,7 @@ struct QTexturedBrushData : public QBrushData void setImage(const QImage &image) { m_image = image; delete m_pixmap; - m_pixmap = 0; + m_pixmap = nullptr; m_has_pixmap_texture = false; } @@ -360,7 +360,7 @@ public: { if (!brush->ref.deref()) delete brush; - brush = 0; + brush = nullptr; } }; @@ -831,7 +831,7 @@ const QGradient *QBrush::gradient() const || d->style == Qt::ConicalGradientPattern) { return &static_cast(d.data())->gradient; } - return 0; + return nullptr; } Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush) @@ -968,7 +968,7 @@ bool QBrush::operator==(const QBrush &b) const // but does not share the same data in memory. Since equality is likely to // be used to avoid iterating over the data for a texture update, this should // still be better than doing an accurate comparison. - const QPixmap *us = 0, *them = 0; + const QPixmap *us = nullptr, *them = nullptr; qint64 cacheKey1, cacheKey2; if (qHasPixmapTexture(*this)) { us = (static_cast(d.data()))->m_pixmap; @@ -1335,7 +1335,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b) \internal */ QGradient::QGradient() - : m_type(NoGradient), dummy(0) + : m_type(NoGradient), dummy(nullptr) { } diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 0fb89a75b5..bece814a6f 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -225,7 +225,7 @@ static StrokeLine strokeLine(int strokeSelection) break; default: Q_ASSERT(false); - stroke = 0; + stroke = nullptr; } return stroke; } @@ -252,8 +252,8 @@ void QCosmeticStroker::setup() const QVector &penPattern = state->lastPen.dashPattern(); if (penPattern.isEmpty()) { Q_ASSERT(!pattern && !reversePattern); - pattern = 0; - reversePattern = 0; + pattern = nullptr; + reversePattern = nullptr; patternLength = 0; patternSize = 0; } else { diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index e8d129d047..6819545bda 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -310,7 +310,7 @@ inline void QT_FASTCALL storePixel(uchar *dest, int index, typedef uint (QT_FASTCALL *FetchPixelFunc)(const uchar *src, int index); static const FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = { - 0, // BPPNone + nullptr, // BPPNone fetchPixel, // BPP1MSB fetchPixel, // BPP1LSB fetchPixel, // BPP8 @@ -1713,10 +1713,10 @@ static uint *QT_FASTCALL destFetchUndefined(uint *buffer, QRasterBuffer *, int, static DestFetchProc destFetchProc[QImage::NImageFormats] = { - 0, // Format_Invalid + nullptr, // Format_Invalid destFetchMono, // Format_Mono, destFetchMonoLsb, // Format_MonoLSB - 0, // Format_Indexed8 + nullptr, // Format_Indexed8 destFetchARGB32P, // Format_RGB32 destFetch, // Format_ARGB32, destFetchARGB32P, // Format_ARGB32_Premultiplied @@ -1764,10 +1764,10 @@ static QRgba64 * QT_FASTCALL destFetch64Undefined(QRgba64 *buffer, QRasterBuffer static DestFetchProc64 destFetchProc64[QImage::NImageFormats] = { - 0, // Format_Invalid - 0, // Format_Mono, - 0, // Format_MonoLSB - 0, // Format_Indexed8 + nullptr, // Format_Invalid + nullptr, // Format_Mono, + nullptr, // Format_MonoLSB + nullptr, // Format_Indexed8 destFetch64, // Format_RGB32 destFetch64, // Format_ARGB32, destFetch64, // Format_ARGB32_Premultiplied @@ -1905,13 +1905,13 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con static DestStoreProc destStoreProc[QImage::NImageFormats] = { - 0, // Format_Invalid + nullptr, // Format_Invalid destStoreMono, // Format_Mono, destStoreMonoLsb, // Format_MonoLSB - 0, // Format_Indexed8 - 0, // Format_RGB32 + nullptr, // Format_Indexed8 + nullptr, // Format_RGB32 destStore, // Format_ARGB32, - 0, // Format_ARGB32_Premultiplied + nullptr, // Format_ARGB32_Premultiplied destStoreRGB16, // Format_RGB16 destStore, // Format_ARGB8565_Premultiplied destStore, // Format_RGB666 @@ -1955,10 +1955,10 @@ static void QT_FASTCALL destStore64RGBA64(QRasterBuffer *rasterBuffer, int x, in static DestStoreProc64 destStoreProc64[QImage::NImageFormats] = { - 0, // Format_Invalid - 0, // Format_Mono, - 0, // Format_MonoLSB - 0, // Format_Indexed8 + nullptr, // Format_Invalid + nullptr, // Format_Mono, + nullptr, // Format_MonoLSB + nullptr, // Format_Indexed8 destStore64, // Format_RGB32 destStore64, // Format_ARGB32, destStore64, // Format_ARGB32_Premultiplied @@ -1980,9 +1980,9 @@ static DestStoreProc64 destStoreProc64[QImage::NImageFormats] = destStore64, // Format_A2RGB30_Premultiplied destStore64, // Format_Alpha8 destStore64, // Format_Grayscale8 - 0, // Format_RGBX64 + nullptr, // Format_RGBX64 destStore64RGBA64, // Format_RGBA64 - 0, // Format_RGBA64_Premultiplied + nullptr, // Format_RGBA64_Premultiplied destStore64, // Format_Grayscale16 destStore64, // Format_BGR888 }; @@ -3627,9 +3627,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf #endif fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy); - layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, 0); + layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr); if (disty) - layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, 0); + layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr); for (int i = 0; i < len; ++i) { int distx = (fx & 0x0000ffff); @@ -3662,8 +3662,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy); - layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, 0); - layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, 0); + layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr); + layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr); for (int i = 0; i < len; ++i) { int distx = (fx & 0x0000ffff); @@ -3727,8 +3727,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf fw += fdw; } - layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, 0); - layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, 0); + layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr); + layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr); for (int i = 0; i < len; ++i) { int distx = distxs[i]; @@ -3907,7 +3907,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co // FetchUntransformed can have more specialized methods added depending on SIMD features. static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = { - 0, // Invalid + nullptr, // Invalid fetchUntransformed, // Mono fetchUntransformed, // MonoLsb fetchUntransformed, // Indexed8 @@ -4348,9 +4348,9 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in switch(data->type) { case QSpanData::Solid: solidSource = data->solidColor.isOpaque(); - op.srcFetch = 0; + op.srcFetch = nullptr; #if QT_CONFIG(raster_64bit) - op.srcFetch64 = 0; + op.srcFetch64 = nullptr; #endif break; case QSpanData::LinearGradient: @@ -4721,7 +4721,7 @@ struct QBlendBase QBlendBase(QSpanData *d, const Operator &o) : data(d) , op(o) - , dest(0) + , dest(nullptr) { } @@ -6397,21 +6397,21 @@ static void qt_rectfill_quint64(QRasterBuffer *rasterBuffer, DrawHelper qDrawHelper[QImage::NImageFormats] = { // Format_Invalid, - { 0, 0, 0, 0, 0 }, + { nullptr, nullptr, nullptr, nullptr, nullptr }, // Format_Mono, { blend_color_generic, - 0, 0, 0, 0 + nullptr, nullptr, nullptr, nullptr }, // Format_MonoLSB, { blend_color_generic, - 0, 0, 0, 0 + nullptr, nullptr, nullptr, nullptr }, // Format_Indexed8, { blend_color_generic, - 0, 0, 0, 0 + nullptr, nullptr, nullptr, nullptr }, // Format_RGB32, { @@ -6448,7 +6448,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB8565_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6456,7 +6456,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB666 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6464,7 +6464,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB6666_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6472,7 +6472,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB555 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6480,7 +6480,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB8555_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6488,7 +6488,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB888 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6496,7 +6496,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB444 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6504,7 +6504,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB4444_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6568,7 +6568,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_Alpha8 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_alpha @@ -6576,7 +6576,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_Grayscale8 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_gray @@ -6584,7 +6584,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGBX64 { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint64 @@ -6592,7 +6592,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGBA64 { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint64 @@ -6600,7 +6600,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGBA64_Premultiplied { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint64 @@ -6608,7 +6608,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_Grayscale16 { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6616,7 +6616,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_BGR888 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp index 0c0df0fb13..7cd700a84a 100644 --- a/src/gui/painting/qemulationpaintengine.cpp +++ b/src/gui/painting/qemulationpaintengine.cpp @@ -271,7 +271,7 @@ void QEmulationPaintEngine::fillBGRect(const QRectF &r) { qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(), r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() }; - QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); + QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint); real_engine->fill(vp, state()->bgBrush); } diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp index 0d7205b483..2e2f65b483 100644 --- a/src/gui/painting/qimagescale.cpp +++ b/src/gui/painting/qimagescale.cpp @@ -223,7 +223,7 @@ static QImageScaleInfo* QImageScale::qimageFreeScaleInfo(QImageScaleInfo *isi) delete[] isi->yapoints; delete isi; } - return 0; + return nullptr; } static QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img, @@ -238,7 +238,7 @@ static QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img, isi = new QImageScaleInfo; if (!isi) - return 0; + return nullptr; isi->xup_yup = (qAbs(dw) >= sw) + ((qAbs(dh) >= sh) << 1); diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index 9cb787fb2c..685fbbb37a 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -406,9 +406,9 @@ void qt_memrotate270_64(const uchar *srcPixels, int w, int h, int sbpl, uchar *d MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3] = // 90, 180, 270 { - { 0, 0, 0 }, // BPPNone, - { 0, 0, 0 }, // BPP1MSB, - { 0, 0, 0 }, // BPP1LSB, + { nullptr, nullptr, nullptr }, // BPPNone, + { nullptr, nullptr, nullptr }, // BPP1MSB, + { nullptr, nullptr, nullptr }, // BPP1LSB, { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 }, // BPP8, { qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 }, // BPP16, { qt_memrotate90_24, qt_memrotate180_24, qt_memrotate270_24 }, // BPP24 diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index 2074f98069..67e450986d 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -209,7 +209,7 @@ void QOutlineMapper::endOutline() elements[i] = m_transform.map(elements[i]); } else { const QVectorPath vp((qreal *)elements, m_elements.size(), - m_element_types.size() ? m_element_types.data() : 0); + m_element_types.size() ? m_element_types.data() : nullptr); QPainterPath path = vp.convertToPainterPath(); path = m_transform.map(path); if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL)) diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index c98ca8a1fb..d73a66b790 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -394,7 +394,7 @@ static QString qt_keyForPageSizeId(QPageSize::PageSizeId id) } // Return id name for PPD Key -static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match = 0) +static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match = nullptr) { if (ppdKey.isEmpty()) return QPageSize::Custom; @@ -415,7 +415,7 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match } // Return id name for Windows ID -static QPageSize::PageSizeId qt_idForWindowsID(int windowsId, QSize *match = 0) +static QPageSize::PageSizeId qt_idForWindowsID(int windowsId, QSize *match = nullptr) { // If outside known values then is Custom if (windowsId <= DMPAPER_NONE || windowsId > DMPAPER_LAST) @@ -770,7 +770,7 @@ QPageSizePrivate::QPageSizePrivate(const QSize &pointSize, const QString &name, m_units(QPageSize::Point) { if (pointSize.isValid()) { - QPageSize::PageSizeId id = qt_idForPointSize(pointSize, matchPolicy, 0); + QPageSize::PageSizeId id = qt_idForPointSize(pointSize, matchPolicy, nullptr); id == QPageSize::Custom ? init(pointSize, name) : init(id, name); } } @@ -782,7 +782,7 @@ QPageSizePrivate::QPageSizePrivate(const QSizeF &size, QPageSize::Unit units, m_units(QPageSize::Point) { if (size.isValid()) { - QPageSize::PageSizeId id = qt_idForSize(size, units, matchPolicy, 0); + QPageSize::PageSizeId id = qt_idForSize(size, units, matchPolicy, nullptr); id == QPageSize::Custom ? init(size, units, name) : init(id, name); } } @@ -793,10 +793,10 @@ QPageSizePrivate::QPageSizePrivate(const QString &key, const QSize &pointSize, c m_units(QPageSize::Point) { if (!key.isEmpty() && pointSize.isValid()) { - QPageSize::PageSizeId id = qt_idForPpdKey(key, 0); + QPageSize::PageSizeId id = qt_idForPpdKey(key, nullptr); // If not a known PPD key, check if size is a standard PPD size if (id == QPageSize::Custom) - id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, 0); + id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, nullptr); id == QPageSize::Custom ? init(pointSize, name) : init(id, name); m_key = key; } @@ -808,10 +808,10 @@ QPageSizePrivate::QPageSizePrivate(int windowsId, const QSize &pointSize, const m_units(QPageSize::Point) { if (windowsId > 0 && pointSize.isValid()) { - QPageSize::PageSizeId id = qt_idForWindowsID(windowsId, 0); + QPageSize::PageSizeId id = qt_idForWindowsID(windowsId, nullptr); // If not a known Windows ID, check if size is a standard PPD size if (id == QPageSize::Custom) - id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, 0); + id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, nullptr); id == QPageSize::Custom ? init(pointSize, name) : init(id, name); m_windowsId = windowsId; } @@ -1753,7 +1753,7 @@ QString QPageSize::name(PageSizeId pageSizeId) QPageSize::PageSizeId QPageSize::id(const QSize &pointSize, SizeMatchPolicy matchPolicy) { - return qt_idForPointSize(pointSize, matchPolicy, 0); + return qt_idForPointSize(pointSize, matchPolicy, nullptr); } /*! @@ -1769,7 +1769,7 @@ QPageSize::PageSizeId QPageSize::id(const QSize &pointSize, SizeMatchPolicy matc QPageSize::PageSizeId QPageSize::id(const QSizeF &size, Unit units, SizeMatchPolicy matchPolicy) { - return qt_idForSize(size, units, matchPolicy, 0); + return qt_idForSize(size, units, matchPolicy, nullptr); } /*! diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index 0ddfba6ee9..4afb89b52e 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QPaintDevice::QPaintDevice() noexcept { - reserved = 0; + reserved = nullptr; painters = 0; } @@ -67,7 +67,7 @@ void QPaintDevice::initPainter(QPainter *) const */ QPaintDevice *QPaintDevice::redirected(QPoint *) const { - return 0; + return nullptr; } /*! @@ -75,7 +75,7 @@ QPaintDevice *QPaintDevice::redirected(QPoint *) const */ QPainter *QPaintDevice::sharedPainter() const { - return 0; + return nullptr; } Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric) diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index bfe1c9cadf..1785fcd12d 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -305,7 +305,7 @@ void QPaintEngine::syncState() static_cast(this)->sync(); } -static QPaintEngine *qt_polygon_recursion = 0; +static QPaintEngine *qt_polygon_recursion = nullptr; struct QT_Point { int x; int y; @@ -334,7 +334,7 @@ void QPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDra p[i].y = qRound(points[i].y()); } drawPolygon((QPoint *)p.data(), pointCount, mode); - qt_polygon_recursion = 0; + qt_polygon_recursion = nullptr; } struct QT_PointF { @@ -363,7 +363,7 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw p[i].y = points[i].y(); } drawPolygon((QPointF *)p.data(), pointCount, mode); - qt_polygon_recursion = 0; + qt_polygon_recursion = nullptr; } /*! @@ -691,7 +691,7 @@ void QPaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF */ QPaintEngine::QPaintEngine(PaintEngineFeatures caps) - : state(0), + : state(nullptr), gccaps(caps), active(0), selfDestruct(false), @@ -706,7 +706,7 @@ QPaintEngine::QPaintEngine(PaintEngineFeatures caps) */ QPaintEngine::QPaintEngine(QPaintEnginePrivate &dptr, PaintEngineFeatures caps) - : state(0), + : state(nullptr), gccaps(caps), active(0), selfDestruct(false), @@ -728,7 +728,7 @@ QPaintEngine::~QPaintEngine() */ QPainter *QPaintEngine::painter() const { - return state ? state->painter() : 0; + return state ? state->painter() : nullptr; } /*! diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 40c822076b..bc65ed56e3 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -115,17 +115,17 @@ public: pts[7] = bottom; } inline QRectVectorPath(const QRect &r) - : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) + : QVectorPath(pts, 4, nullptr, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) { set(r); } inline QRectVectorPath(const QRectF &r) - : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) + : QVectorPath(pts, 4, nullptr, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) { set(r); } inline QRectVectorPath() - : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) + : QVectorPath(pts, 4, nullptr, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) { } qreal pts[8]; @@ -433,7 +433,7 @@ void QRasterPaintEngine::init() break; default: qWarning("QRasterPaintEngine: unsupported target device %d\n", d->device->devType()); - d->device = 0; + d->device = nullptr; return; } @@ -601,7 +601,7 @@ QRasterPaintEngineState::~QRasterPaintEngineState() QRasterPaintEngineState::QRasterPaintEngineState() { - stroker = 0; + stroker = nullptr; fillFlags = 0; strokeFlags = 0; @@ -621,7 +621,7 @@ QRasterPaintEngineState::QRasterPaintEngineState() flags.tx_noshear = true; flags.fast_images = true; - clip = 0; + clip = nullptr; flags.has_clip_ownership = false; dirty = 0; @@ -643,8 +643,8 @@ QRasterPaintEngineState::QRasterPaintEngineState(QRasterPaintEngineState &s) , dirty(s.dirty) , flag_bits(s.flag_bits) { - brushData.tempImage = 0; - penData.tempImage = 0; + brushData.tempImage = nullptr; + penData.tempImage = nullptr; flags.has_clip_ownership = false; } @@ -759,7 +759,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) d->dashStroker->setDashOffset(pen.dashOffset()); s->stroker = d->dashStroker.data(); } else { - s->stroker = 0; + s->stroker = nullptr; } ensureRasterState(); // needed because of tx_noshear... @@ -1207,7 +1207,7 @@ static void qrasterpaintengine_state_setNoClip(QRasterPaintEngineState *s) { if (s->flags.has_clip_ownership) delete s->clip; - s->clip = 0; + s->clip = nullptr; s->flags.has_clip_ownership = false; } @@ -1279,14 +1279,14 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // intersect with, in which case we simplify the operation to // a replace... Qt::ClipOperation isectOp = Qt::IntersectClip; - if (base == 0) + if (base == nullptr) isectOp = Qt::ReplaceClip; QClipData *newClip = new QClipData(d->rasterBuffer->height()); newClip->initialize(); ClipData clipData = { base, newClip, isectOp }; ensureOutlineMapper(); - d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, 0); + d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, nullptr); newClip->fixup(); @@ -1334,7 +1334,7 @@ bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOpera QRect clipRect = qrect_normalized(r) & d->deviceRect; QRasterPaintEngineState *s = state(); - if (op == Qt::ReplaceClip || s->clip == 0) { + if (op == Qt::ReplaceClip || s->clip == nullptr) { // No current clip, hence we intersect with sysclip and be // done with it... @@ -1970,7 +1970,7 @@ void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, Poly } // Compose polygon fill.., - QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); + QVectorPath vp((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode)); ensureOutlineMapper(); QT_FT_Outline *outline = d->outlineMapper->convertPath(vp); @@ -2011,7 +2011,7 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly // Do the outline... if (s->penData.blend) { - QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); + QVectorPath vp((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode)); if (s->flags.fast_pen) { QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); @@ -2075,7 +2075,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg QVarLengthArray fpoints(count); for (int i=0; iflags.fast_pen) { QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); @@ -2695,14 +2695,14 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx } else if (depth == 8) { if (s->penData.alphamapBlit) { s->penData.alphamapBlit(rb, rx, ry, s->penData.solidColor, - scanline, w, h, bpl, 0, useGammaCorrection); + scanline, w, h, bpl, nullptr, useGammaCorrection); return; } } else if (depth == 32) { // (A)RGB Alpha mask where the alpha component is not used. if (s->penData.alphaRGBBlit) { s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solidColor, - (const uint *) scanline, w, h, bpl / 4, 0, useGammaCorrection); + (const uint *) scanline, w, h, bpl / 4, nullptr, useGammaCorrection); return; } } @@ -2917,10 +2917,10 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None ? fontEngine->glyphFormat : d->glyphCacheFormat; QImageTextureGlyphCache *cache = - static_cast(fontEngine->glyphCache(0, glyphFormat, s->matrix, QColor(s->penData.solidColor))); + static_cast(fontEngine->glyphCache(nullptr, glyphFormat, s->matrix, QColor(s->penData.solidColor))); if (!cache) { cache = new QImageTextureGlyphCache(glyphFormat, s->matrix, QColor(s->penData.solidColor)); - fontEngine->setGlyphCache(0, cache); + fontEngine->setGlyphCache(nullptr, cache); } cache->populate(fontEngine, numGlyphs, glyphs, positions); @@ -3672,7 +3672,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, int rasterPoolSize = MINIMUM_POOL_SIZE; uchar rasterPoolOnStack[MINIMUM_POOL_SIZE + 0xf]; uchar *rasterPoolBase = alignAddress(rasterPoolOnStack, 0xf); - uchar *rasterPoolOnHeap = 0; + uchar *rasterPoolOnHeap = nullptr; qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); @@ -3684,13 +3684,13 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, deviceRect.y() + deviceRect.height() }; QT_FT_Raster_Params rasterParams; - rasterParams.target = 0; + rasterParams.target = nullptr; rasterParams.source = outline; rasterParams.flags = QT_FT_RASTER_FLAG_CLIP; - rasterParams.gray_spans = 0; - rasterParams.black_spans = 0; - rasterParams.bit_test = 0; - rasterParams.bit_set = 0; + rasterParams.gray_spans = nullptr; + rasterParams.black_spans = nullptr; + rasterParams.bit_test = nullptr; + rasterParams.bit_set = nullptr; rasterParams.user = data; rasterParams.clip_box = clip_box; @@ -3843,10 +3843,10 @@ QImage::Format QRasterBuffer::prepare(QImage *image) QClipData::QClipData(int height) { clipSpanHeight = height; - m_clipLines = 0; + m_clipLines = nullptr; allocated = 0; - m_spans = 0; + m_spans = nullptr; xmin = xmax = ymin = ymax = 0; count = 0; @@ -3890,7 +3890,7 @@ void QClipData::initialize() const int currMaxY = currMinY + rects[firstInBand].height(); while (y < currMinY) { - m_clipLines[y].spans = 0; + m_clipLines[y].spans = nullptr; m_clipLines[y].count = 0; ++y; } @@ -3922,7 +3922,7 @@ void QClipData::initialize() Q_ASSERT(count <= allocated); while (y < clipSpanHeight) { - m_clipLines[y].spans = 0; + m_clipLines[y].spans = nullptr; m_clipLines[y].count = 0; ++y; } @@ -3936,7 +3936,7 @@ void QClipData::initialize() if (hasRectClip) { int y = 0; while (y < ymin) { - m_clipLines[y].spans = 0; + m_clipLines[y].spans = nullptr; m_clipLines[y].count = 0; ++y; } @@ -3957,19 +3957,19 @@ void QClipData::initialize() } while (y < clipSpanHeight) { - m_clipLines[y].spans = 0; + m_clipLines[y].spans = nullptr; m_clipLines[y].count = 0; ++y; } } } QT_CATCH(...) { free(m_spans); // have to free m_spans again or someone might think that we were successfully initialized. - m_spans = 0; + m_spans = nullptr; QT_RETHROW; } } QT_CATCH(...) { free(m_clipLines); // same for clipLines - m_clipLines = 0; + m_clipLines = nullptr; QT_RETHROW; } } @@ -4044,7 +4044,7 @@ void QClipData::setClipRect(const QRect &rect) if (m_spans) { free(m_spans); - m_spans = 0; + m_spans = nullptr; } // qDebug() << xmin << xmax << ymin << ymax; @@ -4074,7 +4074,7 @@ void QClipData::setClipRegion(const QRegion ®ion) if (m_spans) { free(m_spans); - m_spans = 0; + m_spans = nullptr; } } @@ -4532,7 +4532,7 @@ void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe) bilinear = false; m11 = m22 = m33 = 1.; m12 = m13 = m21 = m23 = dx = dy = 0.0; - clip = pe ? pe->d_func()->clip() : 0; + clip = pe ? pe->d_func()->clip() : nullptr; } Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert); @@ -4668,15 +4668,15 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode void QSpanData::adjustSpanMethods() { - bitmapBlit = 0; - alphamapBlit = 0; - alphaRGBBlit = 0; + bitmapBlit = nullptr; + alphamapBlit = nullptr; + alphaRGBBlit = nullptr; - fillRect = 0; + fillRect = nullptr; switch(type) { case None: - unclipped_blend = 0; + unclipped_blend = nullptr; break; case Solid: { const DrawHelper &drawHelper = qDrawHelper[rasterBuffer->format]; @@ -4695,17 +4695,17 @@ void QSpanData::adjustSpanMethods() case Texture: unclipped_blend = qBlendTexture; if (!texture.imageData) - unclipped_blend = 0; + unclipped_blend = nullptr; break; } // setup clipping if (!unclipped_blend) { - blend = 0; + blend = nullptr; } else if (!clip) { blend = unclipped_blend; } else if (clip->hasRectClip) { - blend = clip->clipRect.isEmpty() ? 0 : qt_span_fill_clipRect; + blend = clip->clipRect.isEmpty() ? nullptr : qt_span_fill_clipRect; } else { blend = qt_span_fill_clipped; } @@ -4748,7 +4748,7 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _ { const QImageData *d = const_cast(image)->data_ptr(); if (!d || d->height == 0) { - texture.imageData = 0; + texture.imageData = nullptr; texture.width = 0; texture.height = 0; texture.x1 = 0; @@ -4757,7 +4757,7 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _ texture.y2 = 0; texture.bytesPerLine = 0; texture.format = QImage::Format_Invalid; - texture.colorTable = 0; + texture.colorTable = nullptr; texture.hasAlpha = alpha != 256; } else { texture.imageData = d->data; @@ -4779,7 +4779,7 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _ texture.bytesPerLine = d->bytes_per_line; texture.format = d->format; - texture.colorTable = (d->format <= QImage::Format_Indexed8 && !d->colortable.isEmpty()) ? &d->colortable : 0; + texture.colorTable = (d->format <= QImage::Format_Indexed8 && !d->colortable.isEmpty()) ? &d->colortable : nullptr; texture.hasAlpha = image->hasAlphaChannel() || alpha != 256; } texture.const_alpha = alpha; diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 722afaf119..5d8f89eadd 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -115,7 +115,7 @@ QVectorPath::CacheEntry *QVectorPath::addCacheData(QPaintEngineEx *engine, void qvectorpath_cache_cleanup cleanup) const{ Q_ASSERT(!lookupCacheData(engine)); if ((m_hints & IsCachedHint) == 0) { - m_cache = 0; + m_cache = nullptr; m_hints |= IsCachedHint; } CacheEntry *e = new CacheEntry; @@ -162,8 +162,8 @@ struct StrokeHandler { QPaintEngineExPrivate::QPaintEngineExPrivate() : dasher(&stroker), - strokeHandler(0), - activeStroker(0), + strokeHandler(nullptr), + activeStroker(nullptr), strokerPen(Qt::NoPen) { } @@ -211,7 +211,7 @@ void QPaintEngineExPrivate::replayClipOperations() right, info.rectf.y(), right, bottom, info.rectf.x(), bottom }; - QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); + QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint); q->clip(vp, info.operation); break; } @@ -418,7 +418,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) if (style == Qt::SolidLine) { d->activeStroker = &d->stroker; } else if (style == Qt::NoPen) { - d->activeStroker = 0; + d->activeStroker = nullptr; } else { d->dasher.setDashPattern(pen.dashPattern()); d->dasher.setDashOffset(pen.dashOffset()); @@ -616,7 +616,7 @@ void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op) right, bottom, qreal(r.x()), bottom, qreal(r.x()), qreal(r.y()) }; - QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); + QVectorPath vp(pts, 5, nullptr, QVectorPath::RectangleHint); clip(vp, op); } @@ -687,7 +687,7 @@ void QPaintEngineEx::clip(const QRegion ®ion, Qt::ClipOperation op) void QPaintEngineEx::clip(const QPainterPath &path, Qt::ClipOperation op) { if (path.isEmpty()) { - QVectorPath vp(0, 0); + QVectorPath vp(nullptr, 0); clip(vp, op); } else { clip(qtVectorPathForPath(path), op); @@ -698,7 +698,7 @@ void QPaintEngineEx::fillRect(const QRectF &r, const QBrush &brush) { qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(), r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() }; - QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); + QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint); fill(vp, brush); } @@ -719,7 +719,7 @@ void QPaintEngineEx::drawRects(const QRect *rects, int rectCount) right, bottom, qreal(r.x()), bottom, qreal(r.x()), qreal(r.y()) }; - QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); + QVectorPath vp(pts, 5, nullptr, QVectorPath::RectangleHint); draw(vp); } } @@ -735,7 +735,7 @@ void QPaintEngineEx::drawRects(const QRectF *rects, int rectCount) right, bottom, r.x(), bottom, r.x(), r.y() }; - QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); + QVectorPath vp(pts, 5, nullptr, QVectorPath::RectangleHint); draw(vp); } } @@ -871,7 +871,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount) } else { for (int i=0; ipen); @@ -928,7 +928,7 @@ void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDr for (int i=0; ipen); @@ -960,7 +960,7 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() }; - QVectorPath path(pts, 4, 0, QVectorPath::RectangleHint); + QVectorPath path(pts, 4, nullptr, QVectorPath::RectangleHint); fill(path, brush); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d5cec1b45a..f70bbbd7d2 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -330,7 +330,7 @@ void QPainterPrivate::detachPainterPrivate(QPainter *q) original = new QPainterPrivate(q); } - d_ptrs[refcount - 1] = 0; + d_ptrs[refcount - 1] = nullptr; q->restore(); q->d_ptr.take(); q->d_ptr.reset(original); @@ -338,7 +338,7 @@ void QPainterPrivate::detachPainterPrivate(QPainter *q) if (emulationEngine) { extended = emulationEngine->real_engine; delete emulationEngine; - emulationEngine = 0; + emulationEngine = nullptr; } } @@ -1485,9 +1485,9 @@ QPainter::QPainter() */ QPainter::QPainter(QPaintDevice *pd) - : d_ptr(0) + : d_ptr(nullptr) { - Q_ASSERT(pd != 0); + Q_ASSERT(pd != nullptr); if (!QPainterPrivate::attachPainterPrivate(this, pd)) { d_ptr.reset(new QPainterPrivate(this)); begin(pd); @@ -1718,9 +1718,9 @@ static inline void qt_cleanup_painter_state(QPainterPrivate *d) { qDeleteAll(d->states); d->states.clear(); - d->state = 0; - d->engine = 0; - d->device = 0; + d->state = nullptr; + d->engine = nullptr; + d->device = nullptr; } bool QPainter::begin(QPaintDevice *pd) @@ -1769,13 +1769,13 @@ bool QPainter::begin(QPaintDevice *pd) d->device = pd; - d->extended = d->engine->isExtended() ? static_cast(d->engine) : 0; + d->extended = d->engine->isExtended() ? static_cast(d->engine) : nullptr; if (d->emulationEngine) d->emulationEngine->real_engine = d->extended; // Setup new state... Q_ASSERT(!d->state); - d->state = d->extended ? d->extended->createState(0) : new QPainterState; + d->state = d->extended ? d->extended->createState(nullptr) : new QPainterState; d->state->painter = this; d->states.push_back(d->state); @@ -1915,11 +1915,11 @@ bool QPainter::end() if (d->engine->isActive()) { ended = d->engine->end(); - d->updateState(0); + d->updateState(nullptr); --d->device->painters; if (d->device->painters == 0) { - d->engine->setPaintDevice(0); + d->engine->setPaintDevice(nullptr); d->engine->setActive(false); } } @@ -1935,11 +1935,11 @@ bool QPainter::end() if (d->emulationEngine) { delete d->emulationEngine; - d->emulationEngine = 0; + d->emulationEngine = nullptr; } if (d->extended) { - d->extended = 0; + d->extended = nullptr; } qt_cleanup_painter_state(d); @@ -2761,7 +2761,7 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op) right, rect.y(), right, bottom, rect.x(), bottom }; - QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); + QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint); d->state->clipEnabled = true; d->extended->clip(vp, op); if (op == Qt::ReplaceClip || op == Qt::NoClip) @@ -5642,7 +5642,7 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio QFixed width = rightMost - leftMost; - if (extended != 0 && state->matrix.isAffine()) { + if (extended != nullptr && state->matrix.isAffine()) { QStaticTextItem staticTextItem; staticTextItem.color = state->pen.color(); staticTextItem.font = state->font; @@ -5685,7 +5685,7 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio drawTextItemDecoration(q, QPointF(leftMost.toReal(), baseLine.toReal()), fontEngine, - 0, // textEngine + nullptr, // textEngine (underline ? QTextCharFormat::SingleUnderline : QTextCharFormat::NoUnderline), @@ -5781,7 +5781,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText // If we don't have an extended paint engine, if the painter is projected, // or if the font engine does not support the matrix, we go through standard // code path - if (d->extended == 0 + if (d->extended == nullptr || !d->state->matrix.isAffine() || !fe->supportsTransformation(d->state->matrix)) { staticText_d->paintText(topLeftPosition, this, pen().color()); @@ -5981,7 +5981,7 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br d->updateState(d->state); QRectF bounds; - qt_format_text(d->state->font, r, flags, 0, str, br ? &bounds : 0, 0, 0, 0, this); + qt_format_text(d->state->font, r, flags, nullptr, str, br ? &bounds : nullptr, 0, nullptr, 0, this); if (br) *br = bounds.toAlignedRect(); } @@ -6067,7 +6067,7 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF * if (!d->extended) d->updateState(d->state); - qt_format_text(d->state->font, r, flags, 0, str, br, 0, 0, 0, this); + qt_format_text(d->state->font, r, flags, nullptr, str, br, 0, nullptr, 0, this); } /*! @@ -6185,7 +6185,7 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption if (!d->extended) d->updateState(d->state); - qt_format_text(d->state->font, r, 0, &o, text, 0, 0, 0, 0, this); + qt_format_text(d->state->font, r, 0, &o, text, nullptr, 0, nullptr, 0, this); } /*! @@ -6415,7 +6415,7 @@ Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t drawTextItemDecoration(painter, QPointF(leftMost.toReal(), baseLine.toReal()), fontEngine, - 0, // textEngine + nullptr, // textEngine font.underline() ? QTextCharFormat::SingleUnderline : QTextCharFormat::NoUnderline, flags, width.toReal(), charFormat); @@ -6425,7 +6425,7 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti) { Q_D(QPainter); - d->drawTextItem(p, ti, static_cast(0)); + d->drawTextItem(p, ti, static_cast(nullptr)); } void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QTextEngine *textEngine) @@ -6682,7 +6682,7 @@ QRectF QPainter::boundingRect(const QRectF &r, const QString &text, const QTextO return QRectF(r.x(),r.y(), 0,0); QRectF br; - qt_format_text(d->state->font, r, Qt::TextDontPrint, &o, text, &br, 0, 0, 0, this); + qt_format_text(d->state->font, r, Qt::TextDontPrint, &o, text, &br, 0, nullptr, 0, this); return br; } @@ -7429,7 +7429,7 @@ void QPainter::setRedirected(const QPaintDevice *device, QPaintDevice *replacement, const QPoint &offset) { - Q_ASSERT(device != 0); + Q_ASSERT(device != nullptr); Q_UNUSED(device) Q_UNUSED(replacement) Q_UNUSED(offset) @@ -7480,7 +7480,7 @@ QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset) { Q_UNUSED(device) Q_UNUSED(offset) - return 0; + return nullptr; } #endif @@ -7490,7 +7490,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, QPainter *painter) { qt_format_text(fnt, _r, - tf, 0, str, brect, + tf, nullptr, str, brect, tabstops, ta, tabarraylen, painter); } @@ -7500,7 +7500,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, QPainter *painter) { - Q_ASSERT( !((tf & ~Qt::TextDontPrint)!=0 && option!=0) ); // we either have an option or flags + Q_ASSERT( !((tf & ~Qt::TextDontPrint)!=0 && option!=nullptr) ); // we either have an option or flags if (option) { tf |= option->alignment(); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 859122c3b9..17d8b863ab 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -546,7 +546,7 @@ void QPainterPath::setElementPositionAt(int i, qreal x, qreal y) Constructs an empty QPainterPath object. */ QPainterPath::QPainterPath() noexcept - : d_ptr(0) + : d_ptr(nullptr) { } @@ -602,7 +602,7 @@ void QPainterPath::ensureData_helper() QPainterPath::Element e = { 0, 0, QPainterPath::MoveToElement }; data->elements << e; d_ptr.reset(data); - Q_ASSERT(d_ptr != 0); + Q_ASSERT(d_ptr != nullptr); } /*! @@ -1036,7 +1036,7 @@ void QPainterPath::arcMoveTo(const QRectF &rect, qreal angle) return; QPointF pt; - qt_find_ellipse_coords(rect, angle, 0, &pt, 0); + qt_find_ellipse_coords(rect, angle, 0, &pt, nullptr); moveTo(pt); } diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 924d332452..1a1b2d76e2 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -690,12 +690,12 @@ int QKdPointTree::build(int begin, int end, int depth) if (last > begin) m_nodes.at(last).left = &m_nodes.at(build(begin, last, depth + 1)); else - m_nodes.at(last).left = 0; + m_nodes.at(last).left = nullptr; if (last + 1 < end) m_nodes.at(last).right = &m_nodes.at(build(last + 1, end, depth + 1)); else - m_nodes.at(last).right = 0; + m_nodes.at(last).right = nullptr; return last; } @@ -811,7 +811,7 @@ void QWingedEdge::intersectAndAdd() if (isect->next) { isect += isect->next; } else { - isect = 0; + isect = nullptr; } } @@ -1535,8 +1535,8 @@ QPainterPath QPathClipper::clip(Operation operation) if (subjectPath == clipPath) return op == BoolSub ? QPainterPath() : subjectPath; - bool subjectIsRect = pathToRect(subjectPath, 0); - bool clipIsRect = pathToRect(clipPath, 0); + bool subjectIsRect = pathToRect(subjectPath, nullptr); + bool clipIsRect = pathToRect(clipPath, nullptr); const QRectF clipBounds = clipPath.boundingRect(); const QRectF subjectBounds = subjectPath.boundingRect(); diff --git a/src/gui/painting/qpathsimplifier.cpp b/src/gui/painting/qpathsimplifier.cpp index 4251840bbc..256a2fefe7 100644 --- a/src/gui/painting/qpathsimplifier.cpp +++ b/src/gui/painting/qpathsimplifier.cpp @@ -378,8 +378,8 @@ private: }; inline PathSimplifier::BoundingVolumeHierarchy::BoundingVolumeHierarchy() - : root(0) - , nodeBlock(0) + : root(nullptr) + , nodeBlock(nullptr) , blockSize(0) , firstFree(0) { @@ -392,7 +392,7 @@ inline PathSimplifier::BoundingVolumeHierarchy::~BoundingVolumeHierarchy() inline void PathSimplifier::BoundingVolumeHierarchy::allocate(int nodeCount) { - Q_ASSERT(nodeBlock == 0); + Q_ASSERT(nodeBlock == nullptr); Q_ASSERT(firstFree == 0); nodeBlock = new Node[blockSize = nodeCount]; } @@ -401,9 +401,9 @@ inline void PathSimplifier::BoundingVolumeHierarchy::free() { freeNode(root); delete[] nodeBlock; - nodeBlock = 0; + nodeBlock = nullptr; firstFree = blockSize = 0; - root = 0; + root = nullptr; } inline PathSimplifier::BVHNode *PathSimplifier::BoundingVolumeHierarchy::newNode() @@ -427,7 +427,7 @@ inline void PathSimplifier::BoundingVolumeHierarchy::freeNode(Node *n) } inline PathSimplifier::ElementAllocator::ElementAllocator() - : blocks(0) + : blocks(nullptr) { } @@ -442,11 +442,11 @@ inline PathSimplifier::ElementAllocator::~ElementAllocator() inline void PathSimplifier::ElementAllocator::allocate(int count) { - Q_ASSERT(blocks == 0); + Q_ASSERT(blocks == nullptr); Q_ASSERT(count > 0); blocks = (ElementBlock *)malloc(sizeof(ElementBlock) + (count - 1) * sizeof(Element)); blocks->blockSize = count; - blocks->next = 0; + blocks->next = nullptr; blocks->firstFree = 0; } @@ -479,7 +479,7 @@ inline void PathSimplifier::Element::flip() qSwap(indices[i], indices[degree - i]); } pointingUp = !pointingUp; - Q_ASSERT(next == 0 && previous == 0); + Q_ASSERT(next == nullptr && previous == nullptr); } PathSimplifier::PathSimplifier(const QVectorPath &path, QDataBuffer &vertices, @@ -685,9 +685,9 @@ void PathSimplifier::connectElements() QDataBuffer events(m_elements.size() * 2); for (int i = 0; i < m_elements.size(); ++i) { Element *element = m_elements.at(i); - element->next = element->previous = 0; + element->next = element->previous = nullptr; element->winding = 0; - element->edgeNode = 0; + element->edgeNode = nullptr; const QPoint &u = m_points->at(element->indices[0]); const QPoint &v = m_points->at(element->indices[element->degree]); if (u != v) { @@ -730,7 +730,7 @@ void PathSimplifier::connectElements() Element *element2 = event2->element; element->edgeNode->data = event2->element; element2->edgeNode = element->edgeNode; - element->edgeNode = 0; + element->edgeNode = nullptr; events.pop_back(); events.pop_back(); @@ -783,8 +783,8 @@ void PathSimplifier::connectElements() Element *upperElement = m_elementAllocator.newElement(); *upperElement = *element; upperElement->lowerIndex() = element->upperIndex() = pointIndex; - upperElement->edgeNode = 0; - element->next = element->previous = 0; + upperElement->edgeNode = nullptr; + element->next = element->previous = nullptr; if (upperElement->next) upperElement->next->previous = upperElement; else if (upperElement->previous) @@ -805,7 +805,7 @@ void PathSimplifier::connectElements() RBNode *left = findElementLeftOf(event->element, bounds); RBNode *node = m_elementList.newNode(); node->data = event->element; - Q_ASSERT(event->element->edgeNode == 0); + Q_ASSERT(event->element->edgeNode == nullptr); event->element->edgeNode = node; m_elementList.attachAfter(left, node); } else { @@ -814,7 +814,7 @@ void PathSimplifier::connectElements() Element *element = event->element; Q_ASSERT(element->edgeNode); m_elementList.deleteNode(element->edgeNode); - Q_ASSERT(element->edgeNode == 0); + Q_ASSERT(element->edgeNode == nullptr); } events.pop_back(); } @@ -870,8 +870,8 @@ void PathSimplifier::connectElements() Q_ASSERT(i + 1 < orderedElements.size()); Element *next = orderedElements.at(i); Element *previous = orderedElements.at(i + 1); - Q_ASSERT(next->previous == 0); - Q_ASSERT(previous->next == 0); + Q_ASSERT(next->previous == nullptr); + Q_ASSERT(previous->next == nullptr); next->previous = previous; previous->next = next; } @@ -893,7 +893,7 @@ void PathSimplifier::fillIndices() m_elements.at(i)->processed = false; for (int i = 0; i < m_elements.size(); ++i) { Element *element = m_elements.at(i); - if (element->processed || element->next == 0) + if (element->processed || element->next == nullptr) continue; do { m_indices->add(element->indices[0]); @@ -1395,13 +1395,13 @@ PathSimplifier::RBNode *PathSimplifier::findElementLeftOf(const Element *element const QPair &bounds) { if (!m_elementList.root) - return 0; + return nullptr; RBNode *current = bounds.first; Q_ASSERT(!current || !elementIsLeftOf(element, current->data)); if (!current) current = m_elementList.front(m_elementList.root); Q_ASSERT(current); - RBNode *result = 0; + RBNode *result = nullptr; while (current != bounds.second && !elementIsLeftOf(element, current->data)) { result = current; current = m_elementList.next(current); diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index f560e1f0f0..932c3e6f5a 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -439,8 +439,8 @@ QByteArray QPdf::generateDashes(const QPen &pen) static const char* const pattern_for_brush[] = { - 0, // NoBrush - 0, // SolidPattern + nullptr, // NoBrush + nullptr, // SolidPattern "0 J\n" "6 w\n" "[] 0 d\n" @@ -637,7 +637,7 @@ static void cubicToHook(qfixed c1x, qfixed c1y, } QPdf::Stroker::Stroker() - : stream(0), + : stream(nullptr), first(true), dashStroker(&basicStroker) { @@ -652,7 +652,7 @@ QPdf::Stroker::Stroker() void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints) { if (pen.style() == Qt::NoPen) { - stroker = 0; + stroker = nullptr; return; } qreal w = pen.widthF(); @@ -1469,7 +1469,7 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const QPdfEnginePrivate::QPdfEnginePrivate() : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false), pdfVersion(QPdfEngine::Version_1_4), - outDevice(0), ownsDevice(false), + outDevice(nullptr), ownsDevice(false), embedFonts(true), grayscale(false), m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(10, 10, 10, 10)) @@ -1477,8 +1477,8 @@ QPdfEnginePrivate::QPdfEnginePrivate() initResources(); resolution = 1200; currentObject = 1; - currentPage = 0; - stroker.stream = 0; + currentPage = nullptr; + stroker.stream = nullptr; streampos = 0; @@ -1547,12 +1547,12 @@ bool QPdfEngine::end() qDeleteAll(d->fonts); d->fonts.clear(); delete d->currentPage; - d->currentPage = 0; + d->currentPage = nullptr; if (d->outDevice && d->ownsDevice) { d->outDevice->close(); delete d->outDevice; - d->outDevice = 0; + d->outDevice = nullptr; } setActive(false); diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index bf7e2d3dca..35814d146c 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -55,7 +55,7 @@ public: : QObjectPrivate() { engine = new QPdfEngine(); - output = 0; + output = nullptr; pdfVersion = QPdfWriter::PdfVersion_1_4; } ~QPdfWriterPrivate() diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index dc6e3e04d0..1a940443d1 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -254,7 +254,7 @@ public: { if (!pen->ref.deref()) delete pen; - pen = 0; + pen = nullptr; } }; diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 0ecb4390e9..c092a7153f 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -87,10 +87,10 @@ class QPlatformBackingStorePrivate public: QPlatformBackingStorePrivate(QWindow *w) : window(w) - , backingStore(0) + , backingStore(nullptr) #ifndef QT_NO_OPENGL , textureId(0) - , blitter(0) + , blitter(nullptr) #endif { } diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index b4014272f4..cd31d75f83 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -209,7 +209,7 @@ QScanConverter::QScanConverter() : m_lines(0) , m_alloc(0) , m_size(0) - , m_intersections(0) + , m_intersections(nullptr) , m_active(0) { } @@ -442,7 +442,7 @@ void QScanConverter::end() free(m_intersections); m_alloc = 0; m_size = 0; - m_intersections = 0; + m_intersections = nullptr; } if (m_lines.size() > 1024) diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 82f5be2b65..783b02fb93 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1128,7 +1128,7 @@ Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) segments.resize(4 * (end - rect)); int lastRowSegmentCount = 0; - Segment *lastRowSegments = 0; + Segment *lastRowSegments = nullptr; int lastSegment = 0; int lastY = 0; @@ -1380,10 +1380,10 @@ void QRegionPrivate::intersect(const QRect &rect) extents.setRight(qMax(extents.right(), dest->right())); extents.setBottom(qMax(extents.bottom(), dest->bottom())); - const QRect *nextToLast = (numRects > 1 ? dest - 2 : 0); + const QRect *nextToLast = (numRects > 1 ? dest - 2 : nullptr); // mergeFromBelow inlined and optimized - if (canMergeFromBelow(dest - 1, dest, nextToLast, 0)) { + if (canMergeFromBelow(dest - 1, dest, nextToLast, nullptr)) { if (!n || src->y() != dest->y() || src->left() > r.right()) { QRect *prev = dest - 1; prev->setBottom(dest->bottom()); @@ -1408,11 +1408,11 @@ void QRegionPrivate::append(const QRect *r) QRect *myLast = (numRects == 1 ? &extents : rects.data() + (numRects - 1)); if (mergeFromRight(myLast, r)) { if (numRects > 1) { - const QRect *nextToTop = (numRects > 2 ? myLast - 2 : 0); - if (mergeFromBelow(myLast - 1, myLast, nextToTop, 0)) + const QRect *nextToTop = (numRects > 2 ? myLast - 2 : nullptr); + if (mergeFromBelow(myLast - 1, myLast, nextToTop, nullptr)) --numRects; } - } else if (mergeFromBelow(myLast, r, (numRects > 1 ? myLast - 1 : 0), 0)) { + } else if (mergeFromBelow(myLast, r, (numRects > 1 ? myLast - 1 : nullptr), nullptr)) { // nothing } else { vectorize(); @@ -1451,18 +1451,18 @@ void QRegionPrivate::append(const QRegionPrivate *r) { const QRect *rFirst = srcRect; QRect *myLast = destRect - 1; - const QRect *nextToLast = (numRects > 1 ? myLast - 1 : 0); + const QRect *nextToLast = (numRects > 1 ? myLast - 1 : nullptr); if (mergeFromRight(myLast, rFirst)) { ++srcRect; --numAppend; - const QRect *rNextToFirst = (numAppend > 1 ? rFirst + 2 : 0); + const QRect *rNextToFirst = (numAppend > 1 ? rFirst + 2 : nullptr); if (mergeFromBelow(myLast, rFirst + 1, nextToLast, rNextToFirst)) { ++srcRect; --numAppend; } if (numRects > 1) { - nextToLast = (numRects > 2 ? myLast - 2 : 0); - rNextToFirst = (numAppend > 0 ? srcRect : 0); + nextToLast = (numRects > 2 ? myLast - 2 : nullptr); + rNextToFirst = (numAppend > 0 ? srcRect : nullptr); if (mergeFromBelow(myLast - 1, myLast, nextToLast, rNextToFirst)) { --destRect; --numRects; @@ -1522,20 +1522,20 @@ void QRegionPrivate::prepend(const QRegionPrivate *r) // try merging { QRect *myFirst = rects.data(); - const QRect *nextToFirst = (numRects > 1 ? myFirst + 1 : 0); + const QRect *nextToFirst = (numRects > 1 ? myFirst + 1 : nullptr); const QRect *rLast = r->rects.constData() + r->numRects - 1; - const QRect *rNextToLast = (r->numRects > 1 ? rLast - 1 : 0); + const QRect *rNextToLast = (r->numRects > 1 ? rLast - 1 : nullptr); if (mergeFromLeft(myFirst, rLast)) { --numPrepend; --rLast; - rNextToLast = (numPrepend > 1 ? rLast - 1 : 0); + rNextToLast = (numPrepend > 1 ? rLast - 1 : nullptr); if (mergeFromAbove(myFirst, rLast, nextToFirst, rNextToLast)) { --numPrepend; --rLast; } if (numRects > 1) { - nextToFirst = (numRects > 2? myFirst + 2 : 0); - rNextToLast = (numPrepend > 0 ? rLast : 0); + nextToFirst = (numRects > 2? myFirst + 2 : nullptr); + rNextToLast = (numPrepend > 0 ? rLast : nullptr); if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, rNextToLast)) { --numRects; ++numSkip; @@ -1585,14 +1585,14 @@ void QRegionPrivate::prepend(const QRect *r) QRect *myFirst = (numRects == 1 ? &extents : rects.data()); if (mergeFromLeft(myFirst, r)) { if (numRects > 1) { - const QRect *nextToFirst = (numRects > 2 ? myFirst + 2 : 0); - if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, 0)) { + const QRect *nextToFirst = (numRects > 2 ? myFirst + 2 : nullptr); + if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, nullptr)) { --numRects; memmove(rects.data(), rects.constData() + 1, numRects * sizeof(QRect)); } } - } else if (mergeFromAbove(myFirst, r, (numRects > 1 ? myFirst + 1 : 0), 0)) { + } else if (mergeFromAbove(myFirst, r, (numRects > 1 ? myFirst + 1 : nullptr), nullptr)) { // nothing } else { vectorize(); @@ -2324,14 +2324,14 @@ static void miRegionOp(QRegionPrivate &dest, top = qMax(r1->top(), ybot + 1); bot = qMin(r1->bottom(), r2->top() - 1); - if (nonOverlap1Func != 0 && bot >= top) + if (nonOverlap1Func != nullptr && bot >= top) (*nonOverlap1Func)(dest, r1, r1BandEnd, top, bot); ytop = r2->top(); } else if (r2->top() < r1->top()) { top = qMax(r2->top(), ybot + 1); bot = qMin(r2->bottom(), r1->top() - 1); - if (nonOverlap2Func != 0 && bot >= top) + if (nonOverlap2Func != nullptr && bot >= top) (*nonOverlap2Func)(dest, r2, r2BandEnd, top, bot); ytop = r1->top(); } else { @@ -2374,7 +2374,7 @@ static void miRegionOp(QRegionPrivate &dest, */ curBand = dest.numRects; if (r1 != r1End) { - if (nonOverlap1Func != 0) { + if (nonOverlap1Func != nullptr) { do { r1BandEnd = r1; while (r1BandEnd < r1End && r1BandEnd->top() == r1->top()) @@ -2383,7 +2383,7 @@ static void miRegionOp(QRegionPrivate &dest, r1 = r1BandEnd; } while (r1 != r1End); } - } else if ((r2 != r2End) && (nonOverlap2Func != 0)) { + } else if ((r2 != r2End) && (nonOverlap2Func != nullptr)) { do { r2BandEnd = r2; while (r2BandEnd < r2End && r2BandEnd->top() == r2->top()) @@ -2698,7 +2698,7 @@ static void SubtractRegion(QRegionPrivate *regM, QRegionPrivate *regS, Q_ASSERT(!regS->contains(*regM)); Q_ASSERT(!EqualRegion(regM, regS)); - miRegionOp(dest, regM, regS, miSubtractO, miSubtractNonO1, 0); + miRegionOp(dest, regM, regS, miSubtractO, miSubtractNonO1, nullptr); /* * Can't alter dest's extents before we call miRegionOp because @@ -3235,14 +3235,14 @@ static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, (ScanLineListBlock *)malloc(sizeof(ScanLineListBlock)); Q_CHECK_PTR(tmpSLLBlock); (*SLLBlock)->next = tmpSLLBlock; - tmpSLLBlock->next = (ScanLineListBlock *)NULL; + tmpSLLBlock->next = (ScanLineListBlock *)nullptr; *SLLBlock = tmpSLLBlock; *iSLLBlock = 0; } pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL->next = pPrevSLL->next; - pSLL->edgelist = (EdgeTableEntry *)NULL; + pSLL->edgelist = (EdgeTableEntry *)nullptr; pPrevSLL->next = pSLL; } pSLL->scanline = scanline; @@ -3250,7 +3250,7 @@ static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, /* * now insert the edge in the right bucket */ - prev = 0; + prev = nullptr; start = pSLL->edgelist; while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) { prev = start; @@ -3306,18 +3306,18 @@ static void CreateETandAET(int count, const QPoint *pts, /* * initialize the Active Edge Table */ - AET->next = 0; - AET->back = 0; - AET->nextWETE = 0; + AET->next = nullptr; + AET->back = nullptr; + AET->nextWETE = nullptr; AET->bres.minor_axis = SMALL_COORDINATE; /* * initialize the Edge Table. */ - ET->scanlines.next = 0; + ET->scanlines.next = nullptr; ET->ymax = SMALL_COORDINATE; ET->ymin = LARGE_COORDINATE; - pSLLBlock->next = 0; + pSLLBlock->next = nullptr; PrevPt = &pts[count - 1]; @@ -3426,7 +3426,7 @@ static void computeWAET(EdgeTableEntry *AET) int inside = 1; int isInside = 0; - AET->nextWETE = 0; + AET->nextWETE = nullptr; pWETE = AET; AET = AET->next; while (AET) { @@ -3442,7 +3442,7 @@ static void computeWAET(EdgeTableEntry *AET) } AET = AET->next; } - pWETE->nextWETE = 0; + pWETE->nextWETE = nullptr; } /* @@ -3672,7 +3672,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) if (!(pETEs = static_cast(malloc(sizeof(EdgeTableEntry) * Count)))) { delete region; - return 0; + return nullptr; } region->vectorize(); @@ -3692,7 +3692,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) #endif delete AET; delete region; - return 0; + return nullptr; } @@ -3808,7 +3808,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) curPtBlock = tmpPtBlock; } free(pETEs); - return 0; // this function returns 0 in case of an error + return nullptr; // this function returns 0 in case of an error } FreeStorage(SLLBlock.next); @@ -4185,7 +4185,7 @@ QRegion QRegion::intersected(const QRegion &r) const QRegion result; result.detach(); - miRegionOp(*result.d->qt_rgn, d->qt_rgn, r.d->qt_rgn, miIntersectO, 0, 0); + miRegionOp(*result.d->qt_rgn, d->qt_rgn, r.d->qt_rgn, miIntersectO, nullptr, nullptr); /* * Can't alter dest's extents before we call miRegionOp because diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 271d3ba6bf..22302f9790 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -185,10 +185,10 @@ QStrokerOps::QStrokerOps() : m_elements(0) , m_curveThreshold(qt_real_to_fixed(0.25)) , m_dashThreshold(qt_real_to_fixed(0.25)) - , m_customData(0) - , m_moveTo(0) - , m_lineTo(0) - , m_cubicTo(0) + , m_customData(nullptr) + , m_moveTo(nullptr) + , m_lineTo(nullptr) + , m_cubicTo(nullptr) { } @@ -219,7 +219,7 @@ void QStrokerOps::end() { if (m_elements.size() > 1) processCurrentSubpath(); - m_customData = 0; + m_customData = nullptr; } /*! diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 7a3dd04965..f40ca9d8b4 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -127,7 +127,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QFixed subPixelPosition; if (supportsSubPixelPositions) { - QFixed x = positions != 0 ? positions[i].x : QFixed(); + QFixed x = positions != nullptr ? positions[i].x : QFixed(); subPixelPosition = fontEngine->subPixelPositionForX(x); } diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp index b1b07f9699..8e0308f268 100644 --- a/src/gui/painting/qtriangulatingstroker.cpp +++ b/src/gui/painting/qtriangulatingstroker.cpp @@ -150,7 +150,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co m_cos_theta = qFastCos(Q_PI / m_roundness); const qreal *endPts = pts + (count<<1); - const qreal *startPts = 0; + const qreal *startPts = nullptr; Qt::PenCapStyle cap = m_cap_style; @@ -510,7 +510,7 @@ static void qdashprocessor_cubicTo(qreal, qreal, qreal, qreal, qreal, qreal, voi QDashedStrokeProcessor::QDashedStrokeProcessor() : m_points(0), m_types(0), - m_dash_stroker(0), m_inv_scale(1) + m_dash_stroker(nullptr), m_inv_scale(1) { m_dash_stroker.setMoveToHook(qdashprocessor_moveTo); m_dash_stroker.setLineToHook(qdashprocessor_lineTo); diff --git a/src/gui/painting/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp index 9be3eeaffd..ec3ab8ff8f 100644 --- a/src/gui/painting/qtriangulator.cpp +++ b/src/gui/painting/qtriangulator.cpp @@ -958,7 +958,7 @@ void QTriangulator::ComplexToSimple::initEdges() } else { Q_ASSERT(i + 1 < m_parent->m_indices.size()); // {node, from, to, next, previous, winding, mayIntersect, pointingUp, originallyPointingUp} - Edge edge = {0, int(m_parent->m_indices.at(i)), int(m_parent->m_indices.at(i + 1)), -1, -1, 0, true, false, false}; + Edge edge = {nullptr, int(m_parent->m_indices.at(i)), int(m_parent->m_indices.at(i + 1)), -1, -1, 0, true, false, false}; m_edges.add(edge); } } @@ -1029,7 +1029,7 @@ template QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex) const { QRBTree::Node *current = m_edgeList.root; - QRBTree::Node *result = 0; + QRBTree::Node *result = nullptr; while (current) { if (edgeIsLeftOfEdge(edgeIndex, current->data)) { current = current->left; @@ -1072,7 +1072,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim } current = (d < 0 ? current->left : current->right); } - if (current == 0) + if (current == nullptr) return result; current = result.first->left; @@ -1273,7 +1273,7 @@ void QTriangulator::ComplexToSimple::fillPriorityQueue() m_events.reserve(m_edges.size() * 2); for (int i = 0; i < m_edges.size(); ++i) { Q_ASSERT(m_edges.at(i).previous == -1 && m_edges.at(i).next == -1); - Q_ASSERT(m_edges.at(i).node == 0); + Q_ASSERT(m_edges.at(i).node == nullptr); Q_ASSERT(m_edges.at(i).pointingUp == m_edges.at(i).originallyPointingUp); Q_ASSERT(m_edges.at(i).pointingUp == (m_parent->m_vertices.at(m_edges.at(i).to) < m_parent->m_vertices.at(m_edges.at(i).from))); // Ignore zero-length edges. @@ -1296,7 +1296,7 @@ void QTriangulator::ComplexToSimple::calculateIntersections() fillPriorityQueue(); Q_ASSERT(m_topIntersection.empty()); - Q_ASSERT(m_edgeList.root == 0); + Q_ASSERT(m_edgeList.root == nullptr); // Find all intersection points. while (!m_events.isEmpty()) { @@ -1305,7 +1305,7 @@ void QTriangulator::ComplexToSimple::calculateIntersections() // Find all edges in the edge list that contain the current vertex and mark them to be split later. QPair::Node *, QRBTree::Node *> range = bounds(event.point); - QRBTree::Node *leftNode = range.first ? m_edgeList.previous(range.first) : 0; + QRBTree::Node *leftNode = range.first ? m_edgeList.previous(range.first) : nullptr; int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower()); QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point); @@ -1361,7 +1361,7 @@ int QTriangulator::ComplexToSimple::splitEdge(int splitIndex) { const Split &split = m_splits.at(splitIndex); Edge &lowerEdge = m_edges.at(split.edge); - Q_ASSERT(lowerEdge.node == 0); + Q_ASSERT(lowerEdge.node == nullptr); Q_ASSERT(lowerEdge.previous == -1 && lowerEdge.next == -1); if (lowerEdge.from == split.vertex) @@ -1439,7 +1439,7 @@ void QTriangulator::ComplexToSimple::insertEdgeIntoVectorIfWanted(ShortArray template void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() { - Q_ASSERT(m_edgeList.root == 0); + Q_ASSERT(m_edgeList.root == nullptr); // Initialize priority queue. fillPriorityQueue(); @@ -1772,7 +1772,7 @@ void QTriangulator::SimpleToMonotone::setupDataStructures() { int i = 0; Edge e; - e.node = 0; + e.node = nullptr; e.twin = -1; while (i + 3 <= m_parent->m_indices.size()) { @@ -1862,7 +1862,7 @@ template QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfEdge(int edgeIndex) const { QRBTree::Node *current = m_edgeList.root; - QRBTree::Node *result = 0; + QRBTree::Node *result = nullptr; while (current) { if (edgeIsLeftOfEdge(edgeIndex, current->data)) { current = current->left; @@ -1879,7 +1879,7 @@ template QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(int pointIndex) const { QRBTree::Node *current = m_edgeList.root; - QRBTree::Node *result = 0; + QRBTree::Node *result = nullptr; while (current) { const QPodPoint &p1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &p2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); @@ -2038,7 +2038,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() j = m_edges.at(i).previous; Q_ASSERT(j < m_edges.size()); - QRBTree::Node *leftEdgeNode = 0; + QRBTree::Node *leftEdgeNode = nullptr; switch (m_edges.at(i).type) { case RegularVertex: @@ -2049,7 +2049,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() if (m_edges.at(m_edges.at(i).helper).type == MergeVertex) diagonals.add(QPair(i, m_edges.at(i).helper)); m_edges.at(j).node = m_edges.at(i).node; - m_edges.at(i).node = 0; + m_edges.at(i).node = nullptr; m_edges.at(j).node->data = j; m_edges.at(j).helper = i; } else if (m_edges.at(j).node) { @@ -2057,7 +2057,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() if (m_edges.at(m_edges.at(j).helper).type == MergeVertex) diagonals.add(QPair(i, m_edges.at(j).helper)); m_edges.at(i).node = m_edges.at(j).node; - m_edges.at(j).node = 0; + m_edges.at(j).node = nullptr; m_edges.at(i).node->data = i; m_edges.at(i).helper = i; } else { diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index 8b8f3e28ac..8528f59844 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -471,7 +471,7 @@ QTextObjectInterface *QAbstractTextDocumentLayout::handlerForObject(int objectTy QTextObjectHandler handler = d->handlers.value(objectType); if (!handler.component) - return 0; + return nullptr; return handler.iface; } diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index 89f943ca51..c843e3b706 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -850,7 +850,7 @@ QDistanceFieldData::QDistanceFieldData(const QDistanceFieldData &other) if (nbytes && other.data) data = (uchar *)memcpy(malloc(nbytes), other.data, nbytes); else - data = 0; + data = nullptr; } QDistanceFieldData::~QDistanceFieldData() @@ -1046,7 +1046,7 @@ const uchar *QDistanceField::constBits() const uchar *QDistanceField::scanLine(int i) { if (isNull()) - return 0; + return nullptr; Q_ASSERT(i >= 0 && i < d->height); return d->data + i * d->width; @@ -1055,7 +1055,7 @@ uchar *QDistanceField::scanLine(int i) const uchar *QDistanceField::scanLine(int i) const { if (isNull()) - return 0; + return nullptr; Q_ASSERT(i >= 0 && i < d->height); return d->data + i * d->width; @@ -1064,7 +1064,7 @@ const uchar *QDistanceField::scanLine(int i) const const uchar *QDistanceField::constScanLine(int i) const { if (isNull()) - return 0; + return nullptr; Q_ASSERT(i >= 0 && i < d->height); return d->data + i * d->width; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index bf130fa0b7..e162015aba 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -180,14 +180,14 @@ Q_GUI_EXPORT int qt_defaultDpi() } QFontPrivate::QFontPrivate() - : engineData(0), dpi(qt_defaultDpi()), + : engineData(nullptr), dpi(qt_defaultDpi()), underline(false), overline(false), strikeOut(false), kerning(true), - capital(0), letterSpacingIsAbsolute(false), scFont(0) + capital(0), letterSpacingIsAbsolute(false), scFont(nullptr) { } QFontPrivate::QFontPrivate(const QFontPrivate &other) - : request(other.request), engineData(0), dpi(other.dpi), + : request(other.request), engineData(nullptr), dpi(other.dpi), underline(other.underline), overline(other.overline), strikeOut(other.strikeOut), kerning(other.kerning), capital(other.capital), letterSpacingIsAbsolute(other.letterSpacingIsAbsolute), @@ -202,10 +202,10 @@ QFontPrivate::~QFontPrivate() { if (engineData && !engineData->ref.deref()) delete engineData; - engineData = 0; + engineData = nullptr; if (scFont && scFont != this) scFont->ref.deref(); - scFont = 0; + scFont = nullptr; } extern QRecursiveMutex *qt_fontdatabase_mutex(); @@ -221,7 +221,7 @@ QFontEngine *QFontPrivate::engineForScript(int script) const // throw out engineData that came from a different thread if (!engineData->ref.deref()) delete engineData; - engineData = 0; + engineData = nullptr; } if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, script)) QFontDatabase::load(this, script); @@ -261,7 +261,7 @@ QFontPrivate *QFontPrivate::smallCapsFontPrivate() const void QFontPrivate::resolve(uint mask, const QFontPrivate *other) { - Q_ASSERT(other != 0); + Q_ASSERT(other != nullptr); dpi = other->dpi; @@ -346,7 +346,7 @@ QFontEngineData::~QFontEngineData() if (engines[i]) { if (!engines[i]->ref.deref()) delete engines[i]; - engines[i] = 0; + engines[i] = nullptr; } } } @@ -610,10 +610,10 @@ void QFont::detach() if (d->ref.loadRelaxed() == 1) { if (d->engineData && !d->engineData->ref.deref()) delete d->engineData; - d->engineData = 0; + d->engineData = nullptr; if (d->scFont && d->scFont != d.data()) d->scFont->ref.deref(); - d->scFont = 0; + d->scFont = nullptr; return; } @@ -1666,7 +1666,7 @@ void QFont::setRawMode(bool) bool QFont::exactMatch() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return d->request.exactMatch(engine->fontDef); } @@ -1834,7 +1834,7 @@ Q_GLOBAL_STATIC(QFontSubst, globalFontSubst) QString QFont::substitute(const QString &familyName) { QFontSubst *fontSubst = globalFontSubst(); - Q_ASSERT(fontSubst != 0); + Q_ASSERT(fontSubst != nullptr); QFontSubst::ConstIterator it = fontSubst->constFind(familyName.toLower()); if (it != fontSubst->constEnd() && !(*it).isEmpty()) return (*it).first(); @@ -1855,7 +1855,7 @@ QString QFont::substitute(const QString &familyName) QStringList QFont::substitutes(const QString &familyName) { QFontSubst *fontSubst = globalFontSubst(); - Q_ASSERT(fontSubst != 0); + Q_ASSERT(fontSubst != nullptr); return fontSubst->value(familyName.toLower(), QStringList()); } @@ -1870,7 +1870,7 @@ void QFont::insertSubstitution(const QString &familyName, const QString &substituteName) { QFontSubst *fontSubst = globalFontSubst(); - Q_ASSERT(fontSubst != 0); + Q_ASSERT(fontSubst != nullptr); QStringList &list = (*fontSubst)[familyName.toLower()]; QString s = substituteName.toLower(); if (!list.contains(s)) @@ -1888,7 +1888,7 @@ void QFont::insertSubstitutions(const QString &familyName, const QStringList &substituteNames) { QFontSubst *fontSubst = globalFontSubst(); - Q_ASSERT(fontSubst != 0); + Q_ASSERT(fontSubst != nullptr); QStringList &list = (*fontSubst)[familyName.toLower()]; for (const QString &substituteName : substituteNames) { const QString lowerSubstituteName = substituteName.toLower(); @@ -1906,7 +1906,7 @@ void QFont::insertSubstitutions(const QString &familyName, void QFont::removeSubstitutions(const QString &familyName) { QFontSubst *fontSubst = globalFontSubst(); - Q_ASSERT(fontSubst != 0); + Q_ASSERT(fontSubst != nullptr); fontSubst->remove(familyName.toLower()); } @@ -1926,7 +1926,7 @@ void QFont::removeSubstitutions(const QString &familyName) QStringList QFont::substitutions() { QFontSubst *fontSubst = globalFontSubst(); - Q_ASSERT(fontSubst != 0); + Q_ASSERT(fontSubst != nullptr); QStringList ret = fontSubst->keys(); ret.sort(); @@ -1940,7 +1940,7 @@ QStringList QFont::substitutions() */ static quint8 get_font_bits(int version, const QFontPrivate *f) { - Q_ASSERT(f != 0); + Q_ASSERT(f != nullptr); quint8 bits = 0; if (f->request.style) bits |= 0x01; @@ -1965,7 +1965,7 @@ static quint8 get_font_bits(int version, const QFontPrivate *f) static quint8 get_extended_font_bits(const QFontPrivate *f) { - Q_ASSERT(f != 0); + Q_ASSERT(f != nullptr); quint8 bits = 0; if (f->request.ignorePitch) bits |= 0x01; @@ -1980,7 +1980,7 @@ static quint8 get_extended_font_bits(const QFontPrivate *f) */ static void set_font_bits(int version, quint8 bits, QFontPrivate *f) { - Q_ASSERT(f != 0); + Q_ASSERT(f != nullptr); f->request.style = (bits & 0x01) != 0 ? QFont::StyleItalic : QFont::StyleNormal; f->underline = (bits & 0x02) != 0; f->overline = (bits & 0x40) != 0; @@ -1995,7 +1995,7 @@ static void set_font_bits(int version, quint8 bits, QFontPrivate *f) static void set_extended_font_bits(quint8 bits, QFontPrivate *f) { - Q_ASSERT(f != 0); + Q_ASSERT(f != nullptr); f->request.ignorePitch = (bits & 0x01) != 0; f->letterSpacingIsAbsolute = (bits & 0x02) != 0; } @@ -2549,7 +2549,7 @@ QFontInfo &QFontInfo::operator=(const QFontInfo &fi) QString QFontInfo::family() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->fontDef.family; } @@ -2564,7 +2564,7 @@ QString QFontInfo::family() const QString QFontInfo::styleName() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->fontDef.styleName; } @@ -2576,7 +2576,7 @@ QString QFontInfo::styleName() const int QFontInfo::pointSize() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->fontDef.pointSize); } @@ -2588,7 +2588,7 @@ int QFontInfo::pointSize() const qreal QFontInfo::pointSizeF() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->fontDef.pointSize; } @@ -2600,7 +2600,7 @@ qreal QFontInfo::pointSizeF() const int QFontInfo::pixelSize() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->fontDef.pixelSize; } @@ -2612,7 +2612,7 @@ int QFontInfo::pixelSize() const bool QFontInfo::italic() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->fontDef.style != QFont::StyleNormal; } @@ -2624,7 +2624,7 @@ bool QFontInfo::italic() const QFont::Style QFontInfo::style() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return (QFont::Style)engine->fontDef.style; } @@ -2636,7 +2636,7 @@ QFont::Style QFontInfo::style() const int QFontInfo::weight() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->fontDef.weight; } @@ -2701,7 +2701,7 @@ bool QFontInfo::strikeOut() const bool QFontInfo::fixedPitch() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); #ifdef Q_OS_MAC if (!engine->fontDef.fixedPitchComputed) { QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') }; @@ -2727,7 +2727,7 @@ bool QFontInfo::fixedPitch() const QFont::StyleHint QFontInfo::styleHint() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return (QFont::StyleHint) engine->fontDef.styleHint; } @@ -2759,7 +2759,7 @@ bool QFontInfo::rawMode() const bool QFontInfo::exactMatch() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return d->request.exactMatch(engine->fontDef); } @@ -2793,7 +2793,7 @@ QFontCache *QFontCache::instance() void QFontCache::cleanup() { - QThreadStorage *cache = 0; + QThreadStorage *cache = nullptr; QT_TRY { cache = theFontCache(); } QT_CATCH (const std::bad_alloc &) { @@ -2830,7 +2830,7 @@ void QFontCache::clear() Q_ASSERT(engineCacheCount.value(data->engines[i]) == 0); delete data->engines[i]; } - data->engines[i] = 0; + data->engines[i] = nullptr; } } if (!data->ref.deref()) { @@ -2863,7 +2863,7 @@ void QFontCache::clear() FC_DEBUG("QFontCache::clear: engine %p still has refcount %d", engine, engine->ref.loadRelaxed()); } - it.value().data = 0; + it.value().data = nullptr; } } } while (mightHaveEnginesLeftForCleanup); @@ -2881,7 +2881,7 @@ QFontEngineData *QFontCache::findEngineData(const QFontDef &def) const { EngineDataCache::ConstIterator it = engineDataCache.constFind(def); if (it == engineDataCache.constEnd()) - return 0; + return nullptr; // found return it.value(); @@ -2912,7 +2912,7 @@ QFontEngine *QFontCache::findEngine(const Key &key) { EngineCache::Iterator it = engineCache.find(key), end = engineCache.end(); - if (it == end) return 0; + if (it == end) return nullptr; Q_ASSERT(it.value().data != nullptr); Q_ASSERT(key.multi == (it.value().data->type() == QFontEngine::Multi)); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 67702ab5b5..f2fd585835 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -210,7 +210,7 @@ struct QtFontStyle QtFontStyle(const Key &k) : key(k), bitmapScalable(false), smoothScalable(false), - count(0), pixelSizes(0) + count(0), pixelSizes(nullptr) { } @@ -265,7 +265,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) return pixelSizes + i; } if (!add) - return 0; + return nullptr; if (!pixelSizes) { // Most style have only one font size, we avoid waisting memory @@ -280,13 +280,13 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) pixelSizes = newPixelSizes; } pixelSizes[count].pixelSize = size; - pixelSizes[count].handle = 0; + pixelSizes[count].handle = nullptr; return pixelSizes + (count++); } struct QtFontFoundry { - QtFontFoundry(const QString &n) : name(n), count(0), styles(0) {} + QtFontFoundry(const QString &n) : name(n), count(0), styles(nullptr) {} ~QtFontFoundry() { while (count--) delete styles[count]; @@ -314,7 +314,7 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &st } } if (!create) - return 0; + return nullptr; // qDebug("adding key (weight=%d, style=%d, oblique=%d stretch=%d) at %d", key.weight, key.style, key.oblique, key.stretch, pos); if (!(count % 8)) { @@ -345,7 +345,7 @@ struct QtFontFamily : populated(false), fixedPitch(false), - name(n), count(0), foundries(0) + name(n), count(0), foundries(nullptr) { memset(writingSystems, 0, sizeof(writingSystems)); } @@ -381,7 +381,7 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) return foundries[i]; } if (!create) - return 0; + return nullptr; if (!(count % 8)) { QtFontFoundry **newFoundries = (QtFontFoundry **) @@ -450,7 +450,7 @@ class QFontDatabasePrivate { public: QFontDatabasePrivate() - : count(0), families(0), + : count(0), families(nullptr), fallbacksCache(64) { } @@ -469,7 +469,7 @@ public: while (count--) delete families[count]; ::free(families); - families = 0; + families = nullptr; count = 0; // don't clear the memory fonts! } @@ -505,7 +505,7 @@ void QFontDatabasePrivate::invalidate() QtFontFamily *QFontDatabasePrivate::family(const QString &f, FamilyRequestFlags flags) { - QtFontFamily *fam = 0; + QtFontFamily *fam = nullptr; int low = 0; int high = count; @@ -645,7 +645,7 @@ static void parseFontName(const QString &name, QString &foundry, QString &family struct QtFontDesc { - inline QtFontDesc() : family(0), foundry(0), style(0), size(0) {} + inline QtFontDesc() : family(nullptr), foundry(nullptr), style(nullptr), size(nullptr) {} QtFontFamily *family; QtFontFoundry *foundry; QtFontStyle *style; @@ -949,7 +949,7 @@ QFontEngine *loadSingleEngine(int script, if (Q_UNLIKELY(!engine->supportsScript(QChar::Script(script)))) { qWarning(" OpenType support missing for \"%s\", script %d", qPrintable(def.family), script); - return 0; + return nullptr; } engine->isSmoothlyScalable = style->smoothScalable; @@ -976,7 +976,7 @@ QFontEngine *loadSingleEngine(int script, + qPrintable(def.family), script); if (engine->ref.loadRelaxed() == 0) delete engine; - return 0; + return nullptr; } engine->isSmoothlyScalable = style->smoothScalable; @@ -1081,9 +1081,9 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, Q_UNUSED(script); Q_UNUSED(pitch); - desc->foundry = 0; - desc->style = 0; - desc->size = 0; + desc->foundry = nullptr; + desc->style = nullptr; + desc->size = nullptr; qCDebug(lcFontMatch, " REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count); @@ -1104,7 +1104,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, } int px = -1; - QtFontSize *size = 0; + QtFontSize *size = nullptr; // 1. see if we have an exact matching size if (!(styleStrategy & QFont::ForceOutline)) { @@ -1244,10 +1244,10 @@ static int match(int script, const QFontDef &request, foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch); - desc->family = 0; - desc->foundry = 0; - desc->style = 0; - desc->size = 0; + desc->family = nullptr; + desc->foundry = nullptr; + desc->style = nullptr; + desc->size = nullptr; unsigned int score = ~0u; @@ -1280,7 +1280,7 @@ static int match(int script, const QFontDef &request, bestFoundry(script, score, request.styleStrategy, test.family, foundry_name, styleKey, request.pixelSize, pitch, &test, request.styleName); - if (test.foundry == 0 && !foundry_name.isEmpty()) { + if (test.foundry == nullptr && !foundry_name.isEmpty()) { // the specific foundry was not found, so look for // any foundry matching our requirements newscore = bestFoundry(script, score, request.styleStrategy, test.family, @@ -2068,7 +2068,7 @@ bool QFontDatabase::isPrivateFamily(const QString &family) const */ QString QFontDatabase::writingSystemName(WritingSystem writingSystem) { - const char *name = 0; + const char *name = nullptr; switch (writingSystem) { case Any: name = QT_TRANSLATE_NOOP("QFontDatabase", "Any"); @@ -2548,7 +2548,7 @@ QStringList QFontDatabase::applicationFontFamilies(int id) QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type) { - const QFont *font = 0; + const QFont *font = nullptr; if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { switch (type) { case GeneralFont: @@ -2825,7 +2825,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (fe->type() == QFontEngine::Box && !req.families.at(0).isEmpty()) { if (fe->ref.loadRelaxed() == 0) delete fe; - fe = 0; + fe = nullptr; } else { if (d->dpi > 0) fe->fontDef.pointSize = qreal(double((fe->fontDef.pixelSize * 72) / d->dpi)); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 1668fac5a3..3ca9e9bbde 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -221,7 +221,7 @@ static bool qt_get_font_table_default(void *user_data, uint tag, uchar *buffer, #ifdef QT_BUILD_INTERNAL // for testing purpose only, not thread-safe! -static QList *enginesCollector = 0; +static QList *enginesCollector = nullptr; Q_AUTOTEST_EXPORT void QFontEngine_startCollectingEngines() { @@ -234,7 +234,7 @@ Q_AUTOTEST_EXPORT QList QFontEngine_stopCollectingEngines() Q_ASSERT(enginesCollector); QList ret = *enginesCollector; delete enginesCollector; - enginesCollector = 0; + enginesCollector = nullptr; return ret; } #endif // QT_BUILD_INTERNAL @@ -569,9 +569,9 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) { glyph_metrics_t gi = boundingBox(glyph); - if (leftBearing != 0) + if (leftBearing != nullptr) *leftBearing = gi.leftBearing().toReal(); - if (rightBearing != 0) + if (rightBearing != nullptr) *rightBearing = gi.rightBearing().toReal(); } @@ -1022,7 +1022,7 @@ QByteArray QFontEngine::getSfntTable(uint tag) const { QByteArray table; uint len = 0; - if (!getSfntTableData(tag, 0, &len)) + if (!getSfntTableData(tag, nullptr, &len)) return table; table.resize(len); if (!getSfntTableData(tag, reinterpret_cast(table.data()), &len)) @@ -1231,11 +1231,11 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy // version check quint16 version; if (!qSafeFromBigEndian(header, endPtr, &version) || version != 0) - return 0; + return nullptr; quint16 numTables; if (!qSafeFromBigEndian(header + 2, endPtr, &numTables)) - return 0; + return nullptr; const uchar *maps = table + 4; @@ -1255,11 +1255,11 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy for (int n = 0; n < numTables; ++n) { quint16 platformId; if (!qSafeFromBigEndian(maps + 8 * n, endPtr, &platformId)) - return 0; + return nullptr; quint16 platformSpecificId = 0; if (!qSafeFromBigEndian(maps + 8 * n + 2, endPtr, &platformSpecificId)) - return 0; + return nullptr; switch (platformId) { case 0: // Unicode @@ -1309,38 +1309,38 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy } } if(tableToUse < 0) - return 0; + return nullptr; resolveTable: *isSymbolFont = (symbolTable > -1); quint32 unicode_table = 0; if (!qSafeFromBigEndian(maps + 8 * tableToUse + 4, endPtr, &unicode_table)) - return 0; + return nullptr; if (!unicode_table) - return 0; + return nullptr; // get the header of the unicode table header = table + unicode_table; quint16 format; if (!qSafeFromBigEndian(header, endPtr, &format)) - return 0; + return nullptr; quint32 length; if (format < 8) { quint16 tmp; if (!qSafeFromBigEndian(header + 2, endPtr, &tmp)) - return 0; + return nullptr; length = tmp; } else { if (!qSafeFromBigEndian(header + 4, endPtr, &length)) - return 0; + return nullptr; } if (table + unicode_table + length > endPtr) - return 0; + return nullptr; *cmapSize = length; // To support symbol fonts that contain a unicode table for the symbol area @@ -1844,7 +1844,7 @@ QFontEngine *QFontEngineMulti::loadEngine(int at) return engine; } - return 0; + return nullptr; } glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const @@ -1865,7 +1865,7 @@ glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const const_cast(this)->ensureEngineAt(x); engine = m_engines.at(x); } - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == Box) continue; @@ -1934,7 +1934,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, if (!engine) continue; } - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == Box) continue; @@ -2308,7 +2308,7 @@ QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosit */ QFontEngine *QFontEngineMulti::createMultiFontEngine(QFontEngine *fe, int script) { - QFontEngine *engine = 0; + QFontEngine *engine = nullptr; QFontCache::Key key(fe->fontDef, script, /*multi = */true); QFontCache *fc = QFontCache::instance(); // We can't rely on the fontDef (and hence the cache Key) diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp index 409176d41b..d22239c040 100644 --- a/src/gui/text/qfontengine_qpf2.cpp +++ b/src/gui/text/qfontengine_qpf2.cpp @@ -151,17 +151,17 @@ static inline const uchar *verifyTag(const uchar *tagPtr, const uchar *endPtr) const QFontEngineQPF2::Glyph *QFontEngineQPF2::findGlyph(glyph_t g) const { if (!g || g >= glyphMapEntries) - return 0; + return nullptr; const quint32 *gmapPtr = reinterpret_cast(fontData + glyphMapOffset); quint32 glyphPos = qFromBigEndian(gmapPtr[g]); if (glyphPos > glyphDataSize) { if (glyphPos == 0xffffffff) - return 0; + return nullptr; #if defined(DEBUG_FONTENGINE) qDebug() << "glyph" << g << "outside of glyphData, remapping font file"; #endif if (glyphPos > glyphDataSize) - return 0; + return nullptr; } return reinterpret_cast(fontData + glyphDataOffset + glyphPos); } @@ -230,7 +230,7 @@ QFontEngineQPF2::QFontEngineQPF2(const QFontDef &def, const QByteArray &data) { fontDef = def; cache_cost = 100; - cmap = 0; + cmap = nullptr; cmapOffset = 0; cmapSize = 0; glyphMapOffset = 0; diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 906047cdb4..a79957797d 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -282,7 +282,7 @@ bool QFontMetrics::operator ==(const QFontMetrics &other) const int QFontMetrics::ascent() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->ascent()); } @@ -301,7 +301,7 @@ int QFontMetrics::ascent() const int QFontMetrics::capHeight() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->capHeight()); } @@ -318,7 +318,7 @@ int QFontMetrics::capHeight() const int QFontMetrics::descent() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->descent()); } @@ -332,7 +332,7 @@ int QFontMetrics::descent() const int QFontMetrics::height() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->ascent()) + qRound(engine->descent()); } @@ -346,7 +346,7 @@ int QFontMetrics::height() const int QFontMetrics::leading() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->leading()); } @@ -360,7 +360,7 @@ int QFontMetrics::leading() const int QFontMetrics::lineSpacing() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->leading()) + qRound(engine->ascent()) + qRound(engine->descent()); } @@ -377,7 +377,7 @@ int QFontMetrics::lineSpacing() const int QFontMetrics::minLeftBearing() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->minLeftBearing()); } @@ -394,7 +394,7 @@ int QFontMetrics::minLeftBearing() const int QFontMetrics::minRightBearing() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->minRightBearing()); } @@ -404,7 +404,7 @@ int QFontMetrics::minRightBearing() const int QFontMetrics::maxWidth() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->maxCharWidth()); } @@ -415,7 +415,7 @@ int QFontMetrics::maxWidth() const int QFontMetrics::xHeight() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (d->capital == QFont::SmallCaps) return qRound(d->smallCapsFontPrivate()->engineForScript(QChar::Script_Common)->ascent()); return qRound(engine->xHeight()); @@ -429,7 +429,7 @@ int QFontMetrics::xHeight() const int QFontMetrics::averageCharWidth() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->averageCharWidth()); } @@ -450,7 +450,7 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const { const int script = QChar::script(ucs4); QFontEngine *engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == QFontEngine::Box) return false; return engine->canRender(ucs4); @@ -476,7 +476,7 @@ int QFontMetrics::leftBearing(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == QFontEngine::Box) return 0; @@ -509,7 +509,7 @@ int QFontMetrics::rightBearing(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == QFontEngine::Box) return 0; @@ -518,7 +518,7 @@ int QFontMetrics::rightBearing(QChar ch) const glyph_t glyph = engine->glyphIndex(ch.unicode()); qreal rb; - engine->getGlyphBearings(glyph, 0, &rb); + engine->getGlyphBearings(glyph, nullptr, &rb); return qRound(rb); } @@ -673,7 +673,7 @@ int QFontMetrics::horizontalAdvance(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); d->alterCharForCapitalization(ch); @@ -725,7 +725,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); d->alterCharForCapitalization(ch); @@ -800,7 +800,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); d->alterCharForCapitalization(ch); @@ -877,7 +877,7 @@ QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &te QRectF rb; QRectF rr(rect); qt_format_text(QFont(d.data()), rr, flags | Qt::TextDontPrint, text, &rb, tabStops, tabArray, - tabArrayLen, 0); + tabArrayLen, nullptr); return rb.toAlignedRect(); } @@ -994,7 +994,7 @@ QString QFontMetrics::elidedText(const QString &text, Qt::TextElideMode mode, in int QFontMetrics::underlinePos() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->underlinePosition()); } @@ -1030,7 +1030,7 @@ int QFontMetrics::strikeOutPos() const int QFontMetrics::lineWidth() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return qRound(engine->lineThickness()); } @@ -1248,7 +1248,7 @@ bool QFontMetricsF::operator ==(const QFontMetricsF &other) const qreal QFontMetricsF::ascent() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->ascent().toReal(); } @@ -1267,7 +1267,7 @@ qreal QFontMetricsF::ascent() const qreal QFontMetricsF::capHeight() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->capHeight().toReal(); } @@ -1285,7 +1285,7 @@ qreal QFontMetricsF::capHeight() const qreal QFontMetricsF::descent() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->descent().toReal(); } @@ -1299,7 +1299,7 @@ qreal QFontMetricsF::descent() const qreal QFontMetricsF::height() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return (engine->ascent() + engine->descent()).toReal(); } @@ -1314,7 +1314,7 @@ qreal QFontMetricsF::height() const qreal QFontMetricsF::leading() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->leading().toReal(); } @@ -1328,7 +1328,7 @@ qreal QFontMetricsF::leading() const qreal QFontMetricsF::lineSpacing() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return (engine->leading() + engine->ascent() + engine->descent()).toReal(); } @@ -1345,7 +1345,7 @@ qreal QFontMetricsF::lineSpacing() const qreal QFontMetricsF::minLeftBearing() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->minLeftBearing(); } @@ -1362,7 +1362,7 @@ qreal QFontMetricsF::minLeftBearing() const qreal QFontMetricsF::minRightBearing() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->minRightBearing(); } @@ -1372,7 +1372,7 @@ qreal QFontMetricsF::minRightBearing() const qreal QFontMetricsF::maxWidth() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->maxCharWidth(); } @@ -1383,7 +1383,7 @@ qreal QFontMetricsF::maxWidth() const qreal QFontMetricsF::xHeight() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (d->capital == QFont::SmallCaps) return d->smallCapsFontPrivate()->engineForScript(QChar::Script_Common)->ascent().toReal(); return engine->xHeight().toReal(); @@ -1397,7 +1397,7 @@ qreal QFontMetricsF::xHeight() const qreal QFontMetricsF::averageCharWidth() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->averageCharWidth().toReal(); } @@ -1420,7 +1420,7 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const { const int script = QChar::script(ucs4); QFontEngine *engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == QFontEngine::Box) return false; return engine->canRender(ucs4); @@ -1446,7 +1446,7 @@ qreal QFontMetricsF::leftBearing(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == QFontEngine::Box) return 0; @@ -1479,7 +1479,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); if (engine->type() == QFontEngine::Box) return 0; @@ -1488,7 +1488,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const glyph_t glyph = engine->glyphIndex(ch.unicode()); qreal rb; - engine->getGlyphBearings(glyph, 0, &rb); + engine->getGlyphBearings(glyph, nullptr, &rb); return rb; } @@ -1608,7 +1608,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); d->alterCharForCapitalization(ch); @@ -1679,7 +1679,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const engine = d->smallCapsFontPrivate()->engineForScript(script); else engine = d->engineForScript(script); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); d->alterCharForCapitalization(ch); @@ -1758,7 +1758,7 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString& QRectF rb; qt_format_text(QFont(d.data()), rect, flags | Qt::TextDontPrint, text, &rb, tabStops, tabArray, - tabArrayLen, 0); + tabArrayLen, nullptr); return rb; } @@ -1877,7 +1877,7 @@ QString QFontMetricsF::elidedText(const QString &text, Qt::TextElideMode mode, q qreal QFontMetricsF::underlinePos() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->underlinePosition().toReal(); } @@ -1912,7 +1912,7 @@ qreal QFontMetricsF::strikeOutPos() const qreal QFontMetricsF::lineWidth() const { QFontEngine *engine = d->engineForScript(QChar::Script_Common); - Q_ASSERT(engine != 0); + Q_ASSERT(engine != nullptr); return engine->lineThickness().toReal(); } diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 90322b24da..02e25bb6af 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -368,7 +368,7 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal Q_UNUSED(pixelSize); Q_UNUSED(hintingPreference); qWarning("This plugin does not support font engines created directly from font data"); - return 0; + return nullptr; } /*! diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index e04c8909f3..884525bd76 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -750,7 +750,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ int script = qt_script_for_writing_system(writingSystem); QFontEngine *fe = font_d->engineForScript(script); - if (fe != 0 && fe->type() == QFontEngine::Multi) { + if (fe != nullptr && fe->type() == QFontEngine::Multi) { QFontEngineMulti *multiEngine = static_cast(fe); fe = multiEngine->engine(0); @@ -770,7 +770,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ Q_ASSERT(fe); } - if (fe != 0) { + if (fe != nullptr) { rawFont.d.data()->setFontEngine(fe); rawFont.d.data()->hintingPreference = font.hintingPreference(); } @@ -795,7 +795,7 @@ void QRawFont::setPixelSize(qreal pixelSize) void QRawFontPrivate::loadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { - Q_ASSERT(fontEngine == 0); + Q_ASSERT(fontEngine == nullptr); QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); setFontEngine(pfdb->fontEngine(fontData, pixelSize, hintingPreference)); diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 490e0b6b8f..e588b44efd 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -403,7 +403,7 @@ QSizeF QStaticText::size() const } QStaticTextPrivate::QStaticTextPrivate() - : textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0), + : textWidth(-1.0), items(nullptr), itemCount(0), glyphPool(nullptr), positionPool(nullptr), needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText), untransformedCoordinates(false) { @@ -411,7 +411,7 @@ QStaticTextPrivate::QStaticTextPrivate() QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other) : text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix), - items(0), itemCount(0), glyphPool(0), positionPool(0), textOption(other.textOption), + items(nullptr), itemCount(0), glyphPool(nullptr), positionPool(nullptr), textOption(other.textOption), needsRelayout(true), useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat), untransformedCoordinates(other.untransformedCoordinates) { diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index cf584f6980..c345e89a21 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -321,7 +321,7 @@ QSyntaxHighlighter::QSyntaxHighlighter(QTextDocument *parent) */ QSyntaxHighlighter::~QSyntaxHighlighter() { - setDocument(0); + setDocument(nullptr); } /*! @@ -601,7 +601,7 @@ QTextBlockUserData *QSyntaxHighlighter::currentBlockUserData() const { Q_D(const QSyntaxHighlighter); if (!d->currentBlock.isValid()) - return 0; + return nullptr; return d->currentBlock.userData(); } diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index c88497840f..b69b94d4e7 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -371,7 +371,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor int newPosition = position; - if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != 0) { + if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != nullptr) { if ((op >= QTextCursor::EndOfLine && op <= QTextCursor::NextWord) || (op >= QTextCursor::Right && op <= QTextCursor::WordRight)) { QTextTable *t = qobject_cast(priv->frameAt(position)); @@ -671,7 +671,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor QTextTable *QTextCursorPrivate::complexSelectionTable() const { if (position == anchor) - return 0; + return nullptr; QTextTable *t = qobject_cast(priv->frameAt(position)); if (t) { @@ -681,7 +681,7 @@ QTextTable *QTextCursorPrivate::complexSelectionTable() const Q_ASSERT(cell_anchor.isValid()); if (cell_pos == cell_anchor) - t = 0; + t = nullptr; } return t; } @@ -1044,7 +1044,7 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{ Constructs a null cursor. */ QTextCursor::QTextCursor() - : d(0) + : d(nullptr) { } @@ -1623,7 +1623,7 @@ bool QTextCursor::hasComplexSelection() const if (!d) return false; - return d->complexSelectionTable() != 0; + return d->complexSelectionTable() != nullptr; } /*! @@ -2111,7 +2111,7 @@ QTextList *QTextCursor::insertList(QTextListFormat::Style style) QTextList *QTextCursor::createList(const QTextListFormat &format) { if (!d || !d->priv) - return 0; + return nullptr; QTextList *list = static_cast(d->priv->createObject(format)); QTextBlockFormat modifier; @@ -2146,7 +2146,7 @@ QTextList *QTextCursor::createList(QTextListFormat::Style style) QTextList *QTextCursor::currentList() const { if (!d || !d->priv) - return 0; + return nullptr; QTextBlockFormat b = blockFormat(); QTextObject *o = d->priv->objectForFormat(b); @@ -2186,7 +2186,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols) QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat &format) { if(!d || !d->priv || rows == 0 || cols == 0) - return 0; + return nullptr; int pos = d->position; QTextTable *t = QTextTablePrivate::createTable(d->priv, d->position, rows, cols, format); @@ -2206,7 +2206,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat QTextTable *QTextCursor::currentTable() const { if(!d || !d->priv) - return 0; + return nullptr; QTextFrame *frame = d->priv->frameAt(d->position); while (frame) { @@ -2215,7 +2215,7 @@ QTextTable *QTextCursor::currentTable() const return table; frame = frame->parentFrame(); } - return 0; + return nullptr; } /*! @@ -2230,7 +2230,7 @@ QTextTable *QTextCursor::currentTable() const QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format) { if (!d || !d->priv) - return 0; + return nullptr; return d->priv->insertFrame(selectionStart(), selectionEnd(), format); } @@ -2243,7 +2243,7 @@ QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format) QTextFrame *QTextCursor::currentFrame() const { if(!d || !d->priv) - return 0; + return nullptr; return d->priv->frameAt(d->position); } @@ -2603,7 +2603,7 @@ QTextDocument *QTextCursor::document() const { if (d->priv) return d->priv->document(); - return 0; // document went away + return nullptr; // document went away } QT_END_NAMESPACE diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index e94f635651..3382ec0b69 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1666,7 +1666,7 @@ QTextCursor QTextDocument::find(const QRegularExpression &expr, const QTextCurso */ QTextObject *QTextDocument::createObject(const QTextFormat &f) { - QTextObject *obj = 0; + QTextObject *obj = nullptr; if (f.isListFormat()) obj = new QTextList(this); else if (f.isTableFormat()) @@ -2408,7 +2408,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format) sizeof("small") + sizeof("medium") + 1, // "x-large" )> compressed into "xx-large" sizeof("small") + sizeof("medium"), // "xx-large" ) }; - const char *name = 0; + const char *name = nullptr; const int idx = format.intProperty(QTextFormat::FontSizeAdjustment) + 1; if (idx >= 0 && idx <= 4) { name = sizeNameData + sizeNameOffsets[idx]; @@ -3256,7 +3256,7 @@ void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt) QTextFrame::Iterator next = frameIt; ++next; if (next.atEnd() - && frameIt.currentFrame() == 0 + && frameIt.currentFrame() == nullptr && frameIt.parentFrame() != doc->rootFrame() && frameIt.currentBlock().begin().atEnd()) return; diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 2f02f62a57..524931ebde 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -185,7 +185,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() docChangeOldLength(0), docChangeLength(0), framesDirty(true), - rtFrame(0), + rtFrame(nullptr), initialBlockCharFormatIndex(-1) // set correctly later in init() { editBlock = 0; @@ -195,7 +195,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() undoState = 0; revision = -1; // init() inserts a block, bringing it to 0 - lout = 0; + lout = nullptr; modified = false; modifiedState = 0; @@ -272,7 +272,7 @@ void QTextDocumentPrivate::clear() blocks.clear(); cachedResources.clear(); delete rtFrame; - rtFrame = 0; + rtFrame = nullptr; init(); cursors = oldCursors; { @@ -290,7 +290,7 @@ void QTextDocumentPrivate::clear() QTextDocumentPrivate::~QTextDocumentPrivate() { for (QTextCursorPrivate *curs : qAsConst(cursors)) - curs->priv = 0; + curs->priv = nullptr; cursors.clear(); undoState = 0; undoEnabled = true; @@ -643,7 +643,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O // qDebug("remove_block at %d", key); Q_ASSERT(X->size_array[0] == 1 && isValidBlockSeparator(text.at(X->stringPosition))); b = blocks.previous(b); - B = 0; + B = nullptr; c.command = blocks.size(b) == 1 ? QTextUndoCommand::BlockDeleted : QTextUndoCommand::BlockRemoved; w = remove_block(key, &c.blockFormat, QTextUndoCommand::BlockAdded, op); @@ -1437,7 +1437,7 @@ static QTextFrame *findChildFrame(QTextFrame *f, int pos) else return c; } - return 0; + return nullptr; } QTextFrame *QTextDocumentPrivate::rootFrame() const @@ -1467,7 +1467,7 @@ void QTextDocumentPrivate::clearFrame(QTextFrame *f) for (int i = 0; i < f->d_func()->childFrames.count(); ++i) clearFrame(f->d_func()->childFrames.at(i)); f->d_func()->childFrames.clear(); - f->d_func()->parentFrame = 0; + f->d_func()->parentFrame = nullptr; } void QTextDocumentPrivate::scan_frames(int pos, int charsRemoved, int charsAdded) @@ -1551,7 +1551,7 @@ QTextFrame *QTextDocumentPrivate::insertFrame(int start, int end, const QTextFra Q_ASSERT(start <= end || end == -1); if (start != end && frameAt(start) != frameAt(end)) - return 0; + return nullptr; beginEditBlock(); @@ -1599,7 +1599,7 @@ void QTextDocumentPrivate::removeFrame(QTextFrame *frame) QTextObject *QTextDocumentPrivate::objectForIndex(int objectIndex) const { if (objectIndex < 0) - return 0; + return nullptr; QTextObject *object = objects.value(objectIndex, 0); if (!object) { diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 742c56382d..d7bc707491 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -277,7 +277,7 @@ void QTextDocumentFragmentPrivate::insert(QTextCursor &_cursor) const \sa isEmpty() */ QTextDocumentFragment::QTextDocumentFragment() - : d(0) + : d(nullptr) { } @@ -287,7 +287,7 @@ QTextDocumentFragment::QTextDocumentFragment() like the document's title. */ QTextDocumentFragment::QTextDocumentFragment(const QTextDocument *document) - : d(0) + : d(nullptr) { if (!document) return; @@ -304,7 +304,7 @@ QTextDocumentFragment::QTextDocumentFragment(const QTextDocument *document) \sa isEmpty(), QTextCursor::selection() */ QTextDocumentFragment::QTextDocumentFragment(const QTextCursor &cursor) - : d(0) + : d(nullptr) { if (!cursor.hasSelection()) return; @@ -678,7 +678,7 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processSpecialNodes() if (n->parent) n = &at(n->parent); else - n = 0; + n = nullptr; } } @@ -793,7 +793,7 @@ bool QTextHtmlImporter::closeTag() bool blockTagClosed = false; while (depth > endDepth) { - Table *t = 0; + Table *t = nullptr; if (!tables.isEmpty()) t = &tables.last(); @@ -816,7 +816,7 @@ bool QTextHtmlImporter::closeTag() indent = t->lastIndent; tables.resize(tables.size() - 1); - t = 0; + t = nullptr; if (tables.isEmpty()) { cursor = doc->rootFrame()->lastCursorPosition(); @@ -1123,7 +1123,7 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processBlockNode() // for list items we may want to collapse with the bottom margin of the // list. - const QTextHtmlParserNode *parentNode = currentNode->parent ? &at(currentNode->parent) : 0; + const QTextHtmlParserNode *parentNode = currentNode->parent ? &at(currentNode->parent) : nullptr; if ((currentNode->id == Html_li || currentNode->id == Html_dt || currentNode->id == Html_dd) && parentNode && (parentNode->isListStart() || parentNode->id == Html_dl) @@ -1270,7 +1270,7 @@ void QTextHtmlImporter::appendBlock(const QTextBlockFormat &format, QTextCharFor QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &html) { - return fromHtml(html, 0); + return fromHtml(html, nullptr); } /*! diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index ed23a4d8d9..e21a8d8d52 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -111,7 +111,7 @@ public: QTextFrameData::QTextFrameData() : maximumWidth(QFIXED_MAX), - currentLayoutStruct(0), sizeDirty(true), layoutDirty(true) + currentLayoutStruct(nullptr), sizeDirty(true), layoutDirty(true) { } @@ -571,7 +571,7 @@ public: void setCellPosition(QTextTable *t, const QTextTableCell &cell, const QPointF &pos); QRectF layoutTable(QTextTable *t, int layoutFrom, int layoutTo, QFixed parentY); - void positionFloat(QTextFrame *frame, QTextLine *currentLine = 0); + void positionFloat(QTextFrame *frame, QTextLine *currentLine = nullptr); // calls the next one QRectF layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed parentY = 0); @@ -1554,7 +1554,7 @@ static inline double prioritizedEdgeAnchorOffset(const QTextDocumentLayoutPrivat competingCell = adjacentCell(table, cell, orthogonalEdge); if (competingCell.isValid()) { checkJoinedEdge(table, td, competingCell, edgeData.edge, edgeData, couldHaveContinuation, - &maxCompetingEdgeData, 0); + &maxCompetingEdgeData, nullptr); } } @@ -1946,7 +1946,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint QTextFrame::Iterator it, const QList &floats, QTextBlock *cursorBlockNeedingRepaint) const { Q_Q(const QTextDocumentLayout); - const bool inRootFrame = (!it.atEnd() && it.parentFrame() && it.parentFrame()->parentFrame() == 0); + const bool inRootFrame = (!it.atEnd() && it.parentFrame() && it.parentFrame()->parentFrame() == nullptr); QVector::ConstIterator lastVisibleCheckPoint = checkPoints.end(); if (inRootFrame && context.clip.isValid()) { @@ -1954,7 +1954,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint } QTextBlock previousBlock; - QTextFrame *previousFrame = 0; + QTextFrame *previousFrame = nullptr; for (; !it.atEnd(); ++it) { QTextFrame *c = it.currentFrame(); @@ -2050,7 +2050,7 @@ void QTextDocumentLayoutPrivate::drawBlock(const QPointF &offset, QPainter *pain QVector selections; int blpos = bl.position(); int bllen = bl.length(); - const QTextCharFormat *selFormat = 0; + const QTextCharFormat *selFormat = nullptr; for (int i = 0; i < context.selections.size(); ++i) { const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i); const int selStart = range.cursor.selectionStart() - blpos; @@ -2920,7 +2920,7 @@ QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, in QTextFrameFormat fformat = f->frameFormat(); QTextFrame *parent = f->parentFrame(); - const QTextFrameData *pd = parent ? data(parent) : 0; + const QTextFrameData *pd = parent ? data(parent) : nullptr; const qreal maximumWidth = qMax(qreal(0), pd ? pd->contentsWidth.toReal() : document->pageSize().width()); QFixed width = QFixed::fromReal(fformat.width().value(maximumWidth)); @@ -2971,7 +2971,7 @@ QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, in } QTextFrame *parent = f->parentFrame(); - const QTextFrameData *pd = parent ? data(parent) : 0; + const QTextFrameData *pd = parent ? data(parent) : nullptr; // accumulate top and bottom margins if (parent) { @@ -3296,7 +3296,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout const QFixed origMaximumWidth = layoutStruct->maximumWidth; layoutStruct->maximumWidth = 0; - const QTextBlockFormat *previousBlockFormatPtr = 0; + const QTextBlockFormat *previousBlockFormatPtr = nullptr; if (lastIt.currentBlock().isValid()) previousBlockFormatPtr = &previousBlockFormat; @@ -3405,7 +3405,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout } - fd->currentLayoutStruct = 0; + fd->currentLayoutStruct = nullptr; } static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, const QTextLine &line, qreal scaling, @@ -3865,7 +3865,7 @@ int QTextDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accur d->ensureLayouted(QFixed::fromReal(point.y())); QTextFrame *f = d->docPrivate->rootFrame(); int position = 0; - QTextLayout *l = 0; + QTextLayout *l = nullptr; QFixedPoint pointf; pointf.x = QFixed::fromReal(point.x()); pointf.y = QFixed::fromReal(point.y()); @@ -3944,7 +3944,7 @@ void QTextDocumentLayout::positionInlineObject(QTextInlineObject item, int posIn line = b.layout()->lineAt(b.layout()->lineCount()-1); // qDebug() << "layoutObject: line.isValid" << line.isValid() << b.position() << b.length() << // frame->firstPosition() << frame->lastPosition(); - d->positionFloat(frame, line.isValid() ? &line : 0); + d->positionFloat(frame, line.isValid() ? &line : nullptr); } void QTextDocumentLayout::drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item, diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp index 193d2c0dd3..0bafa5d9ff 100644 --- a/src/gui/text/qtextdocumentwriter.cpp +++ b/src/gui/text/qtextdocumentwriter.cpp @@ -107,7 +107,7 @@ public: \internal */ QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq) - : device(0), + : device(nullptr), deleteDevice(false), #if QT_CONFIG(textcodec) codec(QTextCodec::codecForName("utf-8")), @@ -320,7 +320,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document) */ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment) { - if (fragment.d == 0) + if (fragment.d == nullptr) return false; // invalid fragment. QTextDocument *doc = fragment.d->doc; if (doc) @@ -337,7 +337,7 @@ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment) #if QT_CONFIG(textcodec) void QTextDocumentWriter::setCodec(QTextCodec *codec) { - if (codec == 0) + if (codec == nullptr) codec = QTextCodec::codecForName("UTF-8"); Q_ASSERT(codec); d->codec = codec; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 8a91b34b7a..0024f070ea 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -72,7 +72,7 @@ public: : m_string(string), m_analysis(analysis), m_items(items), - m_splitter(0) + m_splitter(nullptr) { } ~Itemizer() @@ -138,7 +138,7 @@ private: if (!m_splitter) m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word, m_string.constData(), m_string.length(), - /*buffer*/0, /*buffer size*/0); + /*buffer*/nullptr, /*buffer size*/0); m_splitter->setPosition(start); QScriptAnalysis itemAnalysis = m_analysis[start]; @@ -1680,8 +1680,8 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, QGlyphLayout g = availableGlyphs(&si).mid(glyphs_shaped, num_glyphs); ushort *log_clusters = logClusters(&si) + item_pos; - hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, 0); - hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, 0); + hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, nullptr); + hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, nullptr); uint str_pos = 0; uint last_cluster = ~0u; uint last_glyph_pos = glyphs_shaped; @@ -1917,12 +1917,12 @@ void QTextEngine::init(QTextEngine *e) e->visualMovement = false; e->delayDecorations = false; - e->layoutData = 0; + e->layoutData = nullptr; e->minWidth = 0; e->maxWidth = 0; - e->specialData = 0; + e->specialData = nullptr; e->stackEngine = false; #ifndef QT_NO_RAWFONT e->useRawFont = false; @@ -1956,7 +1956,7 @@ const QCharAttributes *QTextEngine::attributes() const itemize(); if (! ensureSpace(layoutData->string.length())) - return NULL; + return nullptr; QVarLengthArray scriptItems(layoutData->items.size()); for (int i = 0; i < layoutData->items.size(); ++i) { @@ -2148,7 +2148,7 @@ void QTextEngine::itemize() const if (it == end || format != frag->format) { if (s && position >= s->preeditPosition) { position += s->preeditText.length(); - s = 0; + s = nullptr; } Q_ASSERT(position <= length); QFont::Capitalization capitalization = @@ -2443,8 +2443,8 @@ QTextEngine::FontEngineCache::FontEngineCache() //input is common (and hard to cache at a higher level) QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFixed *descent, QFixed *leading) const { - QFontEngine *engine = 0; - QFontEngine *scaledEngine = 0; + QFontEngine *engine = nullptr; + QFontEngine *scaledEngine = nullptr; int script = si.analysis.script; QFont font = fnt; @@ -2459,7 +2459,7 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix engine->ref.ref(); if (feCache.prevScaledFontEngine) { releaseCachedFontEngine(feCache.prevScaledFontEngine); - feCache.prevScaledFontEngine = 0; + feCache.prevScaledFontEngine = nullptr; } } if (si.analysis.flags == QScriptAnalysis::SmallCaps) { @@ -2538,7 +2538,7 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix feCache.prevScript = script; feCache.prevPosition = -1; feCache.prevLength = -1; - feCache.prevScaledFontEngine = 0; + feCache.prevScaledFontEngine = nullptr; } } @@ -2808,14 +2808,14 @@ void QScriptLine::setDefaultHeight(QTextEngine *eng) QTextEngine::LayoutData::LayoutData() { - memory = 0; + memory = nullptr; allocated = 0; memory_on_stack = false; used = 0; hasBidi = false; layoutState = LayoutEmpty; haveCharAttributes = false; - logClustersPtr = 0; + logClustersPtr = nullptr; available_glyphs = 0; } @@ -2833,8 +2833,8 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int allocated = 0; memory_on_stack = false; - memory = 0; - logClustersPtr = 0; + memory = nullptr; + logClustersPtr = nullptr; } else { memory_on_stack = true; memory = stack_memory; @@ -2855,7 +2855,7 @@ QTextEngine::LayoutData::~LayoutData() { if (!memory_on_stack) free(memory); - memory = 0; + memory = nullptr; } bool QTextEngine::LayoutData::reallocate(int totalGlyphs) @@ -2879,7 +2879,7 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs) return false; } - void **newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *)); + void **newMem = (void **)::realloc(memory_on_stack ? nullptr : memory, newAllocated*sizeof(void *)); if (!newMem) { layoutState = LayoutFailed; return false; @@ -2928,7 +2928,7 @@ void QTextEngine::freeMemory() { if (!stackEngine) { delete layoutData; - layoutData = 0; + layoutData = nullptr; } else { layoutData->used = 0; layoutData->hasBidi = false; @@ -3035,7 +3035,7 @@ void QTextEngine::setPreeditArea(int position, const QString &preeditText) return; if (specialData->formats.isEmpty()) { delete specialData; - specialData = 0; + specialData = nullptr; } else { specialData->preeditText = QString(); specialData->preeditPosition = -1; @@ -3057,7 +3057,7 @@ void QTextEngine::setFormats(const QVector &formats) return; if (specialData->preeditText.isEmpty()) { delete specialData; - specialData = 0; + specialData = nullptr; } else { specialData->formats.clear(); } @@ -4004,7 +4004,7 @@ QTextLineItemIterator::QTextLineItemIterator(QTextEngine *_eng, int _lineNum, co const QTextLayout::FormatRange *_selection) : eng(_eng), line(eng->lines[_lineNum]), - si(0), + si(nullptr), lineNum(_lineNum), lineEnd(line.from + line.length), firstItem(eng->findItem(line.from)), diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index b867f42480..3b9f2d253e 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -463,7 +463,7 @@ static const QTextHtmlElement *lookupElementHelper(const QString &element) const QTextHtmlElement *end = &elements[Html_NumElements]; const QTextHtmlElement *e = std::lower_bound(start, end, element); if ((e == end) || (element < *e)) - return 0; + return nullptr; return e; } @@ -519,7 +519,7 @@ void QTextHtmlParser::dumpHtml() QTextHtmlParserNode *QTextHtmlParser::newNode(int parent) { QTextHtmlParserNode *lastNode = &nodes.last(); - QTextHtmlParserNode *newNode = 0; + QTextHtmlParserNode *newNode = nullptr; bool reuseLastNode = true; @@ -2123,7 +2123,7 @@ QVector QTextHtmlParser::declarationsForNode(int node) const QCss::StyleSelector::NodePtr n; n.id = node; - const char *extraPseudo = 0; + const char *extraPseudo = nullptr; if (nodes.at(node).id == Html_a && nodes.at(node).hasHref) extraPseudo = "link"; // Ensure that our own style is taken into consideration diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp index f7117bfe0a..14018f34da 100644 --- a/src/gui/text/qtextimagehandler.cpp +++ b/src/gui/text/qtextimagehandler.cpp @@ -246,7 +246,7 @@ QSizeF QTextImageHandler::intrinsicSize(QTextDocument *doc, int posInDocument, c QImage QTextImageHandler::image(QTextDocument *doc, const QTextImageFormat &imageFormat) { - Q_ASSERT(doc != 0); + Q_ASSERT(doc != nullptr); return getImage(doc, imageFormat); } diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a3e194f835..fc256d72f3 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1649,7 +1649,7 @@ namespace { struct LineBreakHelper { LineBreakHelper() - : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0), + : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(nullptr), logClusters(nullptr), manualWrap(false), whiteSpaceOrObject(true) { } @@ -1705,7 +1705,7 @@ namespace { inline void calculateRightBearing(QFontEngine *engine, glyph_t glyph) { qreal rb; - engine->getGlyphBearings(glyph, 0, &rb); + engine->getGlyphBearings(glyph, nullptr, &rb); // We only care about negative right bearings, so we limit the range // of the bearing here so that we can assume it's negative in the rest @@ -2212,7 +2212,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, int textPosition, int textLength) { - Q_ASSERT(logClusters != 0); + Q_ASSERT(logClusters != nullptr); QGlyphRun glyphRun; @@ -2593,7 +2593,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR } else { // si.isTab QFont f = eng->font(si); QTextItemInt gf(si, &f, format); - gf.chars = 0; + gf.chars = nullptr; gf.num_chars = 0; gf.width = iterator.itemWidth; QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng); diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index b845889c3d..77dcae0dc8 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -596,7 +596,7 @@ void QTextFramePrivate::remove_me() parentFrame->d_func()->childFrames.removeAt(index); childFrames.clear(); - parentFrame = 0; + parentFrame = nullptr; } /*! @@ -654,10 +654,10 @@ QTextFrame::iterator QTextFrame::end() const */ QTextFrame::iterator::iterator() { - f = 0; + f = nullptr; b = 0; e = 0; - cf = 0; + cf = nullptr; cb = 0; } @@ -669,7 +669,7 @@ QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end) f = frame; b = begin; e = end; - cf = 0; + cf = nullptr; cb = block; } @@ -739,7 +739,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator++() if (cf) { int end = cf->lastPosition() + 1; cb = map.findNode(end); - cf = 0; + cf = nullptr; } else if (cb) { cb = map.next(cb); if (cb == e) @@ -777,7 +777,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator--() if (cf) { int start = cf->firstPosition() - 1; cb = map.findNode(start); - cf = 0; + cf = nullptr; } else { if (cb == b) goto end; @@ -907,7 +907,7 @@ QTextBlockUserData::~QTextBlockUserData() bool QTextBlock::isValid() const { - return p != 0 && p->blockMap().isValid(n); + return p != nullptr && p->blockMap().isValid(n); } /*! @@ -1079,7 +1079,7 @@ bool QTextBlock::contains(int position) const QTextLayout *QTextBlock::layout() const { if (!p || !n) - return 0; + return nullptr; const QTextBlockData *b = p->blockMap().fragment(n); if (!b->layout) diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 0e8666565f..408e3ec167 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -70,7 +70,7 @@ static QString pixelToPoint(qreal pixels) // strategies class QOutputStrategy { public: - QOutputStrategy() : contentStream(0), counter(1) { } + QOutputStrategy() : contentStream(nullptr), counter(1) { } virtual ~QOutputStrategy() {} virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes) = 0; @@ -240,7 +240,7 @@ void QTextOdfWriter::writeFrame(QXmlStreamWriter &writer, const QTextFrame *fram } QTextFrame::iterator iterator = frame->begin(); - QTextFrame *child = 0; + QTextFrame *child = nullptr; int tableRow = -1; while (! iterator.atEnd()) { @@ -437,7 +437,7 @@ static bool probeImageData(QIODevice *device, QImage *image, QString *mimeType, void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextFragment &fragment) const { writer.writeStartElement(drawNS, QString::fromLatin1("frame")); - if (m_strategy == 0) { + if (m_strategy == nullptr) { // don't do anything. } else if (fragment.charFormat().isImageFormat()) { @@ -997,8 +997,8 @@ QTextOdfWriter::QTextOdfWriter(const QTextDocument &document, QIODevice *device) svgNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0")), m_document(&document), m_device(device), - m_strategy(0), - m_codec(0), + m_strategy(nullptr), + m_codec(nullptr), m_createArchive(true) { } @@ -1093,7 +1093,7 @@ bool QTextOdfWriter::writeAll() writer.writeEndElement(); // document-content writer.writeEndDocument(); delete m_strategy; - m_strategy = 0; + m_strategy = nullptr; return true; } diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index 2c2c05567f..2f195599f0 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -62,7 +62,7 @@ QTextOption::QTextOption() unused2(0), f(0), tab(-1), - d(0) + d(nullptr) { direction = Qt::LayoutDirectionAuto; } @@ -80,7 +80,7 @@ QTextOption::QTextOption(Qt::Alignment alignment) unused2(0), f(0), tab(-1), - d(0) + d(nullptr) { direction = QGuiApplication::layoutDirection(); } @@ -107,7 +107,7 @@ QTextOption::QTextOption(const QTextOption &o) unused2(o.unused2), f(o.f), tab(o.tab), - d(0) + d(nullptr) { if (o.d) d = new QTextOptionPrivate(*o.d); @@ -124,7 +124,7 @@ QTextOption &QTextOption::operator=(const QTextOption &o) if (this == &o) return *this; - QTextOptionPrivate* dNew = 0; + QTextOptionPrivate* dNew = nullptr; if (o.d) dNew = new QTextOptionPrivate(*o.d); delete d; diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index fc7fbcac12..80c0f122e8 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -141,8 +141,8 @@ static int inflate(Bytef *dest, ulong *destLen, const Bytef *source, ulong sourc if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; + stream.zalloc = (alloc_func)nullptr; + stream.zfree = (free_func)nullptr; err = inflateInit2(&stream, -MAX_WBITS); if (err != Z_OK) @@ -172,9 +172,9 @@ static int deflate (Bytef *dest, ulong *destLen, const Bytef *source, ulong sour stream.avail_out = (uInt)*destLen; if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; + stream.zalloc = (alloc_func)nullptr; + stream.zfree = (free_func)nullptr; + stream.opaque = (voidpf)nullptr; err = deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY); if (err != Z_OK) return err; @@ -705,7 +705,7 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const } // TODO add a check if data.length() > contents.length(). Then try to store the original and revert the compression method to be uncompressed writeUInt(header.h.compressed_size, data.length()); - uint crc_32 = ::crc32(0, 0, 0); + uint crc_32 = ::crc32(0, nullptr, 0); crc_32 = ::crc32(crc_32, (const uchar *)contents.constData(), contents.length()); writeUInt(header.h.crc_32, crc_32); @@ -886,7 +886,7 @@ bool QZipReader::isReadable() const bool QZipReader::exists() const { QFile *f = qobject_cast (d->device); - if (f == 0) + if (f == nullptr) return true; return f->exists(); } @@ -1178,7 +1178,7 @@ bool QZipWriter::isWritable() const bool QZipWriter::exists() const { QFile *f = qobject_cast (d->device); - if (f == 0) + if (f == nullptr) return true; return f->exists(); } diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 99214c4960..763f309fc7 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -287,7 +287,7 @@ void QDesktopServices::setUrlHandler(const QString &scheme, QObject *receiver, c */ void QDesktopServices::unsetUrlHandler(const QString &scheme) { - setUrlHandler(scheme, 0, 0); + setUrlHandler(scheme, nullptr, nullptr); } #if QT_DEPRECATED_SINCE(5, 0) diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp index 024f0f084e..4af5e47f8f 100644 --- a/src/gui/util/qgridlayoutengine.cpp +++ b/src/gui/util/qgridlayoutengine.cpp @@ -177,7 +177,7 @@ void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo, qreal extra = compare(box, totalBox, j); if (extra > 0.0) { calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(), - 0, totalBox, rowInfo, snapToPixelGrid); + nullptr, totalBox, rowInfo, snapToPixelGrid); for (int k = 0; k < span; ++k) extras[k].q_sizes(j) = newSizes[k]; @@ -988,7 +988,7 @@ void QGridLayoutEngine::removeItem(QGridLayoutItem *item) for (int i = item->firstRow(); i <= item->lastRow(); ++i) { for (int j = item->firstColumn(); j <= item->lastColumn(); ++j) { if (itemAt(i, j) == item) - setItemAt(i, j, 0); + setItemAt(i, j, nullptr); } } @@ -1001,7 +1001,7 @@ QGridLayoutItem *QGridLayoutEngine::itemAt(int row, int column, Qt::Orientation if (orientation == Qt::Horizontal) qSwap(row, column); if (uint(row) >= uint(rowCount()) || uint(column) >= uint(columnCount())) - return 0; + return nullptr; return q_grid.at((row * internalGridColumnCount()) + column); } @@ -1100,7 +1100,7 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint, if (constraintOrientation() == Qt::Vertical) { //We have items whose height depends on their width if (constraint.width() >= 0) { - ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo); + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo); QVector sizehint_xx; QVector sizehint_widths; @@ -1110,14 +1110,14 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint, //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as //constraints to find the row heights q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), - 0, sizehint_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); + nullptr, sizehint_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical, styleInfo); sizeHintCalculated = true; } } else { if (constraint.height() >= 0) { //We have items whose width depends on their height - ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo); QVector sizehint_yy; QVector sizehint_heights; @@ -1127,7 +1127,7 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint, //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), - 0, sizehint_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid); + nullptr, sizehint_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid); ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal, styleInfo); sizeHintCalculated = true; } @@ -1137,8 +1137,8 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint, } //No items with height for width, so it doesn't matter which order we do these in - ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo); - ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo); + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo); return QSizeF(q_totalBoxes[Hor].q_sizes(which), q_totalBoxes[Ver].q_sizes(which)); } @@ -1650,18 +1650,18 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size, if (constraintOrientation() != Qt::Horizontal) { //We might have items whose height depends on their width (HFW) - ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo); + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo); //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as //constraints to find the row heights q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); + nullptr, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], q_xx.data(), q_widths.data(), Qt::Vertical, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), q_descents.data(), q_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid); } else { //We have items whose width depends on their height (WFH) - ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), @@ -1669,7 +1669,7 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size, ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], q_yy.data(), q_heights.data(), Qt::Horizontal, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); + nullptr, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); } } diff --git a/src/gui/util/qtexturefiledata.cpp b/src/gui/util/qtexturefiledata.cpp index ebf46f8e4e..41cbd1b15a 100644 --- a/src/gui/util/qtexturefiledata.cpp +++ b/src/gui/util/qtexturefiledata.cpp @@ -247,7 +247,7 @@ void QTextureFileData::setLogName(const QByteArray &name) static QByteArray glFormatName(quint32 fmt) { - const char *id = 0; + const char *id = nullptr; #if QT_CONFIG(opengl) id = QMetaEnum::fromType().valueToKey(fmt); #endif diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp index 764cb917ad..4b961a6f20 100644 --- a/src/gui/vulkan/qvulkaninstance.cpp +++ b/src/gui/vulkan/qvulkaninstance.cpp @@ -758,7 +758,7 @@ VkSurfaceKHR QVulkanInstance::surfaceForWindow(QWindow *window) // VkSurfaceKHR is non-dispatchable and maps to a pointer on x64 and a uint64 on x86. // Therefore a pointer is returned from the platform plugin, not the value itself. void *p = nativeInterface->nativeResourceForWindow(QByteArrayLiteral("vkSurface"), window); - return p ? *static_cast(p) : 0; + return p ? *static_cast(p) : VK_NULL_HANDLE; } /*! diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index 790bef9e14..ed73a77683 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -1866,7 +1866,7 @@ void QVulkanWindowPrivate::beginFrame() // build new draw command buffer if (image.cmdBuf) { devFuncs->vkFreeCommandBuffers(dev, cmdPool, 1, &image.cmdBuf); - image.cmdBuf = 0; + image.cmdBuf = nullptr; } VkCommandBufferAllocateInfo cmdBufInfo = { diff --git a/src/network/access/qabstractprotocolhandler.cpp b/src/network/access/qabstractprotocolhandler.cpp index f15dfe6899..6847816ba7 100644 --- a/src/network/access/qabstractprotocolhandler.cpp +++ b/src/network/access/qabstractprotocolhandler.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QAbstractProtocolHandler::QAbstractProtocolHandler(QHttpNetworkConnectionChannel *channel) - : m_channel(channel), m_reply(0), m_socket(m_channel->socket), m_connection(m_channel->connection) + : m_channel(channel), m_reply(nullptr), m_socket(m_channel->socket), m_connection(m_channel->connection) { Q_ASSERT(m_channel); Q_ASSERT(m_socket); diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index cc230a5411..62ae1adbd9 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -74,7 +74,7 @@ public: CsConnectionRefused }; - QFtpDTP(QFtpPI *p, QObject *parent = 0); + QFtpDTP(QFtpPI *p, QObject *parent = nullptr); void setData(QByteArray *); void setDevice(QIODevice *); @@ -149,7 +149,7 @@ class QFtpPI : public QObject Q_OBJECT public: - QFtpPI(QObject *parent = 0); + QFtpPI(QObject *parent = nullptr); void connectToHost(const QString &host, quint16 port); @@ -229,7 +229,7 @@ class QFtpCommand { public: QFtpCommand(QFtp::Command cmd, const QStringList &raw, const QByteArray &ba); - QFtpCommand(QFtp::Command cmd, const QStringList &raw, QIODevice *dev = 0); + QFtpCommand(QFtp::Command cmd, const QStringList &raw, QIODevice *dev = nullptr); ~QFtpCommand(); int id; @@ -279,7 +279,7 @@ QFtpCommand::~QFtpCommand() *********************************************************************/ QFtpDTP::QFtpDTP(QFtpPI *p, QObject *parent) : QObject(parent), - socket(0), + socket(nullptr), listener(this), pi(p), callWriteData(false) @@ -314,7 +314,7 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port) if (socket) { delete socket; - socket = 0; + socket = nullptr; } socket = new QTcpSocket(this); #ifndef QT_NO_BEARERMANAGEMENT @@ -427,7 +427,7 @@ void QFtpDTP::writeData() } // do we continue uploading? - callWriteData = data.dev != 0; + callWriteData = data.dev != nullptr; } } @@ -779,7 +779,7 @@ void QFtpDTP::setupSocket() void QFtpDTP::clearData() { is_ba = false; - data.dev = 0; + data.dev = nullptr; } /********************************************************************** @@ -792,7 +792,7 @@ QFtpPI::QFtpPI(QObject *parent) : rawCommand(false), transferConnectionExtended(true), dtp(this), - commandSocket(0), + commandSocket(nullptr), state(Begin), abortState(None), currentCmd(QString()), waitForDtpToConnect(false), @@ -2173,10 +2173,10 @@ QFtp::Command QFtp::currentCommand() const QIODevice* QFtp::currentDevice() const { if (d_func()->pending.isEmpty()) - return 0; + return nullptr; QFtpCommand *c = d_func()->pending.first(); if (c->is_ba) - return 0; + return nullptr; return c->data.dev; } diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp index c59df9d8b8..d6fefc4314 100644 --- a/src/network/access/qhttpmultipart.cpp +++ b/src/network/access/qhttpmultipart.cpp @@ -111,7 +111,7 @@ QHttpPart::QHttpPart(const QHttpPart &other) : d(other.d) */ QHttpPart::~QHttpPart() { - d = 0; + d = nullptr; } /*! diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 21c6359807..b9a4c874c0 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -382,9 +382,9 @@ void QHttpNetworkConnectionPrivate::emitReplyError(QAbstractSocket *socket, // Clean the channel channels[i].close(); - channels[i].reply = 0; + channels[i].reply = nullptr; if (channels[i].protocolHandler) - channels[i].protocolHandler->setReply(0); + channels[i].protocolHandler->setReply(nullptr); channels[i].request = QHttpNetworkRequest(); if (socket) channels[i].requeueCurrentlyPipelinedRequests(); @@ -408,7 +408,7 @@ void QHttpNetworkConnectionPrivate::copyCredentials(int fromChannel, QAuthentica } // select another channel - QAuthenticator* otherAuth = 0; + QAuthenticator* otherAuth = nullptr; for (int i = 0; i < activeChannelCount; ++i) { if (i == fromChannel) continue; @@ -441,7 +441,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket if (authMethod != QAuthenticatorPrivate::None) { int i = indexOf(socket); //Use a single authenticator for all domains. ### change later to use domain/realm - QAuthenticator* auth = 0; + QAuthenticator* auth = nullptr; if (isProxy) { auth = &channels[i].proxyAuthenticator; channels[i].proxyAuthMethod = authMethod; @@ -496,7 +496,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket // we need to bail out if authentication is required. if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) { // Reset authenticator so the next request on that channel does not get messed up - auth = 0; + auth = nullptr; if (isProxy) channels[i].proxyAuthenticator = QAuthenticator(); else @@ -766,7 +766,7 @@ void QHttpNetworkConnectionPrivate::fillPipeline(QAbstractSocket *socket) int i = indexOf(socket); // return fast if there was no reply right now processed - if (channels[i].reply == 0) + if (channels[i].reply == nullptr) return; if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= defaultRePipelineLength)) { @@ -937,9 +937,9 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) for (int i = 0; i < activeChannelCount; ++i) { // is the reply associated the currently processing of this channel? if (channels[i].reply == reply) { - channels[i].reply = 0; + channels[i].reply = nullptr; if (channels[i].protocolHandler) - channels[i].protocolHandler->setReply(0); + channels[i].protocolHandler->setReply(nullptr); channels[i].request = QHttpNetworkRequest(); channels[i].resendCurrent = false; diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 39f392a79b..47081b29d2 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -87,11 +87,11 @@ private: static const int reconnectAttemptsDefault = 3; QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel() - : socket(0) + : socket(nullptr) , ssl(false) , isInitialized(false) , state(IdleState) - , reply(0) + , reply(nullptr) , written(0) , bytesTotal(0) , resendCurrent(false) @@ -102,13 +102,13 @@ QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel() , proxyAuthMethod(QAuthenticatorPrivate::None) , authenticationCredentialsSent(false) , proxyCredentialsSent(false) - , protocolHandler(0) + , protocolHandler(nullptr) #ifndef QT_NO_SSL , ignoreAllSslErrors(false) #endif , pipeliningSupported(PipeliningSupportUnknown) , networkLayerPreference(QAbstractSocket::AnyIPProtocol) - , connection(0) + , connection(nullptr) { // Inlining this function in the header leads to compiler error on // release-armv5, on at least timebox 9.2 and 10.1. @@ -295,9 +295,9 @@ void QHttpNetworkConnectionChannel::handleUnexpectedEOF() close(); reply->d_func()->errorString = connection->d_func()->errorDetail(QNetworkReply::RemoteHostClosedError, socket); emit reply->finishedWithError(QNetworkReply::RemoteHostClosedError, reply->d_func()->errorString); - reply = 0; + reply = nullptr; if (protocolHandler) - protocolHandler->setReply(0); + protocolHandler->setReply(nullptr); request = QHttpNetworkRequest(); QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } else { @@ -526,8 +526,8 @@ void QHttpNetworkConnectionChannel::allDone() // problem. if (!resendCurrent) { request = QHttpNetworkRequest(); - reply = 0; - protocolHandler->setReply(0); + reply = nullptr; + protocolHandler->setReply(nullptr); } // move next from pipeline to current request @@ -1100,9 +1100,9 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket if (reply) { reply->d_func()->errorString = errorString; emit reply->finishedWithError(errorCode, errorString); - reply = 0; + reply = nullptr; if (protocolHandler) - protocolHandler->setReply(0); + protocolHandler->setReply(nullptr); } } while (!connection->d_func()->highPriorityQueue.isEmpty() || !connection->d_func()->lowPriorityQueue.isEmpty()); diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index a8b635c45a..af456c3607 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -330,12 +330,12 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) currentlyUploadedDataInWindow(0), totallyUploadedData(0), removedContentLength(-1), - connection(0), + connection(nullptr), autoDecompress(false), responseData(), requestIsPrepared(false) ,pipeliningUsed(false), spdyUsed(false), downstreamLimited(false) - ,userProvidedDownloadBuffer(0) + ,userProvidedDownloadBuffer(nullptr) #ifndef QT_NO_COMPRESS - ,inflateStrm(0) + ,inflateStrm(nullptr) #endif { @@ -375,8 +375,8 @@ void QHttpNetworkReplyPrivate::clearHttpLayerInformation() // TODO: Isn't everything HTTP layer related? We don't need to set connection and connectionChannel to 0 at all void QHttpNetworkReplyPrivate::clear() { - connection = 0; - connectionChannel = 0; + connection = nullptr; + connectionChannel = nullptr; autoDecompress = false; clearHttpLayerInformation(); } diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index a3f71b8d2f..5fb8885bdf 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, QHttpNetworkRequest::Priority pri, const QUrl &newUrl) - : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0), + : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(nullptr), autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false), http2Allowed(false), http2Direct(false), withCredentials(true), preConnect(false), redirectCount(0), redirectPolicy(QNetworkRequest::ManualRedirectPolicy) diff --git a/src/network/access/qhttpprotocolhandler.cpp b/src/network/access/qhttpprotocolhandler.cpp index edcbdcbe0e..d39589fb96 100644 --- a/src/network/access/qhttpprotocolhandler.cpp +++ b/src/network/access/qhttpprotocolhandler.cpp @@ -278,7 +278,7 @@ bool QHttpProtocolHandler::sendRequest() m_reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState; m_channel->allDone(); m_connection->preConnectFinished(); // will only decrease the counter - m_reply = 0; // so we can reuse this channel + m_reply = nullptr; // so we can reuse this channel return true; // we have a working connection and are done } @@ -373,7 +373,7 @@ bool QHttpProtocolHandler::sendRequest() // premature eof happened m_connection->d_func()->emitReplyError(m_socket, m_reply, QNetworkReply::UnknownNetworkError); return false; - } else if (readPointer == 0 || currentReadSize == 0) { + } else if (readPointer == nullptr || currentReadSize == 0) { // nothing to read currently, break the loop break; } else { diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index 63a3c4f204..f3125a3a95 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -189,7 +189,7 @@ public: QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QHttpNetworkConnection::ConnectionType connectionType, QSharedPointer networkSession) - : QHttpNetworkConnection(hostName, port, encrypt, connectionType, /*parent=*/0, + : QHttpNetworkConnection(hostName, port, encrypt, connectionType, /*parent=*/nullptr, std::move(networkSession)) #endif { @@ -241,9 +241,9 @@ QHttpThreadDelegate::QHttpThreadDelegate(QObject *parent) : , removedContentLength(-1) , incomingErrorCode(QNetworkReply::NoError) , downloadBuffer() - , httpConnection(0) - , httpReply(0) - , synchronousRequestLoop(0) + , httpConnection(nullptr) + , httpReply(nullptr) + , synchronousRequestLoop(nullptr) { } @@ -439,7 +439,7 @@ void QHttpThreadDelegate::abortRequest() if (httpReply) { httpReply->abort(); delete httpReply; - httpReply = 0; + httpReply = nullptr; } // Got aborted by the timeout timer @@ -545,7 +545,7 @@ void QHttpThreadDelegate::finishedSlot() QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); - httpReply = 0; + httpReply = nullptr; } void QHttpThreadDelegate::synchronousFinishedSlot() @@ -568,7 +568,7 @@ void QHttpThreadDelegate::synchronousFinishedSlot() QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); - httpReply = 0; + httpReply = nullptr; } void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail) @@ -590,7 +590,7 @@ void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError erro QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); - httpReply = 0; + httpReply = nullptr; } @@ -609,7 +609,7 @@ void QHttpThreadDelegate::synchronousFinishedWithErrorSlot(QNetworkReply::Networ QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); - httpReply = 0; + httpReply = nullptr; } static void downloadBufferDeleter(char *ptr) diff --git a/src/network/access/qnetworkaccessauthenticationmanager.cpp b/src/network/access/qnetworkaccessauthenticationmanager.cpp index b661cc45b3..0df11684b1 100644 --- a/src/network/access/qnetworkaccessauthenticationmanager.cpp +++ b/src/network/access/qnetworkaccessauthenticationmanager.cpp @@ -71,7 +71,7 @@ public: if (it == end() && !isEmpty()) --it; if (it == end() || !domain.startsWith(it->domain)) - return 0; + return nullptr; return &*it; } diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 566e410051..8f42f3690b 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -105,7 +105,7 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM ++it; } } - return 0; + return nullptr; } QStringList QNetworkAccessManagerPrivate::backendSupportedSchemes() const @@ -131,7 +131,7 @@ QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() else if (reply->outgoingData) { uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(reply->outgoingData); } else { - return 0; + return nullptr; } // We want signal emissions only for normal asynchronous uploads @@ -151,8 +151,8 @@ void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 byt } QNetworkAccessBackend::QNetworkAccessBackend() - : manager(0) - , reply(0) + : manager(nullptr) + , reply(nullptr) , synchronous(false) { } @@ -223,7 +223,7 @@ QList QNetworkAccessBackend::proxyList() const QAbstractNetworkCache *QNetworkAccessBackend::networkCache() const { if (!manager) - return 0; + return nullptr; return manager->networkCache; } diff --git a/src/network/access/qnetworkaccesscache.cpp b/src/network/access/qnetworkaccesscache.cpp index b694a2c999..ba092f2618 100644 --- a/src/network/access/qnetworkaccesscache.cpp +++ b/src/network/access/qnetworkaccesscache.cpp @@ -73,7 +73,7 @@ struct QNetworkAccessCache::Node int useCount; Node() - : older(0), newer(0), object(0), useCount(0) + : older(nullptr), newer(nullptr), object(nullptr), useCount(0) { } }; @@ -103,7 +103,7 @@ void QNetworkAccessCache::CacheableObject::setShareable(bool enable) } QNetworkAccessCache::QNetworkAccessCache() - : oldest(0), newest(0) + : oldest(nullptr), newest(nullptr) { } @@ -130,7 +130,7 @@ void QNetworkAccessCache::clear() timer.stop(); - oldest = newest = 0; + oldest = newest = nullptr; } /*! @@ -145,11 +145,11 @@ void QNetworkAccessCache::linkEntry(const QByteArray &key) Node *const node = &it.value(); Q_ASSERT(node != oldest && node != newest); - Q_ASSERT(node->older == 0 && node->newer == 0); + Q_ASSERT(node->older == nullptr && node->newer == nullptr); Q_ASSERT(node->useCount == 0); if (newest) { - Q_ASSERT(newest->newer == 0); + Q_ASSERT(newest->newer == nullptr); newest->newer = node; node->older = newest; } @@ -186,7 +186,7 @@ bool QNetworkAccessCache::unlinkEntry(const QByteArray &key) if (node->newer) node->newer->older = node->older; - node->newer = node->older = 0; + node->newer = node->older = nullptr; return wasOldest; } @@ -235,9 +235,9 @@ void QNetworkAccessCache::timerEvent(QTimerEvent *) // fixup the list if (oldest) - oldest->older = 0; + oldest->older = nullptr; else - newest = 0; + newest = nullptr; updateTimer(); } @@ -277,7 +277,7 @@ bool QNetworkAccessCache::requestEntry(const QByteArray &key, QObject *target, c if (node->useCount > 0 && !node->object->shareable) { // object is not shareable and is in use // queue for later use - Q_ASSERT(node->older == 0 && node->newer == 0); + Q_ASSERT(node->older == nullptr && node->newer == nullptr); node->receiverQueue.push_back({target, member}); // request queued @@ -296,7 +296,7 @@ QNetworkAccessCache::CacheableObject *QNetworkAccessCache::requestEntryNow(const { NodeHash::Iterator it = hash.find(key); if (it == hash.end()) - return 0; + return nullptr; if (it->useCount > 0) { if (it->object->shareable) { ++it->useCount; @@ -304,7 +304,7 @@ QNetworkAccessCache::CacheableObject *QNetworkAccessCache::requestEntryNow(const } // object in use and not shareable - return 0; + return nullptr; } // entry not in use, let the caller have it diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index 67a856506c..03ffc69628 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -70,13 +70,13 @@ QNetworkAccessDebugPipeBackendFactory::create(QNetworkAccessManager::Operation o default: // no, we can't handle this operation - return 0; + return nullptr; } QUrl url = request.url(); if (url.scheme() == QLatin1String("debugpipe")) return new QNetworkAccessDebugPipeBackend; - return 0; + return nullptr; } QNetworkAccessDebugPipeBackend::QNetworkAccessDebugPipeBackend() @@ -188,7 +188,7 @@ void QNetworkAccessDebugPipeBackend::pushFromUpstreamToSocket() emitReplyUploadProgress(bytesUploaded, bytesUploaded); possiblyFinish(); break; - } else if (haveRead == 0 || readPointer == 0) { + } else if (haveRead == 0 || readPointer == nullptr) { // nothing to read right now, we will be called again later break; } else { diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 60353cb03e..507417f86c 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -73,7 +73,7 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op, default: // no, we can't handle this operation - return 0; + return nullptr; } QUrl url = request.url(); @@ -95,7 +95,7 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op, return new QNetworkAccessFileBackend; } - return 0; + return nullptr; } QNetworkAccessFileBackend::QNetworkAccessFileBackend() @@ -198,7 +198,7 @@ void QNetworkAccessFileBackend::uploadReadyReadSlot() file.close(); finished(); break; - } else if (haveRead == 0 || readPointer == 0) { + } else if (haveRead == 0 || readPointer == nullptr) { // nothing to read right now, we will be called again later break; } else { diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 51ed2f5a55..fb8cd79c12 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -75,13 +75,13 @@ QNetworkAccessFtpBackendFactory::create(QNetworkAccessManager::Operation op, default: // no, we can't handle this operation - return 0; + return nullptr; } QUrl url = request.url(); if (url.scheme().compare(QLatin1String("ftp"), Qt::CaseInsensitive) == 0) return new QNetworkAccessFtpBackend; - return 0; + return nullptr; } class QNetworkAccessCachedFtpConnection: public QFtp, public QNetworkAccessCache::CacheableObject @@ -104,7 +104,7 @@ public: }; QNetworkAccessFtpBackend::QNetworkAccessFtpBackend() - : ftp(0), uploadDevice(0), totalBytes(0), helpId(-1), sizeId(-1), mdtmId(-1), pwdId(-1), + : ftp(nullptr), uploadDevice(nullptr), totalBytes(0), helpId(-1), sizeId(-1), mdtmId(-1), pwdId(-1), supportsSize(false), supportsMdtm(false), supportsPwd(false), state(Idle) { } @@ -215,7 +215,7 @@ void QNetworkAccessFtpBackend::disconnectFromFtp(CacheCleanupMode mode) state = Disconnecting; if (ftp) { - disconnect(ftp, 0, this, 0); + disconnect(ftp, nullptr, this, nullptr); QByteArray key = makeCacheKey(url()); if (mode == RemoveCachedConnection) { @@ -225,7 +225,7 @@ void QNetworkAccessFtpBackend::disconnectFromFtp(CacheCleanupMode mode) QNetworkAccessManagerPrivate::getObjectCache(this)->releaseEntry(key); } - ftp = 0; + ftp = nullptr; } } @@ -362,7 +362,7 @@ void QNetworkAccessFtpBackend::ftpDone() QFtp::TransferType type = QFtp::Binary; if (operation() == QNetworkAccessManager::GetOperation) { setCachingEnabled(true); - ftp->get(url().path(), 0, type); + ftp->get(url().path(), nullptr, type); } else { ftp->put(uploadDevice, url().path(), type); } diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 903de322ff..47f6112b22 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -131,7 +131,7 @@ QNetworkCookie::QNetworkCookie(const QNetworkCookie &other) QNetworkCookie::~QNetworkCookie() { // QSharedDataPointer auto deletes - d = 0; + d = nullptr; } /*! diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index df2e4902a4..b30d1c9664 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -180,11 +180,11 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) #endif Q_D(QNetworkDiskCache); if (!metaData.isValid() || !metaData.url().isValid() || !metaData.saveToDisk()) - return 0; + return nullptr; if (d->cacheDirectory.isEmpty()) { qWarning("QNetworkDiskCache::prepare() The cache directory is not set"); - return 0; + return nullptr; } const auto headers = metaData.rawHeaders(); @@ -192,14 +192,14 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) if (header.first.compare("content-length", Qt::CaseInsensitive) == 0) { const qint64 size = header.second.toLongLong(); if (size > (maximumCacheSize() * 3)/4) - return 0; + return nullptr; break; } } QScopedPointer cacheItem(new QCacheItem); cacheItem->metaData = metaData; - QIODevice *device = 0; + QIODevice *device = nullptr; if (cacheItem->canCompress()) { cacheItem->data.open(QBuffer::ReadWrite); device = &(cacheItem->data); @@ -208,12 +208,12 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) QT_TRY { cacheItem->file = new QTemporaryFile(templateName, &cacheItem->data); } QT_CATCH(...) { - cacheItem->file = 0; + cacheItem->file = nullptr; } if (!cacheItem->file || !cacheItem->file->open()) { qWarning("QNetworkDiskCache::prepare() unable to open temporary file"); cacheItem.reset(); - return 0; + return nullptr; } cacheItem->writeHeader(cacheItem->file); device = cacheItem->file; @@ -397,19 +397,19 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url) Q_D(QNetworkDiskCache); QScopedPointer buffer; if (!url.isValid()) - return 0; + return nullptr; if (d->lastItem.metaData.url() == url && d->lastItem.data.isOpen()) { buffer.reset(new QBuffer); buffer->setData(d->lastItem.data.data()); } else { QScopedPointer file(new QFile(d->cacheFileName(url))); if (!file->open(QFile::ReadOnly | QIODevice::Unbuffered)) - return 0; + return nullptr; if (!d->lastItem.read(file.data(), true)) { file->close(); remove(url); - return 0; + return nullptr; } if (d->lastItem.data.isOpen()) { // compressed @@ -419,7 +419,7 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url) buffer.reset(new QBuffer); // ### verify that QFile uses the fd size and not the file name qint64 size = file->size() - file->pos(); - const uchar *p = 0; + const uchar *p = nullptr; #if !defined(Q_OS_INTEGRITY) p = file->map(file->pos(), size); #endif @@ -557,7 +557,7 @@ qint64 QNetworkDiskCache::expire() for (QCacheItem *item : qAsConst(d->inserting)) { if (item && item->file && item->file->fileName() == name) { delete item->file; - item->file = 0; + item->file = nullptr; break; } } diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp index ef319ebf0d..afab8ffd94 100644 --- a/src/network/access/qnetworkreplyfileimpl.cpp +++ b/src/network/access/qnetworkreplyfileimpl.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QNetworkReplyFileImplPrivate::QNetworkReplyFileImplPrivate() - : QNetworkReplyPrivate(), managerPrivate(0), realFile(0) + : QNetworkReplyPrivate(), managerPrivate(nullptr), realFile(nullptr) { qRegisterMetaType(); qRegisterMetaType(); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 6eab500e8c..a43a29a239 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() - : backend(0), outgoingData(0), - copyDevice(0), - cacheEnabled(false), cacheSaveDevice(0), + : backend(nullptr), outgoingData(nullptr), + copyDevice(nullptr), + cacheEnabled(false), cacheSaveDevice(nullptr), notificationHandlingPaused(false), bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), preMigrationDownloaded(-1), httpStatusCode(0), @@ -63,7 +63,7 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() , downloadBufferReadPosition(0) , downloadBufferCurrentSize(0) , downloadBufferMaximumSize(0) - , downloadBuffer(0) + , downloadBuffer(nullptr) { if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool() == true) emitAllUploadProgressSignals = true; @@ -489,7 +489,7 @@ void QNetworkReplyImplPrivate::resumeNotificationHandling() QAbstractNetworkCache *QNetworkReplyImplPrivate::networkCache() const { if (!backend) - return 0; + return nullptr; return backend->networkCache(); } @@ -504,7 +504,7 @@ void QNetworkReplyImplPrivate::createCache() bool QNetworkReplyImplPrivate::isCachingEnabled() const { - return (cacheEnabled && networkCache() != 0); + return (cacheEnabled && networkCache() != nullptr); } void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) @@ -529,7 +529,7 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) "backend %s probably needs to be fixed", backend->metaObject()->className()); networkCache()->remove(url); - cacheSaveDevice = 0; + cacheSaveDevice = nullptr; cacheEnabled = false; } } @@ -541,7 +541,7 @@ void QNetworkReplyImplPrivate::completeCacheSave() } else if (cacheEnabled && cacheSaveDevice) { networkCache()->insert(cacheSaveDevice); } - cacheSaveDevice = 0; + cacheSaveDevice = nullptr; cacheEnabled = false; } @@ -610,7 +610,7 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice() networkCache()->metaObject()->className()); networkCache()->remove(url); - cacheSaveDevice = 0; + cacheSaveDevice = nullptr; cacheEnabled = false; } } @@ -927,9 +927,9 @@ void QNetworkReplyImpl::abort() // stop both upload and download if (d->outgoingData) - disconnect(d->outgoingData, 0, this, 0); + disconnect(d->outgoingData, nullptr, this, nullptr); if (d->copyDevice) - disconnect(d->copyDevice, 0, this, 0); + disconnect(d->copyDevice, nullptr, this, nullptr); QNetworkReply::close(); @@ -943,7 +943,7 @@ void QNetworkReplyImpl::abort() // finished may access the backend if (d->backend) { d->backend->deleteLater(); - d->backend = 0; + d->backend = nullptr; } } @@ -958,7 +958,7 @@ void QNetworkReplyImpl::close() if (d->backend) d->backend->closeDownstreamChannel(); if (d->copyDevice) - disconnect(d->copyDevice, 0, this, 0); + disconnect(d->copyDevice, nullptr, this, nullptr); QNetworkReply::close(); diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 92e5aed38c..70b09dba22 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -444,7 +444,7 @@ public: inline QNetworkRequestPrivate() : priority(QNetworkRequest::NormalPriority) #ifndef QT_NO_SSL - , sslConfiguration(0) + , sslConfiguration(nullptr) #endif , maxRedirectsAllowed(maxRedirectCount) , transferTimeout(0) @@ -464,7 +464,7 @@ public: priority = other.priority; maxRedirectsAllowed = other.maxRedirectsAllowed; #ifndef QT_NO_SSL - sslConfiguration = 0; + sslConfiguration = nullptr; if (other.sslConfiguration) sslConfiguration = new QSslConfiguration(*other.sslConfiguration); #endif @@ -550,7 +550,7 @@ QNetworkRequest::QNetworkRequest(const QNetworkRequest &other) QNetworkRequest::~QNetworkRequest() { // QSharedDataPointer auto deletes - d = 0; + d = nullptr; } /*! diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index cc913ce760..eef8df288d 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -254,7 +254,7 @@ static const char spdyDictionary[] = { //} QSpdyProtocolHandler::QSpdyProtocolHandler(QHttpNetworkConnectionChannel *channel) - : QObject(0), QAbstractProtocolHandler(channel), + : QObject(nullptr), QAbstractProtocolHandler(channel), m_nextStreamID(-1), m_maxConcurrentStreams(100), // 100 is recommended in the SPDY RFC m_initialWindowSize(0), @@ -720,7 +720,7 @@ bool QSpdyProtocolHandler::uploadData(qint32 streamID) m_connection->d_func()->emitReplyError(m_socket, reply, QNetworkReply::UnknownNetworkError); return false; - } else if (readPointer == 0 || currentReadSize == 0) { + } else if (readPointer == nullptr || currentReadSize == 0) { // nothing to read currently, break the loop break; } else { @@ -746,7 +746,7 @@ bool QSpdyProtocolHandler::uploadData(qint32 streamID) } if (replyPrivate->totallyUploadedData == request.contentLength()) { DataFrameFlags finFlag = DataFrame_FLAG_FIN; - qint64 writeSize = sendDataFrame(streamID, finFlag, 0, 0); + qint64 writeSize = sendDataFrame(streamID, finFlag, 0, nullptr); Q_ASSERT(writeSize == 0); Q_UNUSED(writeSize); // silence -Wunused-variable replyPrivate->state = QHttpNetworkReplyPrivate::SPDYHalfClosed; @@ -892,7 +892,7 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD HttpMessagePair pair = it.value(); QHttpNetworkReply *httpReply = pair.second; - Q_ASSERT(httpReply != 0); + Q_ASSERT(httpReply != nullptr); if (httpReply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) { sendRST_STREAM(streamID, RST_STREAM_STREAM_ALREADY_CLOSED); @@ -950,7 +950,7 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD if (flag_fin) { if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed) - sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0); + sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, nullptr); replyFinished(httpReply, streamID); } } @@ -1199,7 +1199,7 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders) HttpMessagePair pair = it.value(); QHttpNetworkRequest httpRequest = pair.first; QHttpNetworkReply *httpReply = pair.second; - Q_ASSERT(httpReply != 0); + Q_ASSERT(httpReply != nullptr); QHttpNetworkReplyPrivate *replyPrivate = httpReply->d_func(); @@ -1261,7 +1261,7 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders) if (flag_fin) { if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed) - sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0); + sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, nullptr); replyFinished(httpReply, streamID); } } diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index c2d30d52e2..751735c8bd 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -68,7 +68,7 @@ static void connManager_cleanup() int shutdown = appShutdown.fetchAndStoreAcquire(1); Q_ASSERT(shutdown == 0); Q_UNUSED(shutdown); - QNetworkConfigurationManagerPrivate *cmp = connManager_ptr.fetchAndStoreAcquire(0); + QNetworkConfigurationManagerPrivate *cmp = connManager_ptr.fetchAndStoreAcquire(nullptr); if (cmp) cmp->cleanup(); } diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 252b88d36a..f0aa452dd3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() - : QObject(), pollTimer(0), + : QObject(), pollTimer(nullptr), loader(QBearerEngineFactoryInterface_iid, QLatin1String("/bearer")), forcedPolling(0), firstUpdate(true) { @@ -367,7 +367,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() bool envOK = false; const int skipGeneric = qEnvironmentVariableIntValue("QT_EXCLUDE_GENERIC_BEARER", &envOK); - QBearerEngine *generic = 0; + QBearerEngine *generic = nullptr; QFactoryLoader *l = &loader; const PluginKeyMap keyMap = l->keyMap(); const PluginKeyMapConstIterator cend = keyMap.constEnd(); diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 19bc44e02a..25c4ab711e 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -209,7 +209,7 @@ QT_BEGIN_NAMESPACE \sa isValid() */ QNetworkConfiguration::QNetworkConfiguration() - : d(0) + : d(nullptr) { } diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 1636bcee97..324016d72a 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -250,7 +250,7 @@ QT_BEGIN_NAMESPACE \sa QNetworkConfiguration */ QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig, QObject *parent) - : QObject(parent), d(0) + : QObject(parent), d(nullptr) { qRegisterMetaType(); qRegisterMetaType(); diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 33a30eb1cd..e9a8e2a9e5 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -158,7 +158,7 @@ static QByteArray qGssapiContinue(QAuthenticatorPrivate *ctx, Constructs an empty authentication object. */ QAuthenticator::QAuthenticator() - : d(0) + : d(nullptr) { } @@ -175,7 +175,7 @@ QAuthenticator::~QAuthenticator() Constructs a copy of \a other. */ QAuthenticator::QAuthenticator(const QAuthenticator &other) - : d(0) + : d(nullptr) { if (other.d) *this = other; @@ -1227,7 +1227,7 @@ QByteArray qEncodeHmacMd5(QByteArray &key, const QByteArray &message) static QByteArray qCreatev2Hash(const QAuthenticatorPrivate *ctx, QNtlmPhase3Block *phase3) { - Q_ASSERT(phase3 != 0); + Q_ASSERT(phase3 != nullptr); // since v2 Hash is need for both NTLMv2 and LMv2 it is calculated // only once and stored and reused if(phase3->v2Hash.size() == 0) { @@ -1284,7 +1284,7 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, const QNtlmPhase2Block& ch, QNtlmPhase3Block *phase3) { - Q_ASSERT(phase3 != 0); + Q_ASSERT(phase3 != nullptr); // return value stored in phase3 qCreatev2Hash(ctx, phase3); @@ -1351,7 +1351,7 @@ static QByteArray qEncodeLmv2Response(const QAuthenticatorPrivate *ctx, const QNtlmPhase2Block& ch, QNtlmPhase3Block *phase3) { - Q_ASSERT(phase3 != 0); + Q_ASSERT(phase3 != nullptr); // return value stored in phase3 qCreatev2Hash(ctx, phase3); diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp index 1b66829070..ab1be02b6b 100644 --- a/src/network/kernel/qdnslookup.cpp +++ b/src/network/kernel/qdnslookup.cpp @@ -481,7 +481,7 @@ void QDnsLookup::abort() { Q_D(QDnsLookup); if (d->runnable) { - d->runnable = 0; + d->runnable = nullptr; d->reply = QDnsLookupReply(); d->reply.error = QDnsLookup::OperationCancelledError; d->reply.errorString = tr("Operation cancelled"); @@ -992,7 +992,7 @@ void QDnsLookupPrivate::_q_lookupFinished(const QDnsLookupReply &_reply) qDebug("DNS reply for %s: %i (%s)", qPrintable(name), _reply.error, qPrintable(_reply.errorString)); #endif reply = _reply; - runnable = 0; + runnable = nullptr; isFinished = true; emit q->finished(); } diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp index ee7484ab35..12b40fc35d 100644 --- a/src/network/kernel/qdnslookup_unix.cpp +++ b/src/network/kernel/qdnslookup_unix.cpp @@ -73,13 +73,13 @@ QT_BEGIN_NAMESPACE typedef struct __res_state* res_state; #endif typedef int (*dn_expand_proto)(const unsigned char *, const unsigned char *, const unsigned char *, char *, int); -static dn_expand_proto local_dn_expand = 0; +static dn_expand_proto local_dn_expand = nullptr; typedef void (*res_nclose_proto)(res_state); -static res_nclose_proto local_res_nclose = 0; +static res_nclose_proto local_res_nclose = nullptr; typedef int (*res_ninit_proto)(res_state); -static res_ninit_proto local_res_ninit = 0; +static res_ninit_proto local_res_ninit = nullptr; typedef int (*res_nquery_proto)(res_state, const char *, int, int, unsigned char *, int); -static res_nquery_proto local_res_nquery = 0; +static res_nquery_proto local_res_nquery = nullptr; // Custom deleter to close resolver state. diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index b54fb349fb..ed1c23ed6e 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -144,7 +144,7 @@ static bool parseIp6(const QString &address, QIPAddressUtils::IPv6Address &addr, } else { scopeId->clear(); } - return QIPAddressUtils::parseIp6(addr, tmp.constBegin(), tmp.constEnd()) == 0; + return QIPAddressUtils::parseIp6(addr, tmp.constBegin(), tmp.constEnd()) == nullptr; } bool QHostAddressPrivate::parse(const QString &ipString) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index f9335c3bb9..31671feece 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -410,7 +410,7 @@ QHostInfo QHostInfoAgent::reverseLookup(const QHostAddress &address) // Reverse lookup sockaddr_in sa4; sockaddr_in6 sa6; - sockaddr *sa = 0; + sockaddr *sa = nullptr; QT_SOCKLEN_T saSize; if (address.protocol() == QAbstractSocket::IPv4Protocol) { sa = reinterpret_cast(&sa4); @@ -455,7 +455,7 @@ QHostInfo QHostInfoAgent::lookup(const QString &hostName) return results; } - addrinfo *res = 0; + addrinfo *res = nullptr; struct addrinfo hints; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index 78a05f8407..625fbabf31 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -80,12 +80,12 @@ enum LibResolvFeature { typedef struct __res_state *res_state_ptr; typedef int (*res_init_proto)(void); -static res_init_proto local_res_init = 0; +static res_init_proto local_res_init = nullptr; typedef int (*res_ninit_proto)(res_state_ptr); -static res_ninit_proto local_res_ninit = 0; +static res_ninit_proto local_res_ninit = nullptr; typedef void (*res_nclose_proto)(res_state_ptr); -static res_nclose_proto local_res_nclose = 0; -static res_state_ptr local_res = 0; +static res_nclose_proto local_res_nclose = nullptr; +static res_state_ptr local_res = nullptr; #if QT_CONFIG(library) && !defined(Q_OS_QNX) namespace { diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index b7a6d9adf9..eed57f8a32 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -627,7 +627,7 @@ bool QNetworkAddressEntry::isPermanent() const Constructs an empty network interface object. */ QNetworkInterface::QNetworkInterface() - : d(0) + : d(nullptr) { } diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index a2a89ed94b..90c8b75a86 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -254,13 +254,13 @@ class QGlobalNetworkProxy { public: QGlobalNetworkProxy() - : applicationLevelProxy(0) - , applicationLevelProxyFactory(0) + : applicationLevelProxy(nullptr) + , applicationLevelProxyFactory(nullptr) #if QT_CONFIG(socks5) - , socks5SocketEngineHandler(0) + , socks5SocketEngineHandler(nullptr) #endif #if QT_CONFIG(http) - , httpSocketEngineHandler(0) + , httpSocketEngineHandler(nullptr) #endif #ifdef QT_USE_SYSTEM_PROXIES , useSystemProxies(true) @@ -313,7 +313,7 @@ public: applicationLevelProxy = new QNetworkProxy; *applicationLevelProxy = proxy; delete applicationLevelProxyFactory; - applicationLevelProxyFactory = 0; + applicationLevelProxyFactory = nullptr; useSystemProxies = false; } @@ -501,7 +501,7 @@ template<> void QSharedDataPointer::detach() \sa setType(), setApplicationProxy() */ QNetworkProxy::QNetworkProxy() - : d(0) + : d(nullptr) { // make sure we have QGlobalNetworkProxy singleton created, otherwise // you don't have any socket engine handler created when directly setting diff --git a/src/network/kernel/qurlinfo.cpp b/src/network/kernel/qurlinfo.cpp index 7ae6822fb4..e6f2e70ff4 100644 --- a/src/network/kernel/qurlinfo.cpp +++ b/src/network/kernel/qurlinfo.cpp @@ -126,7 +126,7 @@ public: QUrlInfo::QUrlInfo() { - d = 0; + d = nullptr; } /*! @@ -139,7 +139,7 @@ QUrlInfo::QUrlInfo(const QUrlInfo &ui) d = new QUrlInfoPrivate; *d = *ui.d; } else { - d = 0; + d = nullptr; } } @@ -443,7 +443,7 @@ QUrlInfo &QUrlInfo::operator=(const QUrlInfo &ui) *d = *ui.d; } else { delete d; - d = 0; + d = nullptr; } return *this; } @@ -683,7 +683,7 @@ bool QUrlInfo::equal(const QUrlInfo &i1, const QUrlInfo &i2, bool QUrlInfo::operator==(const QUrlInfo &other) const { if (!d) - return other.d == 0; + return other.d == nullptr; if (!other.d) return false; @@ -721,7 +721,7 @@ bool QUrlInfo::operator==(const QUrlInfo &other) const */ bool QUrlInfo::isValid() const { - return d != 0; + return d != nullptr; } QT_END_NAMESPACE diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index e48fbea3b6..cbc4114904 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -564,12 +564,12 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() port(0), localPort(0), peerPort(0), - socketEngine(0), + socketEngine(nullptr), cachedSocketDescriptor(-1), readBufferMaxSize(0), isBuffered(false), hasPendingData(false), - connectTimer(0), + connectTimer(nullptr), hostLookupId(-1), socketType(QAbstractSocket::UnknownSocketType), state(QAbstractSocket::UnconnectedState), @@ -603,7 +603,7 @@ void QAbstractSocketPrivate::resetSocketLayer() socketEngine->close(); socketEngine->disconnect(); delete socketEngine; - socketEngine = 0; + socketEngine = nullptr; cachedSocketDescriptor = -1; } if (connectTimer) diff --git a/src/network/socket/qabstractsocketengine.cpp b/src/network/socket/qabstractsocketengine.cpp index 3fffff6d5a..54c7452c66 100644 --- a/src/network/socket/qabstractsocketengine.cpp +++ b/src/network/socket/qabstractsocketengine.cpp @@ -85,7 +85,7 @@ QAbstractSocketEnginePrivate::QAbstractSocketEnginePrivate() , peerPort(0) , inboundStreamCount(0) , outboundStreamCount(0) - , receiver(0) + , receiver(nullptr) { } @@ -104,7 +104,7 @@ QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(QAbstractSocket #ifndef QT_NO_NETWORKPROXY // proxy type must have been resolved by now if (proxy.type() == QNetworkProxy::DefaultProxy) - return 0; + return nullptr; #endif QMutexLocker locker(&socketHandlers()->mutex); @@ -116,7 +116,7 @@ QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(QAbstractSocket #ifndef QT_NO_NETWORKPROXY // only NoProxy can have reached here if (proxy.type() != QNetworkProxy::NoProxy) - return 0; + return nullptr; #endif return new QNativeSocketEngine(parent); diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index c67b273937..76b3053224 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -216,7 +216,7 @@ void QHttpSocketEngine::close() if (d->socket) { d->socket->close(); delete d->socket; - d->socket = 0; + d->socket = nullptr; } } @@ -586,7 +586,7 @@ void QHttpSocketEngine::slotSocketReadNotification() } int statusCode = d->reply->statusCode(); - QAuthenticatorPrivate *priv = 0; + QAuthenticatorPrivate *priv = nullptr; if (statusCode == 200) { d->state = Connected; setLocalAddress(d->socket->localAddress()); @@ -829,8 +829,8 @@ QHttpSocketEnginePrivate::QHttpSocketEnginePrivate() , credentialsSent(false) , pendingResponseData(0) { - socket = 0; - reply = 0; + socket = nullptr; + reply = nullptr; state = QHttpSocketEngine::None; } @@ -843,15 +843,15 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(QAbstractSoc QObject *parent) { if (socketType != QAbstractSocket::TcpSocket) - return 0; + return nullptr; // proxy type must have been resolved by now if (proxy.type() != QNetworkProxy::HttpProxy) - return 0; + return nullptr; // we only accept active sockets if (!qobject_cast(parent)) - return 0; + return nullptr; QHttpSocketEngine *engine = new QHttpSocketEngine(parent); engine->setProxy(proxy); @@ -860,7 +860,7 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(QAbstractSoc QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(qintptr, QObject *) { - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index 3e36a7b229..5ca2db70b9 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -417,7 +417,7 @@ QLocalSocket *QLocalServer::nextPendingConnection() { Q_D(QLocalServer); if (d->pendingConnections.isEmpty()) - return 0; + return nullptr; QLocalSocket *nextSocket = d->pendingConnections.dequeue(); #ifndef QT_LOCALSOCKET_TCP if (d->pendingConnections.size() <= d->maxPendingConnections) diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 9547ec5b88..88367d680d 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -243,7 +243,7 @@ void QLocalServerPrivate::closeServer() if (socketNotifier) { socketNotifier->setEnabled(false); // Otherwise, closed socket is checked before deleter runs socketNotifier->deleteLater(); - socketNotifier = 0; + socketNotifier = nullptr; } if (-1 != listenSocket) diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index af7cdb76d2..d35f838af5 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -372,7 +372,7 @@ QLocalSocket::~QLocalSocket() QLocalSocket::close(); #if !defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP) Q_D(QLocalSocket); - d->unixSocket.setParent(0); + d->unixSocket.setParent(nullptr); #endif } diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 3a571edc3a..7de9a7d4c7 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -61,8 +61,8 @@ QT_BEGIN_NAMESPACE QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(), - delayConnect(0), - connectTimer(0), + delayConnect(nullptr), + connectTimer(nullptr), connectingSocket(-1), state(QLocalSocket::UnconnectedState) { @@ -379,10 +379,10 @@ void QLocalSocketPrivate::cancelDelayedConnect() if (delayConnect) { delayConnect->setEnabled(false); delete delayConnect; - delayConnect = 0; + delayConnect = nullptr; connectTimer->stop(); delete connectTimer; - connectTimer = 0; + connectTimer = nullptr; } } diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index f3ca2afdc8..31628846dc 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -191,9 +191,9 @@ QT_BEGIN_NAMESPACE */ QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() : socketDescriptor(-1), - readNotifier(0), - writeNotifier(0), - exceptNotifier(0) + readNotifier(nullptr), + writeNotifier(nullptr), + exceptNotifier(nullptr) { #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QSysInfo::machineHostName(); // this initializes ws2_32.dll @@ -985,15 +985,15 @@ void QNativeSocketEngine::close() d->inboundStreamCount = d->outboundStreamCount = 0; if (d->readNotifier) { qDeleteInEventHandler(d->readNotifier); - d->readNotifier = 0; + d->readNotifier = nullptr; } if (d->writeNotifier) { qDeleteInEventHandler(d->writeNotifier); - d->writeNotifier = 0; + d->writeNotifier = nullptr; } if (d->exceptNotifier) { qDeleteInEventHandler(d->exceptNotifier); - d->exceptNotifier = 0; + d->exceptNotifier = nullptr; } } diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 3ca586e247..e5b9fbbdb2 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -628,7 +628,7 @@ bool QNativeSocketEnginePrivate::nativeListen(int backlog) int QNativeSocketEnginePrivate::nativeAccept() { - int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0); + int acceptedDescriptor = qt_safe_accept(socketDescriptor, nullptr, nullptr); if (acceptedDescriptor == -1) { switch (errno) { case EBADF: @@ -1002,7 +1002,7 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS struct cmsghdr *cmsgptr; QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wsign-compare") - for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; + for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != nullptr; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) { QT_WARNING_POP if (cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_PKTINFO @@ -1166,7 +1166,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l #endif if (msg.msg_controllen == 0) - msg.msg_control = 0; + msg.msg_control = nullptr; ssize_t sentBytes = qt_safe_sendmsg(socketDescriptor, &msg, 0); if (sentBytes < 0) { diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 8a030601dc..622d5df131 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -365,13 +365,13 @@ QSocks5BindData *QSocks5BindStore::retrieve(qintptr socketDescriptor) QMutexLocker lock(&mutex); const auto it = store.constFind(socketDescriptor); if (it == store.cend()) - return 0; + return nullptr; QSocks5BindData *bindData = it.value(); store.erase(it); if (bindData) { if (bindData->controlSocket->thread() != QThread::currentThread()) { qWarning("Cannot access socks5 bind data from different thread"); - return 0; + return nullptr; } } else { QSOCKS5_DEBUG << "__ERROR__ binddata == 0"; @@ -503,12 +503,12 @@ QSocks5SocketEnginePrivate::QSocks5SocketEnginePrivate() , writeNotificationEnabled(false) , exceptNotificationEnabled(false) , socketDescriptor(-1) - , data(0) - , connectData(0) + , data(nullptr) + , connectData(nullptr) #ifndef QT_NO_UDPSOCKET - , udpData(0) + , udpData(nullptr) #endif - , bindData(0) + , bindData(nullptr) , readNotificationActivated(false) , writeNotificationActivated(false) , readNotificationPending(false) @@ -1038,11 +1038,11 @@ bool QSocks5SocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket:: d->data = d->connectData; d->mode = QSocks5SocketEnginePrivate::ConnectMode; d->data->controlSocket = bindData->controlSocket; - bindData->controlSocket = 0; + bindData->controlSocket = nullptr; d->data->controlSocket->setParent(this); d->socketProtocol = d->data->controlSocket->localAddress().protocol(); d->data->authenticator = bindData->authenticator; - bindData->authenticator = 0; + bindData->authenticator = nullptr; d->localPort = bindData->localPort; d->localAddress = bindData->localAddress; d->peerPort = bindData->peerPort; @@ -1367,7 +1367,7 @@ bool QSocks5SocketEngine::bind(const QHostAddress &addr, quint16 port) QElapsedTimer stopWatch; stopWatch.start(); d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port()); - if (!d->waitForConnected(msecs, 0) || + if (!d->waitForConnected(msecs, nullptr) || d->data->controlSocket->state() == QAbstractSocket::UnconnectedState) { // waitForConnected sets the error state and closes the socket QSOCKS5_Q_DEBUG << "waitForConnected to proxy server" << d->data->controlSocket->errorString(); @@ -1428,13 +1428,13 @@ int QSocks5SocketEngine::accept() case QSocks5SocketEnginePrivate::BindSuccess: QSOCKS5_Q_DEBUG << "BindSuccess adding" << d->socketDescriptor << "to the bind store"; d->data->controlSocket->disconnect(); - d->data->controlSocket->setParent(0); + d->data->controlSocket->setParent(nullptr); d->bindData->localAddress = d->localAddress; d->bindData->localPort = d->localPort; sd = d->socketDescriptor; socks5BindStore()->add(sd, d->bindData); - d->data = 0; - d->bindData = 0; + d->data = nullptr; + d->bindData = nullptr; d->socketDescriptor = 0; //### do something about this socket layer ... set it closed and an error about why ... // reset state and local port/address @@ -1909,7 +1909,7 @@ QSocks5SocketEngineHandler::createSocketEngine(QAbstractSocket::SocketType socke // proxy type must have been resolved by now if (proxy.type() != QNetworkProxy::Socks5Proxy) { QSOCKS5_DEBUG << "not proxying"; - return 0; + return nullptr; } QScopedPointer engine(new QSocks5SocketEngine(parent)); engine->setProxy(proxy); @@ -1923,7 +1923,7 @@ QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr so QSOCKS5_DEBUG << "bind store contains" << socketDescriptor; return new QSocks5SocketEngine(parent); } - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 98e58192a2..9916c75e65 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -121,7 +121,7 @@ QTcpServerPrivate::QTcpServerPrivate() : port(0) , socketType(QAbstractSocket::UnknownSocketType) , state(QAbstractSocket::UnconnectedState) - , socketEngine(0) + , socketEngine(nullptr) , serverSocketError(QAbstractSocket::UnknownSocketError) , maxConnections(30) { @@ -389,7 +389,7 @@ void QTcpServer::close() // in out of memory situations, the socketEngine // will be deleted in ~QTcpServer (it's a child-object of this) } - d->socketEngine = 0; + d->socketEngine = nullptr; } d->state = QAbstractSocket::UnconnectedState; @@ -561,7 +561,7 @@ QTcpSocket *QTcpServer::nextPendingConnection() { Q_D(QTcpServer); if (d->pendingConnections.isEmpty()) - return 0; + return nullptr; if (!d->socketEngine) { qWarning("QTcpServer::nextPendingConnection() called while not listening"); diff --git a/src/platformheaders/nativecontexts/qglxnativecontext.h b/src/platformheaders/nativecontexts/qglxnativecontext.h index 2b566d127a..989d68eb9e 100644 --- a/src/platformheaders/nativecontexts/qglxnativecontext.h +++ b/src/platformheaders/nativecontexts/qglxnativecontext.h @@ -56,13 +56,13 @@ typedef int VisualID; struct QGLXNativeContext { QGLXNativeContext() - : m_context(0), - m_display(0), + : m_context(nullptr), + m_display(nullptr), m_window(0), m_visualId(0) { } - QGLXNativeContext(GLXContext ctx, Display *dpy = 0, Window wnd = 0, VisualID vid = 0) + QGLXNativeContext(GLXContext ctx, Display *dpy = nullptr, Window wnd = 0, VisualID vid = 0) : m_context(ctx), m_display(dpy), m_window(wnd), diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index 5ee4773b70..5303d37cee 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -281,11 +281,11 @@ EGLConfig QEglConfigChooser::chooseConfig() } configureAttributes.append(EGL_NONE); - EGLConfig cfg = 0; + EGLConfig cfg = nullptr; do { // Get the number of matching configurations for this set of properties. EGLint matching = 0; - if (!eglChooseConfig(display(), configureAttributes.constData(), 0, 0, &matching) || !matching) + if (!eglChooseConfig(display(), configureAttributes.constData(), nullptr, 0, &matching) || !matching) continue; // Fetch all of the matching configurations and find the @@ -450,7 +450,7 @@ static struct AttrInfo attrs[] = { {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"}, {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"}, {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"}, - {-1, 0}}; + {-1, nullptr}}; void q_printEglConfig(EGLDisplay display, EGLConfig config) { diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 94def16748..aa87a620d8 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -137,7 +137,7 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig, format); // m_format now has the renderableType() resolved (it cannot be Default anymore) // but does not yet contain version, profile, options. - m_shareContext = share ? static_cast(share)->m_eglContext : 0; + m_shareContext = share ? static_cast(share)->m_eglContext : nullptr; QVector contextAttrs; contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); @@ -194,8 +194,8 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont eglBindAPI(m_api); m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, m_shareContext, contextAttrs.constData()); if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) { - m_shareContext = 0; - m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, 0, contextAttrs.constData()); + m_shareContext = nullptr; + m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, nullptr, contextAttrs.constData()); } if (m_eglContext == EGL_NO_CONTEXT) { @@ -262,7 +262,7 @@ void QEGLPlatformContext::adopt(const QVariant &nativeHandle, QPlatformOpenGLCon } m_eglContext = context; - m_shareContext = share ? static_cast(share)->m_eglContext : 0; + m_shareContext = share ? static_cast(share)->m_eglContext : nullptr; updateFormatFromGL(); } @@ -326,7 +326,7 @@ void QEGLPlatformContext::updateFormatFromGL() EGLBoolean ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext); if (!ok) { EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, EGL_PBUFFER_BIT); - tempContext = eglCreateContext(m_eglDisplay, config, 0, m_contextAttrs.constData()); + tempContext = eglCreateContext(m_eglDisplay, config, nullptr, m_contextAttrs.constData()); if (tempContext != EGL_NO_CONTEXT) ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, tempContext); } diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 48b5a74a9e..7af5490963 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -360,7 +360,7 @@ Q_STATIC_ASSERT(sizeof(capabilityForWritingSystem) / sizeof(*capabilityForWritin static const char *getFcFamilyForStyleHint(const QFont::StyleHint style) { - const char *stylehint = 0; + const char *stylehint = nullptr; switch (style) { case QFont::SansSerif: stylehint = "sans-serif"; @@ -394,7 +394,7 @@ static void populateFromPattern(FcPattern *pattern) { QString familyName; QString familyNameLang; - FcChar8 *value = 0; + FcChar8 *value = nullptr; int weight_value; int slant_value; int spacing_value; @@ -417,7 +417,7 @@ static void populateFromPattern(FcPattern *pattern) slant_value = FC_SLANT_ROMAN; weight_value = FC_WEIGHT_REGULAR; spacing_value = FC_PROPORTIONAL; - file_value = 0; + file_value = nullptr; indexValue = 0; scalable = FcTrue; @@ -431,20 +431,20 @@ static void populateFromPattern(FcPattern *pattern) if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing_value) != FcResultMatch) spacing_value = FC_PROPORTIONAL; if (FcPatternGetString(pattern, FC_FILE, 0, &file_value) != FcResultMatch) - file_value = 0; + file_value = nullptr; if (FcPatternGetInteger(pattern, FC_INDEX, 0, &indexValue) != FcResultMatch) indexValue = 0; if (FcPatternGetBool(pattern, FC_SCALABLE, 0, &scalable) != FcResultMatch) scalable = FcTrue; if (FcPatternGetString(pattern, FC_FOUNDRY, 0, &foundry_value) != FcResultMatch) - foundry_value = 0; + foundry_value = nullptr; if (FcPatternGetString(pattern, FC_STYLE, 0, &style_value) != FcResultMatch) - style_value = 0; + style_value = nullptr; if (FcPatternGetBool(pattern,FC_ANTIALIAS,0,&antialias) != FcResultMatch) antialias = true; QSupportedWritingSystems writingSystems; - FcLangSet *langset = 0; + FcLangSet *langset = nullptr; FcResult res = FcPatternGetLangSet(pattern, FC_LANG, 0, &langset); if (res == FcResultMatch) { bool hasLang = false; @@ -461,7 +461,7 @@ static void populateFromPattern(FcPattern *pattern) if (*capabilityForWritingSystem[j] && requiresOpenType(j)) { if (cap == nullptr) capRes = FcPatternGetString(pattern, FC_CAPABILITY, 0, &cap); - if (capRes == FcResultMatch && strstr(reinterpret_cast(cap), capabilityForWritingSystem[j]) == 0) + if (capRes == FcResultMatch && strstr(reinterpret_cast(cap), capabilityForWritingSystem[j]) == nullptr) continue; } #endif @@ -546,14 +546,14 @@ void QFontconfigDatabase::populateFontDatabase() #if FC_VERSION >= 20297 FC_CAPABILITY, #endif - (const char *)0 + (const char *)nullptr }; const char **p = properties; while (*p) { FcObjectSetAdd(os, *p); ++p; } - fonts = FcFontList(0, pattern, os); + fonts = FcFontList(nullptr, pattern, os); FcObjectSetDestroy(os); FcPatternDestroy(pattern); } @@ -572,7 +572,7 @@ void QFontconfigDatabase::populateFontDatabase() { "Serif", "serif", false }, { "Sans Serif", "sans-serif", false }, { "Monospace", "monospace", true }, - { 0, 0, false } + { nullptr, nullptr, false } }; const FcDefaultFont *f = defaults; // aliases only make sense for 'common', not for any of the specials @@ -581,9 +581,9 @@ void QFontconfigDatabase::populateFontDatabase() while (f->qtname) { QString familyQtName = QString::fromLatin1(f->qtname); - registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,f->fixed,ws,0); - registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,f->fixed,ws,0); - registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,f->fixed,ws,0); + registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,f->fixed,ws,nullptr); + registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,f->fixed,ws,nullptr); + registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,f->fixed,ws,nullptr); ++f; } @@ -599,7 +599,7 @@ void QFontconfigDatabase::populateFontDatabase() void QFontconfigDatabase::invalidate() { // Clear app fonts. - FcConfigAppFontClear(0); + FcConfigAppFontClear(nullptr); } QFontEngineMulti *QFontconfigDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) @@ -691,7 +691,7 @@ QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bo QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr) { if (!usrPtr) - return 0; + return nullptr; FontFile *fontfile = static_cast (usrPtr); QFontEngine::FaceId fid; @@ -706,7 +706,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr) if (!engine->init(fid, engine->antialias, engine->defaultFormat) || engine->invalid()) { delete engine; - engine = 0; + engine = nullptr; } return engine; @@ -715,8 +715,8 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr) QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { QFontEngineFT *engine = static_cast(QFreeTypeFontDatabase::fontEngine(fontData, pixelSize, hintingPreference)); - if (engine == 0) - return 0; + if (engine == nullptr) + return nullptr; setupFontEngine(engine, engine->fontDef); @@ -757,7 +757,7 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont // while a Japanese font should be used for that if LANG=ja) FcPattern *dummy = FcPatternCreate(); FcDefaultSubstitute(dummy); - FcChar8 *lang = 0; + FcChar8 *lang = nullptr; FcResult res = FcPatternGetString(dummy, FC_LANG, 0, &lang); if (res == FcResultMatch) FcPatternAddString(pattern, FC_LANG, lang); @@ -770,11 +770,11 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont FcPatternAddWeak(pattern, FC_FAMILY, value, FcTrue); } - FcConfigSubstitute(0, pattern, FcMatchPattern); + FcConfigSubstitute(nullptr, pattern, FcMatchPattern); FcDefaultSubstitute(pattern); FcResult result = FcResultMatch; - FcFontSet *fontSet = FcFontSort(0,pattern,FcFalse,0,&result); + FcFontSet *fontSet = FcFontSort(nullptr,pattern,FcFalse,nullptr,&result); FcPatternDestroy(pattern); if (fontSet) { @@ -782,7 +782,7 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont duplicates.reserve(fontSet->nfont + 1); duplicates.insert(family.toCaseFolded()); for (int i = 0; i < fontSet->nfont; i++) { - FcChar8 *value = 0; + FcChar8 *value = nullptr; if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch) continue; // capitalize(value); @@ -811,7 +811,7 @@ static FcPattern *queryFont(const FcChar8 *file, const QByteArray &data, int id, FT_Library lib = qt_getFreetype(); - FcPattern *pattern = 0; + FcPattern *pattern = nullptr; FT_Face face; if (!FT_New_Memory_Face(lib, (const FT_Byte *)data.constData(), data.size(), id, &face)) { @@ -830,16 +830,16 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData, { QStringList families; - FcFontSet *set = FcConfigGetFonts(0, FcSetApplication); + FcFontSet *set = FcConfigGetFonts(nullptr, FcSetApplication); if (!set) { - FcConfigAppFontAddFile(0, (const FcChar8 *)":/non-existent"); - set = FcConfigGetFonts(0, FcSetApplication); // try again + FcConfigAppFontAddFile(nullptr, (const FcChar8 *)":/non-existent"); + set = FcConfigGetFonts(nullptr, FcSetApplication); // try again if (!set) return families; } int id = 0; - FcBlanks *blanks = FcConfigGetBlanks(0); + FcBlanks *blanks = FcConfigGetBlanks(nullptr); int count = 0; FcPattern *pattern; @@ -849,7 +849,7 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData, if (!pattern) return families; - FcChar8 *fam = 0; + FcChar8 *fam = nullptr; if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) { QString family = QString::fromUtf8(reinterpret_cast(fam)); families << family; @@ -877,10 +877,10 @@ QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const const QByteArray cs = family.toUtf8(); FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) cs.constData()); } - FcConfigSubstitute(0, pattern, FcMatchPattern); + FcConfigSubstitute(nullptr, pattern, FcMatchPattern); FcDefaultSubstitute(pattern); - FcChar8 *familyAfterSubstitution = 0; + FcChar8 *familyAfterSubstitution = nullptr; FcPatternGetString(pattern, FC_FAMILY, 0, &familyAfterSubstitution); resolved = QString::fromUtf8((const char *) familyAfterSubstitution); FcPatternDestroy(pattern); @@ -895,7 +895,7 @@ QFont QFontconfigDatabase::defaultFont() const // or https://bugs.freedesktop.org/show_bug.cgi?id=35482 is fixed FcPattern *dummy = FcPatternCreate(); FcDefaultSubstitute(dummy); - FcChar8 *lang = 0; + FcChar8 *lang = nullptr; FcResult res = FcPatternGetString(dummy, FC_LANG, 0, &lang); FcPattern *pattern = FcPatternCreate(); @@ -904,10 +904,10 @@ QFont QFontconfigDatabase::defaultFont() const // certain FC_LANG based custom rules may happen in FcConfigSubstitute() FcPatternAddString(pattern, FC_LANG, lang); } - FcConfigSubstitute(0, pattern, FcMatchPattern); + FcConfigSubstitute(nullptr, pattern, FcMatchPattern); FcDefaultSubstitute(pattern); - FcChar8 *familyAfterSubstitution = 0; + FcChar8 *familyAfterSubstitution = nullptr; FcPatternGetString(pattern, FC_FAMILY, 0, &familyAfterSubstitution); QString resolved = QString::fromUtf8((const char *) familyAfterSubstitution); FcPatternDestroy(pattern); @@ -964,10 +964,10 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef FcResult result; - FcConfigSubstitute(0, pattern, FcMatchPattern); + FcConfigSubstitute(nullptr, pattern, FcMatchPattern); FcDefaultSubstitute(pattern); - FcPattern *match = FcFontMatch(0, pattern, &result); + FcPattern *match = FcFontMatch(nullptr, pattern, &result); if (match) { engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)fontDef.hintingPreference, match, useXftConf)); diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp index 2fbcb6216e..cbf0793d75 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp @@ -60,7 +60,7 @@ bool QFontEngineMultiFontConfig::shouldLoadFontEngineForCharacter(int at, uint u { bool charSetHasChar = true; FcPattern *matchPattern = getMatchPatternForFallback(at - 1); - if (matchPattern != 0) { + if (matchPattern != nullptr) { FcCharSet *charSet; FcPatternGetCharSet(matchPattern, FC_CHARSET, 0, &charSet); charSetHasChar = FcCharSetHasChar(charSet, ucs4); @@ -85,7 +85,7 @@ FcPattern * QFontEngineMultiFontConfig::getMatchPatternForFallback(int fallBackI value.u.s = reinterpret_cast(cs.data()); FcPatternAdd(requestPattern, FC_FAMILY, value, true); FcResult result; - ret = FcFontMatch(0, requestPattern, &result); + ret = FcFontMatch(nullptr, requestPattern, &result); cachedMatchPatterns.insert(fallBackIndex, ret); FcPatternDestroy(requestPattern); return ret; diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 8c6cc8fbc1..3e5939a5e4 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -121,7 +121,7 @@ class QtFreetypeData { public: QtFreetypeData() - : library(0) + : library(nullptr) { } ~QtFreetypeData(); @@ -135,7 +135,7 @@ QtFreetypeData::~QtFreetypeData() iter.value()->cleanup(); faces.clear(); FT_Done_FreeType(library); - library = 0; + library = nullptr; } Q_GLOBAL_STATIC(QThreadStorage, theFreetypeData) @@ -215,7 +215,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, const QByteArray &fontData) { if (face_id.filename.isEmpty() && fontData.isEmpty()) - return 0; + return nullptr; QtFreetypeData *freetypeData = qt_getFreetypeData(); @@ -238,7 +238,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, } else if (!QFileInfo(fileName).isNativePath()) { QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { - return 0; + return nullptr; } newFreetype->fontData = file.readAll(); } @@ -247,10 +247,10 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, } if (!newFreetype->fontData.isEmpty()) { if (FT_New_Memory_Face(freetypeData->library, (const FT_Byte *)newFreetype->fontData.constData(), newFreetype->fontData.size(), face_id.index, &face)) { - return 0; + return nullptr; } } else if (FT_New_Face(freetypeData->library, face_id.filename, face_id.index, &face)) { - return 0; + return nullptr; } newFreetype->face = face; @@ -261,8 +261,8 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, newFreetype->matrix.yy = 0x10000; newFreetype->matrix.xy = 0; newFreetype->matrix.yx = 0; - newFreetype->unicode_map = 0; - newFreetype->symbol_map = 0; + newFreetype->unicode_map = nullptr; + newFreetype->symbol_map = nullptr; memset(newFreetype->cmapCache, 0, sizeof(newFreetype->cmapCache)); @@ -307,7 +307,7 @@ void QFreetypeFace::cleanup() { hbFace.reset(); FT_Done_Face(face); - face = 0; + face = nullptr; } void QFreetypeFace::release(const QFontEngine::FaceId &face_id) @@ -324,7 +324,7 @@ void QFreetypeFace::release(const QFontEngine::FaceId &face_id) if (freetypeData->faces.isEmpty()) { FT_Done_FreeType(freetypeData->library); - freetypeData->library = 0; + freetypeData->library = nullptr; } } @@ -659,7 +659,7 @@ QFontEngineFT *QFontEngineFT::create(const QByteArray &fontData, qreal pixelSize QFontEngineFTRawData *fe = new QFontEngineFTRawData(fontDef); if (!fe->initFromData(fontData)) { delete fe; - return 0; + return nullptr; } fe->updateFamilyNameAndStyle(); @@ -682,7 +682,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) embolden = false; obliquen = false; antialias = true; - freetype = 0; + freetype = nullptr; default_load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; default_hint_style = ftInitialDefaultHintStyle; subpixelType = Subpixel_None; @@ -729,7 +729,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, face_id = faceId; - symbol = freetype->symbol_map != 0; + symbol = freetype->symbol_map != nullptr; PS_FontInfoRec psrec; // don't assume that type1 fonts are symbol fonts by default if (FT_Get_PS_Font_Info(freetype->face, &psrec) == FT_Err_Ok) { @@ -744,7 +744,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, bool fake_oblique = (fontDef.style != QFont::StyleNormal) && !(face->style_flags & FT_STYLE_FLAG_ITALIC); if (fake_oblique) obliquen = true; - FT_Set_Transform(face, &matrix, 0); + FT_Set_Transform(face, &matrix, nullptr); freetype->matrix = matrix; // fake bold if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face)) { @@ -953,7 +953,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, format = defaultFormat != Format_None ? defaultFormat : Format_Mono; Q_ASSERT(format != Format_None); - Glyph *g = set ? set->getGlyph(glyph, subPixelPosition) : 0; + Glyph *g = set ? set->getGlyph(glyph, subPixelPosition) : nullptr; if (g && g->format == format && (fetchMetricsOnly || g->data)) return g; @@ -1051,10 +1051,10 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, // If any of the metrics are too large to fit, don't cache them if (areMetricsTooLarge(info)) - return 0; + return nullptr; g = new Glyph; - g->data = 0; + g->data = nullptr; g->linearAdvance = info.linearAdvance; g->width = info.width; g->height = info.height; @@ -1176,12 +1176,12 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer.data(), info.width, info.height, slot->bitmap.pitch, subpixelType != Subpixel_VRGB); } else { qWarning("QFontEngine: Glyph rendered in unknown pixel_mode=%d", slot->bitmap.pixel_mode); - return 0; + return nullptr; } if (!g) { g = new Glyph; - g->data = 0; + g->data = nullptr; } g->linearAdvance = info.linearAdvance; @@ -1357,7 +1357,7 @@ static inline FT_Matrix QTransformToFTMatrix(const QTransform &matrix) QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix) { if (matrix.type() > QTransform::TxShear || !cacheEnabled) - return 0; + return nullptr; // FT_Set_Transform only supports scalable fonts if (!FT_IS_SCALABLE(freetype->face)) @@ -1365,7 +1365,7 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix) FT_Matrix m = QTransformToFTMatrix(matrix); - QGlyphSet *gs = 0; + QGlyphSet *gs = nullptr; for (int i = 0; i < transformedGlyphSets.count(); ++i) { const QGlyphSet &g = transformedGlyphSets.at(i); @@ -1393,7 +1393,7 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix) gs->transformationMatrix = m; gs->outline_drawing = fontDef.pixelSize * fontDef.pixelSize * qAbs(matrix.determinant()) > QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE; } - Q_ASSERT(gs != 0); + Q_ASSERT(gs != nullptr); return gs; } @@ -1401,7 +1401,7 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix) void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) { FT_Face face = lockFace(Unscaled); - FT_Set_Transform(face, 0, 0); + FT_Set_Transform(face, nullptr, nullptr); FT_Load_Glyph(face, glyph, FT_LOAD_NO_BITMAP); int left = face->glyph->metrics.horiBearingX; @@ -1424,7 +1424,7 @@ void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_me else QFreetypeFace::addGlyphToPath(face, face->glyph, p, path, face->units_per_EM << 6, face->units_per_EM << 6); - FT_Set_Transform(face, &freetype->matrix, 0); + FT_Set_Transform(face, &freetype->matrix, nullptr); unlockFace(); } @@ -1622,10 +1622,10 @@ glyph_metrics_t QFontEngineFT::scaledBitmapMetrics(const glyph_metrics_t &m, con void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const { - FT_Face face = 0; + FT_Face face = nullptr; bool design = shouldUseDesignMetrics(flags); for (int i = 0; i < glyphs->numGlyphs; i++) { - Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : 0; + Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : nullptr; // Since we are passing Format_None to loadGlyph, use same default format logic as loadGlyph GlyphFormat acceptableFormat = (defaultFormat != Format_None) ? defaultFormat : Format_Mono; if (g && g->format == acceptableFormat) { @@ -1633,7 +1633,7 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlag } else { if (!face) face = lockFace(); - g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyphs->glyphs[i], 0, Format_None, true); + g = loadGlyph(cacheEnabled ? &defaultGlyphSet : nullptr, glyphs->glyphs[i], 0, Format_None, true); if (g) glyphs->advances[i] = design ? QFixed::fromFixed(g->linearAdvance) : QFixed(g->advance); else @@ -1657,7 +1657,7 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlag glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs) { - FT_Face face = 0; + FT_Face face = nullptr; glyph_metrics_t overall; // initialize with line height, we get the same behaviour on all platforms @@ -1672,11 +1672,11 @@ glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs) QFixed ymax = 0; QFixed xmax = 0; for (int i = 0; i < glyphs.numGlyphs; i++) { - Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i]) : 0; + Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i]) : nullptr; if (!g) { if (!face) face = lockFace(); - g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyphs.glyphs[i], 0, Format_None, true); + g = loadGlyph(cacheEnabled ? &defaultGlyphSet : nullptr, glyphs.glyphs[i], 0, Format_None, true); } if (g) { QFixed x = overall.xoff + glyphs.offsets[i].x + g->x; @@ -1716,12 +1716,12 @@ glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs) glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph) { - FT_Face face = 0; + FT_Face face = nullptr; glyph_metrics_t overall; - Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyph) : 0; + Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyph) : nullptr; if (!g) { face = lockFace(); - g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph, 0, Format_None, true); + g = loadGlyph(cacheEnabled ? &defaultGlyphSet : nullptr, glyph, 0, Format_None, true); } if (g) { overall.x = g->x; @@ -1854,10 +1854,10 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, bool disableOutlineDrawing) { QGlyphSet *glyphSet = loadGlyphSet(t); - if (glyphSet != 0 && glyphSet->outline_drawing && !disableOutlineDrawing && !fetchBoundingBox) - return 0; + if (glyphSet != nullptr && glyphSet->outline_drawing && !disableOutlineDrawing && !fetchBoundingBox) + return nullptr; - Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0; + Glyph *glyph = glyphSet != nullptr ? glyphSet->getGlyph(g, subPixelPosition) : nullptr; if (!glyph || glyph->format != format || (!fetchBoundingBox && !glyph->data)) { QScopedValueRollback saved_default_hint_style(default_hint_style); if (t.type() >= QTransform::TxScale && !is2dRotation(t)) @@ -1865,7 +1865,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, lockFace(); FT_Matrix m = this->matrix; - FT_Matrix ftMatrix = glyphSet != 0 ? glyphSet->transformationMatrix : QTransformToFTMatrix(t); + FT_Matrix ftMatrix = glyphSet != nullptr ? glyphSet->transformationMatrix : QTransformToFTMatrix(t); FT_Matrix_Multiply(&ftMatrix, &m); freetype->matrix = m; glyph = loadGlyph(glyphSet, g, subPixelPosition, format, false, disableOutlineDrawing); @@ -1978,7 +1978,7 @@ FT_Face QFontEngineFT::lockFace(Scaling scale) const freetype->matrix.xy != matrix.xy || freetype->matrix.yx != matrix.yx) { freetype->matrix = matrix; - FT_Set_Transform(face, &freetype->matrix, 0); + FT_Set_Transform(face, &freetype->matrix, nullptr); } return face; @@ -2017,7 +2017,7 @@ void QFontEngineFT::QGlyphSet::clear() for (int i = 0; i < 256; ++i) { if (fast_glyph_data[i]) { delete fast_glyph_data[i]; - fast_glyph_data[i] = 0; + fast_glyph_data[i] = nullptr; } } fast_glyph_count = 0; @@ -2031,7 +2031,7 @@ void QFontEngineFT::QGlyphSet::removeGlyphFromCache(glyph_t index, QFixed subPix if (useFastGlyphData(index, subPixelPosition)) { if (fast_glyph_data[index]) { delete fast_glyph_data[index]; - fast_glyph_data[index] = 0; + fast_glyph_data[index] = nullptr; if (fast_glyph_count > 0) --fast_glyph_count; } @@ -2056,7 +2056,7 @@ int QFontEngineFT::getPointInOutline(glyph_t glyph, int flags, quint32 point, QF lockFace(); bool hsubpixel = true; int vfactor = 1; - int load_flags = loadFlags(0, Format_A8, flags, hsubpixel, vfactor); + int load_flags = loadFlags(nullptr, Format_A8, flags, hsubpixel, vfactor); int result = freetype->getPointInOutline(glyph, load_flags, point, xpos, ypos, nPoints); unlockFace(); return result; @@ -2091,7 +2091,7 @@ QFontEngine *QFontEngineFT::cloneWithSize(qreal pixelSize) const QFontEngineFT *fe = new QFontEngineFT(fontDef); if (!fe->initFromFontEngine(this)) { delete fe; - return 0; + return nullptr; } else { return fe; } diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp index 81bccb1c25..5387214e8c 100644 --- a/src/platformsupport/glxconvenience/qglxconvenience.cpp +++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp @@ -193,7 +193,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format { QXcbSoftwareOpenGLEnforcer softwareOpenGLEnforcer; - GLXFBConfig config = 0; + GLXFBConfig config = nullptr; do { const QVector spec = qglx_buildSpec(format, drawableBit, flags); @@ -273,7 +273,7 @@ XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *f { Q_ASSERT(format); - XVisualInfo *visualInfo = 0; + XVisualInfo *visualInfo = nullptr; GLXFBConfig config = qglx_findConfig(display, screen, *format, false, drawableBit, flags); if (config) diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h index 36d7587457..fde5fd7dbb 100644 --- a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h +++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h @@ -52,7 +52,7 @@ class QIntegrityHIDManager : public QThread { Q_OBJECT public: - QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = 0); + QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = nullptr); ~QIntegrityHIDManager(); void run(void); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index c6b678ab20..8eba9ccc42 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -65,7 +65,7 @@ static QBearerEngineImpl *getEngineFromId(const QString &id) } } - return 0; + return nullptr; } class QNetworkSessionManagerPrivate : public QObject @@ -73,7 +73,7 @@ class QNetworkSessionManagerPrivate : public QObject Q_OBJECT public: - QNetworkSessionManagerPrivate(QObject *parent = 0) : QObject(parent) {} + QNetworkSessionManagerPrivate(QObject *parent = nullptr) : QObject(parent) {} ~QNetworkSessionManagerPrivate() {} inline void forceSessionClose(const QNetworkConfiguration &config) @@ -119,7 +119,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() // Defer setting serviceConfig and activeConfig until open(). Q_FALLTHROUGH(); default: - engine = 0; + engine = nullptr; } networkConfigurationsChanged(); diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index a6029b691c..c92cc3ea61 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp @@ -147,8 +147,8 @@ private: */ QGIFFormat::QGIFFormat() { - globalcmap = 0; - localcmap = 0; + globalcmap = nullptr; + localcmap = nullptr; lncols = 0; gncols = 0; disposal = NoDisposal; @@ -160,9 +160,9 @@ QGIFFormat::QGIFFormat() lcmap = false; newFrame = false; partialNewFrame = false; - table[0] = 0; - table[1] = 0; - stack = 0; + table[0] = nullptr; + table[1] = nullptr; + stack = nullptr; } /*! @@ -550,7 +550,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, } oldcode=incode; const int h = image->height(); - QRgb *line = 0; + QRgb *line = nullptr; if (!out_of_bounds && h > y) line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y); while (sp>stack) { diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index dd01138722..c31e2db3c5 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -729,7 +729,7 @@ static bool write_jpeg_image(const QImage &image, // do_write_jpeg_image (by making them non-local). struct jpeg_compress_struct cinfo; JSAMPROW row_pointer[1]; - row_pointer[0] = 0; + row_pointer[0] = nullptr; const bool success = do_write_jpeg_image(cinfo, row_pointer, image, device, @@ -751,7 +751,7 @@ public: }; QJpegHandlerPrivate(QJpegHandler *qq) - : quality(75), transformation(QImageIOHandler::TransformationNone), iod_src(0), + : quality(75), transformation(QImageIOHandler::TransformationNone), iod_src(nullptr), rgb888ToRgb32ConverterPtr(qt_convert_rgb888_to_rgb32), state(Ready), optimize(false), progressive(false), q(qq) {} @@ -761,7 +761,7 @@ public: { jpeg_destroy_decompress(&info); delete iod_src; - iod_src = 0; + iod_src = nullptr; } } @@ -954,7 +954,7 @@ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device) QByteArray exifData; - for (jpeg_saved_marker_ptr marker = info.marker_list; marker != NULL; marker = marker->next) { + for (jpeg_saved_marker_ptr marker = info.marker_list; marker != nullptr; marker = marker->next) { if (marker->marker == JPEG_COM) { QString key, value; QString s = QString::fromUtf8((const char *)marker->data, marker->data_length); diff --git a/src/plugins/platforms/eglfs/api/qeglfscontext.cpp b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp index c10b6facbb..48fafbda8d 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp @@ -78,7 +78,7 @@ EGLSurface QEglFSContext::createTemporaryOffscreenSurface() } } EGLConfig config = q_configFromGLFormat(eglDisplay(), format()); - return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, 0); + return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, nullptr); } void QEglFSContext::destroyTemporaryOffscreenSurface(EGLSurface surface) diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 22319fcc66..98e05195ee 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -62,7 +62,7 @@ QEglFSCursor::QEglFSCursor(QPlatformScreen *screen) : m_visible(true), m_screen(static_cast(screen)), m_activeScreen(nullptr), - m_deviceListener(0), + m_deviceListener(nullptr), m_updateRequested(false) { QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index d3f51c0d0e..d9a3545a95 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -109,10 +109,10 @@ QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() : m_display(EGL_NO_DISPLAY), - m_inputContext(0), + m_inputContext(nullptr), m_fontDb(new QGenericUnixFontDatabase), m_services(new QGenericUnixServices), - m_kbdMgr(0), + m_kbdMgr(nullptr), m_disableInputHandlers(false) { m_disableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT"); @@ -223,7 +223,7 @@ QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLCo EGLConfig config = QEglFSDeviceIntegration::chooseConfig(dpy, adjustedFormat); ctx = new QEglFSContext(adjustedFormat, share, dpy, &config, QVariant()); } else { - ctx = new QEglFSContext(adjustedFormat, share, dpy, 0, nativeHandle); + ctx = new QEglFSContext(adjustedFormat, share, dpy, nullptr, nativeHandle); } nativeHandle = QVariant::fromValue(QEGLNativeContext(ctx->eglContext(), dpy)); @@ -307,7 +307,7 @@ static int resourceType(const QByteArray &key) void *QEglFSIntegration::nativeResourceForIntegration(const QByteArray &resource) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case EglDisplay: @@ -329,7 +329,7 @@ void *QEglFSIntegration::nativeResourceForIntegration(const QByteArray &resource void *QEglFSIntegration::nativeResourceForScreen(const QByteArray &resource, QScreen *screen) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case XlibDisplay: @@ -347,7 +347,7 @@ void *QEglFSIntegration::nativeResourceForScreen(const QByteArray &resource, QSc void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case EglDisplay: @@ -374,7 +374,7 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi #ifndef QT_NO_OPENGL void *QEglFSIntegration::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case EglContext: @@ -402,7 +402,7 @@ static void *eglContextForContext(QOpenGLContext *context) QEglFSContext *handle = static_cast(context->handle()); if (!handle) - return 0; + return nullptr; return handle->eglContext(); } @@ -416,7 +416,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na #else Q_UNUSED(resource); #endif - return 0; + return nullptr; } QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const diff --git a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp index 864271cd3a..c96e329816 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp @@ -67,7 +67,7 @@ QEglFSOffscreenWindow::QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceF return; } EGLConfig config = q_configFromGLFormat(m_display, m_format); - m_surface = eglCreateWindowSurface(m_display, config, m_window, 0); + m_surface = eglCreateWindowSurface(m_display, config, m_window, nullptr); if (m_surface != EGL_NO_SURFACE) m_format = q_glFormatFromConfig(m_display, config); } diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index 11b68c0589..8a8e8cd563 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QEglFSScreen::QEglFSScreen(EGLDisplay dpy) : m_dpy(dpy), m_surface(EGL_NO_SURFACE), - m_cursor(0) + m_cursor(nullptr) { m_cursor = qt_egl_device_integration()->createCursor(this); } @@ -164,7 +164,7 @@ void QEglFSScreen::handleCursorMove(const QPoint &pos) return; } - QWindow *enter = 0, *leave = 0; + QWindow *enter = nullptr, *leave = nullptr; for (int i = windows.count() - 1; i >= 0; --i) { QWindow *window = windows[i]->sourceWindow(); const QRect geom = window->geometry(); diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 3457be116a..f7e116eb88 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -61,8 +61,8 @@ QT_BEGIN_NAMESPACE QEglFSWindow::QEglFSWindow(QWindow *w) : QPlatformWindow(w), #ifndef QT_NO_OPENGL - m_backingStore(0), - m_rasterCompositingContext(0), + m_backingStore(nullptr), + m_rasterCompositingContext(nullptr), #endif m_winId(0), m_surface(EGL_NO_SURFACE), @@ -207,7 +207,7 @@ void QEglFSWindow::resetSurface() m_format = q_glFormatFromConfig(display, m_config, platformFormat); const QSize surfaceSize = screen()->rawGeometry().size(); m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format); - m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL); + m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr); } void QEglFSWindow::setVisible(bool visible) @@ -337,7 +337,7 @@ const QPlatformTextureList *QEglFSWindow::textures() const if (m_backingStore) return m_backingStore->textures(); - return 0; + return nullptr; } void QEglFSWindow::endCompositing() diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp index 1125bcb390..dc98cdce4b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp @@ -69,7 +69,7 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen) : m_screen(screen) , m_cursorSize(64, 64) // 64x64 is the old standard size, we now try to query the real size below , m_bo(nullptr) - , m_cursorImage(0, 0, 0, 0, 0, 0) + , m_cursorImage(nullptr, nullptr, 0, 0, 0, 0) , m_state(CursorPendingVisible) , m_deviceListener(nullptr) { @@ -102,7 +102,7 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen) #ifndef QT_NO_CURSOR QCursor cursor(Qt::ArrowCursor); - changeCursor(&cursor, 0); + changeCursor(&cursor, nullptr); #endif setPos(QPoint(0, 0)); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp index 07b2de7c58..ce5a721906 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp @@ -75,7 +75,7 @@ void EventReader::run() if (client->format == 32 && client->type == atoms[Atoms::WM_PROTOCOLS] && client->data.data32[0] == atoms[Atoms::WM_DELETE_WINDOW]) { - QWindow *window = m_integration->platformWindow() ? m_integration->platformWindow()->window() : 0; + QWindow *window = m_integration->platformWindow() ? m_integration->platformWindow()->window() : nullptr; if (window) QWindowSystemInterface::handleCloseEvent(window); } @@ -106,7 +106,7 @@ void QEglFSX11Integration::sendConnectionEvent(xcb_atom_t a) void QEglFSX11Integration::platformInit() { - m_display = XOpenDisplay(0); + m_display = XOpenDisplay(nullptr); if (Q_UNLIKELY(!m_display)) qFatal("Could not open display"); @@ -121,7 +121,7 @@ void QEglFSX11Integration::platformInit() xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_connectionEventListener, it.data->root, 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY, - it.data->root_visual, 0, 0); + it.data->root_visual, 0, nullptr); m_eventReader = new EventReader(this); m_eventReader->start(); @@ -135,11 +135,11 @@ void QEglFSX11Integration::platformDestroy() m_eventReader->wait(); delete m_eventReader; - m_eventReader = 0; + m_eventReader = nullptr; XCloseDisplay(DISPLAY); - m_display = 0; - m_connection = 0; + m_display = nullptr; + m_connection = nullptr; } EGLNativeDisplayType QEglFSX11Integration::platformDisplay() const @@ -175,7 +175,7 @@ EGLNativeWindowType QEglFSX11Integration::createNativeWindow(QPlatformWindow *pl xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_window, it.data->root, 0, 0, size.width(), size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, it.data->root_visual, - 0, 0); + 0, nullptr); xcb_intern_atom_cookie_t cookies[Atoms::N_ATOMS]; static const char *atomNames[Atoms::N_ATOMS] = { @@ -189,7 +189,7 @@ EGLNativeWindowType QEglFSX11Integration::createNativeWindow(QPlatformWindow *pl for (int i = 0; i < Atoms::N_ATOMS; ++i) { cookies[i] = xcb_intern_atom(m_connection, false, strlen(atomNames[i]), atomNames[i]); - xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i], 0); + xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i], nullptr); m_atoms[i] = reply->atom; free(reply); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h index bf431caaac..ebcc19b682 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h @@ -67,7 +67,7 @@ class EventReader; class QEglFSX11Integration : public QEglFSDeviceIntegration { public: - QEglFSX11Integration() : m_connection(0), m_window(0), m_eventReader(0) {} + QEglFSX11Integration() : m_connection(nullptr), m_window(0), m_eventReader(nullptr) {} void platformInit() override; void platformDestroy() override; diff --git a/src/plugins/platforms/eglfs/qeglfsmain.cpp b/src/plugins/platforms/eglfs/qeglfsmain.cpp index 4f77b7cd17..b41bbec27d 100644 --- a/src/plugins/platforms/eglfs/qeglfsmain.cpp +++ b/src/plugins/platforms/eglfs/qeglfsmain.cpp @@ -56,7 +56,7 @@ QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, con if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) return new QEglFSIntegration; - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp index 207db60f3a..f364d9f004 100644 --- a/src/plugins/platforms/offscreen/main.cpp +++ b/src/plugins/platforms/offscreen/main.cpp @@ -57,7 +57,7 @@ QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, if (!system.compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) return QOffscreenIntegration::createOffscreenIntegration(); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp index eae25012c1..de75a3e012 100644 --- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp +++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -QPlatformWindow *QOffscreenScreen::windowContainingCursor = 0; +QPlatformWindow *QOffscreenScreen::windowContainingCursor = nullptr; class QOffscreenCursor : public QPlatformCursor { @@ -60,7 +60,7 @@ public: { m_pos = pos; const QWindowList wl = QGuiApplication::topLevelWindows(); - QWindow *containing = 0; + QWindow *containing = nullptr; for (QWindow *w : wl) { if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(pos)) { containing = w; @@ -72,7 +72,7 @@ public: if (containing) local -= containing->position(); - QWindow *previous = QOffscreenScreen::windowContainingCursor ? QOffscreenScreen::windowContainingCursor->window() : 0; + QWindow *previous = QOffscreenScreen::windowContainingCursor ? QOffscreenScreen::windowContainingCursor->window() : nullptr; if (containing != previous) QWindowSystemInterface::handleEnterLeaveEvent(containing, previous, local, pos); @@ -80,7 +80,7 @@ public: QWindowSystemInterface::handleMouseEvent(containing, local, pos, QGuiApplication::mouseButtons(), Qt::NoButton, QEvent::MouseMove, QGuiApplication::keyboardModifiers(), Qt::MouseEventSynthesizedByQt); - QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0; + QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : nullptr; } #ifndef QT_NO_CURSOR void changeCursor(QCursor *windowCursor, QWindow *window) override @@ -106,7 +106,7 @@ QPixmap QOffscreenScreen::grabWindow(WId id, int x, int y, int width, int height QOffscreenWindow *window = QOffscreenWindow::windowForWinId(id); if (!window || window->window()->type() == Qt::Desktop) { const QWindowList wl = QGuiApplication::topLevelWindows(); - QWindow *containing = 0; + QWindow *containing = nullptr; for (QWindow *w : wl) { if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(rect)) { containing = w; diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp index 869e9228cd..3a4494fc2e 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -79,7 +79,7 @@ template class QOffscreenEventDispatcher : public BaseEventDispatcher { public: - explicit QOffscreenEventDispatcher(QObject *parent = 0) + explicit QOffscreenEventDispatcher(QObject *parent = nullptr) : BaseEventDispatcher(parent) { } diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp index 92fc8aa57a..84991d751f 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp @@ -206,7 +206,7 @@ QOffscreenX11GLXContext::QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGL if (d->format.renderableType() != QSurfaceFormat::OpenGL) return; - d->shareContext = 0; + d->shareContext = nullptr; if (context->shareHandle()) d->shareContext = static_cast(context->shareHandle())->d->context; @@ -216,9 +216,9 @@ QOffscreenX11GLXContext::QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGL if (config) { d->context = glXCreateNewContext(x11->display(), config, GLX_RGBA_TYPE, d->shareContext, true); if (!d->context && d->shareContext) { - d->shareContext = 0; + d->shareContext = nullptr; // re-try without a shared glx context - d->context = glXCreateNewContext(x11->display(), config, GLX_RGBA_TYPE, 0, true); + d->context = glXCreateNewContext(x11->display(), config, GLX_RGBA_TYPE, nullptr, true); } // Get the basic surface format details @@ -234,8 +234,8 @@ QOffscreenX11GLXContext::QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGL d->context = glXCreateContext(x11->display(), visualInfo, d->shareContext, true); if (!d->context && d->shareContext) { // re-try without a shared glx context - d->shareContext = 0; - d->context = glXCreateContext(x11->display(), visualInfo, 0, true); + d->shareContext = nullptr; + d->context = glXCreateContext(x11->display(), visualInfo, nullptr, true); } d->window = createDummyWindow(x11, visualInfo); @@ -269,7 +269,7 @@ bool QOffscreenX11GLXContext::makeCurrent(QPlatformSurface *surface) void QOffscreenX11GLXContext::doneCurrent() { - glXMakeCurrent(d->x11->display(), 0, 0); + glXMakeCurrent(d->x11->display(), 0, nullptr); } void QOffscreenX11GLXContext::swapBuffers(QPlatformSurface *) diff --git a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp index 832e94034d..53880c877e 100644 --- a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp @@ -69,7 +69,7 @@ QOffscreenWindow::QOffscreenWindow(QWindow *window) QOffscreenWindow::~QOffscreenWindow() { if (QOffscreenScreen::windowContainingCursor == this) - QOffscreenScreen::windowContainingCursor = 0; + QOffscreenScreen::windowContainingCursor = nullptr; m_windowForWinIdHash.remove(m_winId); } diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index 3ec0f0b78d..ac7e18e03f 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -56,7 +56,7 @@ QPlatformIntegration* QVncIntegrationPlugin::create(const QString& system, const if (!system.compare(QLatin1String("vnc"), Qt::CaseInsensitive)) return new QVncIntegration(paramList); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp index 32114c6443..8390fa19cd 100644 --- a/src/plugins/platforms/vnc/qvnc.cpp +++ b/src/plugins/platforms/vnc/qvnc.cpp @@ -537,7 +537,7 @@ QVncClientCursor::QVncClientCursor() { QWindow *w = QGuiApplication::focusWindow(); QCursor c = w ? w->cursor() : QCursor(Qt::ArrowCursor); - changeCursor(&c, 0); + changeCursor(&c, nullptr); } QVncClientCursor::~QVncClientCursor() @@ -595,7 +595,7 @@ void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window) cursor = widgetCursor->pixmap().toImage(); } else { // system cursor - QPlatformCursorImage platformImage(0, 0, 0, 0, 0, 0); + QPlatformCursorImage platformImage(nullptr, nullptr, 0, 0, 0, 0); platformImage.set(shape); cursor = *platformImage.image(); hotspot = platformImage.hotspot(); diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp index 2450f7dad5..c5caddc58d 100644 --- a/src/plugins/platforms/vnc/qvncclient.cpp +++ b/src/plugins/platforms/vnc/qvncclient.cpp @@ -617,7 +617,7 @@ void QVncClient::keyEvent() m_keymod = ev.down ? m_keymod | Qt::AltModifier : m_keymod & ~Qt::AltModifier; if (ev.unicode || ev.keycode) - QWindowSystemInterface::handleKeyEvent(0, ev.down ? QEvent::KeyPress : QEvent::KeyRelease, ev.keycode, m_keymod, QString(ev.unicode)); + QWindowSystemInterface::handleKeyEvent(nullptr, ev.down ? QEvent::KeyPress : QEvent::KeyRelease, ev.keycode, m_keymod, QString(ev.unicode)); m_handleMsg = false; } } diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp index 2eca18fb4d..5dc3919ff5 100644 --- a/src/plugins/platforms/vnc/qvncscreen.cpp +++ b/src/plugins/platforms/vnc/qvncscreen.cpp @@ -101,7 +101,7 @@ bool QVncScreen::initialize() default: qWarning("QVNCScreen::initDevice: No support for screen depth %d", depth()); - dirty = 0; + dirty = nullptr; return false; } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h index c3ce8d8745..fda53f17a1 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h @@ -52,7 +52,7 @@ class QXcbEglContext : public QEGLPlatformContext public: QXcbEglContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share, EGLDisplay display, const QVariant &nativeHandle) - : QEGLPlatformContext(glFormat, share, display, 0, nativeHandle) + : QEGLPlatformContext(glFormat, share, display, nullptr, nativeHandle) { } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp index 65beac227c..30e3381993 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp @@ -93,7 +93,7 @@ void QXcbEglWindow::create() { QXcbWindow::create(); - m_surface = eglCreateWindowSurface(m_glIntegration->eglDisplay(), m_config, m_window, 0); + m_surface = eglCreateWindowSurface(m_glIntegration->eglDisplay(), m_config, m_window, nullptr); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 2b77062b16..57805d5571 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -223,13 +223,13 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat const QVariant &nativeHandle) : QPlatformOpenGLContext() , m_display(static_cast(screen->connection()->xlib_display())) - , m_config(0) - , m_context(0) - , m_shareContext(0) + , m_config(nullptr) + , m_context(nullptr) + , m_shareContext(nullptr) , m_format(format) , m_isPBufferCurrent(false) , m_ownsContext(nativeHandle.isNull()) - , m_getGraphicsResetStatus(0) + , m_getGraphicsResetStatus(nullptr) , m_lost(false) { if (nativeHandle.isNull()) @@ -254,14 +254,14 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share) GLXFBConfig config = qglx_findConfig(m_display, screen->screenNumber(), m_format); m_config = config; - XVisualInfo *visualInfo = 0; + XVisualInfo *visualInfo = nullptr; Window window = 0; // Temporary window used to query OpenGL context if (config) { const QByteArrayList glxExt = QByteArray(glXQueryExtensionsString(m_display, screen->screenNumber())).split(' '); // Resolve entry point for glXCreateContextAttribsARB - glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0; + glXCreateContextAttribsARBProc glXCreateContextAttribsARB = nullptr; if (glxExt.contains("GLX_ARB_create_context")) glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); @@ -271,7 +271,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share) // Use glXCreateContextAttribsARB if available // Also, GL ES context creation requires GLX_EXT_create_context_es2_profile - if (glXCreateContextAttribsARB != 0 + if (glXCreateContextAttribsARB != nullptr && (m_format.renderableType() != QSurfaceFormat::OpenGLES || (supportsProfiles && glxExt.contains("GLX_EXT_create_context_es2_profile")))) { // Try to create an OpenGL context for each known OpenGL version in descending // order from the requested version. @@ -358,9 +358,9 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share) m_context = glXCreateContextAttribsARB(m_display, config, m_shareContext, true, contextAttributes.data()); if (!m_context && m_shareContext) { // re-try without a shared glx context - m_context = glXCreateContextAttribsARB(m_display, config, 0, true, contextAttributes.data()); + m_context = glXCreateContextAttribsARB(m_display, config, nullptr, true, contextAttributes.data()); if (m_context) - m_shareContext = 0; + m_shareContext = nullptr; } } } @@ -375,9 +375,9 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share) m_context = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, m_shareContext, true); if (!m_context && m_shareContext) { // re-try without a shared glx context - m_context = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, 0, true); + m_context = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, nullptr, true); if (m_context) - m_shareContext = 0; + m_shareContext = nullptr; } } @@ -399,7 +399,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share) m_context = glXCreateContext(m_display, visualInfo, m_shareContext, true); if (!m_context && m_shareContext) { // re-try without a shared glx context - m_shareContext = 0; + m_shareContext = nullptr; m_context = glXCreateContext(m_display, visualInfo, nullptr, true); } @@ -444,7 +444,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share, const // Legacy contexts created using glXCreateContext are created using a visual // and the FBConfig cannot be queried. The only way to adapt these contexts // is to figure out the visual id. - XVisualInfo *vinfo = 0; + XVisualInfo *vinfo = nullptr; // If the VisualID is provided use it. VisualID vid = handle.visualId(); if (!vid) { @@ -464,13 +464,13 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share, const vinfo = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask, &v, &n); if (n < 1) { XFree(vinfo); - vinfo = 0; + vinfo = nullptr; } } // For contexts created with an FBConfig using the modern functions providing the // visual or window is not mandatory. Just query the config from the context. - GLXFBConfig config = 0; + GLXFBConfig config = nullptr; if (!vinfo) { int configId = 0; if (glXQueryContext(dpy, context, GLX_FBCONFIG_ID, &configId) != Success) { @@ -595,8 +595,8 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface) if (interval >= 0 && interval != window->swapInterval() && screen) { typedef void (*qt_glXSwapIntervalEXT)(Display *, GLXDrawable, int); typedef void (*qt_glXSwapIntervalMESA)(unsigned int); - static qt_glXSwapIntervalEXT glXSwapIntervalEXT = 0; - static qt_glXSwapIntervalMESA glXSwapIntervalMESA = 0; + static qt_glXSwapIntervalEXT glXSwapIntervalEXT = nullptr; + static qt_glXSwapIntervalMESA glXSwapIntervalMESA = nullptr; static bool resolved = false; if (!resolved) { resolved = true; @@ -621,9 +621,9 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface) void QGLXContext::doneCurrent() { if (m_isPBufferCurrent) - glXMakeContextCurrent(m_display, 0, 0, 0); + glXMakeContextCurrent(m_display, 0, 0, nullptr); else - glXMakeCurrent(m_display, 0, 0); + glXMakeCurrent(m_display, 0, nullptr); m_isPBufferCurrent = false; } @@ -658,12 +658,12 @@ QSurfaceFormat QGLXContext::format() const bool QGLXContext::isSharing() const { - return m_shareContext != 0; + return m_shareContext != nullptr; } bool QGLXContext::isValid() const { - return m_context != 0 && !m_lost; + return m_context != nullptr && !m_lost; } bool QGLXContext::m_queriedDummyContext = false; @@ -675,7 +675,7 @@ bool QGLXContext::m_supportsThreading = true; // binary search. static const char *qglx_threadedgl_blacklist_renderer[] = { "Chromium", // QTBUG-32225 (initialization fails) - 0 + nullptr }; static const char *qglx_threadedgl_blacklist_vendor[] = { @@ -695,7 +695,7 @@ void QGLXContext::queryDummyContext() return; QOpenGLContext *oldContext = QOpenGLContext::currentContext(); - QSurface *oldSurface = 0; + QSurface *oldSurface = nullptr; if (oldContext) oldSurface = oldContext->surface(); @@ -732,7 +732,7 @@ void QGLXContext::queryDummyContext() if (const char *renderer = (const char *) glGetString(GL_RENDERER)) { for (int i = 0; qglx_threadedgl_blacklist_renderer[i]; ++i) { - if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != 0) { + if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != nullptr) { qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: " "blacklisted renderer \"" << qglx_threadedgl_blacklist_renderer[i] @@ -744,7 +744,7 @@ void QGLXContext::queryDummyContext() } if (const char *vendor = (const char *) glGetString(GL_VENDOR)) { for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) { - if (strstr(vendor, qglx_threadedgl_blacklist_vendor[i]) != 0) { + if (strstr(vendor, qglx_threadedgl_blacklist_vendor[i]) != nullptr) { qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: " "blacklisted vendor \"" << qglx_threadedgl_blacklist_vendor[i] @@ -759,7 +759,7 @@ void QGLXContext::queryDummyContext() // Blacklist Mesa drivers due to QTCREATORBUG-10875 (crash in creator), // QTBUG-34492 (flickering in fullscreen) and QTBUG-38221 const char *mesaVersionStr = nullptr; - if (strstr(glxvendor, "Mesa Project") != 0) { + if (strstr(glxvendor, "Mesa Project") != nullptr) { mesaVersionStr = (const char *) glGetString(GL_VERSION); m_supportsThreading = false; } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index 34895caaa2..6814dbd844 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -133,7 +133,7 @@ bool QXcbGlxIntegration::handleXcbEvent(xcb_generic_event_t *event, uint respons Display *xdisplay = static_cast(m_connection->xlib_display()); XLockDisplay(xdisplay); bool locked = true; - Bool (*proc)(Display*, XEvent*, xEvent*) = XESetWireToEvent(xdisplay, responseType, 0); + Bool (*proc)(Display*, XEvent*, xEvent*) = XESetWireToEvent(xdisplay, responseType, nullptr); if (proc) { XESetWireToEvent(xdisplay, responseType, proc); XEvent dummy; @@ -212,7 +212,7 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO if (glxPbufferUsable) return new QGLXPbuffer(surface); else - return 0; // trigger fallback to hidden QWindow + return nullptr; // trigger fallback to hidden QWindow } diff --git a/src/plugins/platforms/xcb/qxcbatom.cpp b/src/plugins/platforms/xcb/qxcbatom.cpp index ecb73cb90b..79b5ba06e6 100644 --- a/src/plugins/platforms/xcb/qxcbatom.cpp +++ b/src/plugins/platforms/xcb/qxcbatom.cpp @@ -265,7 +265,7 @@ void QXcbAtom::initializeAllAtoms(xcb_connection_t *connection) { cookies[i] = xcb_intern_atom(connection, false, strlen(names[i]), names[i]); for (i = 0; i < QXcbAtom::NAtoms; ++i) { - xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookies[i], 0); + xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookies[i], nullptr); m_allAtoms[i] = reply->atom; free(reply); } diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 741317d766..8f55bc2e96 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -229,7 +229,7 @@ void QXcbBackingStoreImage::resize(const QSize &size) m_xcb_format->bits_per_pixel, 0, byteOrder, XCB_IMAGE_ORDER_MSB_FIRST, - 0, ~0, 0); + nullptr, ~0, nullptr); const size_t segmentSize = imageDataSize(m_xcb_image); @@ -412,13 +412,13 @@ bool QXcbBackingStoreImage::createSystemVShmSegment(xcb_connection_t *c, size_t return false; } - void *addr = shmat(id, 0, 0); + void *addr = shmat(id, nullptr, 0); if (addr == (void *)-1) { qCWarning(lcQpaXcb, "shmat() failed (%d: %s) for id %d", errno, strerror(errno), id); return false; } - if (shmctl(id, IPC_RMID, 0) == -1) + if (shmctl(id, IPC_RMID, nullptr) == -1) qCWarning(lcQpaXcb, "Error while marking the shared memory segment to be destroyed"); const auto seg = xcb_generate_id(c); @@ -780,7 +780,7 @@ QXcbBackingStore::~QXcbBackingStore() QPaintDevice *QXcbBackingStore::paintDevice() { if (!m_image) - return 0; + return nullptr; return m_rgbImage.isNull() ? m_image->image() : &m_rgbImage; } @@ -1036,7 +1036,7 @@ void QXcbSystemTrayBackingStore::recreateImage(QXcbWindow *win, const QSize &siz xcb_create_pixmap(xcb_connection(), 32, m_xrenderPixmap, screen->root(), size.width(), size.height()); m_xrenderPicture = xcb_generate_id(xcb_connection()); - xcb_render_create_picture(xcb_connection(), m_xrenderPicture, m_xrenderPixmap, m_xrenderPictFormat, 0, 0); + xcb_render_create_picture(xcb_connection(), m_xrenderPicture, m_xrenderPixmap, m_xrenderPictFormat, 0, nullptr); // XRender expects premultiplied alpha if (m_image) @@ -1077,7 +1077,7 @@ void QXcbSystemTrayBackingStore::initXRenderMode() m_windowPicture = xcb_generate_id(conn); xcb_void_cookie_t cookie = - xcb_render_create_picture_checked(conn, m_windowPicture, platformWindow->xcb_window(), vfmt->format, 0, 0); + xcb_render_create_picture_checked(conn, m_windowPicture, platformWindow->xcb_window(), vfmt->format, 0, nullptr); xcb_generic_error_t *error = xcb_request_check(conn, cookie); if (error) { qWarning("QXcbSystemTrayBackingStore: Failed to create Picture with format %x for window %x, error code %d", diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index 2cb6720d40..c2d9d060fb 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -226,8 +226,8 @@ QXcbClipboard::QXcbClipboard(QXcbConnection *c) { Q_ASSERT(QClipboard::Clipboard == 0); Q_ASSERT(QClipboard::Selection == 1); - m_clientClipboard[QClipboard::Clipboard] = 0; - m_clientClipboard[QClipboard::Selection] = 0; + m_clientClipboard[QClipboard::Clipboard] = nullptr; + m_clientClipboard[QClipboard::Selection] = nullptr; m_timestamp[QClipboard::Clipboard] = XCB_CURRENT_TIME; m_timestamp[QClipboard::Selection] = XCB_CURRENT_TIME; m_owner = connection()->getQtSelectionOwner(); @@ -316,7 +316,7 @@ QClipboard::Mode QXcbClipboard::modeForAtom(xcb_atom_t a) const QMimeData * QXcbClipboard::mimeData(QClipboard::Mode mode) { if (mode > QClipboard::Selection) - return 0; + return nullptr; xcb_window_t clipboardOwner = getSelectionOwner(atomForMode(mode)); if (clipboardOwner == owner()) { @@ -334,7 +334,7 @@ void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) if (mode > QClipboard::Selection) return; - QXcbClipboardMime *xClipboard = 0; + QXcbClipboardMime *xClipboard = nullptr; // verify if there is data to be cleared on global X Clipboard. if (!data) { xClipboard = qobject_cast(mimeData(mode)); @@ -353,7 +353,7 @@ void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) if (m_clientClipboard[mode]) { if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection]) delete m_clientClipboard[mode]; - m_clientClipboard[mode] = 0; + m_clientClipboard[mode] = nullptr; m_timestamp[mode] = XCB_CURRENT_TIME; } @@ -416,7 +416,7 @@ xcb_window_t QXcbClipboard::requestor() const XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class platformScreen->screen()->root_visual, // visual 0, // value mask - 0); // value list + nullptr); // value list QXcbWindow::setWindowTitle(connection(), window, QStringLiteral("Qt Clipboard Requestor Window")); @@ -529,7 +529,7 @@ void QXcbClipboard::handleSelectionClearRequest(xcb_selection_clear_event_t *eve if (newOwner != XCB_NONE) { if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection]) delete m_clientClipboard[mode]; - m_clientClipboard[mode] = 0; + m_clientClipboard[mode] = nullptr; m_timestamp[mode] = XCB_CURRENT_TIME; } } @@ -576,7 +576,7 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req) xcb_atom_t multipleAtom = atom(QXcbAtom::MULTIPLE); xcb_atom_t timestampAtom = atom(QXcbAtom::TIMESTAMP); - struct AtomPair { xcb_atom_t target; xcb_atom_t property; } *multi = 0; + struct AtomPair { xcb_atom_t target; xcb_atom_t property; } *multi = nullptr; xcb_atom_t multi_type = XCB_NONE; int multi_format = 0; int nmulti = 0; @@ -587,7 +587,7 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req) QByteArray multi_data; if (req->property == XCB_NONE || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, - 0, &multi_type, &multi_format) + nullptr, &multi_type, &multi_format) || multi_format != 32) { // MULTIPLE property not formatted correctly xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event); @@ -842,7 +842,7 @@ QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb continue; prev_time = event->time; - if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, nullptr, nullptr)) { if (length == 0) { // no more data, we're done if (nullterm) { buf.resize(offset+1); @@ -900,7 +900,7 @@ QByteArray QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target, return buf; xcb_atom_t type; - if (clipboardReadProperty(win, property, true, &buf, 0, &type, 0)) { + if (clipboardReadProperty(win, property, true, &buf, nullptr, &type, nullptr)) { if (type == atom(QXcbAtom::INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; buf = clipboardReadIncrementalProperty(win, property, nbytes, false); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index cbc930387f..435c4aee93 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -184,7 +184,7 @@ QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id) QXcbWindowEventListener *listener = m_mapper.value(id, 0); if (listener) return listener->toWindow(); - return 0; + return nullptr; } #define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \ @@ -803,7 +803,7 @@ xcb_window_t QXcbConnection::getQtSelectionOwner() XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class xcbScreen->root_visual, // visual 0, // value mask - 0); // value list + nullptr); // value list QXcbWindow::setWindowTitle(connection(), m_qtSelectionOwner, QLatin1String("Qt Selection Owner for ") + QCoreApplication::applicationName()); @@ -830,7 +830,7 @@ xcb_window_t QXcbConnection::clientLeader() 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->screen()->root_visual, - 0, 0); + 0, nullptr); QXcbWindow::setWindowTitle(connection(), m_clientLeader, @@ -1031,7 +1031,7 @@ void QXcbConnection::sync() { // from xcb_aux_sync xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus(xcb_connection()); - free(xcb_get_input_focus_reply(xcb_connection(), cookie, 0)); + free(xcb_get_input_focus_reply(xcb_connection(), cookie, nullptr)); } QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const @@ -1049,14 +1049,14 @@ QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const Qt::MouseButtons QXcbConnection::queryMouseButtons() const { int stateMask = 0; - QXcbCursor::queryPointer(connection(), 0, 0, &stateMask); + QXcbCursor::queryPointer(connection(), nullptr, nullptr, &stateMask); return translateMouseButtons(stateMask); } Qt::KeyboardModifiers QXcbConnection::queryKeyboardModifiers() const { int stateMask = 0; - QXcbCursor::queryPointer(connection(), 0, 0, &stateMask); + QXcbCursor::queryPointer(connection(), nullptr, nullptr, &stateMask); return keyboard()->translateModifiers(stateMask); } @@ -1114,7 +1114,7 @@ void QXcbSyncWindowRequest::invalidate() { if (m_window) { m_window->clearSyncWindowRequest(); - m_window = 0; + m_window = nullptr; } } @@ -1134,7 +1134,7 @@ void QXcbConnectionGrabber::release() { if (m_connection) { m_connection->ungrabServer(); - m_connection = 0; + m_connection = nullptr; } } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 62c5e5d79e..2d89b971dc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -127,7 +127,7 @@ class Q_XCB_EXPORT QXcbConnection : public QXcbBasicConnection { Q_OBJECT public: - QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName = 0); + QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName = nullptr); ~QXcbConnection(); QXcbConnection *connection() const { return const_cast(this); } diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp index 1ba4b4a1b9..18dee89adb 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp @@ -93,7 +93,7 @@ static int nullErrorHandler(Display *dpy, XErrorEvent *err) static int ioErrorHandler(Display *dpy) { xcb_connection_t *conn = XGetXCBConnection(dpy); - if (conn != NULL) { + if (conn != nullptr) { /* Print a message with a textual description of the error */ int code = xcb_connection_has_error(conn); const char *str = "Unknown error"; @@ -134,7 +134,7 @@ QXcbBasicConnection::QXcbBasicConnection(const char *displayName) xcb_extension_t *extensions[] = { &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id, - &xcb_render_id, &xcb_xkb_id, &xcb_input_id, 0 + &xcb_render_id, &xcb_xkb_id, &xcb_input_id, nullptr }; for (xcb_extension_t **ext_it = extensions; *ext_it; ++ext_it) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index fdf59c5ef4..bd62460b96 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -166,7 +166,7 @@ void QXcbConnection::xi2SetupDevice(void *info, bool removeExisting) } case XCB_INPUT_DEVICE_CLASS_TYPE_BUTTON: { auto *bci = reinterpret_cast(classinfo); - xcb_atom_t *labels = 0; + xcb_atom_t *labels = nullptr; if (bci->num_buttons >= 5) { labels = xcb_input_button_class_labels(bci); xcb_atom_t label4 = labels[3]; @@ -527,7 +527,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) int sourceDeviceId = xiEvent->deviceid; // may be the master id qt_xcb_input_device_event_t *xiDeviceEvent = nullptr; xcb_input_enter_event_t *xiEnterEvent = nullptr; - QXcbWindowEventListener *eventListener = 0; + QXcbWindowEventListener *eventListener = nullptr; switch (xiEvent->event_type) { case XCB_INPUT_BUTTON_PRESS: diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index fbadab4d50..639e4f039c 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -67,10 +67,10 @@ enum { }; #undef CursorShape -static PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor = 0; -static PtrXcursorLibraryGetTheme ptrXcursorLibraryGetTheme = 0; -static PtrXcursorLibrarySetTheme ptrXcursorLibrarySetTheme = 0; -static PtrXcursorLibraryGetDefaultSize ptrXcursorLibraryGetDefaultSize = 0; +static PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor = nullptr; +static PtrXcursorLibraryGetTheme ptrXcursorLibraryGetTheme = nullptr; +static PtrXcursorLibrarySetTheme ptrXcursorLibrarySetTheme = nullptr; +static PtrXcursorLibraryGetDefaultSize ptrXcursorLibraryGetDefaultSize = nullptr; #endif static xcb_font_t cursorFont = 0; @@ -118,7 +118,7 @@ static const uint8_t mcur_fdiag_bits[] = { static const uint8_t *cursor_bits16[] = { cur_ver_bits, mcur_ver_bits, cur_hor_bits, mcur_hor_bits, cur_bdiag_bits, mcur_bdiag_bits, cur_fdiag_bits, mcur_fdiag_bits, - 0, 0, cur_blank_bits, cur_blank_bits }; + nullptr, nullptr, cur_blank_bits, cur_blank_bits }; static const uint8_t vsplit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -219,7 +219,7 @@ static const uint8_t busym_bits[] = { static const uint8_t * const cursor_bits32[] = { vsplit_bits, vsplitm_bits, hsplit_bits, hsplitm_bits, - 0, 0, 0, 0, whatsthis_bits, whatsthism_bits, busy_bits, busym_bits + nullptr, nullptr, nullptr, nullptr, whatsthis_bits, whatsthism_bits, busy_bits, busym_bits }; static const uint8_t forbidden_bits[] = { @@ -452,19 +452,19 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) if (cshape == Qt::BlankCursor) { xcb_pixmap_t cp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, - 1, 0, 0, 0); + 1, 0, 0, nullptr); xcb_pixmap_t mp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, - 1, 0, 0, 0); + 1, 0, 0, nullptr); cursor = xcb_generate_id(conn); xcb_create_cursor(conn, cursor, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); } else if (cshape >= Qt::SizeVerCursor && cshape < Qt::SizeAllCursor) { int i = (cshape - Qt::SizeVerCursor) * 2; xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(cursor_bits16[i]), - 16, 16, 1, 0, 0, 0); + 16, 16, 1, 0, 0, nullptr); xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(cursor_bits16[i + 1]), - 16, 16, 1, 0, 0, 0); + 16, 16, 1, 0, 0, nullptr); cursor = xcb_generate_id(conn); xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); } else if ((cshape >= Qt::SplitVCursor && cshape <= Qt::SplitHCursor) @@ -472,10 +472,10 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) int i = (cshape - Qt::SplitVCursor) * 2; xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(cursor_bits32[i]), - 32, 32, 1, 0, 0, 0); + 32, 32, 1, 0, 0, nullptr); xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(cursor_bits32[i + 1]), - 32, 32, 1, 0, 0, 0); + 32, 32, 1, 0, 0, nullptr); int hs = (cshape == Qt::PointingHandCursor || cshape == Qt::WhatsThisCursor || cshape == Qt::BusyCursor) ? 0 : 16; cursor = xcb_generate_id(conn); @@ -484,20 +484,20 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) int i = (cshape - Qt::ForbiddenCursor) * 2; xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(cursor_bits20[i]), - 20, 20, 1, 0, 0, 0); + 20, 20, 1, 0, 0, nullptr); xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(cursor_bits20[i + 1]), - 20, 20, 1, 0, 0, 0); + 20, 20, 1, 0, 0, nullptr); cursor = xcb_generate_id(conn); xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 10, 10); } else if (cshape == Qt::OpenHandCursor || cshape == Qt::ClosedHandCursor) { bool open = cshape == Qt::OpenHandCursor; xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(open ? openhand_bits : closedhand_bits), - 16, 16, 1, 0, 0, 0); + 16, 16, 1, 0, 0, nullptr); xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), const_cast(open ? openhandm_bits : closedhandm_bits), - 16, 16, 1, 0, 0, 0); + 16, 16, 1, 0, 0, nullptr); cursor = xcb_generate_id(conn); xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); } else if (cshape == Qt::DragCopyCursor || cshape == Qt::DragMoveCursor @@ -660,14 +660,14 @@ void QXcbCursor::queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDes QPoint QXcbCursor::pos() const { QPoint p; - queryPointer(connection(), 0, &p); + queryPointer(connection(), nullptr, &p); return p; } void QXcbCursor::setPos(const QPoint &pos) { QXcbVirtualDesktop *virtualDesktop = nullptr; - queryPointer(connection(), &virtualDesktop, 0); + queryPointer(connection(), &virtualDesktop, nullptr); xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y()); xcb_flush(xcb_connection()); } diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index eb5b8f808e..47d58fa880 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -148,7 +148,7 @@ void QXcbDrag::init() source_time = XCB_CURRENT_TIME; target_time = XCB_CURRENT_TIME; - QXcbCursor::queryPointer(connection(), ¤t_virtual_desktop, 0); + QXcbCursor::queryPointer(connection(), ¤t_virtual_desktop, nullptr); drag_types.clear(); //current_embedding_widget = 0; @@ -384,13 +384,13 @@ void QXcbDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardMod if (!findXdndAwareTarget(globalPos, &target)) return; - QXcbWindow *w = 0; + QXcbWindow *w = nullptr; if (target) { w = connection()->platformWindowFromId(target); if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/) - w = 0; + w = nullptr; } else { - w = 0; + w = nullptr; target = current_virtual_desktop->root(); } @@ -522,7 +522,7 @@ void QXcbDrag::drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardMod QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target); if (w && w->window()->type() == Qt::Desktop) // && !w->acceptDrops() - w = 0; + w = nullptr; Transaction t = { connection()->time(), @@ -716,7 +716,7 @@ void QXcbDrag::handle_xdnd_position(QPlatformWindow *w, const xcb_client_message target_time = e->data.data32[3]; } - QMimeData *dropData = 0; + QMimeData *dropData = nullptr; Qt::DropActions supported_actions = Qt::IgnoreAction; if (currentDrag()) { dropData = currentDrag()->mimeData(); @@ -911,7 +911,7 @@ void QXcbDrag::send_leave() QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target); if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/) - w = 0; + w = nullptr; qCDebug(lcQpaXDnd) << "sending XdndLeave to target:" << current_target; @@ -945,7 +945,7 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e target_time = l[2]; Qt::DropActions supported_drop_actions; - QMimeData *dropData = 0; + QMimeData *dropData = nullptr; if (currentDrag()) { dropData = currentDrag()->mimeData(); supported_drop_actions = Qt::DropActions(l[4]); @@ -1152,7 +1152,7 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event } } - QDrag *transactionDrag = 0; + QDrag *transactionDrag = nullptr; if (at >= 0) { transactionDrag = transactions.at(at).drag; } else if (at == -2) { @@ -1222,7 +1222,7 @@ bool QXcbDrag::dndEnable(QXcbWindow *w, bool on) if (w->window()->type() == Qt::Desktop) { xcb_delete_property(xcb_connection(), w->xcb_window(), atom(QXcbAtom::XdndProxy)); delete desktop_proxy; - desktop_proxy = 0; + desktop_proxy = nullptr; } else { qCDebug(lcQpaXDnd) << "not deleting XDndAware"; } diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp index 8f33e6ed31..b0e610dd51 100644 --- a/src/plugins/platforms/xcb/qxcbimage.cpp +++ b/src/plugins/platforms/xcb/qxcbimage.cpp @@ -221,7 +221,7 @@ xcb_pixmap_t qt_xcb_XPixmapFromBitmap(QXcbScreen *screen, const QImage &image) for (int i = 0; i < height; i++) memcpy(buf + (destLineSize * i), map + (bytesPerLine * i), destLineSize); xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, screen->root(), buf, - width, height, 1, 0, 0, 0); + width, height, 1, 0, 0, nullptr); delete[] buf; return pm; } @@ -249,7 +249,7 @@ xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image, 32, 32, 32, 32, QSysInfo::ByteOrder == QSysInfo::BigEndian ? XCB_IMAGE_ORDER_MSB_FIRST : XCB_IMAGE_ORDER_LSB_FIRST, XCB_IMAGE_ORDER_MSB_FIRST, - 0, 0, 0); + nullptr, 0, nullptr); if (!xi) { qWarning("qt_xcb_createCursorXRender: xcb_image_create failed"); return XCB_NONE; @@ -266,10 +266,10 @@ xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image, xcb_create_pixmap(conn, 32, pix, screen->root(), w, h); xcb_render_picture_t pic = xcb_generate_id(conn); - xcb_render_create_picture(conn, pic, pix, fmt->id, 0, 0); + xcb_render_create_picture(conn, pic, pix, fmt->id, 0, nullptr); xcb_gcontext_t gc = xcb_generate_id(conn); - xcb_create_gc(conn, gc, pix, 0, 0); + xcb_create_gc(conn, gc, pix, 0, nullptr); xcb_image_put(conn, pix, gc, xi, 0, 0, 0); xcb_free_gc(conn, gc); diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index efda6b67ce..3fd989e1f9 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -130,7 +130,7 @@ QXcbIntegration *QXcbIntegration::m_instance = nullptr; QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char **argv) : m_services(new QGenericUnixServices) - , m_instanceName(0) + , m_instanceName(nullptr) , m_canGrab(true) , m_defaultVisualId(UINT_MAX) { @@ -146,7 +146,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char m_nativeInterface.reset(new QXcbNativeInterface); // Parse arguments - const char *displayName = 0; + const char *displayName = nullptr; bool noGrabArg = false; bool doGrabArg = false; if (argc) { diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 3caee3f409..e8286381a2 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -579,7 +579,7 @@ void QXcbKeyboard::selectEvents() required_events, required_map_parts, required_map_parts, - 0); + nullptr); xcb_generic_error_t *error = xcb_request_check(xcb_connection(), select); if (error) { @@ -620,7 +620,7 @@ void QXcbKeyboard::updateVModMapping() vmod_mask = name_reply->virtualMods; // find the virtual modifiers for which names are defined. for (bit = 1; vmod_mask; bit <<= 1) { - vmod_name = 0; + vmod_name = nullptr; if (!(vmod_mask & bit)) continue; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 81b889a80f..30fa6864ac 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -268,7 +268,7 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QXcbNativeInterfa if (lowerCaseResource == "peekeventqueue") return NativeResourceForIntegrationFunction(reinterpret_cast(peekEventQueue)); - return 0; + return nullptr; } QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource) @@ -291,7 +291,7 @@ QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterface::n return NativeResourceForScreenFunction(reinterpret_cast(setAppTime)); else if (lowerCaseResource == "setappusertime") return NativeResourceForScreenFunction(reinterpret_cast(setAppUserTime)); - return 0; + return nullptr; } QPlatformNativeInterface::NativeResourceForWindowFunction QXcbNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource) @@ -365,7 +365,7 @@ void *QXcbNativeInterface::startupId() QXcbConnection *defaultConnection = integration->defaultConnection(); if (defaultConnection) return reinterpret_cast(const_cast(defaultConnection->startupId().constData())); - return 0; + return nullptr; } void *QXcbNativeInterface::x11Screen() @@ -374,7 +374,7 @@ void *QXcbNativeInterface::x11Screen() QXcbConnection *defaultConnection = integration->defaultConnection(); if (defaultConnection) return reinterpret_cast(defaultConnection->primaryScreenNumber()); - return 0; + return nullptr; } void *QXcbNativeInterface::rootWindow() @@ -383,7 +383,7 @@ void *QXcbNativeInterface::rootWindow() QXcbConnection *defaultConnection = integration->defaultConnection(); if (defaultConnection) return reinterpret_cast(defaultConnection->rootWindow()); - return 0; + return nullptr; } void *QXcbNativeInterface::display() diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 8da299d491..8bcaa78122 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -318,7 +318,7 @@ bool QXcbVirtualDesktop::xResource(const QByteArray &identifier, static bool parseXftInt(const QByteArray& stringValue, int *value) { - Q_ASSERT(value != 0); + Q_ASSERT(value != nullptr); bool ok; *value = stringValue.toInt(&ok); return ok; @@ -457,7 +457,7 @@ const xcb_visualtype_t *QXcbVirtualDesktop::visualForId(xcb_visualid_t visualid) { QMap::const_iterator it = m_visuals.find(visualid); if (it == m_visuals.constEnd()) - return 0; + return nullptr; return &*it; } @@ -577,7 +577,7 @@ QWindow *QXcbScreen::topLevelAt(const QPoint &p) const do { auto translate_reply = Q_XCB_REPLY_UNCHECKED(xcb_translate_coordinates, xcb_connection(), parent, child, x, y); if (!translate_reply) { - return 0; + return nullptr; } parent = child; @@ -586,14 +586,14 @@ QWindow *QXcbScreen::topLevelAt(const QPoint &p) const y = translate_reply->dst_y; if (!child || child == root) - return 0; + return nullptr; QPlatformWindow *platformWindow = connection()->platformWindowFromId(child); if (platformWindow) return platformWindow->window(); } while (parent != child); - return 0; + return nullptr; } void QXcbScreen::windowShown(QXcbWindow *window) diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index f880d4d722..2eb32c069e 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -69,7 +69,7 @@ public Q_SLOTS: }; -static SmcConn smcConnection = 0; +static SmcConn smcConnection = nullptr; static bool sm_interactionActive; static bool sm_smActive; static int sm_interactStyle; @@ -81,7 +81,7 @@ static bool sm_phase2; static bool sm_in_phase2; bool qt_sm_blockUserInput = false; -static QSmSocketReceiver* sm_receiver = 0; +static QSmSocketReceiver* sm_receiver = nullptr; static void resetSmState(); static void sm_setProperty(const char *name, const char *type, @@ -191,7 +191,7 @@ static void sm_performSaveYourself(QXcbSessionManager *sm) // generate a new session key timeval tv; - gettimeofday(&tv, 0); + gettimeofday(&tv, nullptr); sm->setSessionKey(QString::number(qulonglong(tv.tv_sec)) + QLatin1Char('_') + QString::number(qulonglong(tv.tv_usec))); @@ -203,7 +203,7 @@ static void sm_performSaveYourself(QXcbSessionManager *sm) // tell the session manager about our program in best POSIX style sm_setProperty(QString::fromLatin1(SmProgram), argument0); // tell the session manager about our user as well. - struct passwd *entryPtr = 0; + struct passwd *entryPtr = nullptr; #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) QVarLengthArray buf(qMax(sysconf(_SC_GETPW_R_SIZE_MAX), 1024L)); struct passwd entry; @@ -329,7 +329,7 @@ static void sm_saveYourselfPhase2Callback(SmcConn smcConn, SmPointer clientData) void QSmSocketReceiver::socketActivated(int) { - IceProcessMessages(SmcGetIceConnection(smcConnection), 0, 0); + IceProcessMessages(SmcGetIceConnection(smcConnection), nullptr, nullptr); } @@ -337,11 +337,11 @@ void QSmSocketReceiver::socketActivated(int) QXcbSessionManager::QXcbSessionManager(const QString &id, const QString &key) : QPlatformSessionManager(id, key) - , m_eventLoop(0) + , m_eventLoop(nullptr) { resetSmState(); char cerror[256]; - char* myId = 0; + char* myId = nullptr; QByteArray b_id = id.toLatin1(); char* prevId = b_id.data(); @@ -359,7 +359,7 @@ QXcbSessionManager::QXcbSessionManager(const QString &id, const QString &key) if (!qEnvironmentVariableIsSet("SESSION_MANAGER")) return; - smcConnection = SmcOpenConnection(0, 0, 1, 0, + smcConnection = SmcOpenConnection(nullptr, nullptr, 1, 0, SmcSaveYourselfProcMask | SmcDieProcMask | SmcSaveCompleteProcMask | @@ -382,8 +382,8 @@ QXcbSessionManager::QXcbSessionManager(const QString &id, const QString &key) QXcbSessionManager::~QXcbSessionManager() { if (smcConnection) - SmcCloseConnection(smcConnection, 0, 0); - smcConnection = 0; + SmcCloseConnection(smcConnection, 0, nullptr); + smcConnection = nullptr; delete sm_receiver; } @@ -411,7 +411,7 @@ bool QXcbSessionManager::allowsInteraction() QEventLoop eventLoop; m_eventLoop = &eventLoop; eventLoop.exec(); - m_eventLoop = 0; + m_eventLoop = nullptr; sm_waitingForInteraction = false; if (sm_smActive) { // not cancelled @@ -441,7 +441,7 @@ bool QXcbSessionManager::allowsErrorInteraction() QEventLoop eventLoop; m_eventLoop = &eventLoop; eventLoop.exec(); - m_eventLoop = 0; + m_eventLoop = nullptr; sm_waitingForInteraction = false; if (sm_smActive) { // not cancelled diff --git a/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp b/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp index 684e603fab..ff5ad98cd2 100644 --- a/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp +++ b/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp @@ -64,11 +64,11 @@ QXcbSystemTrayTracker *QXcbSystemTrayTracker::create(QXcbConnection *connection) // Selection, tray atoms for GNOME, NET WM Specification const xcb_atom_t trayAtom = connection->atom(QXcbAtom::_NET_SYSTEM_TRAY_OPCODE); if (!trayAtom) - return 0; + return nullptr; const QByteArray netSysTray = QByteArrayLiteral("_NET_SYSTEM_TRAY_S") + QByteArray::number(connection->primaryScreenNumber()); const xcb_atom_t selection = connection->internAtom(netSysTray.constData()); if (!selection) - return 0; + return nullptr; return new QXcbSystemTrayTracker(connection, trayAtom, selection); } diff --git a/src/plugins/platforms/xcb/qxcbvulkaninstance.cpp b/src/plugins/platforms/xcb/qxcbvulkaninstance.cpp index b3f8a5832d..7c15882768 100644 --- a/src/plugins/platforms/xcb/qxcbvulkaninstance.cpp +++ b/src/plugins/platforms/xcb/qxcbvulkaninstance.cpp @@ -93,7 +93,7 @@ bool QXcbVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice, VkSurfaceKHR QXcbVulkanInstance::createSurface(QXcbWindow *window) { - VkSurfaceKHR surface = 0; + VkSurfaceKHR surface = nullptr; if (!m_createSurface) { m_createSurface = reinterpret_cast( diff --git a/src/plugins/platforms/xcb/qxcbvulkanwindow.cpp b/src/plugins/platforms/xcb/qxcbvulkanwindow.cpp index 25bc340f97..17d7d9791e 100644 --- a/src/plugins/platforms/xcb/qxcbvulkanwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbvulkanwindow.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QXcbVulkanWindow::QXcbVulkanWindow(QWindow *window) : QXcbWindow(window), - m_surface(0) + m_surface(nullptr) { } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index f505ddbd1e..66030b9ad4 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -174,13 +174,13 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) { #include - static XTextProperty tp = { 0, 0, 0, 0 }; + static XTextProperty tp = { nullptr, 0, 0, 0 }; static bool free_prop = true; // we can't free tp.value in case it references // the data of the static QByteArray below. if (tp.value) { if (free_prop) XFree(tp.value); - tp.value = 0; + tp.value = nullptr; free_prop = true; } @@ -191,7 +191,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) QByteArray mapped = mapper->fromUnicode(s); char* tl[2]; tl[0] = mapped.data(); - tl[1] = 0; + tl[1] = nullptr; errCode = XmbTextListToTextProperty(dpy, tl, 1, XStdICCTextStyle, &tp); if (errCode < 0) qCDebug(lcQpaXcb, "XmbTextListToTextProperty result code %d", errCode); @@ -280,7 +280,7 @@ void QXcbWindow::create() m_window = platformScreen->root(); m_depth = platformScreen->screen()->root_depth; m_visualId = platformScreen->screen()->root_visual; - const xcb_visualtype_t *visual = 0; + const xcb_visualtype_t *visual = nullptr; if (connection()->hasDefaultVisualId()) { visual = platformScreen->visualForId(connection()->defaultVisualId()); if (visual) @@ -819,7 +819,7 @@ bool QXcbWindow::relayFocusToModalWindow() const while (w && w->parent()) w = w->parent(); - QWindow *modalWindow = 0; + QWindow *modalWindow = nullptr; const bool blocked = QGuiApplicationPrivate::instance()->isWindowBlocked(w, &modalWindow); if (blocked && modalWindow != w) { modalWindow->requestActivate(); @@ -1193,7 +1193,7 @@ void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp) XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class m_visualId, // visual 0, // value mask - 0); // value list + nullptr); // value list wid = m_netWmUserTimeWindow; xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW), XCB_ATOM_WINDOW, 32, 1, &m_netWmUserTimeWindow); @@ -1223,7 +1223,7 @@ void QXcbWindow::setTransparentForMouseEvents(bool transparent) xcb_rectangle_t rectangle; - xcb_rectangle_t *rect = 0; + xcb_rectangle_t *rect = nullptr; int nrect = 0; if (!transparent) { @@ -1882,7 +1882,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in if (m_embedded && !m_trayIconWindow) { if (window() != QGuiApplication::focusWindow()) { const QXcbWindow *container = static_cast(parent()); - Q_ASSERT(container != 0); + Q_ASSERT(container != nullptr); sendXEmbedMessage(container->xcb_window(), XEMBED_REQUEST_FOCUS); } @@ -2087,7 +2087,7 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource const Qt::MouseButton button = conn->xiToQtMouseButton(ev->detail); - const char *sourceName = 0; + const char *sourceName = nullptr; if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) { const QMetaObject *metaObject = qt_getEnumMetaObject(source); const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(source))); diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 88f15e344f..902f196ba9 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -256,7 +256,7 @@ QXcbXSettings::QXcbXSettings(QXcbVirtualDesktop *screen) QXcbXSettings::~QXcbXSettings() { delete d_ptr; - d_ptr = 0; + d_ptr = nullptr; } bool QXcbXSettings::initialized() const diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp index fb1c425d8e..860fc3a26e 100644 --- a/src/plugins/platformthemes/gtk3/main.cpp +++ b/src/plugins/platformthemes/gtk3/main.cpp @@ -57,7 +57,7 @@ QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList & if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) return new QGtk3Theme; - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index c64a02fa0c..65564b59a1 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -165,12 +165,12 @@ void QGtk3Dialog::onResponse(QGtk3Dialog *dialog, int response) void QGtk3Dialog::onParentWindowDestroyed() { // The QGtk3*DialogHelper classes own this object. Make sure the parent doesn't delete it. - setParent(0); + setParent(nullptr); } QGtk3ColorDialogHelper::QGtk3ColorDialogHelper() { - d.reset(new QGtk3Dialog(gtk_color_chooser_dialog_new("", 0))); + d.reset(new QGtk3Dialog(gtk_color_chooser_dialog_new("", nullptr))); connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted())); connect(d.data(), SIGNAL(reject()), this, SIGNAL(reject())); @@ -238,7 +238,7 @@ void QGtk3ColorDialogHelper::applyOptions() QGtk3FileDialogHelper::QGtk3FileDialogHelper() { - d.reset(new QGtk3Dialog(gtk_file_chooser_dialog_new("", 0, + d.reset(new QGtk3Dialog(gtk_file_chooser_dialog_new("", nullptr, GTK_FILE_CHOOSER_ACTION_OPEN, qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Cancel)), GTK_RESPONSE_CANCEL, qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Ok)), GTK_RESPONSE_OK, @@ -497,7 +497,7 @@ void QGtk3FileDialogHelper::setNameFilters(const QStringList &filters) QGtk3FontDialogHelper::QGtk3FontDialogHelper() { - d.reset(new QGtk3Dialog(gtk_font_chooser_dialog_new("", 0))); + d.reset(new QGtk3Dialog(gtk_font_chooser_dialog_new("", nullptr))); connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted())); connect(d.data(), SIGNAL(reject()), this, SIGNAL(reject())); diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 4f0bd9d9a0..d9d117faeb 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -200,7 +200,7 @@ void QGtk3MenuItem::setMenu(QPlatformMenu *menu) { m_menu = qobject_cast(menu); if (GTK_IS_MENU_ITEM(m_item)) - gtk_menu_item_set_submenu(GTK_MENU_ITEM(m_item), m_menu ? m_menu->handle() : NULL); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(m_item), m_menu ? m_menu->handle() : nullptr); } bool QGtk3MenuItem::isVisible() const @@ -436,7 +436,7 @@ void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, if (pw) m_targetPos = pw->mapToGlobal(m_targetPos); - gtk_menu_popup(GTK_MENU(m_menu), NULL, NULL, qt_gtk_menu_position_func, this, 0, gtk_get_current_event_time()); + gtk_menu_popup(GTK_MENU(m_menu), nullptr, nullptr, qt_gtk_menu_position_func, this, 0, gtk_get_current_event_time()); } void QGtk3Menu::dismiss() diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp index 077955eb4e..93520344f8 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp @@ -86,9 +86,9 @@ QGtk3Theme::QGtk3Theme() { // gtk_init will reset the Xlib error handler, and that causes // Qt applications to quit on X errors. Therefore, we need to manually restore it. - int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(NULL); + int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(nullptr); - gtk_init(0, 0); + gtk_init(nullptr, nullptr); XSetErrorHandler(oldErrorHandler); @@ -99,7 +99,7 @@ QGtk3Theme::QGtk3Theme() g_type_ensure(PANGO_TYPE_FONT_FACE); /* Use our custom log handler. */ - g_log_set_handler("Gtk", G_LOG_LEVEL_MESSAGE, gtkMessageHandler, NULL); + g_log_set_handler("Gtk", G_LOG_LEVEL_MESSAGE, gtkMessageHandler, nullptr); } static inline QVariant gtkGetLongPressTime() @@ -173,7 +173,7 @@ QPlatformDialogHelper *QGtk3Theme::createPlatformDialogHelper(DialogType type) c case FontDialog: return new QGtk3FontDialogHelper; default: - return 0; + return nullptr; } } @@ -197,7 +197,7 @@ bool QGtk3Theme::useNativeFileDialog() * dialogs entirely since we can't avoid creation of a platform * dialog helper. */ - return gtk_check_version(3, 15, 5) == 0; + return gtk_check_version(3, 15, 5) == nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql_p.h b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h index 48b04fb1f5..9ccc8f4e4f 100644 --- a/src/plugins/sqldrivers/mysql/qsql_mysql_p.h +++ b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h @@ -75,8 +75,8 @@ class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver Q_DECLARE_PRIVATE(QMYSQLDriver) Q_OBJECT public: - explicit QMYSQLDriver(QObject *parent=0); - explicit QMYSQLDriver(MYSQL *con, QObject * parent=0); + explicit QMYSQLDriver(QObject *parent=nullptr); + explicit QMYSQLDriver(MYSQL *con, QObject * parent=nullptr); ~QMYSQLDriver(); bool hasFeature(DriverFeature f) const override; bool open(const QString & db, diff --git a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h index 48c64536f1..57db0a4d47 100644 --- a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h +++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h @@ -76,8 +76,8 @@ class Q_EXPORT_SQLDRIVER_SQLITE2 QSQLite2Driver : public QSqlDriver Q_DECLARE_PRIVATE(QSQLite2Driver) Q_OBJECT public: - explicit QSQLite2Driver(QObject *parent = 0); - explicit QSQLite2Driver(sqlite *connection, QObject *parent = 0); + explicit QSQLite2Driver(QObject *parent = nullptr); + explicit QSQLite2Driver(sqlite *connection, QObject *parent = nullptr); ~QSQLite2Driver(); bool hasFeature(DriverFeature f) const override; bool open(const QString &db, diff --git a/src/plugins/sqldrivers/tds/qsql_tds_p.h b/src/plugins/sqldrivers/tds/qsql_tds_p.h index 948e3c7024..b72fababbb 100644 --- a/src/plugins/sqldrivers/tds/qsql_tds_p.h +++ b/src/plugins/sqldrivers/tds/qsql_tds_p.h @@ -85,8 +85,8 @@ class Q_EXPORT_SQLDRIVER_TDS QTDSDriver : public QSqlDriver Q_OBJECT friend class QTDSResultPrivate; public: - explicit QTDSDriver(QObject* parent = 0); - QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = 0); + explicit QTDSDriver(QObject* parent = nullptr); + QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = nullptr); ~QTDSDriver(); bool hasFeature(DriverFeature f) const override; bool open(const QString &db, diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 1d8af9dbf0..ab7a2edb67 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -725,7 +725,7 @@ QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent) } QPageSetupDialog::QPageSetupDialog(QWidget *parent) - : QDialog(*(new QUnixPageSetupDialogPrivate(0)), parent) + : QDialog(*(new QUnixPageSetupDialogPrivate(nullptr)), parent) { Q_D(QPageSetupDialog); setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index c7328d9732..d929367557 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -1176,7 +1176,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter * void QUnixPrintWidgetPrivate::updateWidget() { - const bool printToFile = q == 0 || q->isOptionEnabled(QPrintDialog::PrintToFile); + const bool printToFile = q == nullptr || q->isOptionEnabled(QPrintDialog::PrintToFile); if (printToFile && !filePrintersAdded) { if (widget.printers->count()) widget.printers->insertSeparator(widget.printers->count()); diff --git a/src/printsupport/kernel/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp index 410051df2a..8106db4edb 100644 --- a/src/printsupport/kernel/qpaintengine_alpha.cpp +++ b/src/printsupport/kernel/qpaintengine_alpha.cpp @@ -377,16 +377,16 @@ void QAlphaPaintEngine::cleanUp() delete d->m_picpainter; delete d->m_pic; - d->m_picpainter = 0; - d->m_pic = 0; - d->m_picengine = 0; + d->m_picpainter = nullptr; + d->m_pic = nullptr; + d->m_picengine = nullptr; } QAlphaPaintEnginePrivate::QAlphaPaintEnginePrivate() : m_pass(0), - m_pic(0), - m_picengine(0), - m_picpainter(0), + m_pic(nullptr), + m_picengine(nullptr), + m_picpainter(nullptr), m_numberOfCachedRects(0), m_hasalpha(false), m_alphaPen(false), diff --git a/src/printsupport/kernel/qplatformprintplugin.h b/src/printsupport/kernel/qplatformprintplugin.h index 30e8f7938a..db28da4dd3 100644 --- a/src/printsupport/kernel/qplatformprintplugin.h +++ b/src/printsupport/kernel/qplatformprintplugin.h @@ -66,7 +66,7 @@ class Q_PRINTSUPPORT_EXPORT QPlatformPrinterSupportPlugin : public QObject { Q_OBJECT public: - explicit QPlatformPrinterSupportPlugin(QObject *parent = 0); + explicit QPlatformPrinterSupportPlugin(QObject *parent = nullptr); ~QPlatformPrinterSupportPlugin(); virtual QPlatformPrinterSupport *create(const QString &key) = 0; diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h index 37c9702c17..4c42ed5717 100644 --- a/src/printsupport/kernel/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -76,12 +76,12 @@ class Q_PRINTSUPPORT_EXPORT QPrinterPrivate public: QPrinterPrivate(QPrinter *printer) : pdfVersion(QPrinter::PdfVersion_1_4), - printEngine(0), - paintEngine(0), - realPrintEngine(0), - realPaintEngine(0), + printEngine(nullptr), + paintEngine(nullptr), + realPrintEngine(nullptr), + realPaintEngine(nullptr), #if QT_CONFIG(printpreviewwidget) - previewEngine(0), + previewEngine(nullptr), #endif q_ptr(printer), printRange(QPrinter::AllPages), diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 01726d79ef..32338c1fe2 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -84,7 +84,7 @@ Q_GLOBAL_STATIC(QConnectionDict, dbDict) class QSqlDatabasePrivate { public: - QSqlDatabasePrivate(QSqlDatabase *d, QSqlDriver *dr = 0): + QSqlDatabasePrivate(QSqlDatabase *d, QSqlDriver *dr = nullptr): ref(1), q(d), driver(dr), @@ -178,7 +178,7 @@ DriverDict &QSqlDatabasePrivate::driverDict() QSqlDatabasePrivate *QSqlDatabasePrivate::shared_null() { static QSqlNullDriver dr; - static QSqlDatabasePrivate n(NULL, &dr); + static QSqlDatabasePrivate n(nullptr, &dr); return &n; } @@ -702,7 +702,7 @@ void QSqlDatabasePrivate::init(const QString &type) qWarning("QSqlDatabase: %s driver not loaded", type.toLatin1().data()); qWarning("QSqlDatabase: available drivers: %s", QSqlDatabase::drivers().join(QLatin1Char(' ')).toLatin1().data()); - if (QCoreApplication::instance() == 0) + if (QCoreApplication::instance() == nullptr) qWarning("QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins"); driver = shared_null()->driver; } diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index e0ddc4ca84..fcd3c70a04 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE static QString prepareIdentifier(const QString &identifier, QSqlDriver::IdentifierType type, const QSqlDriver *driver) { - Q_ASSERT( driver != NULL ); + Q_ASSERT( driver != nullptr ); QString ret = identifier; if (!driver->isIdentifierEscaped(identifier, type)) { ret = driver->escapeIdentifier(identifier, type); diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp index 34be010474..20adec6a3b 100644 --- a/src/sql/models/qsqlrelationaltablemodel.cpp +++ b/src/sql/models/qsqlrelationaltablemodel.cpp @@ -137,7 +137,7 @@ class QRelatedTableModel; struct QRelation { public: - QRelation(): model(0), m_parent(0), m_dictInitialized(false) {} + QRelation(): model(nullptr), m_parent(nullptr), m_dictInitialized(false) {} void init(QSqlRelationalTableModel *parent, const QSqlRelation &relation); void populateModel(); @@ -161,7 +161,7 @@ struct QRelation class QRelatedTableModel : public QSqlTableModel { public: - QRelatedTableModel(QRelation *rel, QObject *parent = 0, QSqlDatabase db = QSqlDatabase()); + QRelatedTableModel(QRelation *rel, QObject *parent = nullptr, QSqlDatabase db = QSqlDatabase()); bool select() override; private: bool firstSelect; @@ -174,7 +174,7 @@ private: */ void QRelation::init(QSqlRelationalTableModel *parent, const QSqlRelation &relation) { - Q_ASSERT(parent != NULL); + Q_ASSERT(parent != nullptr); m_parent = parent; rel = relation; } @@ -183,7 +183,7 @@ void QRelation::populateModel() { if (!isValid()) return; - Q_ASSERT(m_parent != NULL); + Q_ASSERT(m_parent != nullptr); if (!model) { model = new QRelatedTableModel(this, m_parent, m_parent->database()); @@ -202,7 +202,7 @@ void QRelation::populateDictionary() if (!isValid()) return; - if (model == NULL) + if (model == nullptr) populateModel(); QSqlRecord record; @@ -234,13 +234,13 @@ void QRelation::clearDictionary() void QRelation::clear() { delete model; - model = 0; + model = nullptr; clearDictionary(); } bool QRelation::isValid() { - return (rel.isValid() && m_parent != NULL); + return (rel.isValid() && m_parent != nullptr); } diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 6a74e739e6..553e16d472 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -77,7 +77,7 @@ static const char *metaTypeEnumValueString(int type) QT_FOR_EACH_STATIC_TYPE(RETURN_METATYPENAME_STRING) } #undef RETURN_METATYPENAME_STRING - return 0; + return nullptr; } Generator::Generator(ClassDef *classDef, const QVector &metaTypes, const QHash &knownQObjectClasses, const QHash &knownGadgets, FILE *outfile) diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp index b7aefae1ec..068f75d4bd 100644 --- a/src/tools/moc/parser.cpp +++ b/src/tools/moc/parser.cpp @@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE Symbol::LexemStore Symbol::lexemStore; #endif -static const char *error_msg = 0; +static const char *error_msg = nullptr; #ifdef Q_CC_MSVC #define ErrorFormatString "%s(%d): " diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index d135bddb4c..a99b8cc80c 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -943,7 +943,7 @@ int PP_Expression::primary_expression() test(PP_RPAREN); } else { next(); - value = lexem().toInt(0, 0); + value = lexem().toInt(nullptr, 0); } return value; } diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 63c6fbb9bb..4d9a629ab6 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -97,10 +97,10 @@ public: if (t == QAccessible::ActionInterface) { return static_cast(this); } - return 0; + return nullptr; } - QObject *object() const override { return 0; } + QObject *object() const override { return nullptr; } QAccessible::Role role() const override { return QAccessible::PageTab; } QAccessible::State state() const override { if (!isValid()) { @@ -129,7 +129,7 @@ public: return false; } - QAccessibleInterface *childAt(int, int) const override { return 0; } + QAccessibleInterface *childAt(int, int) const override { return nullptr; } int childCount() const override { return 0; } int indexOfChild(const QAccessibleInterface *) const override { return -1; } @@ -168,7 +168,7 @@ public: QAccessibleInterface *parent() const override { return QAccessible::queryAccessibleInterface(m_parent.data()); } - QAccessibleInterface *child(int) const override { return 0; } + QAccessibleInterface *child(int) const override { return nullptr; } // action interface QStringList actionNames() const override @@ -237,7 +237,7 @@ QAccessibleInterface* QAccessibleTabBar::child(int index) const return QAccessible::queryAccessibleInterface(tabBar()->d_func()->rightB); } } - return 0; + return nullptr; } int QAccessibleTabBar::indexOfChild(const QAccessibleInterface *child) const @@ -314,7 +314,7 @@ QAccessibleInterface *QAccessibleComboBox::child(int index) const } else if (index == 1 && comboBox()->isEditable()) { return QAccessible::queryAccessibleInterface(comboBox()->lineEdit()); } - return 0; + return nullptr; } int QAccessibleComboBox::childCount() const @@ -327,7 +327,7 @@ QAccessibleInterface *QAccessibleComboBox::childAt(int x, int y) const { if (comboBox()->isEditable() && comboBox()->lineEdit()->rect().contains(x, y)) return child(1); - return 0; + return nullptr; } int QAccessibleComboBox::indexOfChild(const QAccessibleInterface *child) const @@ -432,7 +432,7 @@ bool QAccessibleAbstractScrollArea::isValid() const QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(int x, int y) const { if (!abstractScrollArea()->isVisible()) - return 0; + return nullptr; for (int i = 0; i < childCount(); ++i) { QPoint wpos = accessibleChildren().at(i)->mapToGlobal(QPoint(0, 0)); @@ -440,7 +440,7 @@ QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(int x, int y) const if (rect.contains(x, y)) return child(i); } - return 0; + return nullptr; } QAbstractScrollArea *QAccessibleAbstractScrollArea::abstractScrollArea() const diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index 3bfe215c05..5a7fdf9a03 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -121,7 +121,7 @@ QAccessibleTable::~QAccessibleTable() QHeaderView *QAccessibleTable::horizontalHeader() const { - QHeaderView *header = 0; + QHeaderView *header = nullptr; if (false) { #if QT_CONFIG(tableview) } else if (const QTableView *tv = qobject_cast(view())) { @@ -137,7 +137,7 @@ QHeaderView *QAccessibleTable::horizontalHeader() const QHeaderView *QAccessibleTable::verticalHeader() const { - QHeaderView *header = 0; + QHeaderView *header = nullptr; if (false) { #if QT_CONFIG(tableview) } else if (const QTableView *tv = qobject_cast(view())) { @@ -150,19 +150,19 @@ QHeaderView *QAccessibleTable::verticalHeader() const QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const { if (!view()->model()) - return 0; + return nullptr; Q_ASSERT(role() != QAccessible::Tree); QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); if (Q_UNLIKELY(!index.isValid())) { qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view(); - return 0; + return nullptr; } return child(logicalIndex(index)); } QAccessibleInterface *QAccessibleTable::caption() const { - return 0; + return nullptr; } QString QAccessibleTable::columnDescription(int column) const @@ -254,7 +254,7 @@ QList QAccessibleTable::selectedRows() const QAccessibleInterface *QAccessibleTable::summary() const { - return 0; + return nullptr; } bool QAccessibleTable::isColumnSelected(int column) const @@ -422,7 +422,7 @@ QAccessibleInterface *QAccessibleTable::childAt(int x, int y) const if (index.isValid()) { return child(logicalIndex(index)); } - return 0; + return nullptr; } int QAccessibleTable::childCount() const @@ -485,13 +485,13 @@ QAccessibleInterface *QAccessibleTable::parent() const } return QAccessible::queryAccessibleInterface(view()->parent()); } - return 0; + return nullptr; } QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const { if (!view()->model()) - return 0; + return nullptr; auto id = childToId.constFind(logicalIndex); if (id != childToId.constEnd()) @@ -505,7 +505,7 @@ QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const int row = logicalIndex / columns; int column = logicalIndex % columns; - QAccessibleInterface *iface = 0; + QAccessibleInterface *iface = nullptr; if (vHeader) { if (column == 0) { @@ -528,7 +528,7 @@ QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); if (Q_UNLIKELY(!index.isValid())) { qWarning("QAccessibleTable::child: Invalid index at: %d %d", row, column); - return 0; + return nullptr; } iface = new QAccessibleTableCell(view(), index, cellRole()); } @@ -542,7 +542,7 @@ void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t) { if (t == QAccessible::TableInterface) return static_cast(this); - return 0; + return nullptr; } void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event) @@ -676,13 +676,13 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const QAccessibleInterface *QAccessibleTree::childAt(int x, int y) const { if (!view()->model()) - return 0; + return nullptr; QPoint viewportOffset = view()->viewport()->mapTo(view(), QPoint(0,0)); QPoint indexPosition = view()->mapFromGlobal(QPoint(x, y) - viewportOffset); QModelIndex index = view()->indexAt(indexPosition); if (!index.isValid()) - return 0; + return nullptr; const QTreeView *treeView = qobject_cast(view()); int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0); @@ -706,9 +706,9 @@ int QAccessibleTree::childCount() const QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const { if (logicalIndex < 0 || !view()->model() || !view()->model()->columnCount()) - return 0; + return nullptr; - QAccessibleInterface *iface = 0; + QAccessibleInterface *iface = nullptr; int index = logicalIndex; if (horizontalHeader()) { @@ -724,7 +724,7 @@ QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const int column = index % view()->model()->columnCount(); QModelIndex modelIndex = indexFromLogical(row, column); if (!modelIndex.isValid()) - return 0; + return nullptr; iface = new QAccessibleTableCell(view(), modelIndex, cellRole()); } QAccessible::registerAccessibleInterface(iface); @@ -772,7 +772,7 @@ QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const QModelIndex index = indexFromLogical(row, column); if (Q_UNLIKELY(!index.isValid())) { qWarning("Requested invalid tree cell: %d %d", row, column); - return 0; + return nullptr; } const QTreeView *treeView = qobject_cast(view()); Q_ASSERT(treeView); @@ -841,7 +841,7 @@ void *QAccessibleTableCell::interface_cast(QAccessible::InterfaceType t) return static_cast(this); if (t == QAccessible::ActionInterface) return static_cast(this); - return 0; + return nullptr; } int QAccessibleTableCell::columnExtent() const { return 1; } @@ -869,7 +869,7 @@ QList QAccessibleTableCell::columnHeaderCells() const QHeaderView *QAccessibleTableCell::horizontalHeader() const { - QHeaderView *header = 0; + QHeaderView *header = nullptr; if (false) { #if QT_CONFIG(tableview) @@ -887,7 +887,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const QHeaderView *QAccessibleTableCell::verticalHeader() const { - QHeaderView *header = 0; + QHeaderView *header = nullptr; #if QT_CONFIG(tableview) if (const QTableView *tv = qobject_cast(view)) header = tv->verticalHeader(); @@ -1115,7 +1115,7 @@ QAccessibleInterface *QAccessibleTableCell::parent() const QAccessibleInterface *QAccessibleTableCell::child(int) const { - return 0; + return nullptr; } QAccessibleTableHeaderCell::QAccessibleTableHeaderCell(QAbstractItemView *view_, int index_, Qt::Orientation orientation_) @@ -1143,7 +1143,7 @@ QAccessible::State QAccessibleTableHeaderCell::state() const QRect QAccessibleTableHeaderCell::rect() const { - QHeaderView *header = 0; + QHeaderView *header = nullptr; if (false) { #if QT_CONFIG(tableview) } else if (const QTableView *tv = qobject_cast(view)) { @@ -1206,12 +1206,12 @@ QAccessibleInterface *QAccessibleTableHeaderCell::parent() const QAccessibleInterface *QAccessibleTableHeaderCell::child(int) const { - return 0; + return nullptr; } QHeaderView *QAccessibleTableHeaderCell::headerView() const { - QHeaderView *header = 0; + QHeaderView *header = nullptr; if (false) { #if QT_CONFIG(tableview) } else if (const QTableView *tv = qobject_cast(view)) { diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp index 7f87288520..51ba0adaa6 100644 --- a/src/widgets/accessible/qaccessiblemenu.cpp +++ b/src/widgets/accessible/qaccessiblemenu.cpp @@ -88,8 +88,8 @@ QAccessibleInterface *QAccessibleMenu::childAt(int x, int y) const { QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y))); if(act && act->isSeparator()) - act = 0; - return act ? getOrCreateMenu(menu(), act) : 0; + act = nullptr; + return act ? getOrCreateMenu(menu(), act) : nullptr; } QString QAccessibleMenu::text(QAccessible::Text t) const @@ -112,7 +112,7 @@ QAccessibleInterface *QAccessibleMenu::child(int index) const { if (index < childCount()) return getOrCreateMenu(menu(), menu()->actions().at(index)); - return 0; + return nullptr; } QAccessibleInterface *QAccessibleMenu::parent() const @@ -165,7 +165,7 @@ QAccessibleInterface *QAccessibleMenuBar::child(int index) const if (index < childCount()) { return getOrCreateMenu(menuBar(), menuBar()->actions().at(index)); } - return 0; + return nullptr; } int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const @@ -195,7 +195,7 @@ QAccessibleInterface *QAccessibleMenuItem::childAt(int x, int y ) const return childInterface; } } - return 0; + return nullptr; } int QAccessibleMenuItem::childCount() const @@ -224,14 +224,14 @@ QAccessibleInterface *QAccessibleMenuItem::child(int index) const { if (index == 0 && action()->menu()) return QAccessible::queryAccessibleInterface(action()->menu()); - return 0; + return nullptr; } void *QAccessibleMenuItem::interface_cast(QAccessible::InterfaceType t) { if (t == QAccessible::ActionInterface) return static_cast(this); - return 0; + return nullptr; } QObject *QAccessibleMenuItem::object() const diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 27e6b09dc7..c782e00f4f 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -363,7 +363,7 @@ QAccessibleInterface *QAccessibleWidget::child(int index) const QWidgetList childList = childWidgets(widget()); if (index >= 0 && index < childList.size()) return QAccessible::queryAccessibleInterface(childList.at(index)); - return 0; + return nullptr; } /*! \reimp */ @@ -374,11 +374,11 @@ QAccessibleInterface *QAccessibleWidget::focusChild() const QWidget *fw = widget()->focusWidget(); if (!fw) - return 0; + return nullptr; if (isAncestor(widget(), fw) || fw == widget()) return QAccessible::queryAccessibleInterface(fw); - return 0; + return nullptr; } /*! \reimp */ @@ -522,7 +522,7 @@ void *QAccessibleWidget::interface_cast(QAccessible::InterfaceType t) { if (t == QAccessible::ActionInterface) return static_cast(this); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 0bac45de27..d59da86076 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *object) { - QAccessibleInterface *iface = 0; + QAccessibleInterface *iface = nullptr; if (!object || !object->isWidgetType()) return iface; @@ -79,7 +79,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje #if QT_CONFIG(lineedit) } else if (classname == QLatin1String("QLineEdit")) { if (widget->objectName() == QLatin1String("qt_spinbox_lineedit")) - iface = 0; + iface = nullptr; else iface = new QAccessibleLineEdit(widget); #endif @@ -223,7 +223,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje #endif } else if (classname == QLatin1String("QDesktopScreenWidget")) { - iface = 0; + iface = nullptr; } else if (classname == QLatin1String("QWidget")) { iface = new QAccessibleWidget(widget); } else if (classname == QLatin1String("QWindowContainer")) { diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index 52c953ed3a..574be1f5ea 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -332,14 +332,14 @@ QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget) QAccessibleInterface *QAccessibleStackedWidget::childAt(int x, int y) const { if (!stackedWidget()->isVisible()) - return 0; + return nullptr; QWidget *currentWidget = stackedWidget()->currentWidget(); if (!currentWidget) - return 0; + return nullptr; QPoint position = currentWidget->mapFromGlobal(QPoint(x, y)); if (currentWidget->rect().contains(position)) return child(stackedWidget()->currentIndex()); - return 0; + return nullptr; } int QAccessibleStackedWidget::childCount() const @@ -359,7 +359,7 @@ int QAccessibleStackedWidget::indexOfChild(const QAccessibleInterface *child) co QAccessibleInterface *QAccessibleStackedWidget::child(int index) const { if (index < 0 || index >= stackedWidget()->count()) - return 0; + return nullptr; return QAccessible::queryAccessibleInterface(stackedWidget()->widget(index)); } @@ -401,7 +401,7 @@ QAccessibleInterface *QAccessibleMdiArea::child(int index) const QList subWindows = mdiArea()->subWindowList(); QWidget *targetObject = subWindows.value(index); if (!targetObject) - return 0; + return nullptr; return QAccessible::queryAccessibleInterface(targetObject); } @@ -478,7 +478,7 @@ QAccessibleInterface *QAccessibleMdiSubWindow::child(int index) const { QMdiSubWindow *source = mdiSubWindow(); if (index != 0 || !source->widget()) - return 0; + return nullptr; return QAccessible::queryAccessibleInterface(source->widget()); } @@ -554,7 +554,7 @@ int QAccessibleCalendarWidget::indexOfChild(const QAccessibleInterface *child) c QAccessibleInterface *QAccessibleCalendarWidget::child(int index) const { if (index < 0 || index >= childCount()) - return 0; + return nullptr; if (childCount() > 1 && index == 0) return QAccessible::queryAccessibleInterface(navigationBar()); @@ -573,7 +573,7 @@ QAbstractItemView *QAccessibleCalendarWidget::calendarView() const if (child->objectName() == QLatin1String("qt_calendar_calendarview")) return static_cast(child); } - return 0; + return nullptr; } QWidget *QAccessibleCalendarWidget::navigationBar() const @@ -582,7 +582,7 @@ QWidget *QAccessibleCalendarWidget::navigationBar() const if (child->objectName() == QLatin1String("qt_calendar_navigationbar")) return static_cast(child); } - return 0; + return nullptr; } #endif // QT_CONFIG(calendarwidget) @@ -624,7 +624,7 @@ QAccessibleInterface *QAccessibleDockWidget::child(int index) const if (item) return QAccessible::queryAccessibleInterface(item->widget()); } - return 0; + return nullptr; } int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const @@ -1109,7 +1109,7 @@ QAccessibleInterface *QAccessibleMainWindow::child(int index) const if (index >= 0 && index < kids.count()) { return QAccessible::queryAccessibleInterface(kids.at(index)); } - return 0; + return nullptr; } int QAccessibleMainWindow::childCount() const @@ -1128,10 +1128,10 @@ QAccessibleInterface *QAccessibleMainWindow::childAt(int x, int y) const { QWidget *w = widget(); if (!w->isVisible()) - return 0; + return nullptr; QPoint gp = w->mapToGlobal(QPoint(0, 0)); if (!QRect(gp.x(), gp.y(), w->width(), w->height()).contains(x, y)) - return 0; + return nullptr; const QWidgetList kids = childWidgets(mainWindow()); QPoint rp = mainWindow()->mapFromGlobal(QPoint(x, y)); @@ -1140,7 +1140,7 @@ QAccessibleInterface *QAccessibleMainWindow::childAt(int x, int y) const return QAccessible::queryAccessibleInterface(child); } } - return 0; + return nullptr; } QMainWindow *QAccessibleMainWindow::mainWindow() const diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index ca74ee4b12..9dbbe9c608 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -364,7 +364,7 @@ QAccessibleInterface *QAccessibleToolButton::child(int index) const #else Q_UNUSED(index) #endif - return 0; + return nullptr; } /* @@ -976,7 +976,7 @@ QAccessibleInterface *QAccessibleWindowContainer::child(int i) const { if (i == 0) return QAccessible::queryAccessibleInterface(container()->containedWindow()); - return 0; + return nullptr; } QWindowContainer *QAccessibleWindowContainer::container() const diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index d00a600424..689002b589 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -192,7 +192,7 @@ class QWellArray : public QWidget Q_PROPERTY(int selectedRow READ selectedRow) public: - QWellArray(int rows, int cols, QWidget* parent=0); + QWellArray(int rows, int cols, QWidget* parent=nullptr); ~QWellArray() {} QString cellContent(int row, int col) const; @@ -744,7 +744,7 @@ class QColorLuminancePicker : public QWidget { Q_OBJECT public: - QColorLuminancePicker(QWidget* parent=0); + QColorLuminancePicker(QWidget* parent=nullptr); ~QColorLuminancePicker(); public slots: @@ -789,7 +789,7 @@ QColorLuminancePicker::QColorLuminancePicker(QWidget* parent) :QWidget(parent) { hue = 100; val = 100; sat = 100; - pix = 0; + pix = nullptr; // setAttribute(WA_NoErase, true); } @@ -812,7 +812,7 @@ void QColorLuminancePicker::setVal(int v) if (val == v) return; val = qMax(0, qMin(v,255)); - delete pix; pix=0; + delete pix; pix=nullptr; repaint(); emit newHsv(hue, sat, val); } @@ -861,7 +861,7 @@ void QColorLuminancePicker::setCol(int h, int s , int v) val = v; hue = h; sat = s; - delete pix; pix=0; + delete pix; pix=nullptr; repaint(); } @@ -1678,8 +1678,8 @@ void QColorDialogPrivate::init(const QColor &initial) q->setWindowTitle(QColorDialog::tr("Select Color")); // default: use the native dialog if possible. Can be overridden in setOptions() - nativeDialogInUse = (platformColorDialogHelper() != 0); - colorPickingEventFilter = 0; + nativeDialogInUse = (platformColorDialogHelper() != nullptr); + colorPickingEventFilter = nullptr; nextCust = 0; if (!nativeDialogInUse) @@ -1703,7 +1703,7 @@ void QColorDialogPrivate::initWidgets() QHBoxLayout *topLay = new QHBoxLayout(); mainLay->addLayout(topLay); - leftLay = 0; + leftLay = nullptr; #if defined(QT_SMALL_COLORDIALOG) smallDisplay = true; @@ -1773,8 +1773,8 @@ void QColorDialogPrivate::initWidgets() pWidth = 150; pHeight = 100; #endif - custom = 0; - standard = 0; + custom = nullptr; + standard = nullptr; } QVBoxLayout *rightLay = new QVBoxLayout; @@ -2302,7 +2302,7 @@ void QColorDialog::done(int result) if (d->receiverToDisconnectOnClose) { disconnect(this, SIGNAL(colorSelected(QColor)), d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); - d->receiverToDisconnectOnClose = 0; + d->receiverToDisconnectOnClose = nullptr; } d->memberToDisconnectOnClose.clear(); } diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 3cdd9a5f04..362200a4fd 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -187,7 +187,7 @@ QWindow *QDialogPrivate::transientParentWindow() const return parent->windowHandle(); else if (q->windowHandle()) return q->windowHandle()->transientParent(); - return 0; + return nullptr; } bool QDialogPrivate::setNativeDialogVisible(bool visible) @@ -214,7 +214,7 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const void QDialogPrivate::deletePlatformHelper() { delete m_platformHelper; - m_platformHelper = 0; + m_platformHelper = nullptr; m_platformHelperCreated = false; nativeDialogInUse = false; } @@ -460,7 +460,7 @@ void QDialogPrivate::setDefault(QPushButton *pushButton) */ void QDialogPrivate::setMainDefault(QPushButton *pushButton) { - mainDef = 0; + mainDef = nullptr; setDefault(pushButton); } @@ -602,7 +602,7 @@ int QDialog::exec() } if (guard.isNull()) return QDialog::Rejected; - d->eventLoop = 0; + d->eventLoop = nullptr; setAttribute(Qt::WA_ShowModal, wasShowModal); @@ -679,12 +679,12 @@ void QDialog::contextMenuEvent(QContextMenuEvent *e) #else QWidget *w = childAt(e->pos()); if (!w) { - w = rect().contains(e->pos()) ? this : 0; + w = rect().contains(e->pos()) ? this : nullptr; if (!w) return; } while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis)) - w = w->isWindow() ? 0 : w->parentWidget(); + w = w->isWindow() ? nullptr : w->parentWidget(); if (w) { QPointer p = new QMenu(this); QAction *wt = p.data()->addAction(tr("What's This?")); @@ -1191,7 +1191,7 @@ void QDialog::setSizeGripEnabled(bool enabled) d->resizer->show(); } else { delete d->resizer; - d->resizer = 0; + d->resizer = nullptr; } } #endif // QT_CONFIG(sizegrip) diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index f0ec2c0102..790d09414b 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -149,13 +149,13 @@ QSize QErrorMessageTextView::sizeHint() const \sa QMessageBox, QStatusBar::showMessage(), {Standard Dialogs Example} */ -static QErrorMessage * qtMessageHandler = 0; +static QErrorMessage * qtMessageHandler = nullptr; static void deleteStaticcQErrorMessage() // post-routine { if (qtMessageHandler) { delete qtMessageHandler; - qtMessageHandler = 0; + qtMessageHandler = nullptr; } } @@ -252,8 +252,8 @@ QErrorMessage::QErrorMessage(QWidget * parent) QErrorMessage::~QErrorMessage() { if (this == qtMessageHandler) { - qtMessageHandler = 0; - QtMessageHandler tmp = qInstallMessageHandler(0); + qtMessageHandler = nullptr; + QtMessageHandler tmp = qInstallMessageHandler(nullptr); // in case someone else has later stuck in another... if (tmp != jump) qInstallMessageHandler(tmp); @@ -293,7 +293,7 @@ void QErrorMessage::done(int a) QErrorMessage * QErrorMessage::qtHandler() { if (!qtMessageHandler) { - qtMessageHandler = new QErrorMessage(0); + qtMessageHandler = new QErrorMessage(nullptr); qAddPostRoutine(deleteStaticcQErrorMessage); // clean up qtMessageHandler->setWindowTitle(QCoreApplication::applicationName()); qInstallMessageHandler(jump); diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index fbcc02accd..f0bd08a778 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -531,15 +531,15 @@ void QFileDialog::changeEvent(QEvent *e) QFileDialogPrivate::QFileDialogPrivate() : #if QT_CONFIG(proxymodel) - proxyModel(0), + proxyModel(nullptr), #endif - model(0), + model(nullptr), currentHistoryLocation(-1), - renameAction(0), - deleteAction(0), - showHiddenAction(0), + renameAction(nullptr), + deleteAction(nullptr), + showHiddenAction(nullptr), useDefaultCaption(true), - qFileDialogUi(0), + qFileDialogUi(nullptr), options(QFileDialogOptions::create()) { } @@ -882,14 +882,14 @@ void QFileDialog::setVisible(bool visible) #if QT_CONFIG(fscompleter) // So the completer doesn't try to complete and therefore show a popup if (!d->nativeDialogInUse) - d->completer->setModel(0); + d->completer->setModel(nullptr); #endif } else { d->createWidgets(); setAttribute(Qt::WA_DontShowOnScreen, false); #if QT_CONFIG(fscompleter) if (!d->nativeDialogInUse) { - if (d->proxyModel != 0) + if (d->proxyModel != nullptr) d->completer->setModel(d->proxyModel); else d->completer->setModel(d->model); @@ -1824,7 +1824,7 @@ QModelIndex QFileDialogPrivate::rootIndex() const { QAbstractItemView *QFileDialogPrivate::currentView() const { if (!qFileDialogUi->stackedWidget) - return 0; + return nullptr; if (qFileDialogUi->stackedWidget->currentWidget() == qFileDialogUi->listView->parent()) return qFileDialogUi->listView; return qFileDialogUi->treeView; @@ -2038,7 +2038,7 @@ QAbstractItemDelegate *QFileDialog::itemDelegate() const { Q_D(const QFileDialog); if (!d->usingWidgets()) - return 0; + return nullptr; return d->qFileDialogUi->listView->itemDelegate(); } @@ -2776,7 +2776,7 @@ void QFileDialog::done(int result) if (d->receiverToDisconnectOnClose) { disconnect(this, d->signalToDisconnectOnClose, d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); - d->receiverToDisconnectOnClose = 0; + d->receiverToDisconnectOnClose = nullptr; } d->memberToDisconnectOnClose.clear(); d->signalToDisconnectOnClose.clear(); @@ -3015,7 +3015,7 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter, } q->setAcceptMode(QFileDialog::AcceptOpen); - nativeDialogInUse = platformFileDialogHelper() != 0; + nativeDialogInUse = platformFileDialogHelper() != nullptr; if (!nativeDialogInUse) createWidgets(); q->setFileMode(QFileDialog::AnyFile); @@ -3273,7 +3273,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) this, SLOT(_q_rowsInserted(QModelIndex))); } - if (proxyModel != 0) { + if (proxyModel != nullptr) { proxyModel->setParent(this); d->proxyModel = proxyModel; proxyModel->setSourceModel(d->model); @@ -3286,13 +3286,13 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) connect(d->proxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(_q_rowsInserted(QModelIndex))); } else { - d->proxyModel = 0; + d->proxyModel = nullptr; d->qFileDialogUi->listView->setModel(d->model); d->qFileDialogUi->treeView->setModel(d->model); #if QT_CONFIG(fscompleter) d->completer->setModel(d->model); d->completer->sourceModel = d->model; - d->completer->proxyModel = 0; + d->completer->proxyModel = nullptr; #endif connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(_q_rowsInserted(QModelIndex))); @@ -3330,27 +3330,27 @@ QAbstractProxyModel *QFileDialog::proxyModel() const void QFileDialogPrivate::createToolButtons() { Q_Q(QFileDialog); - qFileDialogUi->backButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowBack, 0, q)); + qFileDialogUi->backButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowBack, nullptr, q)); qFileDialogUi->backButton->setAutoRaise(true); qFileDialogUi->backButton->setEnabled(false); QObject::connect(qFileDialogUi->backButton, SIGNAL(clicked()), q, SLOT(_q_navigateBackward())); - qFileDialogUi->forwardButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowForward, 0, q)); + qFileDialogUi->forwardButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowForward, nullptr, q)); qFileDialogUi->forwardButton->setAutoRaise(true); qFileDialogUi->forwardButton->setEnabled(false); QObject::connect(qFileDialogUi->forwardButton, SIGNAL(clicked()), q, SLOT(_q_navigateForward())); - qFileDialogUi->toParentButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogToParent, 0, q)); + qFileDialogUi->toParentButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogToParent, nullptr, q)); qFileDialogUi->toParentButton->setAutoRaise(true); qFileDialogUi->toParentButton->setEnabled(false); QObject::connect(qFileDialogUi->toParentButton, SIGNAL(clicked()), q, SLOT(_q_navigateToParent())); - qFileDialogUi->listModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogListView, 0, q)); + qFileDialogUi->listModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogListView, nullptr, q)); qFileDialogUi->listModeButton->setAutoRaise(true); qFileDialogUi->listModeButton->setDown(true); QObject::connect(qFileDialogUi->listModeButton, SIGNAL(clicked()), q, SLOT(_q_showListView())); - qFileDialogUi->detailModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogDetailedView, 0, q)); + qFileDialogUi->detailModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogDetailedView, nullptr, q)); qFileDialogUi->detailModeButton->setAutoRaise(true); QObject::connect(qFileDialogUi->detailModeButton, SIGNAL(clicked()), q, SLOT(_q_showDetailsView())); @@ -3361,7 +3361,7 @@ void QFileDialogPrivate::createToolButtons() qFileDialogUi->forwardButton->setFixedSize(toolSize); qFileDialogUi->toParentButton->setFixedSize(toolSize); - qFileDialogUi->newFolderButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogNewFolder, 0, q)); + qFileDialogUi->newFolderButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogNewFolder, nullptr, q)); qFileDialogUi->newFolderButton->setFixedSize(toolSize); qFileDialogUi->newFolderButton->setAutoRaise(true); qFileDialogUi->newFolderButton->setEnabled(false); @@ -3598,7 +3598,7 @@ void QFileDialogPrivate::_q_showContextMenu(const QPoint &position) Q_UNUSED(position); #else Q_Q(QFileDialog); - QAbstractItemView *view = 0; + QAbstractItemView *view = nullptr; if (q->viewMode() == QFileDialog::Detail) view = qFileDialogUi->treeView; else diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 79a7c23e0d..914c845565 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -586,9 +586,9 @@ QModelIndex QFileSystemModel::parent(const QModelIndex &index) const return QModelIndex(); QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(index); - Q_ASSERT(indexNode != 0); + Q_ASSERT(indexNode != nullptr); QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent; - if (parentNode == 0 || parentNode == &d->root) + if (parentNode == nullptr || parentNode == &d->root) return QModelIndex(); // get the parent's row @@ -608,7 +608,7 @@ QModelIndex QFileSystemModel::parent(const QModelIndex &index) const QModelIndex QFileSystemModelPrivate::index(const QFileSystemModelPrivate::QFileSystemNode *node, int column) const { Q_Q(const QFileSystemModel); - QFileSystemModelPrivate::QFileSystemNode *parentNode = (node ? node->parent : 0); + QFileSystemModelPrivate::QFileSystemNode *parentNode = (node ? node->parent : nullptr); if (node == &root || !parentNode) return QModelIndex(); diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 3da829d328..fe8f88d64f 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -276,7 +276,7 @@ void QFontDialogPrivate::init() mainGrid->setColumnMinimumWidth(3, spacing); int margin = 0; - mainGrid->getContentsMargins(0, 0, 0, &margin); + mainGrid->getContentsMargins(nullptr, nullptr, nullptr, &margin); mainGrid->setRowMinimumHeight(3, margin); mainGrid->setRowMinimumHeight(6, 2); @@ -435,7 +435,7 @@ bool QFontDialog::eventFilter(QObject *o , QEvent *e) QCoreApplication::sendEvent(d->sizeList, k); if (ci != d->sizeList->currentItem() - && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, this)) + && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, this)) d->sizeEdit->selectAll(); return true; } else if ((o == d->familyList || o == d->styleList) && @@ -445,7 +445,7 @@ bool QFontDialog::eventFilter(QObject *o , QEvent *e) return true; } } else if (e->type() == QEvent::FocusIn - && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, this)) { + && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, this)) { if (o == d->familyList) d->familyEdit->selectAll(); else if (o == d->styleList) @@ -550,7 +550,7 @@ void QFontDialogPrivate::updateFamilies() else familyList->setCurrentItem(0); familyEdit->setText(familyList->currentText()); - if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q) + if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q) && familyList->hasFocus()) familyEdit->selectAll(); @@ -602,7 +602,7 @@ void QFontDialogPrivate::updateStyles() } styleEdit->setText(styleList->currentText()); - if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q) + if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q) && styleList->hasFocus()) styleEdit->selectAll(); @@ -641,7 +641,7 @@ void QFontDialogPrivate::updateSizes() const QSignalBlocker blocker(sizeEdit); sizeEdit->setText((smoothScalable ? QString::number(size) : sizeList->currentText())); - if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q) + if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q) && sizeList->hasFocus()) sizeEdit->selectAll(); } else { @@ -692,7 +692,7 @@ void QFontDialogPrivate::_q_familyHighlighted(int i) Q_Q(QFontDialog); family = familyList->text(i); familyEdit->setText(family); - if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q) + if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q) && familyList->hasFocus()) familyEdit->selectAll(); @@ -709,7 +709,7 @@ void QFontDialogPrivate::_q_styleHighlighted(int index) Q_Q(QFontDialog); QString s = styleList->text(index); styleEdit->setText(s); - if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q) + if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q) && styleList->hasFocus()) styleEdit->selectAll(); @@ -728,7 +728,7 @@ void QFontDialogPrivate::_q_sizeHighlighted(int index) Q_Q(QFontDialog); QString s = sizeList->text(index); sizeEdit->setText(s); - if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q) + if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q) && sizeEdit->hasFocus()) sizeEdit->selectAll(); @@ -1019,7 +1019,7 @@ void QFontDialog::done(int result) if (d->receiverToDisconnectOnClose) { disconnect(this, SIGNAL(fontSelected(QFont)), d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); - d->receiverToDisconnectOnClose = 0; + d->receiverToDisconnectOnClose = nullptr; } d->memberToDisconnectOnClose.clear(); } diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp index 3cfe8367e0..1cb4be0682 100644 --- a/src/widgets/dialogs/qinputdialog.cpp +++ b/src/widgets/dialogs/qinputdialog.cpp @@ -138,7 +138,7 @@ class QInputDialogDoubleSpinBox : public QDoubleSpinBox Q_OBJECT public: - QInputDialogDoubleSpinBox(QWidget *parent = 0) + QInputDialogDoubleSpinBox(QWidget *parent = nullptr) : QDoubleSpinBox(parent) { connect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(notifyTextChanged())); connect(this, SIGNAL(editingFinished()), this, SLOT(notifyTextChanged())); @@ -171,7 +171,7 @@ private: class QInputDialogListView : public QListView { public: - QInputDialogListView(QWidget *parent = 0) : QListView(parent) {} + QInputDialogListView(QWidget *parent = nullptr) : QListView(parent) {} QVariant inputMethodQuery(Qt::InputMethodQuery query) const override { if (query == Qt::ImEnabled) @@ -223,8 +223,8 @@ public: }; QInputDialogPrivate::QInputDialogPrivate() - : label(0), buttonBox(0), lineEdit(0), plainTextEdit(0), intSpinBox(0), doubleSpinBox(0), - comboBox(0), listView(0), inputWidget(0), mainLayout(0) + : label(nullptr), buttonBox(nullptr), lineEdit(nullptr), plainTextEdit(nullptr), intSpinBox(nullptr), doubleSpinBox(nullptr), + comboBox(nullptr), listView(nullptr), inputWidget(nullptr), mainLayout(nullptr) { } @@ -1174,7 +1174,7 @@ void QInputDialog::done(int result) if (d->receiverToDisconnectOnClose) { disconnect(this, signalForMember(d->memberToDisconnectOnClose), d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); - d->receiverToDisconnectOnClose = 0; + d->receiverToDisconnectOnClose = nullptr; } d->memberToDisconnectOnClose.clear(); } diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 8dad212692..17d199cb4f 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -97,7 +97,7 @@ public: class TextEdit : public QTextEdit { public: - TextEdit(QWidget *parent=0) : QTextEdit(parent) { } + TextEdit(QWidget *parent=nullptr) : QTextEdit(parent) { } #ifndef QT_NO_CONTEXTMENU void contextMenuEvent(QContextMenuEvent * e) override { @@ -108,7 +108,7 @@ public: #endif // QT_NO_CONTEXTMENU }; - QMessageBoxDetailsText(QWidget *parent=0) + QMessageBoxDetailsText(QWidget *parent=nullptr) : QWidget(parent) , copyAvailable(false) { @@ -197,12 +197,12 @@ class QMessageBoxPrivate : public QDialogPrivate Q_DECLARE_PUBLIC(QMessageBox) public: - QMessageBoxPrivate() : escapeButton(0), defaultButton(0), checkbox(0), clickedButton(0), detailsButton(0), + QMessageBoxPrivate() : escapeButton(nullptr), defaultButton(nullptr), checkbox(nullptr), clickedButton(nullptr), detailsButton(nullptr), #if QT_CONFIG(textedit) - detailsText(0), + detailsText(nullptr), #endif compatMode(false), autoAddOkButton(true), - detectedEscapeButton(0), informativeLabel(0), + detectedEscapeButton(nullptr), informativeLabel(nullptr), options(QMessageDialogOptions::create()) { } void init(const QString &title = QString(), const QString &text = QString()); @@ -274,7 +274,7 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text) label = new QLabel; label->setObjectName(QLatin1String("qt_msgbox_label")); - label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q))); + label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, q))); label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); label->setOpenExternalLinks(true); iconLabel = new QLabel(q); @@ -283,7 +283,7 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text) buttonBox = new QDialogButtonBox; buttonBox->setObjectName(QLatin1String("qt_msgbox_buttonbox")); - buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, q)); + buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, q)); QObject::connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), q, SLOT(_q_buttonClicked(QAbstractButton*))); setupLayout(); @@ -927,9 +927,9 @@ void QMessageBox::removeButton(QAbstractButton *button) Q_D(QMessageBox); d->customButtonList.removeAll(button); if (d->escapeButton == button) - d->escapeButton = 0; + d->escapeButton = nullptr; if (d->defaultButton == button) - d->defaultButton = 0; + d->defaultButton = nullptr; d->buttonBox->removeButton(button); d->updateSize(); } @@ -952,9 +952,9 @@ void QMessageBox::setStandardButtons(StandardButtons buttons) QList buttonList = d->buttonBox->buttons(); if (!buttonList.contains(d->escapeButton)) - d->escapeButton = 0; + d->escapeButton = nullptr; if (!buttonList.contains(d->defaultButton)) - d->defaultButton = 0; + d->defaultButton = nullptr; d->autoAddOkButton = false; d->updateSize(); } @@ -1081,7 +1081,7 @@ void QMessageBoxPrivate::detectEscapeButton() for (auto *button : buttons) { if (buttonBox->buttonRole(button) == QDialogButtonBox::RejectRole) { if (detectedEscapeButton) { // already detected! - detectedEscapeButton = 0; + detectedEscapeButton = nullptr; break; } detectedEscapeButton = button; @@ -1094,7 +1094,7 @@ void QMessageBoxPrivate::detectEscapeButton() for (auto *button : buttons) { if (buttonBox->buttonRole(button) == QDialogButtonBox::NoRole) { if (detectedEscapeButton) { // already detected! - detectedEscapeButton = 0; + detectedEscapeButton = nullptr; break; } detectedEscapeButton = button; @@ -1189,7 +1189,7 @@ void QMessageBox::setCheckBox(QCheckBox *cb) d->checkbox->hide(); layout()->removeWidget(d->checkbox); if (d->checkbox->parentWidget() == this) { - d->checkbox->setParent(0); + d->checkbox->setParent(nullptr); d->checkbox->deleteLater(); } } @@ -1433,9 +1433,9 @@ void QMessageBox::changeEvent(QEvent *ev) { if (d->icon != NoIcon) setIcon(d->icon); - Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this)); + Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this)); d->label->setTextInteractionFlags(flags); - d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this)); + d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, this)); if (d->informativeLabel) d->informativeLabel->setTextInteractionFlags(flags); Q_FALLTHROUGH(); @@ -1624,7 +1624,7 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent); QDialogButtonBox *buttonBox = msgBox.findChild(); - Q_ASSERT(buttonBox != 0); + Q_ASSERT(buttonBox != nullptr); uint mask = QMessageBox::FirstButton; while (mask <= QMessageBox::LastButton) { @@ -2001,7 +2001,7 @@ QAbstractButton *QMessageBoxPrivate::abstractButtonForId(int id) const if (result) return result; if (id & QMessageBox::FlagMask) // for compatibility with Qt 4.0/4.1 (even if it is silly) - return 0; + return nullptr; return q->button(newButton(id)); } @@ -2522,13 +2522,13 @@ void QMessageBox::setDetailedText(const QString &text) d->detailsText->hide(); d->detailsText->deleteLater(); } - d->detailsText = 0; + d->detailsText = nullptr; removeButton(d->detailsButton); if (d->detailsButton) { d->detailsButton->hide(); d->detailsButton->deleteLater(); } - d->detailsButton = 0; + d->detailsButton = nullptr; } else { if (!d->detailsText) { d->detailsText = new QMessageBoxDetailsText(this); @@ -2577,12 +2577,12 @@ void QMessageBox::setInformativeText(const QString &text) d->informativeLabel->hide(); d->informativeLabel->deleteLater(); } - d->informativeLabel = 0; + d->informativeLabel = nullptr; } else { if (!d->informativeLabel) { QLabel *label = new QLabel; label->setObjectName(QLatin1String("qt_msgbox_informativelabel")); - label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this))); + label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this))); label->setAlignment(Qt::AlignTop | Qt::AlignLeft); label->setOpenExternalLinks(true); label->setWordWrap(true); @@ -2644,20 +2644,20 @@ void QMessageBox::setWindowModality(Qt::WindowModality windowModality) QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb) { QStyle *style = mb ? mb->style() : QApplication::style(); - int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, mb); + int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, mb); QIcon tmpIcon; switch (icon) { case QMessageBox::Information: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, mb); + tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, nullptr, mb); break; case QMessageBox::Warning: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, mb); + tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, nullptr, mb); break; case QMessageBox::Critical: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, mb); + tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, nullptr, mb); break; case QMessageBox::Question: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mb); + tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, nullptr, mb); default: break; } @@ -2739,7 +2739,7 @@ void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHel QPixmap QMessageBox::standardIcon(Icon icon) { - return QMessageBoxPrivate::standardIcon(icon, 0); + return QMessageBoxPrivate::standardIcon(icon, nullptr); } /*! diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 189dcd2989..94d3928c8b 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -65,13 +65,13 @@ class QProgressDialogPrivate : public QDialogPrivate Q_DECLARE_PUBLIC(QProgressDialog) public: - QProgressDialogPrivate() : label(0), cancel(0), bar(0), + QProgressDialogPrivate() : label(nullptr), cancel(nullptr), bar(nullptr), shown_once(false), cancellation_flag(false), setValue_called(false), showTime(defaultShowTime), #ifndef QT_NO_SHORTCUT - escapeShortcut(0), + escapeShortcut(nullptr), #endif useDefaultCancelText(false) { @@ -112,7 +112,7 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance label = new QLabel(labelText, q); bar = new QProgressBar(q); bar->setRange(min, max); - int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); + int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, nullptr, q); label->setAlignment(Qt::Alignment(align)); autoClose = true; autoReset = true; @@ -132,12 +132,12 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance void QProgressDialogPrivate::layout() { Q_Q(QProgressDialog); - int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, q); - int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q); - int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q)); - int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q)); + int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, nullptr, q); + int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr, q); + int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, q)); + int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, q)); const bool centered = - bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); + bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, nullptr, q)); int additionalSpacing = 0; QSize cs = cancel ? cancel->sizeHint() : QSize(0,0); @@ -188,7 +188,7 @@ void QProgressDialogPrivate::_q_disconnectOnClose() if (receiverToDisconnectOnClose) { QObject::disconnect(q, SIGNAL(canceled()), receiverToDisconnectOnClose, memberToDisconnectOnClose); - receiverToDisconnectOnClose = 0; + receiverToDisconnectOnClose = nullptr; } memberToDisconnectOnClose.clear(); } @@ -418,7 +418,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton) } else { #ifndef QT_NO_SHORTCUT delete d->escapeShortcut; - d->escapeShortcut = 0; + d->escapeShortcut = nullptr; #endif } d->adoptChildWidget(cancelButton); @@ -450,7 +450,7 @@ void QProgressDialogPrivate::setCancelButtonText(const QString &cancelButtonText q->setCancelButton(new QPushButton(cancelButtonText, q)); } } else { - q->setCancelButton(0); + q->setCancelButton(nullptr); } ensureSizeIsAtLeastSizeHint(); } diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index 2c8c66e1e2..dfb707eda0 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -73,7 +73,7 @@ void QSideBarDelegate::initStyleOption(QStyleOptionViewItem *option, Example usage: File dialog sidebar and combo box */ -QUrlModel::QUrlModel(QObject *parent) : QStandardItemModel(parent), showFullPath(false), fileSystemModel(0) +QUrlModel::QUrlModel(QObject *parent) : QStandardItemModel(parent), showFullPath(false), fileSystemModel(nullptr) { } @@ -298,7 +298,7 @@ void QUrlModel::setFileSystemModel(QFileSystemModel *model) { if (model == fileSystemModel) return; - if (fileSystemModel != 0) { + if (fileSystemModel != nullptr) { disconnect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); disconnect(model, SIGNAL(layoutChanged()), @@ -307,7 +307,7 @@ void QUrlModel::setFileSystemModel(QFileSystemModel *model) this, SLOT(layoutChanged())); } fileSystemModel = model; - if (fileSystemModel != 0) { + if (fileSystemModel != nullptr) { connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); connect(model, SIGNAL(layoutChanged()), diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 7c4a473976..a4789f40b1 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -115,7 +115,7 @@ static QWidget *iWantTheFocus(QWidget *ancestor) return candidate; } } - return 0; + return nullptr; } static bool objectInheritsXAndXIsCloserThanY(const QObject *object, const QByteArray &classX, @@ -165,7 +165,7 @@ static const char *changed_signal(int which) }; Q_STATIC_ASSERT(7 == NFallbackDefaultProperties); Q_UNREACHABLE(); - return 0; + return nullptr; } class QWizardDefaultProperty @@ -286,9 +286,9 @@ class QWizardHeader : public QWidget public: enum RulerType { Ruler }; - inline QWizardHeader(RulerType /* ruler */, QWidget *parent = 0) + inline QWizardHeader(RulerType /* ruler */, QWidget *parent = nullptr) : QWidget(parent) { setFixedHeight(2); } - QWizardHeader(QWidget *parent = 0); + QWizardHeader(QWidget *parent = nullptr); void setup(const QWizardLayoutInfo &info, const QString &title, const QString &subTitle, const QPixmap &logo, const QPixmap &banner, @@ -438,7 +438,7 @@ void QWizardHeader::paintEvent(QPaintEvent * /* event */) class QWizardRuler : public QWizardHeader { public: - inline QWizardRuler(QWidget *parent = 0) + inline QWizardRuler(QWidget *parent = nullptr) : QWizardHeader(Ruler, parent) {} }; @@ -684,7 +684,7 @@ void QWizardPrivate::init() std::fill(btns, btns + QWizard::NButtons, nullptr); antiFlickerWidget = new QWizardAntiFlickerWidget(q, this); - wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q)); + wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, nullptr, q)); if (wizStyle == QWizard::MacStyle) { opts = (QWizard::NoDefaultButton | QWizard::NoCancelButton); } else if (wizStyle == QWizard::ModernStyle) { @@ -836,7 +836,7 @@ void QWizardPrivate::switchToPage(int newId, Direction direction) newPage && newPage->isCommitPage() ? QWizard::CommitButton : QWizard::NextButton; QAbstractButton *nextOrFinishButton = btns[canContinue ? nextOrCommit : QWizard::FinishButton]; - QWidget *candidate = 0; + QWidget *candidate = nullptr; /* If there is no default button and the Next or Finish button @@ -887,7 +887,7 @@ static const char * buttonSlots(QWizard::WizardButton which) case QWizard::NoButton: Q_UNREACHABLE(); }; - return 0; + return nullptr; }; QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage() @@ -898,14 +898,14 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage() QWizardLayoutInfo info; const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); - info.topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q); - info.topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q); - info.topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, 0, q); - info.topLevelMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q); - info.childMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, titleLabel); - info.childMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, 0, titleLabel); - info.childMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, 0, titleLabel); - info.childMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, titleLabel); + info.topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, q); + info.topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, q); + info.topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr, q); + info.topLevelMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr, q); + info.childMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, titleLabel); + info.childMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, titleLabel); + info.childMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr, titleLabel); + info.childMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr, titleLabel); info.hspacing = (layoutHorizontalSpacing == -1) ? style->layoutSpacing(QSizePolicy::DefaultType, QSizePolicy::DefaultType, Qt::Horizontal) : layoutHorizontalSpacing; @@ -959,7 +959,7 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info) for (int i = mainLayout->count() - 1; i >= 0; --i) { QLayoutItem *item = mainLayout->takeAt(i); if (item->layout()) { - item->layout()->setParent(0); + item->layout()->setParent(nullptr); } else { delete item; } @@ -2281,7 +2281,7 @@ void QWizard::removePage(int id) { Q_D(QWizard); - QWizardPage *removedPage = 0; + QWizardPage *removedPage = nullptr; // update startItem accordingly if (d->pageMap.count() > 0) { // only if we have any pages @@ -2792,7 +2792,7 @@ QAbstractButton *QWizard::button(WizardButton which) const return d->vistaHelper->backButton(); #endif if (!d->ensureButton(which)) - return 0; + return nullptr; return d->btns[which]; } diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp index 94188f3485..2eb74ce2a8 100644 --- a/src/widgets/effects/qgraphicseffect.cpp +++ b/src/widgets/effects/qgraphicseffect.cpp @@ -415,7 +415,7 @@ QGraphicsEffect::QGraphicsEffect(QGraphicsEffectPrivate &dd, QObject *parent) QGraphicsEffect::~QGraphicsEffect() { Q_D(QGraphicsEffect); - d->setGraphicsEffectSource(0); + d->setGraphicsEffectSource(nullptr); } /*! diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index e1e8175423..637c9c6aba 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -208,7 +208,7 @@ QRectF QPixmapFilter::boundingRectFor(const QRectF &rect) const class QPixmapConvolutionFilterPrivate : public QPixmapFilterPrivate { public: - QPixmapConvolutionFilterPrivate(): convolutionKernel(0), kernelWidth(0), kernelHeight(0), convoluteAlpha(false) {} + QPixmapConvolutionFilterPrivate(): convolutionKernel(nullptr), kernelWidth(0), kernelHeight(0), convoluteAlpha(false) {} ~QPixmapConvolutionFilterPrivate() { delete[] convolutionKernel; } @@ -424,7 +424,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q // raster implementation - QImage *target = 0; + QImage *target = nullptr; if (painter->paintEngine()->paintDevice()->devType() == QInternal::Image) { target = static_cast(painter->paintEngine()->paintDevice()); @@ -432,18 +432,18 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if (mat.type() > QTransform::TxTranslate) { // Disabled because of transformation... - target = 0; + target = nullptr; } else { QRasterPaintEngine *pe = static_cast(painter->paintEngine()); if (pe->clipType() == QRasterPaintEngine::ComplexClip) // disabled because of complex clipping... - target = 0; + target = nullptr; else { QRectF clip = pe->clipBoundingRect(); QRectF rect = boundingRectFor(srcRect.isEmpty() ? src.rect() : srcRect); QTransform x = painter->deviceTransform(); if (!clip.contains(rect.translated(x.dx() + p.x(), x.dy() + p.y()))) { - target = 0; + target = nullptr; } } diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp index ea6a8018ca..4f1855a606 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp @@ -353,7 +353,7 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem, bool ok = true; if (orientations & Qt::Horizontal) { // Currently, if the first is ok, then the rest of the calls should be ok - ok = addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft) != 0; + ok = addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft) != nullptr; if (ok) addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight); } @@ -465,7 +465,7 @@ void QGraphicsAnchorLayout::removeAt(int index) d->removeAnchors(item); d->items.remove(index); - item->setParentLayoutItem(0); + item->setParentLayoutItem(nullptr); invalidate(); } diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index 4f44373cad..af0ee3d38c 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE const qreal g_offset = (sizeof(qreal) == sizeof(double)) ? QWIDGETSIZE_MAX : QWIDGETSIZE_MAX / 32; QGraphicsAnchorPrivate::QGraphicsAnchorPrivate(int version) - : QObjectPrivate(version), layoutPrivate(0), data(0), + : QObjectPrivate(version), layoutPrivate(nullptr), data(nullptr), sizePolicy(QSizePolicy::Fixed), preferredSize(0), hasSize(true) { @@ -72,7 +72,7 @@ QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate() if (data) { // The QGraphicsAnchor was already deleted at this moment. We must clean // the dangling pointer to avoid double deletion in the AnchorData dtor. - data->graphicsAnchor = 0; + data->graphicsAnchor = nullptr; layoutPrivate->removeAnchor(data->from, data->to); } @@ -631,9 +631,9 @@ QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate() spacings[i] = -1; graphHasConflicts[i] = false; - layoutFirstVertex[i] = 0; - layoutCentralVertex[i] = 0; - layoutLastVertex[i] = 0; + layoutFirstVertex[i] = nullptr; + layoutCentralVertex[i] = nullptr; + layoutLastVertex[i] = nullptr; } } @@ -981,7 +981,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyVertices(Orientation orientation) feasible &= replaceVertex(orientation, next, newV, newV->m_secondAnchors); // Update the layout vertex information if one of the vertices is a layout vertex. - AnchorVertex *layoutVertex = 0; + AnchorVertex *layoutVertex = nullptr; if (v->m_item == q) layoutVertex = v; else if (next->m_item == q) @@ -1035,7 +1035,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP QSet visited; QStack > stack; - stack.push(qMakePair(static_cast(0), layoutFirstVertex[orientation])); + stack.push(qMakePair(static_cast(nullptr), layoutFirstVertex[orientation])); QVector candidates; // Walk depth-first, in the stack we store start of the candidate sequence (beforeSequence) @@ -1384,7 +1384,7 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() // Save a reference to layout vertices layoutFirstVertex[Horizontal] = internalVertex(layout, Qt::AnchorLeft); - layoutCentralVertex[Horizontal] = 0; + layoutCentralVertex[Horizontal] = nullptr; layoutLastVertex[Horizontal] = internalVertex(layout, Qt::AnchorRight); // Vertical @@ -1395,7 +1395,7 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() // Save a reference to layout vertices layoutFirstVertex[Vertical] = internalVertex(layout, Qt::AnchorTop); - layoutCentralVertex[Vertical] = 0; + layoutCentralVertex[Vertical] = nullptr; layoutLastVertex[Vertical] = internalVertex(layout, Qt::AnchorBottom); } @@ -1581,7 +1581,7 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors( } if (item == q) { - layoutCentralVertex[orientation] = 0; + layoutCentralVertex[orientation] = nullptr; } } @@ -1636,29 +1636,29 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi qreal *spacing) { Q_Q(QGraphicsAnchorLayout); - if ((firstItem == 0) || (secondItem == 0)) { + if ((firstItem == nullptr) || (secondItem == nullptr)) { qWarning("QGraphicsAnchorLayout::addAnchor(): " "Cannot anchor NULL items"); - return 0; + return nullptr; } if (firstItem == secondItem) { qWarning("QGraphicsAnchorLayout::addAnchor(): " "Cannot anchor the item to itself"); - return 0; + return nullptr; } if (edgeOrientation(secondEdge) != edgeOrientation(firstEdge)) { qWarning("QGraphicsAnchorLayout::addAnchor(): " "Cannot anchor edges of different orientations"); - return 0; + return nullptr; } const QGraphicsLayoutItem *parentWidget = q->parentLayoutItem(); if (firstItem == parentWidget || secondItem == parentWidget) { qWarning("QGraphicsAnchorLayout::addAnchor(): " "You cannot add the parent of the layout to the layout."); - return 0; + return nullptr; } // In QGraphicsAnchorLayout, items are represented in its internal @@ -1770,13 +1770,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::getAnchor(QGraphicsLayoutItem *fi { // Do not expose internal anchors if (firstItem == secondItem) - return 0; + return nullptr; const Orientation orientation = edgeOrientation(firstEdge); AnchorVertex *v1 = internalVertex(firstItem, firstEdge); AnchorVertex *v2 = internalVertex(secondItem, secondEdge); - QGraphicsAnchor *graphicsAnchor = 0; + QGraphicsAnchor *graphicsAnchor = nullptr; AnchorData *data = graph[orientation].edgeData(v1, v2); if (data) { @@ -1811,7 +1811,7 @@ void QGraphicsAnchorLayoutPrivate::removeAnchor(AnchorVertex *firstVertex, removeAnchor_helper(firstVertex, secondVertex); // Ensure no dangling pointer is left behind - firstVertex = secondVertex = 0; + firstVertex = secondVertex = nullptr; // Checking if the item stays in the layout or not bool keepFirstItem = false; @@ -2017,13 +2017,13 @@ QLayoutStyleInfo &QGraphicsAnchorLayoutPrivate::styleInfo() const if (styleInfoDirty) { Q_Q(const QGraphicsAnchorLayout); //### Fix this if QGV ever gets support for Metal style or different Aqua sizes. - QWidget *wid = 0; + QWidget *wid = nullptr; QGraphicsLayoutItem *parent = q->parentLayoutItem(); while (parent && parent->isLayout()) { parent = parent->parentLayoutItem(); } - QGraphicsWidget *w = 0; + QGraphicsWidget *w = nullptr; if (parent) { QGraphicsItem *parentItem = parent->graphicsItem(); if (parentItem && parentItem->isWidget()) @@ -2404,7 +2404,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin // Look for the layout edge. That can be either the first half in case the // layout is split in two, or the whole layout anchor. Orientation orient = Orientation(anchors.first()->orientation); - AnchorData *layoutEdge = 0; + AnchorData *layoutEdge = nullptr; if (layoutCentralVertex[orient]) { layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]); } else { @@ -2423,7 +2423,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin actualMax = -layoutEdge->minSize; } if (actualMax != expectedMax) { - layoutEdge = 0; + layoutEdge = nullptr; } // For each variable, create constraints based on size hints @@ -2496,8 +2496,8 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) Q_ASSERT(layoutFirstVertex[orientation] && layoutLastVertex[orientation]); - AnchorData *edgeL1 = 0; - AnchorData *edgeL2 = 0; + AnchorData *edgeL1 = nullptr; + AnchorData *edgeL2 = nullptr; // The layout may have a single anchor between Left and Right or two half anchors // passing through the center @@ -2625,7 +2625,7 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom) qreal left; qreal right; - q->getContentsMargins(&left, &top, &right, 0); + q->getContentsMargins(&left, &top, &right, nullptr); const Qt::LayoutDirection visualDir = visualDirection(); if (visualDir == Qt::RightToLeft) qSwap(left, right); diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp index 6b7052a0ab..260e1861c7 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp @@ -137,7 +137,7 @@ QGraphicsGridLayout::~QGraphicsGridLayout() // ~QGraphicsLayoutItem. removeAt(i); if (item) { - item->setParentLayoutItem(0); + item->setParentLayoutItem(nullptr); if (item->ownedByLayout()) delete item; } @@ -535,11 +535,11 @@ QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int row, int column) const Q_D(const QGraphicsGridLayout); if (row < 0 || row >= rowCount() || column < 0 || column >= columnCount()) { qWarning("QGraphicsGridLayout::itemAt: invalid row, column %d, %d", row, column); - return 0; + return nullptr; } if (QGraphicsGridLayoutEngineItem *engineItem = static_cast(d->engine.itemAt(row, column))) return engineItem->layoutItem(); - return 0; + return nullptr; } /*! @@ -583,7 +583,7 @@ void QGraphicsGridLayout::removeAt(int index) if (QGraphicsGridLayoutEngineItem *gridItem = static_cast(d->engine.itemAt(index))) { if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()) - layoutItem->setParentLayoutItem(0); + layoutItem->setParentLayoutItem(nullptr); d->engine.removeItem(gridItem); // recalculate rowInfo.count if we remove an item that is on the right/bottommost row diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 7c0f836156..6f1eb4b346 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1250,7 +1250,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q if (isWidget) static_cast(this)->fixFocusChainBeforeReparenting((newParent && - newParent->isWidget()) ? static_cast(newParent) : 0, + newParent->isWidget()) ? static_cast(newParent) : nullptr, scene); if (scene) { // Deliver the change to the index @@ -1293,7 +1293,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q // Ensure any last parent focus scope does not point to this item or any of // its descendents. QGraphicsItem *p = parent; - QGraphicsItem *parentFocusScopeItem = 0; + QGraphicsItem *parentFocusScopeItem = nullptr; while (p) { if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) { // If this item's focus scope's focus scope item points @@ -1301,7 +1301,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q QGraphicsItem *fsi = p->d_ptr->focusScopeItem; if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) { parentFocusScopeItem = fsi; - p->d_ptr->focusScopeItem = 0; + p->d_ptr->focusScopeItem = nullptr; fsi->d_ptr->focusScopeItemChange(false); } break; @@ -1321,7 +1321,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) { if (subFocusItem && subFocusItem != q_ptr) { // Find the subFocusItem's topmost focus scope within the new parent's focusscope - QGraphicsItem *ancestorScope = 0; + QGraphicsItem *ancestorScope = nullptr; QGraphicsItem *p2 = subFocusItem->d_ptr->parent; while (p2 && p2 != p) { if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) @@ -1587,7 +1587,7 @@ QGraphicsItem::~QGraphicsItem() if (QAbstractDeclarativeData::destroyed) QAbstractDeclarativeData::destroyed(p->declarativeData, o); } - p->declarativeData = 0; + p->declarativeData = nullptr; p->wasDeleted = false; } } @@ -1607,14 +1607,14 @@ QGraphicsItem::~QGraphicsItem() #endif clearFocus(); - setFocusProxy(0); + setFocusProxy(nullptr); // Update focus scope item ptr. QGraphicsItem *p = d_ptr->parent; while (p) { if (p->flags() & ItemIsFocusScope) { if (p->d_ptr->focusScopeItem == this) - p->d_ptr->focusScopeItem = 0; + p->d_ptr->focusScopeItem = nullptr; break; } p = p->d_ptr->parent; @@ -1630,7 +1630,7 @@ QGraphicsItem::~QGraphicsItem() d_ptr->scene->d_func()->removeItemHelper(this); } else { d_ptr->resetFocusProxy(); - setParentItem(0); + setParentItem(nullptr); } #if QT_CONFIG(graphicseffect) @@ -1639,7 +1639,7 @@ QGraphicsItem::~QGraphicsItem() if (d_ptr->transformData) { for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) { QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i); - static_cast(t->d_ptr.data())->item = 0; + static_cast(t->d_ptr.data())->item = nullptr; delete t; } } @@ -1751,7 +1751,7 @@ QGraphicsWidget *QGraphicsItem::parentWidget() const QGraphicsItem *p = parentItem(); while (p && !p->isWidget()) p = p->parentItem(); - return (p && p->isWidget()) ? static_cast(p) : 0; + return (p && p->isWidget()) ? static_cast(p) : nullptr; } /*! @@ -1811,7 +1811,7 @@ QGraphicsItem *QGraphicsItem::panel() const */ QGraphicsObject *QGraphicsItem::toGraphicsObject() { - return d_ptr->isObject ? static_cast(this) : 0; + return d_ptr->isObject ? static_cast(this) : nullptr; } /*! @@ -1822,7 +1822,7 @@ QGraphicsObject *QGraphicsItem::toGraphicsObject() */ const QGraphicsObject *QGraphicsItem::toGraphicsObject() const { - return d_ptr->isObject ? static_cast(this) : 0; + return d_ptr->isObject ? static_cast(this) : nullptr; } /*! @@ -2224,7 +2224,7 @@ bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const return false; - QGraphicsItem *dummy = 0; + QGraphicsItem *dummy = nullptr; if (!blockingPanel) blockingPanel = &dummy; @@ -2420,7 +2420,7 @@ bool QGraphicsItem::isVisibleTo(const QGraphicsItem *parent) const if (p->d_ptr->explicitlyHidden) return false; } while ((p = p->d_ptr->parent)); - return parent == 0; + return parent == nullptr; } /*! @@ -2959,7 +2959,7 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) if (d_ptr->graphicsEffect) { delete d_ptr->graphicsEffect; - d_ptr->graphicsEffect = 0; + d_ptr->graphicsEffect = nullptr; } else if (d_ptr->parent) { d_ptr->parent->d_ptr->updateChildWithGraphicsEffectFlagRecursively(); } @@ -2984,7 +2984,7 @@ void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively() if (itemPrivate->mayHaveChildWithGraphicsEffect) return; itemPrivate->mayHaveChildWithGraphicsEffect = 1; - } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0)); + } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : nullptr)); #endif } @@ -3396,13 +3396,13 @@ void QGraphicsItem::setActive(bool active) if (!activePanel || activePanel == thisPanel) { // Deactivate this item, and reactivate the parent panel, // or the last active panel (if any). - QGraphicsItem *nextToActivate = 0; + QGraphicsItem *nextToActivate = nullptr; if (d_ptr->parent) nextToActivate = d_ptr->parent->panel(); if (!nextToActivate) nextToActivate = d_ptr->scene->d_func()->lastActivePanel; if (nextToActivate == this || isAncestorOf(nextToActivate)) - nextToActivate = 0; + nextToActivate = nullptr; d_ptr->scene->setActivePanel(nextToActivate); } } @@ -3499,7 +3499,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim } // Update the child focus chain. - QGraphicsItem *commonAncestor = 0; + QGraphicsItem *commonAncestor = nullptr; if (scene && scene->focusItem() && scene->focusItem()->panel() == q_ptr->panel()) { commonAncestor = scene->focusItem()->commonAncestorItem(f); scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor); @@ -3552,7 +3552,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenB while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { if (p->d_ptr->focusScopeItem == q_ptr) { - p->d_ptr->focusScopeItem = 0; + p->d_ptr->focusScopeItem = nullptr; if (!subFocusItem->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere focusScopeItemChange(false); } @@ -3572,7 +3572,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenB clearSubFocus(q_ptr); // If this item has the scene's input focus, clear it. - scene->setFocusItem(0); + scene->setFocusItem(nullptr); } } @@ -3621,7 +3621,7 @@ void QGraphicsItem::setFocusProxy(QGraphicsItem *item) qWarning("QGraphicsItem::setFocusProxy: focus proxy must be in same scene"); return; } - for (QGraphicsItem *f = item->focusProxy(); f != 0; f = f->focusProxy()) { + for (QGraphicsItem *f = item->focusProxy(); f != nullptr; f = f->focusProxy()) { if (f == this) { qWarning("QGraphicsItem::setFocusProxy: %p is already in the focus proxy chain", item); return; @@ -4452,7 +4452,7 @@ QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) c QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) const { // Catch simple cases first. - if (other == 0) { + if (other == nullptr) { qWarning("QGraphicsItem::itemTransform: null pointer passed"); return QTransform(); } @@ -4892,7 +4892,7 @@ void QGraphicsItem::stackBefore(const QGraphicsItem *sibling) } QList *siblings = d_ptr->parent ? &d_ptr->parent->d_ptr->children - : (d_ptr->scene ? &d_ptr->scene->d_func()->topLevelItems : 0); + : (d_ptr->scene ? &d_ptr->scene->d_func()->topLevelItems : nullptr); if (!siblings) { qWarning("QGraphicsItem::stackUnder: cannot stack under %p, which must be a sibling", sibling); return; @@ -4949,7 +4949,7 @@ QRectF QGraphicsItem::childrenBoundingRect() const return d_ptr->childrenBoundingRect; d_ptr->childrenBoundingRect = QRectF(); - d_ptr->childrenBoundingRectHelper(0, &d_ptr->childrenBoundingRect, 0); + d_ptr->childrenBoundingRectHelper(nullptr, &d_ptr->childrenBoundingRect, nullptr); d_ptr->dirtyChildrenBoundingRect = 0; return d_ptr->childrenBoundingRect; } @@ -5422,7 +5422,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c // Render QStyleOptionGraphicsItem option; - const_cast(this)->paint(&p, &option, 0); + const_cast(this)->paint(&p, &option, nullptr); p.end(); // Transform QRegion back to device space @@ -5575,7 +5575,7 @@ void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively() if (!itemPrivate->updateDueToGraphicsEffect) static_cast(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache(); } - } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0)); + } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : nullptr)); } void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::InvalidateReason reason) @@ -5739,7 +5739,7 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost if (*topMostDirtyItem == q_ptr) { if (!dirtySceneTransform) return; // OK, neither my ancestors nor I have dirty scene transforms. - *topMostDirtyItem = 0; + *topMostDirtyItem = nullptr; } else if (*topMostDirtyItem) { return; // Continue backtrack. } @@ -5771,7 +5771,7 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *s if (parent != q_ptr && parent->d_ptr->subFocusItem) { if (parent->d_ptr->subFocusItem == q_ptr) break; - parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem); + parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(nullptr, stopItem); } parent->d_ptr->subFocusItem = q_ptr; parent->d_ptr->subFocusItemChange(); @@ -5793,7 +5793,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem do { if (parent->d_ptr->subFocusItem != q_ptr) break; - parent->d_ptr->subFocusItem = 0; + parent->d_ptr->subFocusItem = nullptr; if (parent != stopItem && !parent->isAncestorOf(stopItem)) parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); @@ -5808,7 +5808,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem void QGraphicsItemPrivate::resetFocusProxy() { for (int i = 0; i < focusProxyRefs.size(); ++i) - *focusProxyRefs.at(i) = 0; + *focusProxyRefs.at(i) = nullptr; focusProxyRefs.clear(); } @@ -7322,7 +7322,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } // Find the active view. - QGraphicsView *view = 0; + QGraphicsView *view = nullptr; if (event->widget()) view = qobject_cast(event->widget()->parentWidget()); @@ -7330,7 +7330,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) int i = 0; bool movedMe = false; while (i <= selectedItems.size()) { - QGraphicsItem *item = 0; + QGraphicsItem *item = nullptr; if (i < selectedItems.size()) item = selectedItems.at(i); else @@ -7891,7 +7891,7 @@ void QGraphicsItemPrivate::children_append(QDeclarativeListPropertysendParentChangeNotification) { item->setParentItem(graphicsObject); } else { - QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0); + QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, nullptr, nullptr); } } } @@ -7908,7 +7908,7 @@ QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty= 0 && index < d->children.count()) return d->children.at(index)->toGraphicsObject(); else - return 0; + return nullptr; } void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty *list) @@ -7917,10 +7917,10 @@ void QGraphicsItemPrivate::children_clear(QDeclarativeListPropertychildren.count(); if (d->sendParentChangeNotification) { for (int index = 0; index < childCount; index++) - d->children.at(0)->setParentItem(0); + d->children.at(0)->setParentItem(nullptr); } else { for (int index = 0; index < childCount; index++) - QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, 0, 0); + QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(nullptr, nullptr, nullptr); } } @@ -9949,7 +9949,7 @@ class QGraphicsTextItemPrivate { public: QGraphicsTextItemPrivate() - : control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0) + : control(nullptr), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0) { } mutable QWidgetTextControl *control; @@ -11232,7 +11232,7 @@ void QGraphicsItemGroup::removeFromGroup(QGraphicsItem *item) // ### Expensive, we could maybe use dirtySceneTransform bit for optimization item->setTransform(itemTransform); - item->d_func()->setIsMemberOfGroup(item->group() != 0); + item->d_func()->setIsMemberOfGroup(item->group() != nullptr); // ### Quite expensive. But removeFromGroup() isn't called very often. prepareGeometryChange(); @@ -11412,18 +11412,18 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP QTransform sceneTransform = item->sceneTransform(); QTransform newEffectTransform = sceneTransform.inverted(); newEffectTransform *= effectTransform; - scened->draw(item, &pixmapPainter, 0, &sceneTransform, 0, 0, qreal(1.0), + scened->draw(item, &pixmapPainter, nullptr, &sceneTransform, nullptr, nullptr, qreal(1.0), &newEffectTransform, false, true); } else if (deviceCoordinates) { // Device coordinates with info. - scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0, + scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, nullptr, info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform, info->drawItem); } else { // Item coordinates with info. QTransform newEffectTransform = info->transformPtr->inverted(); newEffectTransform *= effectTransform; - scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0, + scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, nullptr, info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform, info->drawItem); } diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp index ad77e2f260..1c5dbf265c 100644 --- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp +++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp @@ -106,7 +106,7 @@ class QGraphicsItemAnimationPrivate { public: inline QGraphicsItemAnimationPrivate() - : q(0), timeLine(0), item(0), step(0) + : q(nullptr), timeLine(nullptr), item(nullptr), step(0) { } QGraphicsItemAnimation *q; diff --git a/src/widgets/graphicsview/qgraphicslayout_p.cpp b/src/widgets/graphicsview/qgraphicslayout_p.cpp index 59ed7acd72..c10763d065 100644 --- a/src/widgets/graphicsview/qgraphicslayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicslayout_p.cpp @@ -97,7 +97,7 @@ void QGraphicsLayoutPrivate::getMargin(qreal *result, qreal userMargin, QStyle:: *result = 0.0; if (QGraphicsItem *layoutParentItem = parentItem()) { if (layoutParentItem->isWidget()) - *result = (qreal)static_cast(layoutParentItem)->style()->pixelMetric(pm, 0); + *result = (qreal)static_cast(layoutParentItem)->style()->pixelMetric(pm, nullptr); } } } diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp index 1192bad51e..8694dcb36b 100644 --- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp +++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp @@ -105,7 +105,7 @@ static void normalizeHints(qreal &minimum, qreal &preferred, qreal &maximum, qre \internal */ QGraphicsLayoutItemPrivate::QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *par, bool layout) - : parent(par), userSizeHints(0), isLayout(layout), ownedByLayout(false), graphicsItem(0) + : parent(par), userSizeHints(nullptr), isLayout(layout), ownedByLayout(false), graphicsItem(nullptr) { } diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp index da2510a8cb..2f1526cc78 100644 --- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp +++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QGraphicsLayoutStyleInfo::QGraphicsLayoutStyleInfo(const QGraphicsLayoutPrivate *layout) - : m_layout(layout), m_style(0) + : m_layout(layout), m_style(nullptr) { m_widget.reset(new QWidget); // pixelMetric might need a widget ptr m_styleOption.initFrom(m_widget.get()); diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp index 22633df4e3..f76cc61586 100644 --- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp +++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp @@ -211,7 +211,7 @@ QGraphicsLinearLayout::~QGraphicsLinearLayout() // ~QGraphicsLayoutItem. removeAt(i); if (item) { - item->setParentLayoutItem(0); + item->setParentLayoutItem(nullptr); if (item->ownedByLayout()) delete item; } @@ -310,7 +310,7 @@ void QGraphicsLinearLayout::removeItem(QGraphicsLayoutItem *item) { Q_D(QGraphicsLinearLayout); if (QGraphicsGridLayoutEngineItem *gridItem = d->engine.findLayoutItem(item)) { - item->setParentLayoutItem(0); + item->setParentLayoutItem(nullptr); d->removeGridItem(gridItem); delete gridItem; invalidate(); @@ -333,7 +333,7 @@ void QGraphicsLinearLayout::removeAt(int index) if (QGraphicsGridLayoutEngineItem *gridItem = static_cast(d->engine.itemAt(index))) { if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()) - layoutItem->setParentLayoutItem(0); + layoutItem->setParentLayoutItem(nullptr); d->removeGridItem(gridItem); delete gridItem; invalidate(); @@ -483,9 +483,9 @@ QGraphicsLayoutItem *QGraphicsLinearLayout::itemAt(int index) const Q_D(const QGraphicsLinearLayout); if (index < 0 || index >= d->engine.itemCount()) { qWarning("QGraphicsLinearLayout::itemAt: invalid index %d", index); - return 0; + return nullptr; } - QGraphicsLayoutItem *item = 0; + QGraphicsLayoutItem *item = nullptr; if (QGraphicsGridLayoutEngineItem *gridItem = static_cast(d->engine.itemAt(index))) item = gridItem->layoutItem(); return item; diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index c60dca7a90..4d4958c674 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -291,7 +291,7 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent } if (!lastWidgetUnderMouse) { - QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : receiver, 0, event->screenPos()); + QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : receiver, nullptr, event->screenPos()); lastWidgetUnderMouse = receiver; } @@ -315,10 +315,10 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent if (q->rect().contains(event->pos()) && q->acceptHoverEvents()) lastWidgetUnderMouse = alienWidget ? alienWidget : widget; else // released on the frame our outside the item, or doesn't accept hover events. - lastWidgetUnderMouse = 0; + lastWidgetUnderMouse = nullptr; QApplicationPrivate::dispatchEnterLeave(lastWidgetUnderMouse, embeddedMouseGrabber, event->screenPos()); - embeddedMouseGrabber = 0; + embeddedMouseGrabber = nullptr; #ifndef QT_NO_CURSOR // ### Restore the cursor, don't override it. @@ -368,7 +368,7 @@ void QGraphicsProxyWidgetPrivate::removeSubFocusHelper(QWidget *widget, Qt::Focu QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) const { if (!widget) - return 0; + return nullptr; // Run around the focus chain until we find a widget that can take tab focus. if (!child) { @@ -376,12 +376,12 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) } else { child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; if ((next && child == widget) || (!next && child == widget->d_func()->focus_prev)) { - return 0; + return nullptr; } } if (!child) - return 0; + return nullptr; QWidget *oldChild = child; uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus; @@ -394,7 +394,7 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) } child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; } while (child != oldChild && !(next && child == widget) && !(!next && child == widget->d_func()->focus_prev)); - return 0; + return nullptr; } /*! @@ -405,9 +405,9 @@ void QGraphicsProxyWidgetPrivate::_q_removeWidgetSlot() Q_Q(QGraphicsProxyWidget); if (!widget.isNull()) { if (const auto &extra = widget->d_func()->extra) - extra->proxyWidget = 0; + extra->proxyWidget = nullptr; } - widget = 0; + widget = nullptr; delete q; } @@ -430,7 +430,7 @@ void QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget() QRectF widgetGeometry = widget->geometry(); QWidget *parentWidget = widget->parentWidget(); if (widget->isWindow()) { - QGraphicsProxyWidget *proxyParent = 0; + QGraphicsProxyWidget *proxyParent = nullptr; if (parentWidget && (proxyParent = qobject_cast(q->parentWidget()))) { // Nested window proxy (e.g., combobox popup), map widget to the // parent widget's global coordinates, and map that to the parent @@ -497,7 +497,7 @@ void QGraphicsProxyWidgetPrivate::unembedSubWindow(QWidget *subWin) if (child->isWidget()) { if (QGraphicsProxyWidget *proxy = qobject_cast(static_cast(child))) { if (proxy->widget() == subWin) { - proxy->setWidget(0); + proxy->setWidget(nullptr); scene->removeItem(proxy); delete proxy; return; @@ -598,7 +598,7 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto QObject::disconnect(widget, SIGNAL(destroyed()), q, SLOT(_q_removeWidgetSlot())); widget->removeEventFilter(q); widget->setAttribute(Qt::WA_DontShowOnScreen, false); - widget->d_func()->extra->proxyWidget = 0; + widget->d_func()->extra->proxyWidget = nullptr; resolveFont(inheritedFontResolveMask); resolvePalette(inheritedPaletteResolveMask); widget->update(); @@ -1081,7 +1081,7 @@ void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) return; QDragLeaveEvent proxyDragLeave; QCoreApplication::sendEvent(d->dragDropWidget, &proxyDragLeave); - d->dragDropWidget = 0; + d->dragDropWidget = nullptr; #endif } @@ -1143,7 +1143,7 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event) // Leave the last drag drop item QDragLeaveEvent dragLeave; QCoreApplication::sendEvent(d->dragDropWidget, &dragLeave); - d->dragDropWidget = 0; + d->dragDropWidget = nullptr; } // Propagate event->setDropAction(Qt::IgnoreAction); @@ -1165,7 +1165,7 @@ void QGraphicsProxyWidget::dropEvent(QGraphicsSceneDragDropEvent *event) QDropEvent dropEvent(widgetPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers()); QCoreApplication::sendEvent(d->dragDropWidget, &dropEvent); event->setAccepted(dropEvent.isAccepted()); - d->dragDropWidget = 0; + d->dragDropWidget = nullptr; } #endif } @@ -1188,8 +1188,8 @@ void QGraphicsProxyWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_D(QGraphicsProxyWidget); // If hoverMove was compressed away, make sure we update properly here. if (d->lastWidgetUnderMouse) { - QApplicationPrivate::dispatchEnterLeave(0, d->lastWidgetUnderMouse, event->screenPos()); - d->lastWidgetUnderMouse = 0; + QApplicationPrivate::dispatchEnterLeave(nullptr, d->lastWidgetUnderMouse, event->screenPos()); + d->lastWidgetUnderMouse = nullptr; } } @@ -1205,13 +1205,13 @@ void QGraphicsProxyWidget::hoverMoveEvent(QGraphicsSceneHoverEvent *event) // Ignore events on the window frame. if (!d->widget || !rect().contains(event->pos())) { if (d->lastWidgetUnderMouse) { - QApplicationPrivate::dispatchEnterLeave(0, d->lastWidgetUnderMouse, event->screenPos()); - d->lastWidgetUnderMouse = 0; + QApplicationPrivate::dispatchEnterLeave(nullptr, d->lastWidgetUnderMouse, event->screenPos()); + d->lastWidgetUnderMouse = nullptr; } return; } - d->embeddedMouseGrabber = 0; + d->embeddedMouseGrabber = nullptr; d->sendWidgetMouseEvent(event); } @@ -1230,7 +1230,7 @@ void QGraphicsProxyWidget::ungrabMouseEvent(QEvent *event) { Q_D(QGraphicsProxyWidget); Q_UNUSED(event); - d->embeddedMouseGrabber = 0; + d->embeddedMouseGrabber = nullptr; } /*! @@ -1372,12 +1372,12 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event) switch (event->reason()) { case Qt::TabFocusReason: { - if (QWidget *focusChild = d->findFocusChild(0, true)) + if (QWidget *focusChild = d->findFocusChild(nullptr, true)) focusChild->setFocus(event->reason()); break; } case Qt::BacktabFocusReason: - if (QWidget *focusChild = d->findFocusChild(0, false)) + if (QWidget *focusChild = d->findFocusChild(nullptr, false)) focusChild->setFocus(event->reason()); break; default: @@ -1578,16 +1578,16 @@ QGraphicsProxyWidget *QGraphicsProxyWidget::createProxyForChildWidget(QWidget *c return proxy; if (!child->parentWidget()) { qWarning("QGraphicsProxyWidget::createProxyForChildWidget: top-level widget not in a QGraphicsScene"); - return 0; + return nullptr; } QGraphicsProxyWidget *parentProxy = createProxyForChildWidget(child->parentWidget()); if (!parentProxy) - return 0; + return nullptr; if (!QMetaObject::invokeMethod(parentProxy, "newProxyWidget", Qt::DirectConnection, Q_RETURN_ARG(QGraphicsProxyWidget*, proxy), Q_ARG(const QWidget*, child))) - return 0; + return nullptr; proxy->setParent(parentProxy); proxy->setWidget(child); return proxy; diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index d641d17232..1c6e68def1 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -278,7 +278,7 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph */ QGraphicsScenePrivate::QGraphicsScenePrivate() : indexMethod(QGraphicsScene::BspTreeIndex), - index(0), + index(nullptr), lastItemCount(0), hasSceneRect(false), dirtyGrowingItemsBoundingRect(true), @@ -301,19 +301,19 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() minimumRenderSize(0.0), selectionChanging(0), rectAdjust(2), - focusItem(0), - lastFocusItem(0), - passiveFocusItem(0), - tabFocusFirst(0), - activePanel(0), - lastActivePanel(0), + focusItem(nullptr), + lastFocusItem(nullptr), + passiveFocusItem(nullptr), + tabFocusFirst(nullptr), + activePanel(nullptr), + lastActivePanel(nullptr), activationRefCount(0), childExplicitActivation(0), - lastMouseGrabberItem(0), - dragDropItem(0), - enterWidget(0), + lastMouseGrabberItem(nullptr), + dragDropItem(nullptr), + enterWidget(nullptr), lastDropAction(Qt::IgnoreAction), - style(0) + style(nullptr) { } @@ -443,8 +443,8 @@ void QGraphicsScenePrivate::_q_polishItems() return; const QVariant booleanTrueVariant(true); - QGraphicsItem *item = 0; - QGraphicsItemPrivate *itemd = 0; + QGraphicsItem *item = nullptr; + QGraphicsItemPrivate *itemd = nullptr; const int oldUnpolishedCount = unpolishedItems.count(); for (int i = 0; i < oldUnpolishedCount; ++i) { @@ -602,7 +602,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) unregisterScenePosItem(item); QGraphicsScene *oldScene = item->d_func()->scene; - item->d_func()->scene = 0; + item->d_func()->scene = nullptr; //We need to remove all children first because they might use their parent //attributes (e.g. sceneTransform). @@ -614,7 +614,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) if (!item->d_ptr->inDestructor && !item->parentItem() && item->isWidget()) { QGraphicsWidget *widget = static_cast(item); - widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0); + widget->d_func()->fixFocusChainBeforeReparenting(nullptr, oldScene, nullptr); } // Unregister focus proxy. @@ -625,7 +625,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) if (parentItem->scene()) { Q_ASSERT_X(parentItem->scene() == q, "QGraphicsScene::removeItem", "Parent item's scene is different from this item's scene"); - item->setParentItem(0); + item->setParentItem(nullptr); } } else { unregisterTopLevelItem(item); @@ -633,17 +633,17 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) // Reset the mouse grabber and focus item data. if (item == focusItem) - focusItem = 0; + focusItem = nullptr; if (item == lastFocusItem) - lastFocusItem = 0; + lastFocusItem = nullptr; if (item == passiveFocusItem) - passiveFocusItem = 0; + passiveFocusItem = nullptr; if (item == activePanel) { // ### deactivate... - activePanel = 0; + activePanel = nullptr; } if (item == lastActivePanel) - lastActivePanel = 0; + lastActivePanel = nullptr; // Change tabFocusFirst to the next widget in focus chain if removing the current one. if (item == tabFocusFirst) { @@ -651,7 +651,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) if (wd->focusNext && wd->focusNext != tabFocusFirst && wd->focusNext->scene() == q) tabFocusFirst = wd->focusNext; else - tabFocusFirst = 0; + tabFocusFirst = nullptr; } // Cancel active touches @@ -705,11 +705,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) // Reset the last mouse grabber item if (item == lastMouseGrabberItem) - lastMouseGrabberItem = 0; + lastMouseGrabberItem = nullptr; // Reset the current drop item if (item == dragDropItem) - dragDropItem = 0; + dragDropItem = nullptr; // Reenable selectionChanged() for individual items --selectionChanging; @@ -752,8 +752,8 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin q->setFocus(Qt::ActiveWindowFocusReason); // Find the item's panel. - QGraphicsItem *panel = item ? item->panel() : 0; - lastActivePanel = panel ? activePanel : 0; + QGraphicsItem *panel = item ? item->panel() : nullptr; + lastActivePanel = panel ? activePanel : nullptr; if (panel == activePanel || (!q->isActive() && !duringActivationEvent)) return; @@ -764,7 +764,7 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin if (QGraphicsItem *fi = activePanel->focusItem()) { // Remove focus from the current focus item. if (fi == q->focusItem()) - setFocusItemHelper(0, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false); + setFocusItemHelper(nullptr, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false); } QEvent event(QEvent::WindowDeactivate); @@ -841,7 +841,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, // accept input focus. if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable) || !item->isVisible() || !item->isEnabled())) { - item = 0; + item = nullptr; } // Set focus on the scene if an item requests focus. @@ -849,7 +849,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, q->setFocus(focusReason); if (item == focusItem) { if (emitFocusChanged) - emit q->focusItemChanged(focusItem, (QGraphicsItem *)0, focusReason); + emit q->focusItemChanged(focusItem, (QGraphicsItem *)nullptr, focusReason); return; } } @@ -869,7 +869,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, } #endif //QT_NO_IM - focusItem = 0; + focusItem = nullptr; QFocusEvent event(QEvent::FocusOut, focusReason); sendEvent(lastFocusItem, &event); } @@ -877,7 +877,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, // This handles the case that the item has been removed from the // scene in response to the FocusOut event. if (item && item->scene() != q) - item = 0; + item = nullptr; if (item) focusItem = item; @@ -1039,7 +1039,7 @@ void QGraphicsScenePrivate::clearMouseGrabber() { if (!mouseGrabberItems.isEmpty()) mouseGrabberItems.first()->ungrabMouse(); - lastMouseGrabberItem = 0; + lastMouseGrabberItem = nullptr; } /*! @@ -1365,10 +1365,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // Update window activation. QGraphicsItem *topItem = cachedItemsUnderMouse.value(0); - QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : 0; + QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : nullptr; if (newActiveWindow && newActiveWindow->isBlockedByModalPanel(&topItem)) { // pass activation to the blocking modal window - newActiveWindow = topItem ? topItem->window() : 0; + newActiveWindow = topItem ? topItem->window() : nullptr; } if (newActiveWindow != q->activeWindow()) @@ -1409,7 +1409,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // If nobody could take focus, clear it. if (!stickyFocus && !setFocus && !sceneModality) - q->setFocusItem(0, Qt::MouseFocusReason); + q->setFocusItem(nullptr, Qt::MouseFocusReason); // Any item will do. if (sceneModality && cachedItemsUnderMouse.isEmpty()) @@ -1694,7 +1694,7 @@ QGraphicsScene::~QGraphicsScene() // Remove this scene from all associated views. for (int j = 0; j < d->views.size(); ++j) - d->views.at(j)->setScene(0); + d->views.at(j)->setScene(nullptr); } /*! @@ -2432,7 +2432,7 @@ QGraphicsItemGroup *QGraphicsScene::createItemGroup(const QList } // Find the common ancestor for all items - QGraphicsItem *commonAncestor = 0; + QGraphicsItem *commonAncestor = nullptr; if (!ancestors.isEmpty()) { while (n < items.size()) { int commonIndex = -1; @@ -2446,7 +2446,7 @@ QGraphicsItemGroup *QGraphicsScene::createItemGroup(const QList } while ((parent = parent->parentItem())); if (commonIndex == -1) { - commonAncestor = 0; + commonAncestor = nullptr; break; } @@ -2545,7 +2545,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // from this scene. if (QGraphicsItem *itemParent = item->d_ptr->parent) { if (itemParent->d_ptr->scene != this) - item->setParentItem(0); + item->setParentItem(nullptr); } // Add the item to this scene @@ -2911,7 +2911,7 @@ QGraphicsSimpleTextItem *QGraphicsScene::addSimpleText(const QString &text, cons */ QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags) { - QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, wFlags); + QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(nullptr, wFlags); proxy->setWidget(widget); addItem(proxy); return proxy; @@ -2944,7 +2944,7 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, QVariant::fromValue(0))); QGraphicsScene *targetScene = qvariant_cast(newSceneVariant); - if (targetScene != 0 && targetScene != this) { + if (targetScene != nullptr && targetScene != this) { targetScene->addItem(item); return; } @@ -3046,7 +3046,7 @@ void QGraphicsScene::clearFocus() if (d->hasFocus) { d->hasFocus = false; d->passiveFocusItem = d->focusItem; - setFocusItem(0, Qt::OtherFocusReason); + setFocusItem(nullptr, Qt::OtherFocusReason); } } @@ -3492,7 +3492,7 @@ bool QGraphicsScene::event(QEvent *event) // Deactivate the active panel (but keep it so we can // reactivate it later). QGraphicsItem *lastActivePanel = d->activePanel; - d->setActivePanelHelper(0, true); + d->setActivePanelHelper(nullptr, true); d->lastActivePanel = lastActivePanel; } else { // Activate all toplevel items. @@ -3621,7 +3621,7 @@ void QGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMen void QGraphicsScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event) { Q_D(QGraphicsScene); - d->dragDropItem = 0; + d->dragDropItem = nullptr; d->lastDropAction = Qt::IgnoreAction; event->accept(); } @@ -3705,7 +3705,7 @@ void QGraphicsScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event) QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); d->cloneDragDropEvent(&dragLeave, event); d->sendDragDropEvent(d->dragDropItem, &dragLeave); - d->dragDropItem = 0; + d->dragDropItem = nullptr; } // Propagate event->setDropAction(Qt::IgnoreAction); @@ -3725,7 +3725,7 @@ void QGraphicsScene::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) if (d->dragDropItem) { // Leave the last drag drop item d->sendDragDropEvent(d->dragDropItem, event); - d->dragDropItem = 0; + d->dragDropItem = nullptr; } } @@ -3743,7 +3743,7 @@ void QGraphicsScene::dropEvent(QGraphicsSceneDragDropEvent *event) if (d->dragDropItem) { // Drop on the last drag drop item d->sendDragDropEvent(d->dragDropItem, event); - d->dragDropItem = 0; + d->dragDropItem = nullptr; } } @@ -3793,7 +3793,7 @@ void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent) Q_D(QGraphicsScene); d->hasFocus = false; d->passiveFocusItem = d->focusItem; - setFocusItem(0, focusEvent->reason()); + setFocusItem(nullptr, focusEvent->reason()); // Remove all popups when the scene loses focus. if (!d->popupWidgets.isEmpty()) @@ -3825,7 +3825,7 @@ void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent) QList itemsAtPos = d->itemsAtPosition(helpEvent->screenPos(), helpEvent->scenePos(), helpEvent->widget()); - QGraphicsItem *toolTipItem = 0; + QGraphicsItem *toolTipItem = nullptr; for (int i = 0; i < itemsAtPos.size(); ++i) { QGraphicsItem *tmp = itemsAtPos.at(i); if (tmp->d_func()->isProxyWidget()) { @@ -3883,7 +3883,7 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv hoverEvent->widget()); } - QGraphicsItem *item = 0; + QGraphicsItem *item = nullptr; for (int i = 0; i < cachedItemsUnderMouse.size(); ++i) { QGraphicsItem *tmp = cachedItemsUnderMouse.at(i); if (itemAcceptsHoverEvents_helper(tmp)) { @@ -3894,13 +3894,13 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv // Find the common ancestor item for the new topmost hoverItem and the // last item in the hoverItem list. - QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.constLast()) : 0; + QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.constLast()) : nullptr; while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem)) commonAncestorItem = commonAncestorItem->parentItem(); if (commonAncestorItem && commonAncestorItem->panel() != item->panel()) { // The common ancestor isn't in the same panel as the two hovered // items. - commonAncestorItem = 0; + commonAncestorItem = nullptr; } // Check if the common ancestor item is known. @@ -4130,7 +4130,7 @@ void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) if (d->lastMouseGrabberItemHasImplicitMouseGrab) d->mouseGrabberItems.constLast()->ungrabMouse(); } else { - d->lastMouseGrabberItem = 0; + d->lastMouseGrabberItem = nullptr; } // Generate a hoverevent @@ -4362,7 +4362,7 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion & pixmapPainter.setWorldTransform(itemToPixmap, true); // Render. - _q_paintItem(item, &pixmapPainter, option, 0, false, painterStateProtection); + _q_paintItem(item, &pixmapPainter, option, nullptr, false, painterStateProtection); pixmapPainter.end(); if (!subPix.isNull()) { @@ -4756,7 +4756,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * return; QTransform transform(Qt::Uninitialized); - QTransform *transformPtr = 0; + QTransform *transformPtr = nullptr; bool translateOnlyTransform = false; #define ENSURE_TRANSFORM_PTR \ if (!transformPtr) { \ @@ -4866,7 +4866,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * item->d_ptr->graphicsEffect->draw(painter); painter->setWorldTransform(restoreTransform); - sourced->info = 0; + sourced->info = nullptr; } else #endif // QT_CONFIG(graphicseffect) { @@ -4944,7 +4944,7 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q Q_ASSERT(!(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents)); Q_ASSERT(transformPtr); item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion - ? *exposedRegion : QRegion(), exposedRegion == 0); + ? *exposedRegion : QRegion(), exposedRegion == nullptr); const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; bool restorePainterClip = false; @@ -5330,7 +5330,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool if (itemClipsChildrenToShape) { // Reset updateClip. for (int i = 0; i < views.size(); ++i) - views.at(i)->d_func()->setUpdateClip(0); + views.at(i)->d_func()->setUpdateClip(nullptr); } } else if (wasDirtyParentSceneTransform) { item->d_ptr->invalidateChildrenSceneTransform(); @@ -5386,7 +5386,7 @@ void QGraphicsScene::drawItems(QPainter *painter, // Determine view, expose and flags. QGraphicsView *view = widget ? qobject_cast(widget->parentWidget()) : 0; - QRegion *expose = 0; + QRegion *expose = nullptr; const quint32 oldRectAdjust = d->rectAdjust; if (view) { d->updateAll = false; @@ -5470,7 +5470,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next) } // The item must be a widget. - QGraphicsWidget *widget = 0; + QGraphicsWidget *widget = nullptr; if (!item) { widget = next ? d->tabFocusFirst : d->tabFocusFirst->d_func()->focusPrev; } else { @@ -5486,7 +5486,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next) // Run around the focus chain until we find a widget that can take tab focus. do { if (widget->flags() & QGraphicsItem::ItemIsFocusable - && widget->isEnabled() && widget->isVisibleTo(0) + && widget->isEnabled() && widget->isVisibleTo(nullptr) && (widget->focusPolicy() & Qt::TabFocus) && (!item || !item->isPanel() || item->isAncestorOf(widget)) ) { @@ -5771,7 +5771,7 @@ void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget) } // Activate the widget's panel (all windows are panels). - QGraphicsItem *panel = widget ? widget->panel() : 0; + QGraphicsItem *panel = widget ? widget->panel() : nullptr; setActivePanel(panel); // Raise @@ -5953,7 +5953,7 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) const QTouchEvent::TouchPoint &touchPoint = sceneTouchEvent->touchPoints().at(i); // update state - QGraphicsItem *item = 0; + QGraphicsItem *item = nullptr; if (touchPoint.state() == Qt::TouchPointPressed) { if (sceneTouchEvent->device()->type() == QTouchDevice::TouchPad) { // on touch-pad devices, send all touch points to the same item @@ -6111,7 +6111,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve // If nobody could take focus, clear it. if (!stickyFocus && !setFocus) - q->setFocusItem(0, Qt::MouseFocusReason); + q->setFocusItem(nullptr, Qt::MouseFocusReason); } bool res = false; @@ -6125,7 +6125,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve eventAccepted = touchEvent->isAccepted(); if (itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0) { // item was deleted - item = 0; + item = nullptr; } else { item->d_ptr->acceptedTouchBeginEvent = (res && eventAccepted); } @@ -6259,7 +6259,7 @@ void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet &ges if (!gesture->hasHotSpot()) continue; const Qt::GestureType gestureType = gesture->gestureType(); - QList items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0); + QList items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, nullptr); for (int j = 0; j < items.size(); ++j) { QGraphicsItem *item = items.at(j); @@ -6331,7 +6331,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) if (!startedGestures.isEmpty()) { QSet normalGestures; // that have just one target QSet conflictedGestures; // that have multiple possible targets - gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0, + gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, nullptr, &normalGestures, &conflictedGestures); cachedTargetItems = cachedItemGestures.keys(); std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); @@ -6505,7 +6505,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) } gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures, - &cachedItemGestures, &targetsSet, 0, 0); + &cachedItemGestures, &targetsSet, nullptr, nullptr); cachedTargetItems = targetsSet.values(); std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); @@ -6545,7 +6545,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) { Q_ASSERT(original); QGraphicsItem *originalItem = gestureTargets.value(original); - if (originalItem == 0) // we only act on accepted gestures, which implies it has a target. + if (originalItem == nullptr) // we only act on accepted gestures, which implies it has a target. return; // iterate over all active gestures and for each find the owner @@ -6568,13 +6568,13 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) QSet almostCanceledGestures = canceledGestures; QSet::Iterator setIter; while (!almostCanceledGestures.isEmpty()) { - QGraphicsObject *target = 0; + QGraphicsObject *target = nullptr; QSet gestures; setIter = almostCanceledGestures.begin(); // sort per target item while (setIter != almostCanceledGestures.end()) { QGraphicsObject *item = gestureTargets.value(*setIter); - if (target == 0) + if (target == nullptr) target = item; if (target == item) { gestures << *setIter; @@ -6598,7 +6598,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) if (!g->hasHotSpot()) continue; - QList items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0); + QList items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, nullptr); for (int j = 0; j < items.size(); ++j) { QGraphicsObject *item = items.at(j)->toGraphicsObject(); if (!item) diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp index 768dd07d4e..048ea6dc7d 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.cpp +++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp @@ -278,8 +278,8 @@ class QGraphicsSceneEventPrivate { public: inline QGraphicsSceneEventPrivate() - : widget(0), - q_ptr(0) + : widget(nullptr), + q_ptr(nullptr) { } inline virtual ~QGraphicsSceneEventPrivate() @@ -1290,7 +1290,7 @@ class QGraphicsSceneDragDropEventPrivate : public QGraphicsSceneEventPrivate Q_DECLARE_PUBLIC(QGraphicsSceneDragDropEvent) public: inline QGraphicsSceneDragDropEventPrivate() - : source(0), mimeData(0) + : source(nullptr), mimeData(nullptr) { } QPointF pos; diff --git a/src/widgets/graphicsview/qgraphicstransform.cpp b/src/widgets/graphicsview/qgraphicstransform.cpp index 0f0d9aaddc..fa763de05d 100644 --- a/src/widgets/graphicsview/qgraphicstransform.cpp +++ b/src/widgets/graphicsview/qgraphicstransform.cpp @@ -112,7 +112,7 @@ void QGraphicsTransformPrivate::setItem(QGraphicsItem *i) Q_ASSERT(d_ptr->transformData); d_ptr->transformData->graphicsTransforms.removeAll(q); d_ptr->dirtySceneTransform = 1; - item = 0; + item = nullptr; } item = i; @@ -138,7 +138,7 @@ QGraphicsTransform::QGraphicsTransform(QObject *parent) QGraphicsTransform::~QGraphicsTransform() { Q_D(QGraphicsTransform); - d->setItem(0); + d->setItem(nullptr); } /*! diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 4c270b1af2..7589a1ebbd 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -352,7 +352,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate() alignment(Qt::AlignCenter), transformationAnchor(QGraphicsView::AnchorViewCenter), resizeAnchor(QGraphicsView::NoAnchor), viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), - scene(0), + scene(nullptr), #if QT_CONFIG(rubberband) rubberBanding(false), rubberBandSelectionMode(Qt::IntersectsItemShape), @@ -362,7 +362,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate() #ifndef QT_NO_CURSOR hasStoredOriginalCursor(false), #endif - lastDragDropEvent(0), + lastDragDropEvent(nullptr), updateSceneSlotReimplementedChecked(false) { styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS); @@ -384,7 +384,7 @@ void QGraphicsViewPrivate::recalculateContentSize() int height = maxSize.height(); QRectF viewRect = matrix.mapRect(q->sceneRect()); - bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)); + bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q)); if (frameOnlyAround) { if (hbarpolicy == Qt::ScrollBarAlwaysOn) height -= frameWidth * 2; @@ -394,7 +394,7 @@ void QGraphicsViewPrivate::recalculateContentSize() // Adjust the maximum width and height of the viewport based on the width // of visible scroll bars. - int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q); + int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, q); if (frameOnlyAround) scrollBarExtent += frameWidth * 2; @@ -1162,7 +1162,7 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg void QGraphicsViewPrivate::updateInputMethodSensitivity() { Q_Q(QGraphicsView); - QGraphicsItem *focusItem = 0; + QGraphicsItem *focusItem = nullptr; bool enabled = scene && (focusItem = scene->focusItem()) && (focusItem->d_ptr->flags & QGraphicsItem::ItemAcceptsInputMethod); q->setAttribute(Qt::WA_InputMethodEnabled, enabled); @@ -1174,7 +1174,7 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity() } QGraphicsProxyWidget *proxy = focusItem->d_ptr->isWidget && focusItem->d_ptr->isProxyWidget() - ? static_cast(focusItem) : 0; + ? static_cast(focusItem) : nullptr; if (!proxy) { q->setInputMethodHints(focusItem->inputMethodHints()); } else if (QWidget *widget = proxy->widget()) { @@ -1192,7 +1192,7 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity() QGraphicsView::QGraphicsView(QWidget *parent) : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) { - setViewport(0); + setViewport(nullptr); setAcceptDrops(true); setBackgroundRole(QPalette::Base); // Investigate leaving these disabled by default. @@ -1208,7 +1208,7 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) { setScene(scene); - setViewport(0); + setViewport(nullptr); setAcceptDrops(true); setBackgroundRole(QPalette::Base); // Investigate leaving these disabled by default. @@ -1222,7 +1222,7 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) QGraphicsView::QGraphicsView(QGraphicsViewPrivate &dd, QWidget *parent) : QAbstractScrollArea(dd, parent) { - setViewport(0); + setViewport(nullptr); setAcceptDrops(true); setBackgroundRole(QPalette::Base); // Investigate leaving these disabled by default. @@ -2374,7 +2374,7 @@ QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const { Q_D(const QGraphicsView); if (!d->scene) - return 0; + return nullptr; const QList itemsAtPos = items(pos); return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first(); } @@ -2888,7 +2888,7 @@ bool QGraphicsView::viewportEvent(QEvent *event) } d->useLastMouseEvent = false; // a hack to pass a viewport pointer to the scene inside the leave event - Q_ASSERT(event->d == 0); + Q_ASSERT(event->d == nullptr); QScopedValueRollback rb(event->d); event->d = reinterpret_cast(viewport()); QCoreApplication::sendEvent(d->scene, event); @@ -3019,7 +3019,7 @@ void QGraphicsView::dropEvent(QDropEvent *event) event->setDropAction(sceneEvent.dropAction()); delete d->lastDragDropEvent; - d->lastDragDropEvent = 0; + d->lastDragDropEvent = nullptr; } /*! @@ -3077,7 +3077,7 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) sceneEvent.setWidget(d->lastDragDropEvent->widget()); sceneEvent.setSource(d->lastDragDropEvent->source()); delete d->lastDragDropEvent; - d->lastDragDropEvent = 0; + d->lastDragDropEvent = nullptr; // Send it to the scene. QCoreApplication::sendEvent(d->scene, &sceneEvent); @@ -3525,7 +3525,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) d->scene->d_func()->rectAdjust = 1; else d->scene->d_func()->rectAdjust = 2; - d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : 0, + d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : nullptr, &d->exposedRegion, viewport()); d->scene->d_func()->rectAdjust = oldRectAdjust; // Make sure the painter's world transform is restored correctly when @@ -3794,7 +3794,7 @@ void QGraphicsView::drawItems(QPainter *painter, int numItems, { Q_D(QGraphicsView); if (d->scene) { - QWidget *widget = painter->device() == viewport() ? viewport() : 0; + QWidget *widget = painter->device() == viewport() ? viewport() : nullptr; d->scene->drawItems(painter, numItems, items, options, widget); } } diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index cf041b9817..1035ed3575 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -172,7 +172,7 @@ QT_BEGIN_NAMESPACE window, a tool, a popup, etc). */ QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags) - : QGraphicsObject(*new QGraphicsWidgetPrivate, 0), QGraphicsLayoutItem(0, false) + : QGraphicsObject(*new QGraphicsWidgetPrivate, nullptr), QGraphicsLayoutItem(nullptr, false) { Q_D(QGraphicsWidget); d->init(parent, wFlags); @@ -184,7 +184,7 @@ QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags) Constructs a new QGraphicsWidget, using \a dd as parent. */ QGraphicsWidget::QGraphicsWidget(QGraphicsWidgetPrivate &dd, QGraphicsItem *parent, Qt::WindowFlags wFlags) - : QGraphicsObject(dd, 0), QGraphicsLayoutItem(0, false) + : QGraphicsObject(dd, nullptr), QGraphicsLayoutItem(nullptr, false) { Q_D(QGraphicsWidget); d->init(parent, wFlags); @@ -241,7 +241,7 @@ QGraphicsWidget::~QGraphicsWidget() if (QGraphicsScene *scn = scene()) { QGraphicsScenePrivate *sceneD = scn->d_func(); if (sceneD->tabFocusFirst == this) - sceneD->tabFocusFirst = (d->focusNext == this ? 0 : d->focusNext); + sceneD->tabFocusFirst = (d->focusNext == this ? nullptr : d->focusNext); } d->focusPrev->d_func()->focusNext = d->focusNext; d->focusNext->d_func()->focusPrev = d->focusPrev; @@ -263,15 +263,15 @@ QGraphicsWidget::~QGraphicsWidget() if (item->isWidget()) { QGraphicsWidget *widget = static_cast(item); if (widget->parentLayoutItem() == d->layout) - widget->setParentLayoutItem(0); + widget->setParentLayoutItem(nullptr); } } - d->layout = 0; + d->layout = nullptr; delete temp; } // Remove this graphics widget from widgetStyles - widgetStyles()->setStyleForWidget(this, 0); + widgetStyles()->setStyleForWidget(this, nullptr); // Unset the parent here, when we're still a QGraphicsWidget. // It is otherwise done in ~QGraphicsItem() where we'd be @@ -942,7 +942,7 @@ QStyle *QGraphicsWidget::style() const */ void QGraphicsWidget::setStyle(QStyle *style) { - setAttribute(Qt::WA_SetStyle, style != 0); + setAttribute(Qt::WA_SetStyle, style != nullptr); widgetStyles()->setStyleForWidget(this, style); // Deliver StyleChange to the widget itself (doesn't propagate). @@ -1557,7 +1557,7 @@ bool QGraphicsWidget::focusNextPrevChild(bool next) { Q_D(QGraphicsWidget); // Let the parent's focusNextPrevChild implementation decide what to do. - QGraphicsWidget *parent = 0; + QGraphicsWidget *parent = nullptr; if (!isWindow() && (parent = parentWidget())) return parent->focusNextPrevChild(next); if (!d->scene) @@ -1995,7 +1995,7 @@ void QGraphicsWidget::setShortcutAutoRepeat(int id, bool enabled) */ void QGraphicsWidget::addAction(QAction *action) { - insertAction(0, action); + insertAction(nullptr, action); } /*! @@ -2012,7 +2012,7 @@ void QGraphicsWidget::addActions(QList actions) #endif { for (int i = 0; i < actions.count(); ++i) - insertAction(0, actions.at(i)); + insertAction(nullptr, actions.at(i)); } /*! @@ -2041,7 +2041,7 @@ void QGraphicsWidget::insertAction(QAction *before, QAction *action) int pos = d->actions.indexOf(before); if (pos < 0) { - before = 0; + before = nullptr; pos = d->actions.size(); } d->actions.insert(pos, action); @@ -2346,7 +2346,7 @@ void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGrap frameOptions.palette.setCurrentColorGroup(isActive ? QPalette::Active : QPalette::Normal); frameOptions.rect = windowFrameRect; - frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, widget); + frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, widget); frameOptions.midLineWidth = 1; style()->drawPrimitive(QStyle::PE_FrameWindow, &frameOptions, painter, widget); diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index 0156faf8e4..e6f39d6803 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -322,7 +322,7 @@ void QGraphicsWidgetPrivate::initStyleOptionTitleBar(QStyleOptionTitleBar *optio option->titleBarState = Qt::WindowNoState; } QFont windowTitleFont = QApplication::font("QMdiSubWindowTitleBar"); - QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, 0); + QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, nullptr); option->text = QFontMetrics(windowTitleFont).elidedText( windowData->windowTitle, Qt::ElideRight, textRect.width()); } @@ -690,7 +690,7 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent break; case Qt::TitleBarArea: windowData->buttonRect = q->style()->subControlRect( - QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); + QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, nullptr); if (windowData->buttonRect.contains(pos.toPoint())) windowData->buttonMouseOver = true; event->ignore(); @@ -707,7 +707,7 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent Q_UNUSED(cursorShape); #endif // update buttons if we hover over them - windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), 0); + windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), nullptr); if (windowData->hoveredSubControl != QStyle::SC_TitleBarCloseButton) windowData->hoveredSubControl = QStyle::SC_TitleBarLabel; @@ -781,7 +781,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new if (!parent && oldScene && oldScene != newScene && oldScene->d_func()->tabFocusFirst == q) { // detach from old scene's top level focus chain. - oldScene->d_func()->tabFocusFirst = (focusAfter != q) ? focusAfter : 0; + oldScene->d_func()->tabFocusFirst = (focusAfter != q) ? focusAfter : nullptr; } // detach from current focus chain; skip this widget subtree. diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp index e18f1fa4c4..38c2df5fc6 100644 --- a/src/widgets/graphicsview/qsimplex_p.cpp +++ b/src/widgets/graphicsview/qsimplex_p.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ -QSimplex::QSimplex() : objective(0), rows(0), columns(0), firstArtificial(0), matrix(0) +QSimplex::QSimplex() : objective(nullptr), rows(0), columns(0), firstArtificial(0), matrix(nullptr) { } @@ -93,7 +93,7 @@ QSimplex::~QSimplex() */ void QSimplex::clearDataStructures() { - if (matrix == 0) + if (matrix == nullptr) return; // Matrix @@ -101,7 +101,7 @@ void QSimplex::clearDataStructures() columns = 0; firstArtificial = 0; free(matrix); - matrix = 0; + matrix = nullptr; // Constraints for (int i = 0; i < constraints.size(); ++i) { @@ -113,7 +113,7 @@ void QSimplex::clearDataStructures() // Other variables.clear(); - objective = 0; + objective = nullptr; } /*! @@ -195,7 +195,7 @@ bool QSimplex::setConstraints(const QList &newConstraints) QSimplexVariable *artificial; Q_ASSERT(constraints[i]->helper.first == 0); - Q_ASSERT(constraints[i]->artificial == 0); + Q_ASSERT(constraints[i]->artificial == nullptr); switch(constraints[i]->ratio) { case QSimplexConstraint::LessOrEqual: diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index eecc18e5c7..bb47881c03 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -255,7 +255,7 @@ QWidget *QAbstractItemDelegate::createEditor(QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const { - return 0; + return nullptr; } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index b1557e9af4..67c01adea7 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -77,13 +77,13 @@ QT_BEGIN_NAMESPACE QAbstractItemViewPrivate::QAbstractItemViewPrivate() : model(QAbstractItemModelPrivate::staticEmptyModel()), - itemDelegate(0), - selectionModel(0), + itemDelegate(nullptr), + selectionModel(nullptr), ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate), noSelectionOnMousePress(false), selectionMode(QAbstractItemView::ExtendedSelection), selectionBehavior(QAbstractItemView::SelectItems), - currentlyCommittingEditor(0), + currentlyCommittingEditor(nullptr), pressedModifiers(Qt::NoModifier), pressedPosition(QPoint(-1, -1)), pressedAlreadySelected(false), @@ -145,8 +145,8 @@ void QAbstractItemViewPrivate::init() q->setAttribute(Qt::WA_InputMethodEnabled); - verticalScrollMode = static_cast(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0)); - horizontalScrollMode = static_cast(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0)); + verticalScrollMode = static_cast(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, q, nullptr)); + horizontalScrollMode = static_cast(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, q, nullptr)); } void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) @@ -757,7 +757,7 @@ void QAbstractItemView::setModel(QAbstractItemModel *model) QAbstractItemModel *QAbstractItemView::model() const { Q_D(const QAbstractItemView); - return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model); + return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? nullptr : d->model); } /*! @@ -915,7 +915,7 @@ QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *delegate) { Q_D(QAbstractItemView); - if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0)) { + if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, nullptr)) { if (d->delegateRefCount(rowDelegate) == 1) { disconnect(rowDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint))); @@ -949,7 +949,7 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const { Q_D(const QAbstractItemView); - return d->rowDelegates.value(row, 0); + return d->rowDelegates.value(row, nullptr); } /*! @@ -975,7 +975,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate) { Q_D(QAbstractItemView); - if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0)) { + if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, nullptr)) { if (d->delegateRefCount(columnDelegate) == 1) { disconnect(columnDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint))); @@ -1009,7 +1009,7 @@ void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelega QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) const { Q_D(const QAbstractItemView); - return d->columnDelegates.value(column, 0); + return d->columnDelegates.value(column, nullptr); } /*! @@ -1084,7 +1084,7 @@ void QAbstractItemView::setCurrentIndex(const QModelIndex &index) { Q_D(QAbstractItemView); if (d->selectionModel && (!index.isValid() || d->isIndexEnabled(index))) { - QItemSelectionModel::SelectionFlags command = selectionCommand(index, 0); + QItemSelectionModel::SelectionFlags command = selectionCommand(index, nullptr); d->selectionModel->setCurrentIndex(index, command); d->currentIndexSet = true; if ((command & QItemSelectionModel::Current) == 0) @@ -1201,7 +1201,7 @@ void QAbstractItemView::edit(const QModelIndex &index) Q_D(QAbstractItemView); if (Q_UNLIKELY(!d->isIndexValid(index))) qWarning("edit: index was invalid"); - if (Q_UNLIKELY(!edit(index, AllEditTriggers, 0))) + if (Q_UNLIKELY(!edit(index, AllEditTriggers, nullptr))) qWarning("edit: editing failed"); } @@ -1286,7 +1286,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const void QAbstractItemView::resetVerticalScrollMode() { - auto sm = static_cast(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0)); + auto sm = static_cast(style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, this, nullptr)); setVerticalScrollMode(sm); d_func()->verticalScrollModeSet = false; } @@ -1323,7 +1323,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::horizontalScrollMode() const void QAbstractItemView::resetHorizontalScrollMode() { - auto sm = static_cast(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0)); + auto sm = static_cast(style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, this, nullptr)); setHorizontalScrollMode(sm); d_func()->horizontalScrollModeSet = false; } @@ -1964,7 +1964,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event) QPersistentModelIndex persistent = index; emit doubleClicked(persistent); if ((event->button() == Qt::LeftButton) && !edit(persistent, DoubleClicked, event) - && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)) + && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this)) emit activated(persistent); d->pressedIndex = QModelIndex(); } @@ -2388,7 +2388,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) setFocus(); QItemSelectionModel::SelectionFlags command = selectionCommand(newCurrent, event); if (command != QItemSelectionModel::NoUpdate - || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this)) { + || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, nullptr, this)) { // note that we don't check if the new current index is enabled because moveCursor() makes sure it is if (command & QItemSelectionModel::Current) { d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); @@ -2654,7 +2654,7 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve if (!d->isIndexValid(index)) return false; - if (QWidget *w = (d->persistent.isEmpty() ? static_cast(0) : d->editorForIndex(index).widget.data())) { + if (QWidget *w = (d->persistent.isEmpty() ? static_cast(nullptr) : d->editorForIndex(index).widget.data())) { if (w->focusPolicy() == Qt::NoFocus) return false; w->setFocus(); @@ -2692,7 +2692,7 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve if (trigger == SelectedClicked) d->delayedEditing.start(QApplication::doubleClickInterval(), this); else - d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0); + d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : nullptr); return true; } @@ -2909,7 +2909,7 @@ void QAbstractItemView::commitData(QWidget *editor) editor->removeEventFilter(delegate); delegate->setModelData(editor, d->model, index); editor->installEventFilter(delegate); - d->currentlyCommittingEditor = 0; + d->currentlyCommittingEditor = nullptr; } /*! @@ -3260,7 +3260,7 @@ QWidget* QAbstractItemView::indexWidget(const QModelIndex &index) const if (QWidget *editor = d->editorForIndex(index).widget.data()) return editor; - return 0; + return nullptr; } /*! @@ -3673,7 +3673,7 @@ void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelI if (d->autoScroll) scrollTo(current); update(current); - edit(current, CurrentChanged, 0); + edit(current, CurrentChanged, nullptr); if (current.row() == (d->model->rowCount(d->root) - 1)) d->fetchMore(); } else { @@ -3737,7 +3737,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const if (d->iconSize.isValid()) { option.decorationSize = d->iconSize; } else { - int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); + int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this); option.decorationSize = QSize(pm, pm); } option.decorationPosition = QStyleOptionViewItem::Left; @@ -3745,7 +3745,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter; option.textElideMode = d->textElideMode; option.rect = QRect(); - option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, this); + option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, this); if (d->wrapItemText) option.features = QStyleOptionViewItem::WrapText; option.locale = locale(); @@ -4231,7 +4231,7 @@ QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index, if (!w) { QAbstractItemDelegate *delegate = delegateForIndex(index); if (!delegate) - return 0; + return nullptr; w = delegate->createEditor(viewport, options, index); if (w) { w->installEventFilter(delegate); diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp index a4eed2d885..4d0161025c 100644 --- a/src/widgets/itemviews/qcolumnview.cpp +++ b/src/widgets/itemviews/qcolumnview.cpp @@ -142,7 +142,7 @@ void QColumnView::setResizeGripsVisible(bool visible) connect(grip, SIGNAL(gripMoved(int)), this, SLOT(_q_gripMoved(int))); } else { QWidget *widget = view->cornerWidget(); - view->setCornerWidget(0); + view->setCornerWidget(nullptr); widget->deleteLater(); } } @@ -327,7 +327,7 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint) } #if QT_CONFIG(animation) - if (const int animationDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, this)) { + if (const int animationDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, this)) { d->currentAnimation.setDuration(animationDuration); d->currentAnimation.setEndValue(newScrollbarValue); d->currentAnimation.start(); @@ -638,7 +638,7 @@ void QColumnViewPrivate::_q_clicked(const QModelIndex &index) { Q_Q(QColumnView); QModelIndex parent = index.parent(); - QAbstractItemView *columnClicked = 0; + QAbstractItemView *columnClicked = nullptr; for (int column = 0; column < columns.count(); ++column) { if (columns.at(column)->rootIndex() == parent) { columnClicked = columns[column]; @@ -666,7 +666,7 @@ void QColumnViewPrivate::_q_clicked(const QModelIndex &index) QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bool show) { Q_Q(QColumnView); - QAbstractItemView *view = 0; + QAbstractItemView *view = nullptr; if (model->hasChildren(index)) { view = q->createColumn(index); q->connect(view, SIGNAL(clicked(QModelIndex)), @@ -1045,8 +1045,8 @@ QColumnViewPrivate::QColumnViewPrivate() : QAbstractItemViewPrivate() ,showResizeGrips(true) ,offset(0) -,previewWidget(0) -,previewColumn(0) +,previewWidget(nullptr) +,previewColumn(nullptr) { } diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp index 125ee73194..24039c42f6 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.cpp +++ b/src/widgets/itemviews/qdatawidgetmapper.cpp @@ -56,7 +56,7 @@ public: Q_DECLARE_PUBLIC(QDataWidgetMapper) QDataWidgetMapperPrivate() - : model(QAbstractItemModelPrivate::staticEmptyModel()), delegate(0), + : model(QAbstractItemModelPrivate::staticEmptyModel()), delegate(nullptr), orientation(Qt::Horizontal), submitPolicy(QDataWidgetMapper::AutoSubmit) { } @@ -226,7 +226,7 @@ void QDataWidgetMapperPrivate::_q_modelDestroyed() { Q_Q(QDataWidgetMapper); - model = 0; + model = nullptr; q->setModel(QAbstractItemModelPrivate::staticEmptyModel()); } @@ -374,7 +374,7 @@ QAbstractItemModel *QDataWidgetMapper::model() const { Q_D(const QDataWidgetMapper); return d->model == QAbstractItemModelPrivate::staticEmptyModel() - ? static_cast(0) + ? static_cast(nullptr) : d->model; } @@ -567,7 +567,7 @@ QWidget *QDataWidgetMapper::mappedWidgetAt(int section) const return e.widget; } - return 0; + return nullptr; } /*! diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index c9e7c7b7a6..0d387d7def 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -75,7 +75,7 @@ class QDirModelPrivate : public QAbstractItemModelPrivate public: struct QDirNode { - QDirNode() : parent(0), populated(false), stat(false) {} + QDirNode() : parent(nullptr), populated(false), stat(false) {} QDirNode *parent; QFileInfo info; QIcon icon; // cache the icon @@ -238,7 +238,7 @@ QDirModel::QDirModel(const QStringList &nameFilters, d->nameFilters = nameFilters.isEmpty() ? QStringList(QLatin1String("*")) : nameFilters; d->filters = filters; d->sort = sort; - d->root.parent = 0; + d->root.parent = nullptr; d->root.info = QFileInfo(); d->clear(&d->root); } @@ -293,7 +293,7 @@ QModelIndex QDirModel::index(int row, int column, const QModelIndex &parent) con if (row >= p->children.count()) return QModelIndex(); // now get the internal pointer for the index - QDirModelPrivate::QDirNode *n = d->node(row, d->indexValid(parent) ? p : 0); + QDirModelPrivate::QDirNode *n = d->node(row, d->indexValid(parent) ? p : nullptr); Q_ASSERT(n); return createIndex(row, column, n); @@ -310,8 +310,8 @@ QModelIndex QDirModel::parent(const QModelIndex &child) const if (!d->indexValid(child)) return QModelIndex(); QDirModelPrivate::QDirNode *node = d->node(child); - QDirModelPrivate::QDirNode *par = (node ? node->parent : 0); - if (par == 0) // parent is the root node + QDirModelPrivate::QDirNode *par = (node ? node->parent : nullptr); + if (par == nullptr) // parent is the root node return QModelIndex(); // get the parent's row @@ -1159,7 +1159,7 @@ void QDirModelPrivate::init() filters = QDir::AllEntries | QDir::NoDotAndDotDot; sort = QDir::Name; nameFilters << QLatin1String("*"); - root.parent = 0; + root.parent = nullptr; root.info = QFileInfo(); clear(&root); roleNames.insert(QDirModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration @@ -1170,7 +1170,7 @@ void QDirModelPrivate::init() QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) const { if (row < 0) - return 0; + return nullptr; bool isDir = !parent || parent->info.isDir(); QDirNode *p = (parent ? parent : &root); @@ -1179,7 +1179,7 @@ QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) co if (Q_UNLIKELY(row >= p->children.count())) { qWarning("node: the row does not exist"); - return 0; + return nullptr; } return const_cast(&p->children.at(row)); @@ -1190,7 +1190,7 @@ QVector QDirModelPrivate::children(QDirNode *parent, Q_ASSERT(parent); QFileInfoList infoList; if (parent == &root) { - parent = 0; + parent = nullptr; infoList = QDir::drives(); } else if (parent->info.isDir()) { //resolve directory links only if requested. @@ -1333,7 +1333,7 @@ void QDirModelPrivate::appendChild(QDirModelPrivate::QDirNode *parent, const QSt QDirModelPrivate::QDirNode node; node.populated = false; node.stat = shouldStat; - node.parent = (parent == &root ? 0 : parent); + node.parent = (parent == &root ? nullptr : parent); node.info = QFileInfo(path); node.info.setCaching(true); diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index d7bdf6aa4c..790f305463 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1583,7 +1583,7 @@ int QHeaderView::minimumSectionSize() const Q_D(const QHeaderView); if (d->minimumSectionSize == -1) { QSize strut = QApplication::globalStrut(); - int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this); + int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, nullptr, this); if (d->orientation == Qt::Horizontal) return qMax(strut.width(), (fontMetrics().maxWidth() + margin)); return qMax(strut.height(), (fontMetrics().height() + margin)); @@ -2883,12 +2883,12 @@ void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logical opt.text = d->model->headerData(logicalIndex, d->orientation, Qt::DisplayRole).toString(); - int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this); + int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, nullptr, this); - const Qt::Alignment headerArrowAlignment = static_cast(style()->styleHint(QStyle::SH_Header_ArrowAlignment, 0, this)); + const Qt::Alignment headerArrowAlignment = static_cast(style()->styleHint(QStyle::SH_Header_ArrowAlignment, nullptr, this)); const bool isHeaderArrowOnTheSide = headerArrowAlignment & Qt::AlignVCenter; if (isSortIndicatorShown() && sortIndicatorSection() == logicalIndex && isHeaderArrowOnTheSide) - margin += style()->pixelMetric(QStyle::PM_HeaderMarkSize, 0, this); + margin += style()->pixelMetric(QStyle::PM_HeaderMarkSize, nullptr, this); const QVariant variant = d->model->headerData(logicalIndex, d->orientation, Qt::DecorationRole); @@ -2896,8 +2896,8 @@ void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logical if (opt.icon.isNull()) opt.icon = qvariant_cast(variant); if (!opt.icon.isNull()) // see CT_HeaderSection - margin += style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this) + - style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this); + margin += style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this) + + style()->pixelMetric(QStyle::PM_HeaderMargin, nullptr, this); if (d->textElideMode != Qt::ElideNone) { const QRect textRect = style()->subElementRect(QStyle::SE_HeaderLabel, &opt, this); @@ -3275,7 +3275,7 @@ int QHeaderViewPrivate::sectionHandleAt(int position) return -1; int log = logicalIndex(visual); int pos = q->sectionViewportPosition(log); - int grip = q->style()->pixelMetric(QStyle::PM_HeaderGripMargin, 0, q); + int grip = q->style()->pixelMetric(QStyle::PM_HeaderGripMargin, nullptr, q); bool atLeft = position < pos + grip; bool atRight = (position > pos + q->sectionSize(log) - grip); @@ -3814,10 +3814,10 @@ void QHeaderViewPrivate::updateDefaultSectionSizeFromStyle() { Q_Q(QHeaderView); if (orientation == Qt::Horizontal) { - defaultSectionSize = q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, 0, q); + defaultSectionSize = q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, nullptr, q); } else { defaultSectionSize = qMax(q->minimumSectionSize(), - q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, 0, q)); + q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, nullptr, q)); } } diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp index 460764f1b8..daea907963 100644 --- a/src/widgets/itemviews/qitemdelegate.cpp +++ b/src/widgets/itemviews/qitemdelegate.cpp @@ -77,7 +77,7 @@ class QItemDelegatePrivate : public QAbstractItemDelegatePrivate Q_DECLARE_PUBLIC(QItemDelegate) public: - QItemDelegatePrivate() : f(0), clipPainting(true) {} + QItemDelegatePrivate() : f(nullptr), clipPainting(true) {} inline const QItemEditorFactory *editorFactory() const { return f ? f : QItemEditorFactory::defaultFactory(); } @@ -149,7 +149,7 @@ QRect QItemDelegatePrivate::textLayoutBounds(const QStyleOptionViewItem &option, QStyle *style = w ? w->style() : QApplication::style(); const bool wrapText = option.features & QStyleOptionViewItem::WrapText; // see QItemDelegate::drawDisplay - const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, w) + 1; + const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, w) + 1; switch (option.decorationPosition) { case QStyleOptionViewItem::Left: case QStyleOptionViewItem::Right: @@ -502,9 +502,9 @@ QWidget *QItemDelegate::createEditor(QWidget *parent, { Q_D(const QItemDelegate); if (!index.isValid()) - return 0; + return nullptr; const QItemEditorFactory *factory = d->f; - if (factory == 0) + if (factory == nullptr) factory = QItemEditorFactory::defaultFactory(); QWidget *w = factory->createEditor(index.data(Qt::EditRole).userType(), parent); if (w) @@ -533,7 +533,7 @@ void QItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) con if (!n.isEmpty()) { if (!v.isValid()) - v = QVariant(editor->property(n).userType(), (const void *)0); + v = QVariant(editor->property(n).userType(), (const void *)nullptr); editor->setProperty(n, v); } #endif @@ -586,7 +586,7 @@ void QItemDelegate::updateEditorGeometry(QWidget *editor, QPixmap pixmap = decoration(option, index.data(Qt::DecorationRole)); QString text = QItemDelegatePrivate::replaceNewLine(index.data(Qt::DisplayRole).toString()); QRect pixmapRect = QRect(QPoint(0, 0), option.decorationSize).intersected(pixmap.rect()); - QRect textRect = textRectangle(0, option.rect, option.font, text); + QRect textRect = textRectangle(nullptr, option.rect, option.font, text); QRect checkRect = doCheck(option, textRect, index.data(Qt::CheckStateRole)); QStyleOptionViewItem opt = option; opt.showDecorationSelected = true; // let the editor take up all available space @@ -654,7 +654,7 @@ void QItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &o const QWidget *widget = d->widget(option); QStyle *style = widget ? widget->style() : QApplication::style(); - const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; + const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1; QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding const bool wrapText = opt.features & QStyleOptionViewItem::WrapText; d->textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap); @@ -841,7 +841,7 @@ void QItemDelegate::doLayout(const QStyleOptionViewItem &option, const bool hasText = textRect->isValid(); const bool hasMargin = (hasText | hasPixmap | hasCheck); const int frameHMargin = hasMargin ? - style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1 : 0; + style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1 : 0; const int textMargin = hasText ? frameHMargin : 0; const int pixmapMargin = hasPixmap ? frameHMargin : 0; const int checkMargin = hasCheck ? frameHMargin : 0; @@ -1242,7 +1242,7 @@ QStyleOptionViewItem QItemDelegate::setOptions(const QModelIndex &index, opt.palette.setBrush(QPalette::Text, qvariant_cast(value)); // disable style animations for checkboxes etc. within itemviews (QTBUG-30146) - opt.styleObject = 0; + opt.styleObject = nullptr; return opt; } diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index 8ed2ee5f28..f874597d59 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -91,7 +91,7 @@ class QUIntSpinBox : public QSpinBox Q_OBJECT Q_PROPERTY(uint value READ uintValue WRITE setUIntValue NOTIFY uintValueChanged USER true) public: - explicit QUIntSpinBox(QWidget *parent = 0) + explicit QUIntSpinBox(QWidget *parent = nullptr) : QSpinBox(parent) { connect(this, SIGNAL(valueChanged(int)), SIGNAL(uintValueChanged())); @@ -176,7 +176,7 @@ QWidget *QItemEditorFactory::createEditor(int userType, QWidget *parent) const QItemEditorCreatorBase *creator = creatorMap.value(userType, 0); if (!creator) { const QItemEditorFactory *dfactory = defaultFactory(); - return dfactory == this ? 0 : dfactory->createEditor(userType, parent); + return dfactory == this ? nullptr : dfactory->createEditor(userType, parent); } return creator->createWidget(parent); } @@ -295,8 +295,8 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) default: { // the default editor is a lineedit QExpandingLineEdit *le = new QExpandingLineEdit(parent); - le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le)); - if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, le)) + le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, nullptr, le)); + if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, le)) le->setWidgetOwnsGeometry(true); return le; } #else @@ -304,7 +304,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) break; #endif } - return 0; + return nullptr; } QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const @@ -335,11 +335,11 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const } } -static QItemEditorFactory *q_default_factory = 0; +static QItemEditorFactory *q_default_factory = nullptr; struct QDefaultFactoryCleaner { inline QDefaultFactoryCleaner() {} - ~QDefaultFactoryCleaner() { delete q_default_factory; q_default_factory = 0; } + ~QDefaultFactoryCleaner() { delete q_default_factory; q_default_factory = nullptr; } }; /*! diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 04cddf2926..de32082b5a 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -933,8 +933,8 @@ QStyleOptionViewItem QListView::viewOptions() const QStyleOptionViewItem option = QAbstractItemView::viewOptions(); if (!d->iconSize.isValid()) { // otherwise it was already set in abstractitemview int pm = (d->viewMode == QListView::ListMode - ? style()->pixelMetric(QStyle::PM_ListViewIconSize, 0, this) - : style()->pixelMetric(QStyle::PM_IconViewIconSize, 0, this)); + ? style()->pixelMetric(QStyle::PM_ListViewIconSize, nullptr, this) + : style()->pixelMetric(QStyle::PM_IconViewIconSize, nullptr, this)); option.decorationSize = QSize(pm, pm); } if (d->viewMode == QListView::IconMode) { @@ -1688,7 +1688,7 @@ bool QListView::event(QEvent *e) QListViewPrivate::QListViewPrivate() : QAbstractItemViewPrivate(), - commonListView(0), + commonListView(nullptr), wrap(false), space(0), flow(QListView::TopToBottom), @@ -1733,10 +1733,10 @@ void QListViewPrivate::prepareItemsLayout() // Qt::ScrollBarAlwaysOn but scrollbar extent must be deduced if policy // is Qt::ScrollBarAsNeeded int verticalMargin = vbarpolicy==Qt::ScrollBarAsNeeded - ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, vbar) + frameAroundContents + ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, vbar) + frameAroundContents : 0; int horizontalMargin = hbarpolicy==Qt::ScrollBarAsNeeded - ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, hbar) + frameAroundContents + ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, hbar) + frameAroundContents : 0; layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin); @@ -3072,7 +3072,7 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) moved.resize(items.count()); QRect rect(QPoint(), topLeft); - QListViewItem *item = 0; + QListViewItem *item = nullptr; for (int row = info.first; row <= info.last; ++row) { item = &items[row]; if (isHidden(row)) { @@ -3178,7 +3178,7 @@ QVector QIconModeViewBase::intersectingSet(const QRect &area) const QVector res; that->interSectingVector = &res; that->tree.climbTree(area, &QIconModeViewBase::addLeaf, data); - that->interSectingVector = 0; + that->interSectingVector = nullptr; return res; } diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 1931360dbc..f71e0f2822 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -75,7 +75,7 @@ void QListModel::clear() for (int i = 0; i < items.count(); ++i) { if (items.at(i)) { items.at(i)->d->theid = -1; - items.at(i)->view = 0; + items.at(i)->view = nullptr; delete items.at(i); } } @@ -96,7 +96,7 @@ void QListModel::remove(QListWidgetItem *item) Q_ASSERT(row != -1); beginRemoveRows(QModelIndex(), row, row); items.at(row)->d->theid = -1; - items.at(row)->view = 0; + items.at(row)->view = nullptr; items.removeAt(row); endRemoveRows(); } @@ -156,11 +156,11 @@ void QListModel::insert(int row, const QStringList &labels) QListWidgetItem *QListModel::take(int row) { if (row < 0 || row >= items.count()) - return 0; + return nullptr; beginRemoveRows(QModelIndex(), row, row); items.at(row)->d->theid = -1; - items.at(row)->view = 0; + items.at(row)->view = nullptr; QListWidgetItem *item = items.takeAt(row); endRemoveRows(); return item; @@ -263,7 +263,7 @@ bool QListModel::insertRows(int row, int count, const QModelIndex &parent) beginInsertRows(QModelIndex(), row, row + count - 1); QListWidget *view = qobject_cast(QObject::parent()); - QListWidgetItem *itm = 0; + QListWidgetItem *itm = nullptr; for (int r = row; r < row + count; ++r) { itm = new QListWidgetItem; @@ -282,10 +282,10 @@ bool QListModel::removeRows(int row, int count, const QModelIndex &parent) return false; beginRemoveRows(QModelIndex(), row, row + count - 1); - QListWidgetItem *itm = 0; + QListWidgetItem *itm = nullptr; for (int r = row; r < row + count; ++r) { itm = items.takeAt(row); - itm->view = 0; + itm->view = nullptr; itm->d->theid = -1; delete itm; } @@ -1220,7 +1220,7 @@ void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex ¤t, //persistentCurrent is invalid if something changed the model in response //to the currentItemChanged signal emission and the item was removed if (!persistentCurrent.isValid()) { - currentItem = 0; + currentItem = nullptr; } emit q->currentTextChanged(currentItem ? currentItem->text() : QString()); @@ -1478,7 +1478,7 @@ QListWidgetItem *QListWidget::item(int row) const { Q_D(const QListWidget); if (row < 0 || row >= d->model->rowCount()) - return 0; + return nullptr; return d->listModel()->at(row); } @@ -1548,7 +1548,7 @@ QListWidgetItem *QListWidget::takeItem(int row) { Q_D(QListWidget); if (row < 0 || row >= d->model->rowCount()) - return 0; + return nullptr; return d->listModel()->take(row); } @@ -2064,7 +2064,7 @@ QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const Q_D(const QListWidget); if (d->isIndexValid(index)) return d->listModel()->at(index.row()); - return 0; + return nullptr; } /*! diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index 702e290da3..f42af2ea00 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -83,7 +83,7 @@ class QStyledItemDelegatePrivate : public QAbstractItemDelegatePrivate Q_DECLARE_PUBLIC(QStyledItemDelegate) public: - QStyledItemDelegatePrivate() : factory(0) { } + QStyledItemDelegatePrivate() : factory(nullptr) { } static const QWidget *widget(const QStyleOptionViewItem &option) { @@ -351,7 +351,7 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option, option->backgroundBrush = qvariant_cast(index.data(Qt::BackgroundRole)); // disable style animations for checkboxes etc. within itemviews (QTBUG-30146) - option->styleObject = 0; + option->styleObject = nullptr; } /*! @@ -426,7 +426,7 @@ QWidget *QStyledItemDelegate::createEditor(QWidget *parent, { Q_D(const QStyledItemDelegate); if (!index.isValid()) - return 0; + return nullptr; return d->editorFactory()->createEditor(index.data(Qt::EditRole).userType(), parent); } @@ -450,7 +450,7 @@ void QStyledItemDelegate::setEditorData(QWidget *editor, const QModelIndex &inde if (!n.isEmpty()) { if (!v.isValid()) - v = QVariant(editor->property(n).userType(), (const void *)0); + v = QVariant(editor->property(n).userType(), (const void *)nullptr); editor->setProperty(n, v); } #endif @@ -507,7 +507,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor, //or it is in a QTableView #if QT_CONFIG(tableview) && QT_CONFIG(lineedit) if (qobject_cast(editor) && !qobject_cast(widget)) - opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor); + opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, editor); else #endif opt.showDecorationSelected = true; diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 91860341ee..8f37ef4c3d 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE QTableModel::QTableModel(int rows, int columns, QTableWidget *parent) : QAbstractTableModel(parent), - prototype(0), + prototype(nullptr), tableItems(rows * columns, 0), verticalHeaderItems(rows, 0), horizontalHeaderItems(columns, 0) @@ -104,18 +104,18 @@ bool QTableModel::removeRows(int row, int count, const QModelIndex &) beginRemoveRows(QModelIndex(), row, row + count - 1); int i = tableIndex(row, 0); int n = count * columnCount(); - QTableWidgetItem *oldItem = 0; + QTableWidgetItem *oldItem = nullptr; for (int j = i; j < n + i; ++j) { oldItem = tableItems.at(j); if (oldItem) - oldItem->view = 0; + oldItem->view = nullptr; delete oldItem; } tableItems.remove(qMax(i, 0), n); for (int v = row; v < row + count; ++v) { oldItem = verticalHeaderItems.at(v); if (oldItem) - oldItem->view = 0; + oldItem->view = nullptr; delete oldItem; } verticalHeaderItems.remove(row, count); @@ -129,13 +129,13 @@ bool QTableModel::removeColumns(int column, int count, const QModelIndex &) return false; beginRemoveColumns(QModelIndex(), column, column + count - 1); - QTableWidgetItem *oldItem = 0; + QTableWidgetItem *oldItem = nullptr; for (int row = rowCount() - 1; row >= 0; --row) { int i = tableIndex(row, column); for (int j = i; j < i + count; ++j) { oldItem = tableItems.at(j); if (oldItem) - oldItem->view = 0; + oldItem->view = nullptr; delete oldItem; } tableItems.remove(i, count); @@ -143,7 +143,7 @@ bool QTableModel::removeColumns(int column, int count, const QModelIndex &) for (int h=column; hview = 0; + oldItem->view = nullptr; delete oldItem; } horizontalHeaderItems.remove(column, count); @@ -162,7 +162,7 @@ void QTableModel::setItem(int row, int column, QTableWidgetItem *item) // remove old if (oldItem) - oldItem->view = 0; + oldItem->view = nullptr; delete tableItems.at(i); QTableWidget *view = qobject_cast(QObject::parent()); @@ -180,7 +180,7 @@ void QTableModel::setItem(int row, int column, QTableWidgetItem *item) if (row < colItems.count()) colItems.remove(row); int sortedRow; - if (item == 0) { + if (item == nullptr) { // move to after all non-0 (sortable) items sortedRow = colItems.count(); } else { @@ -222,7 +222,7 @@ QTableWidgetItem *QTableModel::takeItem(int row, int column) long i = tableIndex(row, column); QTableWidgetItem *itm = tableItems.value(i); if (itm) { - itm->view = 0; + itm->view = nullptr; itm->d->id = -1; tableItems[i] = 0; const QModelIndex ind = index(row, column); @@ -239,7 +239,7 @@ QTableWidgetItem *QTableModel::item(int row, int column) const QTableWidgetItem *QTableModel::item(const QModelIndex &index) const { if (!isValid(index)) - return 0; + return nullptr; return tableItems.at(tableIndex(index.row(), index.column())); } @@ -277,7 +277,7 @@ void QTableModel::setHorizontalHeaderItem(int section, QTableWidgetItem *item) return; if (oldItem) - oldItem->view = 0; + oldItem->view = nullptr; delete oldItem; QTableWidget *view = qobject_cast(QObject::parent()); @@ -299,7 +299,7 @@ void QTableModel::setVerticalHeaderItem(int section, QTableWidgetItem *item) return; if (oldItem) - oldItem->view = 0; + oldItem->view = nullptr; delete oldItem; QTableWidget *view = qobject_cast(QObject::parent()); @@ -315,10 +315,10 @@ void QTableModel::setVerticalHeaderItem(int section, QTableWidgetItem *item) QTableWidgetItem *QTableModel::takeHorizontalHeaderItem(int section) { if (section < 0 || section >= horizontalHeaderItems.count()) - return 0; + return nullptr; QTableWidgetItem *itm = horizontalHeaderItems.at(section); if (itm) { - itm->view = 0; + itm->view = nullptr; itm->itemFlags &= ~ItemIsHeaderItem; horizontalHeaderItems[section] = 0; } @@ -328,10 +328,10 @@ QTableWidgetItem *QTableModel::takeHorizontalHeaderItem(int section) QTableWidgetItem *QTableModel::takeVerticalHeaderItem(int section) { if (section < 0 || section >= verticalHeaderItems.count()) - return 0; + return nullptr; QTableWidgetItem *itm = verticalHeaderItems.at(section); if (itm) { - itm->view = 0; + itm->view = nullptr; itm->itemFlags &= ~ItemIsHeaderItem; verticalHeaderItems[section] = 0; } @@ -571,7 +571,7 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order, sorting.reserve(count); for (int row = start; row <= end; ++row) { QTableWidgetItem *itm = item(row, column); - if (itm == 0) { + if (itm == nullptr) { // no more sortable items (all 0-items are // at the end of the table when it is sorted) break; @@ -649,7 +649,7 @@ QVector QTableModel::columnItems(int column) const items.reserve(rc); for (int row = 0; row < rc; ++row) { QTableWidgetItem *itm = item(row, column); - if (itm == 0) { + if (itm == nullptr) { // no more sortable items (all 0-items are // at the end of the table when it is sorted) break; @@ -718,7 +718,7 @@ QVariant QTableModel::headerData(int section, Qt::Orientation orientation, int r if (section < 0) return QVariant(); - QTableWidgetItem *itm = 0; + QTableWidgetItem *itm = nullptr; if (orientation == Qt::Horizontal && section < horizontalHeaderItems.count()) itm = horizontalHeaderItems.at(section); else if (orientation == Qt::Vertical && section < verticalHeaderItems.count()) @@ -741,7 +741,7 @@ bool QTableModel::setHeaderData(int section, Qt::Orientation orientation, (orientation == Qt::Vertical && verticalHeaderItems.size() <= section)) return false; - QTableWidgetItem *itm = 0; + QTableWidgetItem *itm = nullptr; if (orientation == Qt::Horizontal) itm = horizontalHeaderItems.at(section); else @@ -764,14 +764,14 @@ void QTableModel::clear() { for (int j = 0; j < verticalHeaderItems.count(); ++j) { if (verticalHeaderItems.at(j)) { - verticalHeaderItems.at(j)->view = 0; + verticalHeaderItems.at(j)->view = nullptr; delete verticalHeaderItems.at(j); verticalHeaderItems[j] = 0; } } for (int k = 0; k < horizontalHeaderItems.count(); ++k) { if (horizontalHeaderItems.at(k)) { - horizontalHeaderItems.at(k)->view = 0; + horizontalHeaderItems.at(k)->view = nullptr; delete horizontalHeaderItems.at(k); horizontalHeaderItems[k] = 0; } @@ -784,7 +784,7 @@ void QTableModel::clearContents() beginResetModel(); for (int i = 0; i < tableItems.count(); ++i) { if (tableItems.at(i)) { - tableItems.at(i)->view = 0; + tableItems.at(i)->view = nullptr; delete tableItems.at(i); tableItems[i] = 0; } @@ -853,7 +853,7 @@ QMimeData *QTableModel::mimeData(const QModelIndexList &indexes) const // cachedIndexes is a little hack to avoid copying from QModelIndexList to // QList and back again in the view cachedIndexes = indexes; - QMimeData *mimeData = (view ? view->mimeData(items) : 0); + QMimeData *mimeData = (view ? view->mimeData(items) : nullptr); cachedIndexes.clear(); return mimeData; } @@ -2040,7 +2040,7 @@ QTableWidgetItem *QTableWidget::takeItem(int row, int column) Q_D(QTableWidget); QTableWidgetItem *item = d->tableModel()->takeItem(row, column); if (item) - item->view = 0; + item->view = nullptr; return item; } @@ -2076,7 +2076,7 @@ QTableWidgetItem *QTableWidget::takeVerticalHeaderItem(int row) Q_D(QTableWidget); QTableWidgetItem *itm = d->tableModel()->takeVerticalHeaderItem(row); if (itm) - itm->view = 0; + itm->view = nullptr; return itm; } @@ -2115,7 +2115,7 @@ QTableWidgetItem *QTableWidget::takeHorizontalHeaderItem(int column) Q_D(QTableWidget); QTableWidgetItem *itm = d->tableModel()->takeHorizontalHeaderItem(column); if (itm) - itm->view = 0; + itm->view = nullptr; return itm; } @@ -2126,7 +2126,7 @@ void QTableWidget::setVerticalHeaderLabels(const QStringList &labels) { Q_D(QTableWidget); QTableModel *model = d->tableModel(); - QTableWidgetItem *item = 0; + QTableWidgetItem *item = nullptr; for (int i = 0; i < model->rowCount() && i < labels.count(); ++i) { item = model->verticalHeaderItem(i); if (!item) { @@ -2144,7 +2144,7 @@ void QTableWidget::setHorizontalHeaderLabels(const QStringList &labels) { Q_D(QTableWidget); QTableModel *model = d->tableModel(); - QTableWidgetItem *item = 0; + QTableWidgetItem *item = nullptr; for (int i = 0; i < model->columnCount() && i < labels.count(); ++i) { item = model->horizontalHeaderItem(i); if (!item) { diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 442369c2ec..9aba17be70 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1517,7 +1517,7 @@ void QTreeView::drawTree(QPainter *painter, const QRegion ®ion) const /// ### move to QObject :) static inline bool ancestorOf(QObject *widget, QObject *other) { - for (QObject *parent = other; parent != 0; parent = parent->parent()) { + for (QObject *parent = other; parent != nullptr; parent = parent->parent()) { if (parent == widget) return true; } @@ -1888,7 +1888,7 @@ void QTreeView::mousePressEvent(QMouseEvent *event) { Q_D(QTreeView); bool handled = false; - if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonPress) + if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, this) == QEvent::MouseButtonPress) handled = d->expandOrCollapseItemAtPos(event->pos()); if (!handled && d->itemDecorationAt(event->pos()) == -1) QAbstractItemView::mousePressEvent(event); @@ -1907,7 +1907,7 @@ void QTreeView::mouseReleaseEvent(QMouseEvent *event) } else { if (state() == QAbstractItemView::DragSelectingState || state() == QAbstractItemView::DraggingState) setState(QAbstractItemView::NoState); - if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonRelease) + if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, this) == QEvent::MouseButtonRelease) d->expandOrCollapseItemAtPos(event->pos()); } } @@ -1944,7 +1944,7 @@ void QTreeView::mouseDoubleClickEvent(QMouseEvent *event) if (edit(persistent, DoubleClicked, event) || state() != NoState) return; // the double click triggered editing - if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)) + if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this)) emit activated(persistent); d->pressedIndex = QModelIndex(); @@ -2208,7 +2208,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie d->collapse(vi, true); d->moveCursorUpdatedView = true; } else { - bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); + bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, nullptr, this); if (descend) { QModelIndex par = current.parent(); if (par.isValid() && par != rootIndex()) @@ -2244,7 +2244,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie d->expand(vi, true); d->moveCursorUpdatedView = true; } else { - bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); + bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, nullptr, this); if (descend) { QModelIndex idx = d->modelIndex(d->below(vi)); if (idx.parent() == current) @@ -3051,7 +3051,7 @@ void QTreeViewPrivate::initialize() header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter); q->setHeader(header); #if QT_CONFIG(animation) - animationsEnabled = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, q) > 0; + animationsEnabled = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, q) > 0; QObject::connect(&animatedOperation, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation())); #endif // animation } @@ -3344,7 +3344,7 @@ void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninit int hidden = 0; int last = 0; int children = 0; - QTreeViewItem *item = 0; + QTreeViewItem *item = nullptr; for (int j = first; j < first + count; ++j) { current = model->index(j - first, 0, parent); if (isRowHidden(current)) { @@ -3955,7 +3955,7 @@ int QTreeViewPrivate::accessibleTree2Index(const QModelIndex &index) const void QTreeViewPrivate::updateIndentationFromStyle() { Q_Q(const QTreeView); - indent = q->style()->pixelMetric(QStyle::PM_TreeViewIndentation, 0, q); + indent = q->style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr, q); } /*! diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index cce0773fec..ddb31523fd 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -144,7 +144,7 @@ QTreeModel::~QTreeModel() clear(); headerItem->view = nullptr; delete headerItem; - rootItem->view = 0; + rootItem->view = nullptr; delete rootItem; } @@ -160,8 +160,8 @@ void QTreeModel::clear() beginResetModel(); for (int i = 0; i < rootItem->childCount(); ++i) { QTreeWidgetItem *item = rootItem->children.at(i); - item->par = 0; - item->view = 0; + item->par = nullptr; + item->view = nullptr; delete item; } rootItem->children.clear(); @@ -214,7 +214,7 @@ void QTreeModel::setColumnCount(int columns) QTreeWidgetItem *QTreeModel::item(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return nullptr; return static_cast(index.internalPointer()); } @@ -515,9 +515,9 @@ bool QTreeModel::removeRows(int row, int count, const QModelIndex &parent) { for (int i = row + count - 1; i >= row; --i) { QTreeWidgetItem *child = itm ? itm->takeChild(i) : rootItem->children.takeAt(i); Q_ASSERT(child); - child->view = 0; + child->view = nullptr; delete child; - child = 0; + child = nullptr; } blocker.unblock(); @@ -1612,11 +1612,11 @@ QTreeWidgetItem::~QTreeWidgetItem() } } else if (model) { if (this == model->headerItem) { - model->headerItem = 0; + model->headerItem = nullptr; } else { int i = model->rootItem->children.indexOf(this); if (i >= 0) { - model->beginRemoveItems(0, i, 1); + model->beginRemoveItems(nullptr, i, 1); // users _could_ do changes when connected to rowsAboutToBeRemoved, // so we check again to make sure 'i' is valid if (!model->rootItem->children.isEmpty() && model->rootItem->children.at(i) == this) @@ -1630,9 +1630,9 @@ QTreeWidgetItem::~QTreeWidgetItem() for (int i = 0; i < children.count(); ++i) { QTreeWidgetItem *child = children.at(i); // make sure the child does not try to remove itself from our children list - child->par = 0; + child->par = nullptr; // make sure the child does not try to remove itself from the top level list - child->view = 0; + child->view = nullptr; delete child; } @@ -1648,16 +1648,16 @@ QTreeWidgetItem::~QTreeWidgetItem() */ QTreeWidgetItem *QTreeWidgetItem::clone() const { - QTreeWidgetItem *copy = 0; + QTreeWidgetItem *copy = nullptr; QStack stack; QStack parentStack; stack.push(this); parentStack.push(0); - QTreeWidgetItem *root = 0; - const QTreeWidgetItem *item = 0; - QTreeWidgetItem *parent = 0; + QTreeWidgetItem *root = nullptr; + const QTreeWidgetItem *item = nullptr; + QTreeWidgetItem *parent = nullptr; while (!stack.isEmpty()) { // get current item, and copied parent item = stack.pop(); @@ -1992,8 +1992,8 @@ void QTreeWidgetItem::write(QDataStream &out) const \sa data(), flags() */ QTreeWidgetItem::QTreeWidgetItem(const QTreeWidgetItem &other) - : rtti(Type), values(other.values), view(0), - d(new QTreeWidgetItemPrivate(this)), par(0), + : rtti(Type), values(other.values), view(nullptr), + d(new QTreeWidgetItemPrivate(this)), par(nullptr), itemFlags(other.itemFlags) { d->display = other.d->display; @@ -2036,14 +2036,14 @@ void QTreeWidgetItem::addChild(QTreeWidgetItem *child) */ void QTreeWidgetItem::insertChild(int index, QTreeWidgetItem *child) { - if (index < 0 || index > children.count() || child == 0 || child->view != 0 || child->par != 0) + if (index < 0 || index > children.count() || child == nullptr || child->view != nullptr || child->par != nullptr) return; if (QTreeModel *model = treeModel()) { const bool wasSkipSort = model->skipPendingSort; model->skipPendingSort = true; if (model->rootItem == this) - child->par = 0; + child->par = nullptr; else child->par = this; if (view->isSortingEnabled()) { @@ -2103,12 +2103,12 @@ QTreeWidgetItem *QTreeWidgetItem::takeChild(int index) if (model) model->beginRemoveItems(this, index, 1); d->updateHiddenStatus(children.at(index), false); QTreeWidgetItem *item = children.takeAt(index); - item->par = 0; + item->par = nullptr; QStack stack; stack.push(item); while (!stack.isEmpty()) { QTreeWidgetItem *i = stack.pop(); - i->view = 0; + i->view = nullptr; for (int c = 0; c < i->children.count(); ++c) stack.push(i->children.at(c)); } @@ -2116,7 +2116,7 @@ QTreeWidgetItem *QTreeWidgetItem::takeChild(int index) if (model) model->endRemoveRows(); return item; } - return 0; + return nullptr; } /*! @@ -2163,7 +2163,7 @@ void QTreeWidgetItem::insertChildren(int index, const QList &c stack.push(child); } if (model && (model->rootItem == this)) - child->par = 0; + child->par = nullptr; else child->par = this; } @@ -2206,12 +2206,12 @@ QList QTreeWidgetItem::takeChildren() if (model) model->beginRemoveItems(this, 0, children.count()); for (int n = 0; n < children.count(); ++n) { QTreeWidgetItem *item = children.at(n); - item->par = 0; + item->par = nullptr; QStack stack; stack.push(item); while (!stack.isEmpty()) { QTreeWidgetItem *i = stack.pop(); - i->view = 0; + i->view = nullptr; for (int c = 0; c < i->children.count(); ++c) stack.push(i->children.at(c)); } @@ -3306,7 +3306,7 @@ QTreeWidgetItem *QTreeWidget::itemAbove(const QTreeWidgetItem *item) const { Q_D(const QTreeWidget); if (item == d->treeModel()->headerItem) - return 0; + return nullptr; const QModelIndex index = d->index(item); const QModelIndex above = indexAbove(index); return d->item(above); @@ -3321,7 +3321,7 @@ QTreeWidgetItem *QTreeWidget::itemBelow(const QTreeWidgetItem *item) const { Q_D(const QTreeWidget); if (item == d->treeModel()->headerItem) - return 0; + return nullptr; const QModelIndex index = d->index(item); const QModelIndex below = indexBelow(index); return d->item(below); @@ -3424,14 +3424,14 @@ QMimeData *QTreeWidget::mimeData(const QList items) const for (const auto *item : items) { if (Q_UNLIKELY(!item)) { qWarning("QTreeWidget::mimeData: Null-item passed"); - return 0; + return nullptr; } for (int c = 0; c < item->values.count(); ++c) { const QModelIndex index = indexFromItem(item, c); if (Q_UNLIKELY(!index.isValid())) { qWarning() << "QTreeWidget::mimeData: No index associated with item :" << item; - return 0; + return nullptr; } indexes << index; } diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp index 14c19fcb9c..a24106d90e 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp +++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp @@ -90,7 +90,7 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(const QTreeWidgetItemIterator & */ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFlags flags) -: current(0), flags(flags) +: current(nullptr), flags(flags) { Q_ASSERT(widget); QTreeModel *model = qobject_cast(widget->model()); @@ -266,7 +266,7 @@ bool QTreeWidgetItemIterator::matchesFlags(const QTreeWidgetItem *item) const QTreeWidgetItem* QTreeWidgetItemIteratorPrivate::nextSibling(const QTreeWidgetItem* item) const { Q_ASSERT(item); - QTreeWidgetItem *next = 0; + QTreeWidgetItem *next = nullptr; if (QTreeWidgetItem *par = item->parent()) { int i = par->indexOfChild(const_cast(item)); next = par->child(i + 1); @@ -280,9 +280,9 @@ QTreeWidgetItem* QTreeWidgetItemIteratorPrivate::nextSibling(const QTreeWidgetIt QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::next(const QTreeWidgetItem *current) { - if (!current) return 0; + if (!current) return nullptr; - QTreeWidgetItem *next = 0; + QTreeWidgetItem *next = nullptr; if (current->childCount()) { // walk the child m_parentIndex.push(m_currentIndex); @@ -307,9 +307,9 @@ QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::next(const QTreeWidgetItem *cur QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::previous(const QTreeWidgetItem *current) { - if (!current) return 0; + if (!current) return nullptr; - QTreeWidgetItem *prev = 0; + QTreeWidgetItem *prev = nullptr; // walk the previous sibling QTreeWidgetItem *parent = current->parent(); prev = parent ? parent->child(m_currentIndex - 1) @@ -347,7 +347,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * // we need to adjust the iterator. if (nextItem == itemToBeRemoved) { QTreeWidgetItem *parent = nextItem; - nextItem = 0; + nextItem = nullptr; while (parent && !nextItem) { nextItem = nextSibling(parent); parent = parent->parent(); @@ -358,7 +358,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * if (!(q->matchesFlags(nextItem))) ++(*q); } else { // set it to null. - q->current = 0; + q->current = nullptr; m_parentIndex.clear(); return; } diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 19ad65692b..64b0d69f6d 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -658,7 +658,7 @@ void QAction::setMenu(QMenu *menu) { Q_D(QAction); if (d->menu) - d->menu->d_func()->setOverrideMenuAction(0); //we reset the default action of any previous menu + d->menu->d_func()->setOverrideMenuAction(nullptr); //we reset the default action of any previous menu d->menu = menu; if (menu) menu->d_func()->setOverrideMenuAction(this); diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp index 1d9213de0c..5dc12c48a4 100644 --- a/src/widgets/kernel/qactiongroup.cpp +++ b/src/widgets/kernel/qactiongroup.cpp @@ -81,7 +81,7 @@ void QActionGroupPrivate::_q_actionChanged() current = action; } } else if (action == current) { - current = 0; + current = nullptr; } } } @@ -271,11 +271,11 @@ void QActionGroup::removeAction(QAction *action) Q_D(QActionGroup); if (d->actions.removeAll(action)) { if (action == d->current) - d->current = 0; + d->current = nullptr; QObject::disconnect(action, SIGNAL(triggered()), this, SLOT(_q_actionTriggered())); QObject::disconnect(action, SIGNAL(changed()), this, SLOT(_q_actionChanged())); QObject::disconnect(action, SIGNAL(hovered()), this, SLOT(_q_actionHovered())); - action->d_func()->group = 0; + action->d_func()->group = nullptr; } } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6d4baacfef..57771b3e12 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE Q_CORE_EXPORT void qt_call_post_routines(); Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1); -QApplicationPrivate *QApplicationPrivate::self = 0; +QApplicationPrivate *QApplicationPrivate::self = nullptr; static void initSystemPalette() { @@ -158,7 +158,7 @@ static void initSystemPalette() static void clearSystemPalette() { delete QApplicationPrivate::sys_pal; - QApplicationPrivate::sys_pal = 0; + QApplicationPrivate::sys_pal = nullptr; } bool QApplicationPrivate::autoSipEnabled = true; @@ -169,8 +169,8 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags) application_type = QApplicationPrivate::Gui; #ifndef QT_NO_GESTURES - gestureManager = 0; - gestureWidget = 0; + gestureManager = nullptr; + gestureWidget = nullptr; #endif // QT_NO_GESTURES if (!self) @@ -180,7 +180,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags) QApplicationPrivate::~QApplicationPrivate() { if (self == this) - self = 0; + self = nullptr; } void QApplicationPrivate::createEventDispatcher() @@ -357,7 +357,7 @@ QWidget *QApplication::topLevelAt(const QPoint &pos) if (const QWidgetWindow *widgetWindow = qobject_cast(window)) return widgetWindow->widget(); } - return 0; + return nullptr; } /*! @@ -372,22 +372,22 @@ QWidget *QApplication::topLevelAt(const QPoint &pos) void qt_init_tooltip_palette(); void qt_cleanup(); -QStyle *QApplicationPrivate::app_style = 0; // default application style +QStyle *QApplicationPrivate::app_style = nullptr; // default application style #ifndef QT_NO_STYLE_STYLESHEET QString QApplicationPrivate::styleSheet; // default application stylesheet #endif -QPointer QApplicationPrivate::leaveAfterRelease = 0; +QPointer QApplicationPrivate::leaveAfterRelease = nullptr; -QPalette *QApplicationPrivate::sys_pal = 0; // default system palette -QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer +QPalette *QApplicationPrivate::sys_pal = nullptr; // default system palette +QPalette *QApplicationPrivate::set_pal = nullptr; // default palette set by programmer -QFont *QApplicationPrivate::sys_font = 0; // default system font -QFont *QApplicationPrivate::set_font = 0; // default font set by programmer +QFont *QApplicationPrivate::sys_font = nullptr; // default system font +QFont *QApplicationPrivate::set_font = nullptr; // default font set by programmer -QWidget *QApplicationPrivate::main_widget = 0; // main application widget -QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus -QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show() -QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus +QWidget *QApplicationPrivate::main_widget = nullptr; // main application widget +QWidget *QApplicationPrivate::focus_widget = nullptr; // has keyboard input focus +QWidget *QApplicationPrivate::hidden_focus_widget = nullptr; // will get keyboard input focus after show() +QWidget *QApplicationPrivate::active_window = nullptr; // toplevel with keyboard focus #if QT_CONFIG(wheelevent) QPointer QApplicationPrivate::wheel_widget; #endif @@ -419,9 +419,9 @@ Q_GLOBAL_STATIC(FontHash, app_fonts) PaletteHash *qt_app_palettes_hash() { return app_palettes(); } FontHash *qt_app_fonts_hash() { return app_fonts(); } -QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus +QWidgetList *QApplicationPrivate::popupWidgets = nullptr; // has keyboard input focus -QDesktopWidget *qt_desktopWidget = 0; // root window widgets +QDesktopWidget *qt_desktopWidget = nullptr; // root window widgets /*! \internal @@ -434,7 +434,7 @@ void QApplicationPrivate::process_cmdline() if (!styleOverride.isEmpty()) { if (app_style) { delete app_style; - app_style = 0; + app_style = nullptr; } } @@ -473,7 +473,7 @@ void QApplicationPrivate::process_cmdline() } if(j < argc) { - argv[j] = 0; + argv[j] = nullptr; argc = j; } } @@ -620,7 +620,7 @@ void QApplicationPrivate::initialize() static void setPossiblePalette(const QPalette *palette, const char *className) { - if (palette == 0) + if (palette == nullptr) return; QApplicationPrivate::setPalette_helper(*palette, className, false); } @@ -746,7 +746,7 @@ QWidget *QApplication::activePopupWidget() QWidget *QApplication::activeModalWidget() { QWidgetWindow *widgetWindow = qobject_cast(modalWindow()); - return widgetWindow ? widgetWindow->widget() : 0; + return widgetWindow ? widgetWindow->widget() : nullptr; } /*! @@ -769,12 +769,12 @@ QApplication::~QApplication() QApplicationPrivate::is_app_running = false; delete QWidgetPrivate::mapper; - QWidgetPrivate::mapper = 0; + QWidgetPrivate::mapper = nullptr; // delete all widgets if (QWidgetPrivate::allWidgets) { QWidgetSet *mySet = QWidgetPrivate::allWidgets; - QWidgetPrivate::allWidgets = 0; + QWidgetPrivate::allWidgets = nullptr; for (QWidgetSet::ConstIterator it = mySet->constBegin(), cend = mySet->constEnd(); it != cend; ++it) { QWidget *w = *it; if (!w->parent()) // window @@ -784,23 +784,23 @@ QApplication::~QApplication() } delete qt_desktopWidget; - qt_desktopWidget = 0; + qt_desktopWidget = nullptr; delete QApplicationPrivate::app_pal; - QApplicationPrivate::app_pal = 0; + QApplicationPrivate::app_pal = nullptr; clearSystemPalette(); delete QApplicationPrivate::set_pal; - QApplicationPrivate::set_pal = 0; + QApplicationPrivate::set_pal = nullptr; app_palettes()->clear(); delete QApplicationPrivate::sys_font; - QApplicationPrivate::sys_font = 0; + QApplicationPrivate::sys_font = nullptr; delete QApplicationPrivate::set_font; - QApplicationPrivate::set_font = 0; + QApplicationPrivate::set_font = nullptr; app_fonts()->clear(); delete QApplicationPrivate::app_style; - QApplicationPrivate::app_style = 0; + QApplicationPrivate::app_style = nullptr; #if QT_CONFIG(draganddrop) if (qt_is_gui_used) @@ -846,7 +846,7 @@ void qt_cleanup() QPixmapCache::clear(); QColormap::cleanup(); - QApplicationPrivate::active_window = 0; //### this should not be necessary + QApplicationPrivate::active_window = nullptr; //### this should not be necessary #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (displayDC) { @@ -892,7 +892,7 @@ QWidget *QApplication::widgetAt(const QPoint &p) QRegion newmask = (oldmask.isEmpty() ? QRegion(window->rect()) : oldmask) - QRegion(wpoint.x(), wpoint.y(), 1, 1); window->setMask(newmask); - QWidget *recurse = 0; + QWidget *recurse = nullptr; if (QApplication::topLevelAt(p) != window) // verify recursion will terminate recurse = widgetAt(x, y); if (oldmask.isEmpty()) @@ -925,7 +925,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis || event->type() == QEvent::LanguageChange)) { for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) { const QPostEvent &cur = *it; - if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type()) + if (cur.receiver != receiver || cur.event == nullptr || cur.event->type() != event->type()) continue; if (cur.event->type() == QEvent::LayoutRequest || cur.event->type() == QEvent::UpdateRequest) { @@ -1020,7 +1020,7 @@ QStyle *QApplication::style() return QApplicationPrivate::app_style; if (!qobject_cast(QCoreApplication::instance())) { Q_ASSERT(!"No style available without QApplication!"); - return 0; + return nullptr; } if (!QApplicationPrivate::app_style) { @@ -1048,7 +1048,7 @@ QStyle *QApplication::style() } if (!app_style) { Q_ASSERT(!"No styles available!"); - return 0; + return nullptr; } } // take ownership of the style @@ -1202,7 +1202,7 @@ QStyle* QApplication::setStyle(const QString& style) { QStyle *s = QStyleFactory::create(style); if (!s) - return 0; + return nullptr; setStyle(s); return s; @@ -1695,7 +1695,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) return; #endif - hidden_focus_widget = 0; + hidden_focus_widget = nullptr; if (focus != focus_widget) { if (focus && focus->isHidden()) { @@ -1893,7 +1893,7 @@ bool QApplication::event(QEvent *e) #endif } else if (e->type() == QEvent::Timer) { QTimerEvent *te = static_cast(e); - Q_ASSERT(te != 0); + Q_ASSERT(te != nullptr); if (te->timerId() == d->toolTipWakeUp.timerId()) { d->toolTipWakeUp.stop(); if (d->toolTipWidget) { @@ -1905,14 +1905,14 @@ bool QApplication::event(QEvent *e) while (w && !showToolTip) { showToolTip = w->isActiveWindow(); w = w->parentWidget(); - w = w ? w->window() : 0; + w = w ? w->window() : nullptr; } if (showToolTip) { QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos); QCoreApplication::sendEvent(d->toolTipWidget, &e); if (e.isAccepted()) { QStyle *s = d->toolTipWidget->style(); - int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, 0, d->toolTipWidget, 0); + int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, nullptr, d->toolTipWidget, nullptr); d->toolTipFallAsleep.start(sleepDelay, this); } } @@ -1982,7 +1982,7 @@ void QApplicationPrivate::notifyLayoutDirectionChange() */ void QApplication::setActiveWindow(QWidget* act) { - QWidget* window = act?act->window():0; + QWidget* window = act?act->window():nullptr; if (QApplicationPrivate::active_window == window) return; @@ -1998,7 +1998,7 @@ void QApplication::setActiveWindow(QWidget* act) QWidgetList toBeDeactivated; if (QApplicationPrivate::active_window) { - if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) { + if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) { const QWidgetList list = topLevelWidgets(); for (auto *w : list) { if (w->isVisible() && w->isActiveWindow()) @@ -2020,7 +2020,7 @@ void QApplication::setActiveWindow(QWidget* act) QApplicationPrivate::active_window = window; if (QApplicationPrivate::active_window) { - if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) { + if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) { const QWidgetList list = topLevelWidgets(); for (auto *w : list) { if (w->isVisible() && w->isActiveWindow()) @@ -2049,10 +2049,10 @@ void QApplication::setActiveWindow(QWidget* act) sendSpontaneousEvent(w, &activationChange); } - if (QApplicationPrivate::popupWidgets == 0) { // !inPopupMode() + if (QApplicationPrivate::popupWidgets == nullptr) { // !inPopupMode() // then focus events if (!QApplicationPrivate::active_window && QApplicationPrivate::focus_widget) { - QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason); + QApplicationPrivate::setFocusWidget(nullptr, Qt::ActiveWindowFocusReason); } else if (QApplicationPrivate::active_window) { QWidget *w = QApplicationPrivate::active_window->focusWidget(); if (w && w->isVisible() /*&& w->focusPolicy() != QWidget::NoFocus*/) @@ -2067,7 +2067,7 @@ void QApplication::setActiveWindow(QWidget* act) if (!w && QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus) QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason); else if (!QApplicationPrivate::active_window->isAncestorOf(w)) - QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason); + QApplicationPrivate::setFocusWidget(nullptr, Qt::ActiveWindowFocusReason); } } } @@ -2095,7 +2095,7 @@ QWidget *qt_tlw_for_window(QWindow *wnd) return tlw; } } - return 0; + return nullptr; } void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous) @@ -2158,7 +2158,7 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool test = test->d_func()->focus_next; } - if (wrappingOccurred != 0) + if (wrappingOccurred != nullptr) *wrappingOccurred = next ? focusWidgetAfterWindow : !focusWidgetAfterWindow; if (w == f) { @@ -2166,7 +2166,7 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool w->window()->setAttribute(Qt::WA_KeyboardFocusChange); w->update(); } - return 0; + return nullptr; } return w; } @@ -2248,7 +2248,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con QEvent leaveEvent(QEvent::Leave); for (int i = 0; i < leaveList.size(); ++i) { auto *w = leaveList.at(i); - if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { + if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, nullptr)) { QCoreApplication::sendEvent(w, &leaveEvent); if (w->testAttribute(Qt::WA_Hover) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) { @@ -2267,7 +2267,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con const QPoint windowPos = qAsConst(enterList).back()->window()->mapFromGlobal(globalPos); for (auto it = enterList.crbegin(), end = enterList.crend(); it != end; ++it) { auto *w = *it; - if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { + if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, nullptr)) { const QPointF localPos = w->mapFromGlobal(globalPos); QEnterEvent enterEvent(localPos, windowPos, globalPosF); QCoreApplication::sendEvent(w, &enterEvent); @@ -2287,7 +2287,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con const bool enterOnAlien = (enter && (isAlien(enter) || enter->testAttribute(Qt::WA_DontShowOnScreen))); // Whenever we leave an alien widget on X11/QPA, we need to reset its nativeParentWidget()'s cursor. // This is not required on Windows as the cursor is reset on every single mouse move. - QWidget *parentOfLeavingCursor = 0; + QWidget *parentOfLeavingCursor = nullptr; for (int i = 0; i < leaveList.size(); ++i) { auto *w = leaveList.at(i); if (!isAlien(w)) @@ -2353,7 +2353,7 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget) bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const { - QWindow *unused = 0; + QWindow *unused = nullptr; if (Q_UNLIKELY(!window)) { qWarning().nospace() << "window == 0 passed."; return false; @@ -2362,13 +2362,13 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin blockingWindow = &unused; if (modalWindowList.isEmpty()) { - *blockingWindow = 0; + *blockingWindow = nullptr; return false; } QWidget *popupWidget = QApplication::activePopupWidget(); - QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0; + QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : nullptr; if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) { - *blockingWindow = 0; + *blockingWindow = nullptr; return false; } @@ -2378,7 +2378,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin // 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; } @@ -2389,7 +2389,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin // modalWindow's widget, this normally happens when waiting for a // native dialog. use WindowModal if we are the child of a group // leader; otherwise use ApplicationModal. - QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0; + QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : nullptr; while (m && !m->testAttribute(Qt::WA_GroupLeader)) { m = m->parentWidget(); if (m) @@ -2404,13 +2404,13 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin case Qt::ApplicationModal: { QWidgetWindow *widgetWindow = qobject_cast(window); - QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : 0; + QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : nullptr; while (groupLeaderForWidget && !groupLeaderForWidget->testAttribute(Qt::WA_GroupLeader)) groupLeaderForWidget = groupLeaderForWidget->parentWidget(); if (groupLeaderForWidget) { // if \a widget has WA_GroupLeader, it can only be blocked by ApplicationModal children - QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0; + QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : nullptr; while (m && m != groupLeaderForWidget && !m->testAttribute(Qt::WA_GroupLeader)) m = m->parentWidget(); if (m == groupLeaderForWidget) { @@ -2450,7 +2450,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin break; } } - *blockingWindow = 0; + *blockingWindow = nullptr; return false; } @@ -2474,7 +2474,7 @@ bool QApplicationPrivate::tryModalHelper(QWidget *widget, QWidget **rettop) bool qt_try_modal(QWidget *widget, QEvent::Type type) { - QWidget * top = 0; + QWidget * top = nullptr; if (QApplicationPrivate::tryModalHelper(widget, &top)) return true; @@ -2499,7 +2499,7 @@ bool qt_try_modal(QWidget *widget, QEvent::Type type) break; } - if (block_event && top && top->parentWidget() == 0) + if (block_event && top && top->parentWidget() == nullptr) top->raise(); return !block_event; @@ -2523,11 +2523,11 @@ QWidget *QApplicationPrivate::pickMouseReceiver(QWidget *candidate, const QPoint QWidget *mouseGrabber = QWidget::mouseGrabber(); if (((type == QEvent::MouseMove && buttons) || (type == QEvent::MouseButtonRelease)) && !buttonDown && !mouseGrabber) { - return 0; + return nullptr; } if (alienWidget && alienWidget->internalWinId()) - alienWidget = 0; + alienWidget = nullptr; QWidget *receiver = candidate; @@ -2560,7 +2560,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, Q_ASSERT(buttonDown); if (alienWidget && !isAlien(alienWidget)) - alienWidget = 0; + alienWidget = nullptr; QPointer receiverGuard = receiver; QPointer nativeGuard = nativeWidget; @@ -2575,7 +2575,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, // leaveAfterRelease has not been updated. // This happens e.g. when modal dialog or popup is shown as a response to button click. if (leaveAfterRelease && !*buttonDown && !event->buttons()) - leaveAfterRelease = 0; + leaveAfterRelease = nullptr; if (*buttonDown) { if (!graphicsWidget) { @@ -2584,7 +2584,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, if ((alienWidget || !receiver->internalWinId()) && !leaveAfterRelease && !QWidget::mouseGrabber()) leaveAfterRelease = *buttonDown; if (event->type() == QEvent::MouseButtonRelease && !event->buttons()) - *buttonDown = 0; + *buttonDown = nullptr; } } else if (lastMouseReceiver && widgetUnderMouse) { // Dispatch enter/leave if we move: @@ -2612,7 +2612,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, // We need this quard in case someone opens a modal dialog / popup. If that's the case // leaveAfterRelease is set to null, but we shall not update lastMouseReceiver. - const bool wasLeaveAfterRelease = leaveAfterRelease != 0; + const bool wasLeaveAfterRelease = leaveAfterRelease != nullptr; bool result = true; // This code is used for sending the synthetic enter/leave events for cases where it is needed // due to other events causing the widget under the mouse to change. However in those cases @@ -2630,18 +2630,18 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, // Dispatch enter/leave if: // 1) the mouse grabber is an alien widget // 2) the button is released on an alien widget - QWidget *enter = 0; + QWidget *enter = nullptr; if (nativeGuard) enter = alienGuard ? alienWidget : nativeWidget; else // The receiver is typically deleted on mouse release with drag'n'drop. enter = QApplication::widgetAt(event->globalPos()); dispatchEnterLeave(enter, leaveAfterRelease, event->screenPos()); - leaveAfterRelease = 0; + leaveAfterRelease = nullptr; lastMouseReceiver = enter; } else if (!wasLeaveAfterRelease) { if (activePopupWidget) { if (!QWidget::mouseGrabber()) - lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : 0); + lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : nullptr); } else { lastMouseReceiver = receiverGuard ? receiver : QApplication::widgetAt(event->globalPos()); } @@ -2696,7 +2696,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) return; // Mouse cursor not inside the widget or any of its children. if (widget->data->in_destructor && qt_button_down == widget) - qt_button_down = 0; + qt_button_down = nullptr; // A mouse move is not actually sent, but we utilize the sendMouseEvent() call to send the // enter/leave events as appropriate @@ -3048,9 +3048,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e) key->accept(); else key->ignore(); - QWidget *w = isWidget ? static_cast(receiver) : 0; + QWidget *w = isWidget ? static_cast(receiver) : nullptr; #if QT_CONFIG(graphicsview) - QGraphicsWidget *gw = isGraphicsWidget ? static_cast(receiver) : 0; + QGraphicsWidget *gw = isGraphicsWidget ? static_cast(receiver) : nullptr; #endif res = d->notify_helper(receiver, e); @@ -3112,7 +3112,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) d->toolTipPos = relpos; d->toolTipGlobalPos = mouse->globalPos(); QStyle *s = d->toolTipWidget->style(); - int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, 0, d->toolTipWidget, 0); + int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, nullptr, d->toolTipWidget, nullptr); d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive() ? 20 : wakeDelay, this); } } @@ -3442,7 +3442,7 @@ QT_WARNING_POP && !isProxyWidget #endif ) - QDragManager::self()->setCurrentTarget(0, e->type() == QEvent::Drop); + QDragManager::self()->setCurrentTarget(nullptr, e->type() == QEvent::Drop); } break; #endif @@ -3473,7 +3473,7 @@ QT_WARNING_POP eventAccepted = touchEvent->isAccepted(); if (p.isNull()) { // widget was deleted - widget = 0; + widget = nullptr; } else { widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted); } @@ -3698,7 +3698,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) bool QApplicationPrivate::inPopupMode() { - return QApplicationPrivate::popupWidgets != 0; + return QApplicationPrivate::popupWidgets != nullptr; } static void ungrabKeyboardForPopup(QWidget *popup) @@ -3742,13 +3742,13 @@ void QApplicationPrivate::closePopup(QWidget *popup) popupWidgets->removeAll(popup); if (popup == qt_popup_down) { - qt_button_down = 0; - qt_popup_down = 0; + qt_button_down = nullptr; + qt_popup_down = nullptr; } if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup delete QApplicationPrivate::popupWidgets; - QApplicationPrivate::popupWidgets = 0; + QApplicationPrivate::popupWidgets = nullptr; if (popupGrabOk) { popupGrabOk = false; @@ -4116,7 +4116,7 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven { const bool setFocusOnRelease = QGuiApplication::styleHints()->setFocusOnTouchRelease(); Qt::FocusPolicy focusPolicy = Qt::ClickFocus; - static QPointer focusedWidgetOnTouchBegin = 0; + static QPointer focusedWidgetOnTouchBegin = nullptr; switch (event->type()) { case QEvent::MouseButtonPress: @@ -4223,7 +4223,7 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, { const QPointF screenPos = touchPoint.screenPos(); int closestTouchPointId = -1; - QObject *closestTarget = 0; + QObject *closestTarget = nullptr; qreal closestDistance = qreal(0.); QHash::const_iterator it = activeTouchPoints.constBegin(), ite = activeTouchPoints.constEnd(); @@ -4309,7 +4309,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, if (!target) continue; } - Q_ASSERT(target.data() != 0); + Q_ASSERT(target.data() != nullptr); QWidget *targetWidget = static_cast(target.data()); @@ -4335,7 +4335,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, const QHash::ConstIterator end = widgetsNeedingEvents.constEnd(); for (; it != end; ++it) { const QPointer widget = it.key(); - if (!QApplicationPrivate::tryModalHelper(widget, 0)) + if (!QApplicationPrivate::tryModalHelper(widget, nullptr)) continue; QEvent::Type eventType; @@ -4462,7 +4462,7 @@ QGestureManager* QGestureManager::instance(InstanceCreation ic) { QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); if (!qAppPriv) - return 0; + return nullptr; if (!qAppPriv->gestureManager && ic == ForceCreation) qAppPriv->gestureManager = new QGestureManager(qApp); return qAppPriv->gestureManager; diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp index 78d37f381e..7b09adfbf0 100644 --- a/src/widgets/kernel/qboxlayout.cpp +++ b/src/widgets/kernel/qboxlayout.cpp @@ -278,7 +278,7 @@ void QBoxLayoutPrivate::setupGeom() int fixedSpacing = q->spacing(); int previousNonEmptyIndex = -1; - QStyle *style = 0; + QStyle *style = nullptr; if (fixedSpacing < 0) { if (QWidget *parentWidget = q->parentWidget()) style = parentWidget->style(); @@ -318,7 +318,7 @@ void QBoxLayoutPrivate::setupGeom() if (style) { spacing = style->combinedLayoutSpacing(actual1, actual2, horz(dir) ? Qt::Horizontal : Qt::Vertical, - 0, q->parentWidget()); + nullptr, q->parentWidget()); if (spacing < 0) spacing = 0; } @@ -433,10 +433,10 @@ QLayoutItem* QBoxLayoutPrivate::replaceAt(int index, QLayoutItem *item) { Q_Q(QBoxLayout); if (!item) - return 0; + return nullptr; QBoxLayoutItem *b = list.value(index); if (!b) - return 0; + return nullptr; QLayoutItem *r = b->item; b->item = item; @@ -551,7 +551,7 @@ QLayoutItem* QBoxLayoutPrivate::replaceAt(int index, QLayoutItem *item) \sa direction() */ QBoxLayout::QBoxLayout(Direction dir, QWidget *parent) - : QLayout(*new QBoxLayoutPrivate, 0, parent) + : QLayout(*new QBoxLayoutPrivate, nullptr, parent) { Q_D(QBoxLayout); d->dir = dir; @@ -684,7 +684,7 @@ int QBoxLayout::minimumHeightForWidth(int w) const Q_D(const QBoxLayout); (void) heightForWidth(w); int top, bottom; - d->effectiveMargins(0, &top, 0, &bottom); + d->effectiveMargins(nullptr, &top, nullptr, &bottom); return d->hasHfw ? (d->hfwMinHeight + top + bottom) : -1; } @@ -713,7 +713,7 @@ int QBoxLayout::count() const QLayoutItem *QBoxLayout::itemAt(int index) const { Q_D(const QBoxLayout); - return index >= 0 && index < d->list.count() ? d->list.at(index)->item : 0; + return index >= 0 && index < d->list.count() ? d->list.at(index)->item : nullptr; } /*! @@ -723,16 +723,16 @@ QLayoutItem *QBoxLayout::takeAt(int index) { Q_D(QBoxLayout); if (index < 0 || index >= d->list.count()) - return 0; + return nullptr; QBoxLayoutItem *b = d->list.takeAt(index); QLayoutItem *item = b->item; - b->item = 0; + b->item = nullptr; delete b; if (QLayout *l = item->layout()) { // sanity check in case the user passed something weird to QObject::setParent() if (l->parent() == this) - l->setParent(0); + l->setParent(nullptr); } invalidate(); diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 9e90adec46..9f98af86e3 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -205,7 +205,7 @@ QT_WARNING_POP } QDesktopWidget::QDesktopWidget() - : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop) + : QWidget(*new QDesktopWidgetPrivate, nullptr, Qt::Desktop) { Q_D(QDesktopWidget); setObjectName(QLatin1String("desktop")); diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index c2838083f3..4ffa226d7f 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -295,11 +295,11 @@ void QFormLayoutPrivate::updateSizes() bool expandH = false; bool expandV = false; - QFormLayoutItem *prevLbl = 0; - QFormLayoutItem *prevFld = 0; + QFormLayoutItem *prevLbl = nullptr; + QFormLayoutItem *prevFld = nullptr; QWidget *parent = q->parentWidget(); - QStyle *style = parent ? parent->style() : 0; + QStyle *style = parent ? parent->style() : nullptr; int userVSpacing = q->verticalSpacing(); int userHSpacing = wrapAllRows ? 0 : q->horizontalSpacing(); @@ -364,9 +364,9 @@ void QFormLayoutPrivate::updateSizes() QSizePolicy::ControlTypes fldtoptypes = QSizePolicy::ControlTypes(fldtop ? fldtop->controlTypes() : QSizePolicy::DefaultType); if (label && lbltop) - label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); + label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent); if (field && fldtop) - field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); + field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent); } else { // Side by side.. we have to also consider the spacings to empty cells, which can strangely be more than // non empty cells.. @@ -380,21 +380,21 @@ void QFormLayoutPrivate::updateSizes() // To be compatible to QGridLayout, we have to compare solitary labels & fields with both predecessors if (label) { if (!field) { - int lblspacing = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); - int fldspacing = style->combinedLayoutSpacing(fldtoptypes, lbltypes, Qt::Vertical, 0, parent); + int lblspacing = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent); + int fldspacing = style->combinedLayoutSpacing(fldtoptypes, lbltypes, Qt::Vertical, nullptr, parent); label->vSpace = qMax(lblspacing, fldspacing); } else - label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); + label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent); } if (field) { // check spacing against both the previous label and field if (!label) { - int lblspacing = style->combinedLayoutSpacing(lbltoptypes, fldtypes, Qt::Vertical, 0, parent); - int fldspacing = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); + int lblspacing = style->combinedLayoutSpacing(lbltoptypes, fldtypes, Qt::Vertical, nullptr, parent); + int fldspacing = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent); field->vSpace = qMax(lblspacing, fldspacing); } else - field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); + field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent); } } } @@ -403,7 +403,7 @@ void QFormLayoutPrivate::updateSizes() // hard-coded the left and right control types so that all the rows have the same // inter-column spacing (otherwise the right column isn't always left aligned) if (userHSpacing < 0 && !wrapAllRows && (label || !field->fullRow) && field) - field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, 0, parent); + field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, nullptr, parent); } // Now update our min/sizehint widths @@ -594,13 +594,13 @@ static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing QSizePolicy::ControlTypes(item1 ? item1->controlTypes() : QSizePolicy::DefaultType); int spacing2 = 0; - spacing = style->combinedLayoutSpacing(itemtypes, prevItem1->controlTypes(), Qt::Vertical, 0, parent); + spacing = style->combinedLayoutSpacing(itemtypes, prevItem1->controlTypes(), Qt::Vertical, nullptr, parent); // At most of one of item2 and prevItem2 will be nonnull if (item2) - spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, 0, parent); + spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, nullptr, parent); else if (prevItem2) - spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, 0, parent); + spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, nullptr, parent); spacing = qMax(spacing, spacing2); } @@ -648,7 +648,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) vLayouts.clear(); vLayouts.resize((2 * rr) + 2); // a max, some may be unused - QStyle *style = 0; + QStyle *style = nullptr; int userVSpacing = q->verticalSpacing(); @@ -676,8 +676,8 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) maxLabelWidth = width; } - QFormLayoutItem *prevItem1 = 0; - QFormLayoutItem *prevItem2 = 0; + QFormLayoutItem *prevItem1 = nullptr; + QFormLayoutItem *prevItem2 = nullptr; bool prevRowSplit = false; for (int i = 0; i < rr; ++i) { @@ -711,13 +711,13 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) initLayoutStruct(vLayouts[vidx], label); if (vidx > 1) - vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, 0, prevItem1, prevItem2); + vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, nullptr, prevItem1, prevItem2); label->vLayoutIndex = vidx; label->sideBySide = false; prevItem1 = label; - prevItem2 = 0; + prevItem2 = nullptr; if (vLayouts[vidx].stretch > 0) addTopBottomStretch = false; @@ -729,13 +729,13 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) initLayoutStruct(vLayouts[vidx], field); if (vidx > 1) - vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, 0, prevItem1, prevItem2); + vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, nullptr, prevItem1, prevItem2); field->vLayoutIndex = vidx; field->sideBySide = false; prevItem1 = field; - prevItem2 = 0; + prevItem2 = nullptr; if (vLayouts[vidx].stretch > 0) addTopBottomStretch = false; @@ -758,7 +758,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) if (label->expandingDirections() & Qt::Vertical) expanding = true; - label->sideBySide = (field != 0); + label->sideBySide = (field != nullptr); label->vLayoutIndex = vidx; stretch1 = label->vStretch(); } @@ -790,7 +790,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) prevItem2 = field; } else { prevItem1 = field; - prevItem2 = 0; + prevItem2 = nullptr; } prevRowSplit = false; @@ -991,12 +991,12 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) { Q_Q(QFormLayout); if (!newitem) - return 0; + return nullptr; const int storageIndex = storageIndexFromLayoutItem(m_matrix, m_things.value(index)); if (Q_UNLIKELY(storageIndex == -1)) { // ### Qt6 - fix warning too when this class becomes public qWarning("QFormLayoutPrivate::replaceAt: Invalid index %d", index); - return 0; + return nullptr; } int row, col; @@ -1192,7 +1192,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) \sa QWidget::setLayout() */ QFormLayout::QFormLayout(QWidget *parent) - : QLayout(*new QFormLayoutPrivate, 0, parent) + : QLayout(*new QFormLayoutPrivate, nullptr, parent) { } @@ -1328,7 +1328,7 @@ void QFormLayout::insertRow(int row, const QString &labelText, QWidget *field) if (field && !d->checkWidget(field)) return; - QLabel *label = 0; + QLabel *label = nullptr; if (!labelText.isEmpty()) { label = new QLabel(labelText); #ifndef QT_NO_SHORTCUT @@ -1350,7 +1350,7 @@ void QFormLayout::insertRow(int row, const QString &labelText, QLayout *field) if (field && !d->checkLayout(field)) return; - insertRow(row, labelText.isEmpty() ? 0 : new QLabel(labelText), field); + insertRow(row, labelText.isEmpty() ? nullptr : new QLabel(labelText), field); } /*! @@ -1653,7 +1653,7 @@ QLayoutItem *QFormLayout::itemAt(int index) const Q_D(const QFormLayout); if (QFormLayoutItem *formItem = d->m_things.value(index)) return formItem->item; - return 0; + return nullptr; } /*! @@ -1666,7 +1666,7 @@ QLayoutItem *QFormLayout::takeAt(int index) const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(index)); if (Q_UNLIKELY(storageIndex == -1)) { qWarning("QFormLayout::takeAt: Invalid index %d", index); - return 0; + return nullptr; } int row, col; @@ -1831,7 +1831,7 @@ QLayoutItem *QFormLayout::itemAt(int row, ItemRole role) const { Q_D(const QFormLayout); if (uint(row) >= uint(d->m_matrix.rowCount())) - return 0; + return nullptr; switch (role) { case SpanningRole: if (QFormLayoutItem *item = d->m_matrix(row, 1)) @@ -1844,7 +1844,7 @@ QLayoutItem *QFormLayout::itemAt(int row, ItemRole role) const return item->item; break; } - return 0; + return nullptr; } /*! @@ -1928,7 +1928,7 @@ QWidget *QFormLayout::labelForField(QWidget *field) const if (QFormLayoutItem *label = d->m_matrix(row, LabelRole)) return label->widget(); } - return 0; + return nullptr; } /*! @@ -1947,7 +1947,7 @@ QWidget *QFormLayout::labelForField(QLayout *field) const if (QFormLayoutItem *label = d->m_matrix(row, LabelRole)) return label->widget(); } - return 0; + return nullptr; } /*! diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp index fc715687c6..84dbed7043 100644 --- a/src/widgets/kernel/qgesture.cpp +++ b/src/widgets/kernel/qgesture.cpp @@ -879,7 +879,7 @@ int QTapAndHoldGesturePrivate::Timeout = 700; // in ms Creates new QGestureEvent containing a list of \a gestures. */ QGestureEvent::QGestureEvent(const QList &gestures) - : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(0) + : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(nullptr) { } @@ -907,7 +907,7 @@ QGesture *QGestureEvent::gesture(Qt::GestureType type) const for (int i = 0; i < m_gestures.size(); ++i) if (m_gestures.at(i)->gestureType() == type) return m_gestures.at(i); - return 0; + return nullptr; } /*! diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index d0c6b882b5..5604391059 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -188,7 +188,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni // from the destructor. if (object->isWidgetType()) { if (static_cast(object)->d_func()->data.in_destructor) - return 0; + return nullptr; } else if (QGesture *g = qobject_cast(object)) { return g; #if QT_CONFIG(graphicsview) @@ -196,7 +196,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni Q_ASSERT(qobject_cast(object)); QGraphicsObject *graphicsObject = static_cast(object); if (graphicsObject->QGraphicsItem::d_func()->inDestructor) - return 0; + return nullptr; #endif } @@ -210,7 +210,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni Q_ASSERT(recognizer); QGesture *state = recognizer->create(object); if (!state) - return 0; + return nullptr; state->setParent(this); if (state->gestureType() == Qt::CustomGesture) { // if the recognizer didn't fill in the gesture type, then this @@ -454,13 +454,13 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) // sort them per target widget by cherry picking from almostCanceledGestures and delivering QSet almostCanceledGestures = cancelledGestures; while (!almostCanceledGestures.isEmpty()) { - QWidget *target = 0; + QWidget *target = nullptr; QSet gestures; iter = almostCanceledGestures.begin(); // sort per target widget while (iter != almostCanceledGestures.end()) { QWidget *widget = m_gestureTargets.value(*iter); - if (target == 0) + if (target == nullptr) target = widget; if (target == widget) { gestures << *iter; @@ -508,7 +508,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) } } // find all gesture contexts for the widget tree - w = w->isWindow() ? 0 : w->parentWidget(); + w = w->isWindow() ? nullptr : w->parentWidget(); while (w) { for (ContextIterator it = w->d_func()->gestureContext.constBegin(), @@ -587,7 +587,7 @@ void QGestureManager::getGestureTargets(const QSet &gestures, // sort gestures by types foreach (QGesture *gesture, gestures) { - QWidget *receiver = m_gestureTargets.value(gesture, 0); + QWidget *receiver = m_gestureTargets.value(gesture, nullptr); Q_ASSERT(receiver); if (receiver) gestureByTypes[gesture->gestureType()].insert(receiver, gesture); @@ -611,7 +611,7 @@ void QGestureManager::getGestureTargets(const QSet &gestures, } } if (w->isWindow()) { - w = 0; + w = nullptr; break; } w = w->parentWidget(); @@ -637,7 +637,7 @@ void QGestureManager::deliverEvents(const QSet &gestures, for (QSet::const_iterator it = gestures.begin(), e = gestures.end(); it != e; ++it) { QGesture *gesture = *it; - QWidget *target = m_gestureTargets.value(gesture, 0); + QWidget *target = m_gestureTargets.value(gesture, nullptr); if (!target) { // the gesture has just started and doesn't have a target yet. Q_ASSERT(gesture->state() == Qt::GestureStarted); diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 4f2b505e32..b4ac263c2b 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -84,7 +84,7 @@ public: Qt::Alignment alignment() const { return item_->alignment(); } QLayoutItem *item() { return item_; } void setItem(QLayoutItem *newitem) { item_ = newitem; } - QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = 0; return i; } + QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = nullptr; return i; } int hStretch() { return item_->widget() ? item_->widget()->sizePolicy().horizontalStretch() : 0; } @@ -152,7 +152,7 @@ public: if (index < things.count()) return things.at(index)->item(); else - return 0; + return nullptr; } inline QLayoutItem *takeAt(int index) { Q_Q(QGridLayout); @@ -162,19 +162,19 @@ public: if (QLayout *l = item->layout()) { // sanity check in case the user passed something weird to QObject::setParent() if (l->parent() == q) - l->setParent(0); + l->setParent(nullptr); } delete b; return item; } } - return 0; + return nullptr; } QLayoutItem* replaceAt(int index, QLayoutItem *newitem) override { if (!newitem) - return 0; - QLayoutItem *item = 0; + return nullptr; + QLayoutItem *item = nullptr; QGridBox *b = things.value(index); if (b) { item = b->takeItem(); @@ -342,7 +342,7 @@ QGridLayoutPrivate::QGridLayoutPrivate() setDirty(); rr = cc = 0; nextR = nextC = 0; - hfwData = 0; + hfwData = nullptr; hReversed = false; vReversed = false; horizontalSpacing = -1; @@ -429,7 +429,7 @@ int QGridLayoutPrivate::minimumHeightForWidth(int w, int hSpacing, int vSpacing) if (!has_hfw) return -1; int top, bottom; - effectiveMargins(0, &top, 0, &bottom); + effectiveMargins(nullptr, &top, nullptr, &bottom); return hfw_minheight + top + bottom; } @@ -521,7 +521,7 @@ void QGridLayoutPrivate::setSize(int r, int c) if (hfwData && (int)hfwData->size() < r) { delete hfwData; - hfwData = 0; + hfwData = nullptr; hfw_width = -1; } rr = r; @@ -710,14 +710,14 @@ void QGridLayoutPrivate::setupSpacings(QVector &chain, qSwap(numRows, numColumns); } - QStyle *style = 0; + QStyle *style = nullptr; if (fixedSpacing < 0) { if (QWidget *parentWidget = q->parentWidget()) style = parentWidget->style(); } for (int c = 0; c < numColumns; ++c) { - QGridBox *previousBox = 0; + QGridBox *previousBox = nullptr; int previousRow = -1; // previous *non-empty* row for (int r = 0; r < numRows; ++r) { @@ -741,7 +741,7 @@ void QGridLayoutPrivate::setupSpacings(QVector &chain, if (style) spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2, - orientation, 0, q->parentWidget()); + orientation, nullptr, q->parentWidget()); } else { if (orientation == Qt::Vertical) { QGridBox *sibling = vReversed ? previousBox : box; @@ -1075,7 +1075,7 @@ QRect QGridLayoutPrivate::cellRect(int row, int col) const new items are inserted. */ QGridLayout::QGridLayout(QWidget *parent) - : QLayout(*new QGridLayoutPrivate, 0, parent) + : QLayout(*new QGridLayoutPrivate, nullptr, parent) { Q_D(QGridLayout); d->expand(1, 1); @@ -1089,7 +1089,7 @@ QGridLayout::QGridLayout(QWidget *parent) will not be performed before this is inserted into another layout. */ QGridLayout::QGridLayout() - : QLayout(*new QGridLayoutPrivate, 0, 0) + : QLayout(*new QGridLayoutPrivate, nullptr, nullptr) { Q_D(QGridLayout); d->expand(1, 1); diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index f0f4fc5505..d4ff9083f1 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -130,7 +130,7 @@ QLayout::QLayout(QWidget *parent) management will work. */ QLayout::QLayout() - : QObject(*new QLayoutPrivate, 0) + : QObject(*new QLayoutPrivate, nullptr) { } @@ -149,14 +149,14 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w) " already has a layout", qUtf16Printable(QObject::objectName()), w->metaObject()->className(), qUtf16Printable(w->objectName())); - setParent(0); + setParent(nullptr); } else { d->topLevel = true; w->d_func()->layout = this; QT_TRY { invalidate(); } QT_CATCH(...) { - w->d_func()->layout = 0; + w->d_func()->layout = nullptr; QT_RETHROW; } } @@ -166,7 +166,7 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w) QLayoutPrivate::QLayoutPrivate() : QObjectPrivate(), insideSpacing(-1), userLeftMargin(-1), userTopMargin(-1), userRightMargin(-1), userBottomMargin(-1), topLevel(false), enabled(true), activated(true), autoNewChild(false), - constraint(QLayout::SetDefaultConstraint), menubar(0) + constraint(QLayout::SetDefaultConstraint), menubar(nullptr) { } @@ -181,7 +181,7 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric } else if (!topLevel) { *result = 0; } else if (QWidget *pw = q->parentWidget()) { - *result = pw->style()->pixelMetric(pm, 0, pw); + *result = pw->style()->pixelMetric(pm, nullptr, pw); } else { *result = 0; } @@ -189,8 +189,8 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric // Static item factory functions that allow for hooking things in Designer -QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = 0; -QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = 0; +QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = nullptr; +QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = nullptr; QWidgetItem *QLayoutPrivate::createWidgetItem(const QLayout *layout, QWidget *widget) { @@ -624,7 +624,7 @@ void QLayout::widgetEvent(QEvent *e) if (c->child()->isWidgetType()) { #if QT_CONFIG(menubar) if (c->child() == d->menubar) - d->menubar = 0; + d->menubar = nullptr; #endif removeWidgetRecursively(this, c->child()); } @@ -764,7 +764,7 @@ QLayout::~QLayout() { Q_D(QLayout); if (d->topLevel && parent() && parent()->isWidgetType() && parentWidget()->layout() == this) - parentWidget()->d_func()->layout = 0; + parentWidget()->d_func()->layout = nullptr; else if (QLayout *parentLayout = qobject_cast(parent())) parentLayout->removeItem(this); } @@ -919,7 +919,7 @@ void QLayout::addChildWidget(QWidget *w) qWarning("QLayout::addChildWidget: %s \"%ls\" in wrong parent; moved to correct parent", w->metaObject()->className(), qUtf16Printable(w->objectName())); #endif - pw = 0; + pw = nullptr; } bool needShow = mw && mw->isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide)); if (!pw && mw) @@ -1153,12 +1153,12 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt { Q_D(QLayout); if (!from || !to) - return 0; + return nullptr; if (from == to) // Do not return a QLayoutItem for \a from, since ownership still return nullptr; // belongs to the layout (since nothing was changed) int index = -1; - QLayoutItem *item = 0; + QLayoutItem *item = nullptr; for (int u = 0; u < count(); ++u) { item = itemAt(u); if (!item) @@ -1176,7 +1176,7 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt } } if (index == -1) - return 0; + return nullptr; addChildWidget(to); QLayoutItem *newitem = new QWidgetItem(to); diff --git a/src/widgets/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp index 92b362e89d..83bbd69b55 100644 --- a/src/widgets/kernel/qlayoutengine.cpp +++ b/src/widgets/kernel/qlayoutengine.cpp @@ -440,7 +440,7 @@ Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm return -1; } else if (parent->isWidgetType()) { QWidget *pw = static_cast(parent); - return pw->style()->pixelMetric(pm, 0, pw); + return pw->style()->pixelMetric(pm, nullptr, pw); } else { return static_cast(parent)->spacing(); } diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index fc02afb014..af5750771d 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -778,7 +778,7 @@ QWidgetItemV2::QWidgetItemV2(QWidget *widget) q_cachedMaximumSize(Dirty, Dirty), q_firstCachedHfw(0), q_hfwCacheSize(0), - d(0) + d(nullptr) { QWidgetPrivate *wd = wid->d_func(); if (!wd->widgetItem) @@ -790,7 +790,7 @@ QWidgetItemV2::~QWidgetItemV2() if (wid) { auto *wd = static_cast(QObjectPrivate::get(wid)); if (wd->widgetItem == this) - wd->widgetItem = 0; + wd->widgetItem = nullptr; } } diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index bc5ca21b97..90622fd21e 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -555,16 +555,16 @@ class QOpenGLWidgetPrivate : public QWidgetPrivate Q_DECLARE_PUBLIC(QOpenGLWidget) public: QOpenGLWidgetPrivate() - : context(0), - fbo(0), - resolvedFbo(0), - surface(0), + : context(nullptr), + fbo(nullptr), + resolvedFbo(nullptr), + surface(nullptr), initialized(false), fakeHidden(false), inBackingStorePaint(false), hasBeenComposed(false), flushPending(false), - paintDevice(0), + paintDevice(nullptr), updateBehavior(QOpenGLWidget::NoPartialUpdate), requestedSamples(0), inPaintGL(false), @@ -704,11 +704,11 @@ void QOpenGLWidgetPrivate::reset() q->makeCurrent(); delete paintDevice; - paintDevice = 0; + paintDevice = nullptr; delete fbo; - fbo = 0; + fbo = nullptr; delete resolvedFbo; - resolvedFbo = 0; + resolvedFbo = nullptr; if (initialized) q->doneCurrent(); @@ -717,9 +717,9 @@ void QOpenGLWidgetPrivate::reset() // the context's aboutToBeDestroyed() may still call makeCurrent() // to perform some cleanup. delete context; - context = 0; + context = nullptr; delete surface; - surface = 0; + surface = nullptr; initialized = fakeHidden = inBackingStorePaint = false; } @@ -732,9 +732,9 @@ void QOpenGLWidgetPrivate::recreateFbo() context->makeCurrent(surface); delete fbo; - fbo = 0; + fbo = nullptr; delete resolvedFbo; - resolvedFbo = 0; + resolvedFbo = nullptr; int samples = requestedSamples; QOpenGLExtensions *extfuncs = static_cast(context->functions()); @@ -1421,7 +1421,7 @@ QPaintEngine *QOpenGLWidget::paintEngine() const return QWidget::paintEngine(); if (!d->initialized) - return 0; + return nullptr; return d->paintDevice->paintEngine(); } diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index 0412dc188d..f87fe96cc0 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -61,11 +61,11 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem) { Q_Q(QStackedLayout); if (idx < 0 || idx >= list.size() || !newitem) - return 0; + return nullptr; QWidget *wdg = newitem->widget(); if (Q_UNLIKELY(!wdg)) { qWarning("QStackedLayout::replaceAt: Only widgets can be added"); - return 0; + return nullptr; } QLayoutItem *orgitem = list.at(idx); list.replace(idx, newitem); @@ -154,7 +154,7 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem) \sa addWidget(), insertWidget() */ QStackedLayout::QStackedLayout() - : QLayout(*new QStackedLayoutPrivate, 0, 0) + : QLayout(*new QStackedLayoutPrivate, nullptr, nullptr) { } @@ -165,7 +165,7 @@ QStackedLayout::QStackedLayout() manage the geometry of its children. */ QStackedLayout::QStackedLayout(QWidget *parent) - : QLayout(*new QStackedLayoutPrivate, 0, parent) + : QLayout(*new QStackedLayoutPrivate, nullptr, parent) { } @@ -174,7 +174,7 @@ QStackedLayout::QStackedLayout(QWidget *parent) the given \a parentLayout. */ QStackedLayout::QStackedLayout(QLayout *parentLayout) - : QLayout(*new QStackedLayoutPrivate, parentLayout, 0) + : QLayout(*new QStackedLayoutPrivate, parentLayout, nullptr) { } @@ -264,7 +264,7 @@ QLayoutItem *QStackedLayout::takeAt(int index) { Q_D(QStackedLayout); if (index <0 || index >= d->list.size()) - return 0; + return nullptr; QLayoutItem *item = d->list.takeAt(index); if (index == d->index) { d->index = -1; @@ -307,7 +307,7 @@ void QStackedLayout::setCurrentIndex(int index) parent->setUpdatesEnabled(false); } - QPointer fw = parent ? parent->window()->focusWidget() : 0; + QPointer fw = parent ? parent->window()->focusWidget() : nullptr; const bool focusWasOnOldPage = fw && (prev && prev->isAncestorOf(fw)); if (prev) { diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 97a279d65d..b290713440 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -151,7 +151,7 @@ public slots: */ void styleSheetParentDestroyed() { setProperty("_q_stylesheet_parent", QVariant()); - styleSheetParent = 0; + styleSheetParent = nullptr; } private: @@ -163,11 +163,11 @@ private: QRect rect; }; -QTipLabel *QTipLabel::instance = 0; +QTipLabel *QTipLabel::instance = nullptr; QTipLabel::QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int msecDisplayTime) #ifndef QT_NO_STYLE_STYLESHEET - : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(0), widget(0) + : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(nullptr), widget(nullptr) #else : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0) #endif @@ -178,12 +178,12 @@ QTipLabel::QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int mse setBackgroundRole(QPalette::ToolTipBase); setPalette(QToolTip::palette()); ensurePolished(); - setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this)); + setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, this)); setFrameStyle(QFrame::NoFrame); setAlignment(Qt::AlignLeft); setIndent(1); qApp->installEventFilter(this); - setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0); + setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, nullptr, this) / 255.0); setMouseTracking(true); fadingOut = false; reuseTip(text, msecDisplayTime, pos); @@ -204,7 +204,7 @@ void QTipLabel::reuseTip(const QString &text, int msecDisplayTime, const QPoint if (styleSheetParent){ disconnect(styleSheetParent, SIGNAL(destroyed()), QTipLabel::instance, SLOT(styleSheetParentDestroyed())); - styleSheetParent = 0; + styleSheetParent = nullptr; } #endif @@ -278,7 +278,7 @@ void QTipLabel::mouseMoveEvent(QMouseEvent *e) QTipLabel::~QTipLabel() { - instance = 0; + instance = nullptr; } void QTipLabel::hideTip() @@ -547,7 +547,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w) */ bool QToolTip::isVisible() { - return (QTipLabel::instance != 0 && QTipLabel::instance->isVisible()); + return (QTipLabel::instance != nullptr && QTipLabel::instance->isVisible()); } /*! diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 228ca4d38a..8a632a395a 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -163,7 +163,7 @@ private: QPixmap background; }; -QWhatsThat *QWhatsThat::instance = 0; +QWhatsThat *QWhatsThat::instance = nullptr; // shadowWidth not const, for XP drop-shadow-fu turns it to 0 static int shadowWidth = 6; // also used as '5' and '6' and even '8' below @@ -193,7 +193,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor setCursor(Qt::ArrowCursor); #endif QRect r; - doc = 0; + doc = nullptr; ensurePolished(); // Ensures style sheet font before size calc if (Qt::mightBeRichText(text)) { doc = new QTextDocument(); @@ -229,7 +229,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor QWhatsThat::~QWhatsThat() { - instance = 0; + instance = nullptr; if (doc) delete doc; } @@ -383,7 +383,7 @@ void QWhatsThisPrivate::notifyToplevels(QEvent *e) QCoreApplication::sendEvent(w, e); } -QWhatsThisPrivate *QWhatsThisPrivate::instance = 0; +QWhatsThisPrivate *QWhatsThisPrivate::instance = nullptr; QWhatsThisPrivate::QWhatsThisPrivate() : leaveOnMouseRelease(false) @@ -423,7 +423,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate() QAccessibleEvent event(this, QAccessible::ContextHelpEnd); QAccessible::updateAccessibility(&event); #endif - instance = 0; + instance = nullptr; } bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e) @@ -497,7 +497,7 @@ class QWhatsThisAction: public QAction Q_OBJECT public: - explicit QWhatsThisAction(QObject* parent = 0); + explicit QWhatsThisAction(QObject* parent = nullptr); private slots: void actionTriggered(); @@ -553,7 +553,7 @@ void QWhatsThis::enterWhatsThisMode() */ bool QWhatsThis::inWhatsThisMode() { - return (QWhatsThisPrivate::instance != 0); + return (QWhatsThisPrivate::instance != nullptr); } /*! @@ -577,7 +577,7 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y) if (text.size() == 0) return; // make a fresh widget, and set it up - QWhatsThat *whatsThat = new QWhatsThat(text, 0, widget); + QWhatsThat *whatsThat = new QWhatsThat(text, nullptr, widget); // okay, now to find a suitable location int scr = (widget ? diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 9099805cf8..9080c530c7 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -132,16 +132,16 @@ extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version) - , focus_next(0) - , focus_prev(0) - , focus_child(0) - , layout(0) - , needsFlush(0) - , redirectDev(0) - , widgetItem(0) - , extraPaintEngine(0) - , polished(0) - , graphicsEffect(0) + , focus_next(nullptr) + , focus_prev(nullptr) + , focus_child(nullptr) + , layout(nullptr) + , needsFlush(nullptr) + , redirectDev(nullptr) + , widgetItem(nullptr) + , extraPaintEngine(nullptr) + , polished(nullptr) + , graphicsEffect(nullptr) #if !defined(QT_NO_IM) , imHints(Qt::ImhNone) #endif @@ -159,7 +159,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , topLayoutItemMargin(0) , rightLayoutItemMargin(0) , bottomLayoutItemMargin(0) - , hd(0) + , hd(nullptr) , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred) , fg_role(QPalette::NoRole) , bg_role(QPalette::NoRole) @@ -214,7 +214,7 @@ QWidgetPrivate::QWidgetPrivate(int version) QWidgetPrivate::~QWidgetPrivate() { if (widgetItem) - widgetItem->wid = 0; + widgetItem->wid = nullptr; if (extra) deleteExtra(); @@ -819,8 +819,8 @@ void QWidget::setAutoFillBackground(bool enabled) */ -QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid -QWidgetSet *QWidgetPrivate::allWidgets = 0; // widgets with no wid +QWidgetMapper *QWidgetPrivate::mapper = nullptr; // widget with wid +QWidgetSet *QWidgetPrivate::allWidgets = nullptr; // widgets with no wid /***************************************************************************** @@ -890,7 +890,7 @@ struct QWidgetExceptionCleaner \sa windowFlags */ QWidget::QWidget(QWidget *parent, Qt::WindowFlags f) - : QObject(*new QWidgetPrivate, 0), QPaintDevice() + : QObject(*new QWidgetPrivate, nullptr), QPaintDevice() { QT_TRY { d_func()->init(parent, f); @@ -904,7 +904,7 @@ QWidget::QWidget(QWidget *parent, Qt::WindowFlags f) /*! \internal */ QWidget::QWidget(QWidgetPrivate &dd, QWidget* parent, Qt::WindowFlags f) - : QObject(dd, 0), QPaintDevice() + : QObject(dd, nullptr), QPaintDevice() { Q_D(QWidget); QT_TRY { @@ -996,7 +996,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) if (parentWidget && parentWidget->windowType() == Qt::Desktop) { const QDesktopScreenWidget *sw = qobject_cast(parentWidget); targetScreen = sw ? sw->screenNumber() : 0; - parentWidget = 0; + parentWidget = nullptr; } q->data = &data; @@ -1072,7 +1072,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) QCoreApplication::sendEvent(q, &e); QCoreApplication::postEvent(q, new QEvent(QEvent::PolishRequest)); - extraPaintEngine = 0; + extraPaintEngine = nullptr; } void QWidgetPrivate::createRecursively() @@ -1307,9 +1307,9 @@ void QWidgetPrivate::create() if (nativeParent->windowHandle()) { if (flags & Qt::Window) { win->setTransientParent(nativeParent->window()->windowHandle()); - win->setParent(0); + win->setParent(nullptr); } else { - win->setTransientParent(0); + win->setTransientParent(nullptr); win->setParent(nativeParent->windowHandle()); } } @@ -1442,7 +1442,7 @@ QWidget::~QWidget() // delete layout while we still are a valid widget delete d->layout; - d->layout = 0; + d->layout = nullptr; // Remove myself from focus list Q_ASSERT(d->focus_next->d_func()->focus_prev == this); @@ -1451,7 +1451,7 @@ QWidget::~QWidget() if (d->focus_next != this) { d->focus_next->d_func()->focus_prev = d->focus_prev; d->focus_prev->d_func()->focus_next = d->focus_next; - d->focus_next = d->focus_prev = 0; + d->focus_next = d->focus_prev = nullptr; } @@ -1493,7 +1493,7 @@ QWidget::~QWidget() } delete d->needsFlush; - d->needsFlush = 0; + d->needsFlush = nullptr; // The next 20 lines are duplicated from QObject, but required here // since QWidget deletes is children itself @@ -1520,7 +1520,7 @@ QWidget::~QWidget() if (QAbstractDeclarativeData::destroyed) QAbstractDeclarativeData::destroyed(d->declarativeData, this); } - d->declarativeData = 0; // don't activate again in ~QObject + d->declarativeData = nullptr; // don't activate again in ~QObject d->wasDeleted = false; } @@ -1564,7 +1564,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier // will have the same windowid (the root window id) as the // qt_desktopWidget. We should not add the second desktop widget // to the mapper. - bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop; + bool userDesktopWidget = qt_desktopWidget != nullptr && qt_desktopWidget != q && q->windowType() == Qt::Desktop; if (mapper && data.winid && !userDesktopWidget) { mapper->remove(data.winid); } @@ -1589,8 +1589,8 @@ void QWidgetPrivate::createTLExtra() if (!extra->topextra) { extra->topextra = qt_make_unique(); QTLWExtra* x = extra->topextra.get(); - x->backingStore = 0; - x->sharedPainter = 0; + x->backingStore = nullptr; + x->sharedPainter = nullptr; x->incw = x->inch = 0; x->basew = x->baseh = 0; x->frameStrut.setCoords(0, 0, 0, 0); @@ -1601,7 +1601,7 @@ void QWidgetPrivate::createTLExtra() x->sizeAdjusted = false; x->inTopLevelResize = false; x->embedded = 0; - x->window = 0; + x->window = nullptr; x->initialScreenIndex = -1; #ifdef QWIDGET_EXTRA_DEBUG @@ -1620,9 +1620,9 @@ void QWidgetPrivate::createExtra() { if (!extra) { // if not exists extra = qt_make_unique(); - extra->glContext = 0; + extra->glContext = nullptr; #if QT_CONFIG(graphicsview) - extra->proxyWidget = 0; + extra->proxyWidget = nullptr; #endif extra->minw = 0; extra->minh = 0; @@ -1681,7 +1681,7 @@ static void deleteBackingStore(QWidgetPrivate *d) QTLWExtra *topData = d->topData(); delete topData->backingStore; - topData->backingStore = 0; + topData->backingStore = nullptr; } void QWidgetPrivate::deleteTLSysExtra() @@ -1705,7 +1705,7 @@ void QWidgetPrivate::deleteTLSysExtra() extra->topextra->window->destroy(); } delete extra->topextra->window; - extra->topextra->window = 0; + extra->topextra->window = nullptr; } } @@ -1805,7 +1805,7 @@ void QWidgetPrivate::paintOnScreen(const QRegion &rgn) if (toBePainted.isEmpty()) return; // Nothing to repaint. - drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0); + drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, nullptr); if (Q_UNLIKELY(q->paintingActive())) qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent"); @@ -2302,10 +2302,10 @@ void QWidgetPrivate::deactivateWidgetCleanup() Q_Q(QWidget); // If this was the active application window, reset it if (QApplication::activeWindow() == q) - QApplication::setActiveWindow(0); + QApplication::setActiveWindow(nullptr); // If the is the active mouse press widget, reset it if (q == qt_button_down) - qt_button_down = 0; + qt_button_down = nullptr; } @@ -2563,7 +2563,7 @@ void QWidget::setStyleSheet(const QString& styleSheet) if (testAttribute(Qt::WA_SetStyle)) { d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true); } else { - d->setStyle_helper(new QStyleSheetStyle(0), true); + d->setStyle_helper(new QStyleSheetStyle(nullptr), true); } } @@ -2606,7 +2606,7 @@ QStyle *QWidget::style() const void QWidget::setStyle(QStyle *style) { Q_D(QWidget); - setAttribute(Qt::WA_SetStyle, style != 0); + setAttribute(Qt::WA_SetStyle, style != nullptr); d->createExtra(); #ifndef QT_NO_STYLE_STYLESHEET if (QStyleSheetStyle *styleSheetStyle = qt_styleSheet(style)) { @@ -2686,7 +2686,7 @@ void QWidgetPrivate::inheritStyle() QStyle *origStyle = proxy ? proxy->base : extraStyle; QWidget *parent = q->parentWidget(); - QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : 0; + QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : nullptr; // If we have stylesheet on app or parent has stylesheet style, we need // to be running a proxy if (!qApp->styleSheet().isEmpty() || qt_styleSheet(parentStyle)) { @@ -2709,7 +2709,7 @@ void QWidgetPrivate::inheritStyle() // In such a case we need to start following the application style (i.e revert // the propagation behavior of QStyleSheetStyle) if (!q->testAttribute(Qt::WA_SetStyle)) - origStyle = 0; + origStyle = nullptr; setStyle_helper(origStyle, true); #endif // QT_NO_STYLE_STYLESHEET @@ -3085,7 +3085,7 @@ bool QWidget::isEnabledTo(const QWidget *ancestor) const */ void QWidget::addAction(QAction *action) { - insertAction(0, action); + insertAction(nullptr, action); } /*! @@ -3100,7 +3100,7 @@ void QWidget::addActions(QList actions) #endif { for(int i = 0; i < actions.count(); i++) - insertAction(0, actions.at(i)); + insertAction(nullptr, actions.at(i)); } /*! @@ -3125,7 +3125,7 @@ void QWidget::insertAction(QAction *before, QAction *action) int pos = d->actions.indexOf(before); if (pos < 0) { - before = 0; + before = nullptr; pos = d->actions.size(); } d->actions.insert(pos, action); @@ -4606,7 +4606,7 @@ void QWidgetPrivate::updateFont(const QFont &font) Q_Q(QWidget); #ifndef QT_NO_STYLE_STYLESHEET const QStyleSheetStyle* cssStyle; - cssStyle = extra ? qt_styleSheet(extra->style) : 0; + cssStyle = extra ? qt_styleSheet(extra->style) : nullptr; const bool useStyleSheetPropagationInWidgetStyles = QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles); #endif @@ -4842,7 +4842,7 @@ void qt_qpa_set_cursor(QWidget *w, bool force) if (!w->testAttribute(Qt::WA_WState_Created)) return; - static QPointer lastUnderMouse = 0; + static QPointer lastUnderMouse = nullptr; if (force) { lastUnderMouse = w; } else if (lastUnderMouse) { @@ -5119,7 +5119,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect) if (d->graphicsEffect) { d->invalidateBackingStore(rect()); delete d->graphicsEffect; - d->graphicsEffect = 0; + d->graphicsEffect = nullptr; } if (effect) { @@ -5313,7 +5313,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP setSystemClip(sharedPainter->paintEngine(), 1, QRegion()); sharedPainter->restore(); } - sourced->context = 0; + sourced->context = nullptr; if (repaintManager) repaintManager->markNeedsFlush(q, rgn, offset); @@ -5431,7 +5431,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (!sharedPainter) paintEngine->d_func()->systemRect = QRect(); else - paintEngine->d_func()->currentClipDevice = 0; + paintEngine->d_func()->currentClipDevice = nullptr; setSystemClip(pdev->paintEngine(), 1, QRegion()); } @@ -5492,7 +5492,7 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, if (paintRegion.isEmpty()) return; - QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0; + QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : nullptr; // Use the target's shared painter if set (typically set when doing // "other->render(widget);" in the widget's paintEvent. @@ -5553,7 +5553,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis const QPoint &offset, DrawWidgetFlags flags , QPainter *sharedPainter, QWidgetRepaintManager *repaintManager) { - QWidget *w = 0; + QWidget *w = nullptr; QRect boundingRect; bool dirtyBoundingRect = true; const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren); @@ -5847,7 +5847,7 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg if (count%2) { // odd number of [*] -> replace last one int lastIndex = cap.lastIndexOf(placeHolder, index - 1); if (widget->isWindowModified() - && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget)) + && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, nullptr, widget)) cap.replace(lastIndex, 3, QWidget::tr("*")); else cap.remove(lastIndex, 3); @@ -6299,7 +6299,7 @@ void QWidget::setFocus(Qt::FocusReason reason) return; #if QT_CONFIG(graphicsview) - QWidget *previousProxyFocus = 0; + QWidget *previousProxyFocus = nullptr; if (const auto &topData = window()->d_func()->extra) { if (topData->proxyWidget && topData->proxyWidget->hasFocus()) { previousProxyFocus = topData->proxyWidget->widget()->focusWidget(); @@ -6439,12 +6439,12 @@ void QWidgetPrivate::updateFocusChild() if (q->isHidden()) { while (w && w->isHidden()) { w->d_func()->focus_child = q; - w = w->isWindow() ? 0 : w->parentWidget(); + w = w->isWindow() ? nullptr : w->parentWidget(); } } else { while (w) { w->d_func()->focus_child = q; - w = w->isWindow() ? 0 : w->parentWidget(); + w = w->isWindow() ? nullptr : w->parentWidget(); } } @@ -6490,7 +6490,7 @@ void QWidget::clearFocus() while (w) { // Just like setFocus(), we update (clear) the focus_child of our parents if (w->d_func()->focus_child == this) - w->d_func()->focus_child = 0; + w->d_func()->focus_child = nullptr; w = w->parentWidget(); } @@ -6511,7 +6511,7 @@ void QWidget::clearFocus() if (hasFocus()) { // Update proxy state - QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); + QApplicationPrivate::setFocusWidget(nullptr, Qt::OtherFocusReason); #ifndef QT_NO_ACCESSIBILITY QAccessibleEvent event(this, QAccessible::Focus); QAccessible::updateAccessibility(&event); @@ -6588,10 +6588,10 @@ bool QWidget::focusNextPrevChild(bool next) */ if (wrappingOccurred) { QWindow *window = windowHandle(); - if (window != 0) { + if (window != nullptr) { QWindowPrivate *winp = qt_window_private(window); - if (winp->platformWindow != 0) { + if (winp->platformWindow != nullptr) { QFocusEvent event(QEvent::FocusIn, reason); event.ignore(); winp->platformWindow->windowEvent(&event); @@ -6669,7 +6669,7 @@ bool QWidget::isActiveWindow() const } #endif - if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) { + if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, this)) { if(tlw->windowType() == Qt::Tool && !tlw->isModal() && (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow())) @@ -6825,9 +6825,9 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw) focus_child->clearFocus(); // separate the focus chain into new (children of myself) and old (the rest) - QWidget *firstOld = 0; + QWidget *firstOld = nullptr; //QWidget *firstNew = q; //invariant - QWidget *o = 0; // last in the old list + QWidget *o = nullptr; // last in the old list QWidget *n = q; // last in the new list bool prevWasNew = true; @@ -7835,7 +7835,7 @@ void QWidgetPrivate::show_helper() #endif if (QApplicationPrivate::hidden_focus_widget == q) { - QApplicationPrivate::hidden_focus_widget = 0; + QApplicationPrivate::hidden_focus_widget = nullptr; q->setFocus(Qt::OtherFocusReason); } @@ -7934,7 +7934,7 @@ void QWidgetPrivate::hide_helper() bool isEmbedded = false; #if QT_CONFIG(graphicsview) - isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0; + isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != nullptr; #else Q_UNUSED(isEmbedded); #endif @@ -8127,7 +8127,7 @@ void QWidgetPrivate::setVisible(bool visible) QCoreApplication::sendEvent(q, &showToParentEvent); } else { // hide if (QApplicationPrivate::hidden_focus_widget == q) - QApplicationPrivate::hidden_focus_widget = 0; + QApplicationPrivate::hidden_focus_widget = nullptr; // hw: The test on getOpaqueRegion() needs to be more intelligent // currently it doesn't work if the widget is hidden (the region will @@ -8820,7 +8820,7 @@ bool QWidget::event(QEvent *event) case Qt::ActionsContextMenu: if (d->actions.count()) { QMenu::exec(d->actions, static_cast(event)->globalPos(), - 0, this); + nullptr, this); break; } Q_FALLTHROUGH(); @@ -10012,9 +10012,9 @@ QLayout *QWidget::takeLayout() Q_D(QWidget); QLayout *l = layout(); if (!l) - return 0; - d->layout = 0; - l->setParent(0); + return nullptr; + d->layout = nullptr; + l->setParent(nullptr); return l; } @@ -10136,10 +10136,10 @@ QWidget *QWidget::childAt(const QPoint &p) const QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const { if (children.isEmpty()) - return 0; + return nullptr; if (!pointInsideRectAndMask(p)) - return 0; + return nullptr; return childAtRecursiveHelper(p, ignoreChildrenInDestructor); } @@ -10167,7 +10167,7 @@ QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChil // We have found our target; namely the child at position 'p'. return child; } - return 0; + return nullptr; } void QWidgetPrivate::updateGeometry_helper(bool forceUpdate) @@ -10380,7 +10380,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) if (f & Qt::Window) // Frame geometry likely changes, refresh. d->data.fstrut_dirty = true; - QWidget *desktopWidget = 0; + QWidget *desktopWidget = nullptr; if (parent && parent->windowType() == Qt::Desktop) desktopWidget = parent; bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget; @@ -10408,7 +10408,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) d->setParent_sys(parent, f); if (desktopWidget) - parent = 0; + parent = nullptr; #ifndef QT_NO_OPENGL if (d->textureChildSeen && parent) { @@ -10522,7 +10522,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) // programmer specified desktop widget const QDesktopScreenWidget *sw = qobject_cast(newparent); targetScreen = sw ? sw->screenNumber() : 0; - newparent = 0; + newparent = nullptr; } setWinId(0); @@ -10532,19 +10532,19 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (q->windowHandle()) { q->windowHandle()->setFlags(f); QWidget *parentWithWindow = - newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0; + newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : nullptr; if (parentWithWindow) { QWidget *topLevel = parentWithWindow->window(); if ((f & Qt::Window) && topLevel && topLevel->windowHandle()) { q->windowHandle()->setTransientParent(topLevel->windowHandle()); - q->windowHandle()->setParent(0); + q->windowHandle()->setParent(nullptr); } else { - q->windowHandle()->setTransientParent(0); + q->windowHandle()->setTransientParent(nullptr); q->windowHandle()->setParent(parentWithWindow->windowHandle()); } } else { - q->windowHandle()->setTransientParent(0); - q->windowHandle()->setParent(0); + q->windowHandle()->setTransientParent(nullptr); + q->windowHandle()->setParent(nullptr); } } } @@ -10575,7 +10575,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) continue; QWidgetWindow *childWW = qobject_cast(childWindow); - QWidget *childWidget = childWW ? childWW->widget() : 0; + QWidget *childWidget = childWW ? childWW->widget() : nullptr; if (!childWW || (childWidget && childWidget->testAttribute(Qt::WA_NativeWindow))) childWindow->setParent(newParentWindow); } @@ -11981,7 +11981,7 @@ QOpenGLContext *QWidgetPrivate::shareContext() const return 0; #else if (!extra || !extra->topextra || !extra->topextra->window) - return 0; + return nullptr; if (!extra->topextra->shareContext) { auto ctx = qt_make_unique(); @@ -12040,7 +12040,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const if (d->extra) { return d->extra->proxyWidget; } - return 0; + return nullptr; } #endif @@ -12101,7 +12101,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) qApp->d_func()->closePopup(this); if (this == QApplicationPrivate::active_window) - QApplication::setActiveWindow(0); + QApplication::setActiveWindow(nullptr); if (QWidget::mouseGrabber() == this) releaseMouse(); if (QWidget::keyboardGrabber() == this) @@ -12165,7 +12165,7 @@ QPaintEngine *QWidget::paintEngine() const const_cast(d_func())->noPaintOnScreen = 1; #endif - return 0; //##### @@@ + return nullptr; //##### @@@ } // Do not call QWindow::mapToGlobal() until QPlatformWindow is properly showing. @@ -12252,10 +12252,10 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const return t.transform.inverted().map(windowLocal); } -QWidget *qt_pressGrab = 0; -QWidget *qt_mouseGrb = 0; +QWidget *qt_pressGrab = nullptr; +QWidget *qt_mouseGrb = nullptr; static bool mouseGrabWithCursor = false; -static QWidget *keyboardGrb = 0; +static QWidget *keyboardGrb = nullptr; static inline QWindow *grabberWindow(const QWidget *w) { @@ -12267,7 +12267,7 @@ static inline QWindow *grabberWindow(const QWidget *w) } #ifndef QT_NO_CURSOR -static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = 0) +static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = nullptr) #else static void grabMouseForWidget(QWidget *widget) #endif @@ -12287,7 +12287,7 @@ static void grabMouseForWidget(QWidget *widget) } qt_mouseGrb = widget; - qt_pressGrab = 0; + qt_pressGrab = nullptr; } static void releaseMouseGrabOfWidget(QWidget *widget) @@ -12303,7 +12303,7 @@ static void releaseMouseGrabOfWidget(QWidget *widget) window->setMouseGrabEnabled(false); } } - qt_mouseGrb = 0; + qt_mouseGrb = nullptr; } /*! @@ -12432,7 +12432,7 @@ void QWidget::releaseKeyboard() if (keyboardGrb == this) { if (QWindow *window = grabberWindow(this)) window->setKeyboardGrabEnabled(false); - keyboardGrb = 0; + keyboardGrb = nullptr; } } @@ -12509,8 +12509,8 @@ void QWidget::activateWindow() */ int QWidget::metric(PaintDeviceMetric m) const { - QWindow *topLevelWindow = 0; - QScreen *screen = 0; + QWindow *topLevelWindow = nullptr; + QScreen *screen = nullptr; if (QWidget *topLevel = window()) { topLevelWindow = topLevel->windowHandle(); if (topLevelWindow) @@ -12596,14 +12596,14 @@ QPainter *QWidget::sharedPainter() const { // Someone sent a paint event directly to the widget if (!d_func()->redirectDev) - return 0; + return nullptr; QPainter *sp = d_func()->sharedPainter(); if (!sp || !sp->isActive()) - return 0; + return nullptr; if (sp->paintEngine()->paintDevice() != d_func()->redirectDev) - return 0; + return nullptr; return sp; } diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 62da3fabf4..6915782cb3 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -420,7 +420,7 @@ public: void setVisible(bool); void setEnabled_helper(bool); - static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0); + static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = nullptr); void updateFrameStrut(); QRect frameStrut() const; diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp index 6eebaca42c..9649e51b92 100644 --- a/src/widgets/kernel/qwidgetaction.cpp +++ b/src/widgets/kernel/qwidgetaction.cpp @@ -146,7 +146,7 @@ void QWidgetAction::setDefaultWidget(QWidget *widget) setVisible(!(widget->isHidden() && widget->testAttribute(Qt::WA_WState_ExplicitShowHide))); d->defaultWidget->hide(); - d->defaultWidget->setParent(0); + d->defaultWidget->setParent(nullptr); d->defaultWidgetInUse = false; if (!isEnabled()) d->defaultWidget->setEnabled(false); @@ -177,7 +177,7 @@ QWidget *QWidgetAction::requestWidget(QWidget *parent) QWidget *w = createWidget(parent); if (!w) { if (d->defaultWidgetInUse || !d->defaultWidget) - return 0; + return nullptr; d->defaultWidget->setParent(parent); d->defaultWidgetInUse = true; return d->defaultWidget; @@ -203,7 +203,7 @@ void QWidgetAction::releaseWidget(QWidget *widget) if (widget == d->defaultWidget) { d->defaultWidget->hide(); - d->defaultWidget->setParent(0); + d->defaultWidget->setParent(nullptr); d->defaultWidgetInUse = false; return; } @@ -251,7 +251,7 @@ bool QWidgetAction::eventFilter(QObject *obj, QEvent *event) QWidget *QWidgetAction::createWidget(QWidget *parent) { Q_UNUSED(parent) - return 0; + return nullptr; } /*! diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index c3211e275f..135a1527ac 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -695,7 +695,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) return qt_dummy_platformTextureList(); } - return 0; + return nullptr; } #else @@ -788,7 +788,7 @@ bool QWidgetRepaintManager::syncAllowed() QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); if (textureListWatcher && !textureListWatcher->isLocked()) { textureListWatcher->deleteLater(); - textureListWatcher = 0; + textureListWatcher = nullptr; } else if (!tlwExtra->widgetTextures.empty()) { bool skipSync = false; for (const auto &tl : tlwExtra->widgetTextures) { @@ -822,7 +822,7 @@ void QWidgetRepaintManager::paintAndFlush() if (hasStaticContents() && !store->size().isEmpty() ) { // Repaint existing dirty area and newly visible area. const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); - const QRegion staticRegion(staticContents(0, clipRect)); + const QRegion staticRegion(staticContents(nullptr, clipRect)); QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height()); newVisible -= staticRegion; dirty += newVisible; @@ -1008,13 +1008,13 @@ void QWidgetRepaintManager::paintAndFlush() QPoint offset; if (w != tlw) offset += w->mapTo(tlw, QPoint()); - wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, 0, this); + wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, nullptr, this); } // Paint the rest with composition. if (repaintAllWidgets || !dirtyCopy.isEmpty()) { QWidgetPrivate::DrawWidgetFlags flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive; - tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, 0, this); + tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, nullptr, this); } store->endPaint(); @@ -1108,7 +1108,7 @@ void QWidgetRepaintManager::flush() for (QWidget *w : qExchange(needsFlushWidgets, {})) { QWidgetPrivate *wd = w->d_func(); Q_ASSERT(wd->needsFlush); - QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : 0; + QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : nullptr; flush(w, *wd->needsFlush, widgetTexturesForNative); *wd->needsFlush = QRegion(); } @@ -1284,7 +1284,7 @@ QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &with wd->clipToEffectiveMask(visible); if (visible.isEmpty()) continue; - wd->subtractOpaqueSiblings(visible, 0, /*alsoNonOpaque=*/true); + wd->subtractOpaqueSiblings(visible, nullptr, /*alsoNonOpaque=*/true); visible.translate(offset); region += visible; @@ -1331,7 +1331,7 @@ void QWidgetPrivate::invalidateBackingStore_resizeHelper(const QPoint &oldPos, c if (!staticContents || graphicsEffect) { QRegion staticChildren; - QWidgetRepaintManager *bs = 0; + QWidgetRepaintManager *bs = nullptr; if (offset.isNull() && (bs = maybeRepaintManager())) staticChildren = bs->staticContents(q, oldWidgetRect); const bool hasStaticChildren = !staticChildren.isEmpty(); diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 02b4ea20a7..41600d2143 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -125,12 +125,12 @@ static const QVariant::Handler widgets_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/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 596343c52f..904067afda 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -57,10 +57,10 @@ QT_BEGIN_NAMESPACE Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets(); -Q_WIDGETS_EXPORT QWidget *qt_button_down = 0; // widget got last button-down +Q_WIDGETS_EXPORT QWidget *qt_button_down = nullptr; // widget got last button-down // popup control -QWidget *qt_popup_down = 0; // popup that contains the pressed widget +QWidget *qt_popup_down = nullptr; // popup that contains the pressed widget extern int openPopupCount; bool qt_replay_popup_mouse_event = false; extern bool qt_try_modal(QWidget *widget, QEvent::Type type); @@ -156,7 +156,7 @@ QOpenGLContext *QWidgetWindowPrivate::shareContext() const #endif // opengl QWidgetWindow::QWidgetWindow(QWidget *widget) - : QWindow(*new QWidgetWindowPrivate(), 0) + : QWindow(*new QWidgetWindowPrivate(), nullptr) , m_widget(widget) { updateObjectName(); @@ -179,7 +179,7 @@ QAccessibleInterface *QWidgetWindow::accessibleRoot() const { if (m_widget) return QAccessible::queryAccessibleInterface(m_widget); - return 0; + return nullptr; } #endif @@ -374,7 +374,7 @@ bool QWidgetWindow::event(QEvent *event) #endif // QT_NO_CONTEXTMENU case QEvent::WindowBlocked: - qt_button_down = 0; + qt_button_down = nullptr; break; case QEvent::UpdateRequest: @@ -393,7 +393,7 @@ bool QWidgetWindow::event(QEvent *event) return QWindow::event(event); } -QPointer qt_last_mouse_receiver = 0; +QPointer qt_last_mouse_receiver = nullptr; void QWidgetWindow::handleEnterLeaveEvent(QEvent *event) { @@ -406,7 +406,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event) return; #endif if (event->type() == QEvent::Leave) { - QWidget *enter = 0; + QWidget *enter = nullptr; // Check from window system event queue if the next queued enter targets a window // in the same window hierarchy (e.g. enter a child of this window). If so, // remove the enter event from queue and handle both in single dispatch. @@ -484,13 +484,13 @@ QWidget *QWidgetWindow::getFocusWidget(FocusWidgets fw) void QWidgetWindow::handleFocusInEvent(QFocusEvent *e) { - QWidget *focusWidget = 0; + QWidget *focusWidget = nullptr; if (e->reason() == Qt::BacktabFocusReason) focusWidget = getFocusWidget(LastFocusWidget); else if (e->reason() == Qt::TabFocusReason) focusWidget = getFocusWidget(FirstFocusWidget); - if (focusWidget != 0) + if (focusWidget != nullptr) focusWidget->setFocus(); } @@ -513,8 +513,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) QWidget *popupChild = activePopupWidget->childAt(mapped); if (activePopupWidget != qt_popup_down) { - qt_button_down = 0; - qt_popup_down = 0; + qt_button_down = nullptr; + qt_popup_down = nullptr; } switch (event->type()) { @@ -589,7 +589,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) && qt_replay_popup_mouse_event && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ReplayMousePressOutsidePopup).toBool()) { if (m_widget->windowType() != Qt::Popup) - qt_button_down = 0; + qt_button_down = nullptr; if (event->type() == QEvent::MouseButtonPress) { // the popup disappeared, replay the mouse press event QWidget *w = QApplication::widgetAt(event->globalPos()); @@ -636,8 +636,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) #endif if (releaseAfter) { - qt_button_down = 0; - qt_popup_down = 0; + qt_button_down = nullptr; + qt_popup_down = nullptr; } return; } @@ -1050,7 +1050,7 @@ bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long #if QT_CONFIG(tabletevent) void QWidgetWindow::handleTabletEvent(QTabletEvent *event) { - static QPointer qt_tablet_target = 0; + static QPointer qt_tablet_target = nullptr; QWidget *widget = qt_tablet_target; @@ -1076,7 +1076,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) } if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton) - qt_tablet_target = 0; + qt_tablet_target = nullptr; } #endif // QT_CONFIG(tabletevent) @@ -1084,7 +1084,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) void QWidgetWindow::handleGestureEvent(QNativeGestureEvent *e) { // copy-pasted code to find correct widget follows: - QObject *receiver = 0; + QObject *receiver = nullptr; if (QApplicationPrivate::inPopupMode()) { QWidget *popup = QApplication::activePopupWidget(); QWidget *popupFocusWidget = popup->focusWidget(); diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index fd8581edbb..b4d889fdfa 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -58,8 +58,8 @@ public: Q_DECLARE_PUBLIC(QWindowContainer) QWindowContainerPrivate() - : window(0) - , oldFocusWindow(0) + : window(nullptr) + , oldFocusWindow(nullptr) , usesNativeWidgets(false) { } @@ -70,7 +70,7 @@ public: QWindowContainer *wc = qobject_cast(w); if (wc) return wc->d_func(); - return 0; + return nullptr; } void updateGeometry() { @@ -90,7 +90,7 @@ public: void updateUsesNativeWidgets() { - if (window->parent() == 0) + if (window->parent() == nullptr) return; Q_Q(QWindowContainer); if (q->internalWinId()) { @@ -295,7 +295,7 @@ bool QWindowContainer::event(QEvent *e) case QEvent::ChildRemoved: { QChildEvent *ce = static_cast(e); if (ce->child() == d->window) - d->window = 0; + d->window = nullptr; break; } // The only thing we are interested in is making sure our sizes stay diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp index 42691d6b77..b310da5781 100644 --- a/src/widgets/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -456,7 +456,7 @@ const QStateMachinePrivate::Handler qt_gui_statemachine_handler = { cloneEvent }; -static const QStateMachinePrivate::Handler *qt_guistatemachine_last_handler = 0; +static const QStateMachinePrivate::Handler *qt_guistatemachine_last_handler = nullptr; void qRegisterGuiStateMachine() { qt_guistatemachine_last_handler = QStateMachinePrivate::handler; diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 861dd7a54c..6b3e3679ae 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE static QWindow *qt_getWindow(const QWidget *widget) { - return widget ? widget->window()->windowHandle() : 0; + return widget ? widget->window()->windowHandle() : nullptr; } /*! @@ -353,7 +353,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->fillRect(mid_h, opt->rect.y(), 1, bef_v - opt->rect.y(), brush); break; } case PE_FrameStatusBarItem: - qDrawShadeRect(p, opt->rect, opt->palette, true, 1, 0, 0); + qDrawShadeRect(p, opt->rect, opt->palette, true, 1, 0, nullptr); break; case PE_IndicatorHeaderArrow: if (const QStyleOptionHeader *header = qstyleoption_cast(opt)) { @@ -450,7 +450,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q #endif // QT_CONFIG(tabbar) case PE_FrameTabWidget: case PE_FrameWindow: - qDrawWinPanel(p, opt->rect, opt->palette, false, 0); + qDrawWinPanel(p, opt->rect, opt->palette, false, nullptr); break; case PE_FrameLineEdit: proxy()->drawPrimitive(PE_Frame, opt, p, widget); @@ -493,17 +493,17 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q x -= 2; if (opt->rect.height() > 4) { qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4, - opt->palette, false, 1, 0); + opt->palette, false, 1, nullptr); qDrawShadePanel(p, x+3, 2, 3, opt->rect.height() - 4, - opt->palette, false, 1, 0); + opt->palette, false, 1, nullptr); } } else { if (opt->rect.width() > 4) { int y = opt->rect.height() / 3; qDrawShadePanel(p, 2, y, opt->rect.width() - 4, 3, - opt->palette, false, 1, 0); + opt->palette, false, 1, nullptr); qDrawShadePanel(p, 2, y+3, opt->rect.width() - 4, 3, - opt->palette, false, 1, 0); + opt->palette, false, 1, nullptr); } } p->restore(); @@ -818,7 +818,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q #if QT_CONFIG(toolbutton) static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbutton, - const QRect &rect, QPainter *painter, const QWidget *widget = 0) + const QRect &rect, QPainter *painter, const QWidget *widget = nullptr) { QStyle::PrimitiveElement pe; switch (toolbutton->arrowType) { @@ -1016,7 +1016,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const { const QWidget *widget = option->widget; - const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; + const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1; QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding const bool wrapText = option->features & QStyleOptionViewItem::WrapText; @@ -2931,8 +2931,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_TabBarScrollLeftButton: { const bool vertical = opt->rect.width() < opt->rect.height(); const Qt::LayoutDirection ld = widget->layoutDirection(); - const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, widget), QApplication::globalStrut().width()); - const int buttonOverlap = proxy()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, 0, widget); + const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget), QApplication::globalStrut().width()); + const int buttonOverlap = proxy()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, nullptr, widget); r = vertical ? QRect(0, opt->rect.height() - (buttonWidth * 2) + buttonOverlap, opt->rect.width(), buttonWidth) : QStyle::visualRect(ld, opt->rect, QRect(opt->rect.width() - (buttonWidth * 2) + buttonOverlap, 0, buttonWidth, opt->rect.height())); @@ -2940,7 +2940,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_TabBarScrollRightButton: { const bool vertical = opt->rect.width() < opt->rect.height(); const Qt::LayoutDirection ld = widget->layoutDirection(); - const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, widget), QApplication::globalStrut().width()); + const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget), QApplication::globalStrut().width()); r = vertical ? QRect(0, opt->rect.height() - buttonWidth, opt->rect.width(), buttonWidth) : QStyle::visualRect(ld, opt->rect, QRect(opt->rect.width() - buttonWidth, 0, buttonWidth, opt->rect.height())); @@ -3030,8 +3030,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QStyleOptionDockWidget *dwOpt = qstyleoption_cast(opt); - bool canClose = dwOpt == 0 ? true : dwOpt->closable; - bool canFloat = dwOpt == 0 ? false : dwOpt->floatable; + bool canClose = dwOpt == nullptr ? true : dwOpt->closable; + bool canFloat = dwOpt == nullptr ? false : dwOpt->floatable; const bool verticalTitleBar = dwOpt && dwOpt->verticalTitleBar; @@ -3134,7 +3134,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false); if (d->cachedOption) { delete d->cachedOption; - d->cachedOption = 0; + d->cachedOption = nullptr; } d->cachedOption = new QStyleOptionViewItem(*vopt); } diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index 5739678932..cfaa5a2011 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -90,7 +90,7 @@ void QProxyStylePrivate::ensureBaseStyle() const if (qstrcmp(baseStyle->metaObject()->className(), q->metaObject()->className()) == 0) { delete baseStyle; - baseStyle = 0; + baseStyle = nullptr; } } } diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index b0ce5e52cf..2c4f6f83a1 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -88,7 +88,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, */ QStyle *QStyleFactory::create(const QString& key) { - QStyle *ret = 0; + QStyle *ret = nullptr; QString style = key.toLower(); #if QT_CONFIG(style_windows) if (style == QLatin1String("windows")) diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 9477ca86da..61a59b03c1 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -132,7 +132,7 @@ bool isInstanceOf(QObject *obj, QAccessible::Role role) bool hasAncestor(QObject *obj, QAccessible::Role role) { bool found = false; - QObject *parent = obj ? obj->parent() : 0; + QObject *parent = obj ? obj->parent() : nullptr; while (parent && !found) { if (isInstanceOf(parent, role)) found = true; diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index e5e93ecc66..1af839c841 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -151,7 +151,7 @@ QT_BEGIN_NAMESPACE QStyleOption::QStyleOption(int version, int type) : version(version), type(type), state(QStyle::State_None), - direction(QGuiApplication::layoutDirection()), fontMetrics(QFont()), styleObject(0) + direction(QGuiApplication::layoutDirection()), fontMetrics(QFont()), styleObject(nullptr) { } @@ -3085,7 +3085,7 @@ QStyleOptionViewItem::QStyleOptionViewItem() : QStyleOption(Version, SO_ViewItem), displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft), textElideMode(Qt::ElideMiddle), decorationPosition(Left), - showDecorationSelected(false), features(None), widget(0), + showDecorationSelected(false), features(None), widget(nullptr), checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid) { } @@ -3097,7 +3097,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version) : QStyleOption(version, SO_ViewItem), displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft), textElideMode(Qt::ElideMiddle), decorationPosition(Left), - showDecorationSelected(false), features(None), widget(0), + showDecorationSelected(false), features(None), widget(nullptr), checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid) { } diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 24a397a274..c40bbbc96c 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -133,7 +133,7 @@ public: }; -static QStyleSheetStyleCaches *styleSheetCaches = 0; +static QStyleSheetStyleCaches *styleSheetCaches = nullptr; /* RECURSION_GUARD: * the QStyleSheetStyle is a proxy. If used with others proxy style, we may end up with something like: @@ -144,16 +144,16 @@ static QStyleSheetStyleCaches *styleSheetCaches = 0; * The first instance of QStyleSheetStyle will set globalStyleSheetStyle to itself. The second one * will notice the globalStyleSheetStyle is not istelf and call its base style directly. */ -static const QStyleSheetStyle *globalStyleSheetStyle = 0; +static const QStyleSheetStyle *globalStyleSheetStyle = nullptr; class QStyleSheetStyleRecursionGuard { public: QStyleSheetStyleRecursionGuard(const QStyleSheetStyle *that) - : guarded(globalStyleSheetStyle == 0) + : guarded(globalStyleSheetStyle == nullptr) { if (guarded) globalStyleSheetStyle = that; } - ~QStyleSheetStyleRecursionGuard() { if (guarded) globalStyleSheetStyle = 0; } + ~QStyleSheetStyleRecursionGuard() { if (guarded) globalStyleSheetStyle = nullptr; } bool guarded; }; #define RECURSION_GUARD(RETURN) \ @@ -371,7 +371,7 @@ struct QStyleSheetBackgroundData : public QSharedData struct QStyleSheetBorderData : public QSharedData { - QStyleSheetBorderData() : bi(0) + QStyleSheetBorderData() : bi(nullptr) { for (int i = 0; i < 4; i++) { borders[i] = 0; @@ -379,7 +379,7 @@ struct QStyleSheetBorderData : public QSharedData } } - QStyleSheetBorderData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r) : bi(0) + QStyleSheetBorderData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r) : bi(nullptr) { for (int i = 0; i < 4; i++) { borders[i] = b[i]; @@ -396,7 +396,7 @@ struct QStyleSheetBorderData : public QSharedData const QStyleSheetBorderImageData *borderImage() const { return bi; } - bool hasBorderImage() const { return bi!=0; } + bool hasBorderImage() const { return bi!=nullptr; } QSharedDataPointer bi; @@ -413,7 +413,7 @@ struct QStyleSheetBorderData : public QSharedData if (!radii[i].isEmpty()) return false; } - if (bi != 0 && bi->pixmap.hasAlpha()) + if (bi != nullptr && bi->pixmap.hasAlpha()) return false; return true; } @@ -502,7 +502,7 @@ struct QStyleSheetImageData : public QSharedData class QRenderRule { public: - QRenderRule() : features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0) { } + QRenderRule() : features(0), hasFont(false), pal(nullptr), b(nullptr), bg(nullptr), bd(nullptr), ou(nullptr), geo(nullptr), p(nullptr), img(nullptr), clipset(0) { } QRenderRule(const QVector &, const QObject *); QRect borderRect(const QRect &r) const; @@ -538,18 +538,18 @@ public: bool hasModification() const; - bool hasPalette() const { return pal != 0; } - bool hasBackground() const { return bg != 0 && (!bg->pixmap.isNull() || bg->brush.style() != Qt::NoBrush); } + bool hasPalette() const { return pal != nullptr; } + bool hasBackground() const { return bg != nullptr && (!bg->pixmap.isNull() || bg->brush.style() != Qt::NoBrush); } bool hasGradientBackground() const { return bg && bg->brush.style() >= Qt::LinearGradientPattern && bg->brush.style() <= Qt::ConicalGradientPattern; } bool hasNativeBorder() const { - return bd == 0 + return bd == nullptr || (!bd->hasBorderImage() && bd->styles[0] == BorderStyle_Native); } bool hasNativeOutline() const { - return (ou == 0 + return (ou == nullptr || (!ou->hasBorderImage() && ou->styles[0] == BorderStyle_Native)); } @@ -563,14 +563,14 @@ public: return features & StyleFeature_BackgroundColor; } - bool hasBox() const { return b != 0; } - bool hasBorder() const { return bd != 0; } - bool hasOutline() const { return ou != 0; } - bool hasPosition() const { return p != 0; } - bool hasGeometry() const { return geo != 0; } + bool hasBox() const { return b != nullptr; } + bool hasBorder() const { return bd != nullptr; } + bool hasOutline() const { return ou != nullptr; } + bool hasPosition() const { return p != nullptr; } + bool hasGeometry() const { return geo != nullptr; } bool hasDrawable() const { return !hasNativeBorder() || hasBackground() || hasImage(); } - bool hasImage() const { return img != 0; } - bool hasIcon() const { return iconPtr != 0; } + bool hasImage() const { return img != nullptr; } + bool hasIcon() const { return iconPtr != nullptr; } QSize minimumContentsSize() const { return geo ? QSize(geo->minWidth, geo->minHeight) : QSize(0, 0); } @@ -910,7 +910,7 @@ static QStyle::StandardPixmap subControlIcon(int pe) } QRenderRule::QRenderRule(const QVector &declarations, const QObject *object) -: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0) +: features(0), hasFont(false), pal(nullptr), b(nullptr), bg(nullptr), bd(nullptr), ou(nullptr), geo(nullptr), p(nullptr), img(nullptr), clipset(0) { QPalette palette = QGuiApplication::palette(); // ###: ideally widget's palette ValueExtractor v(declarations, palette); @@ -1134,11 +1134,11 @@ QSize QRenderRule::boxSize(const QSize &cs, int flags) const void QRenderRule::fixupBorder(int nativeWidth) { - if (bd == 0) + if (bd == nullptr) return; if (!bd->hasBorderImage() || bd->bi->pixmap.isNull()) { - bd->bi = 0; + bd->bi = nullptr; // ignore the color, border of edges that have none border-style QBrush color = pal ? pal->foreground : QBrush(); const bool hasRadius = bd->radii[0].isValid() || bd->radii[1].isValid() @@ -1515,7 +1515,7 @@ public: do { result += QString::fromLatin1(metaObject->className()).replace(QLatin1Char(':'), QLatin1Char('-')); metaObject = metaObject->superClass(); - } while (metaObject != 0); + } while (metaObject != nullptr); return result; } QString attribute(NodePtr node, const QString& name) const override @@ -1539,7 +1539,7 @@ public: return className; } else if (name == QLatin1String("style")) { QWidget *w = qobject_cast(obj); - QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : 0; + QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : nullptr; if (proxy) { QString styleName = QString::fromLatin1(proxy->baseStyle()->metaObject()->className()); cache[name] = styleName; @@ -1575,7 +1575,7 @@ public: if (uc == e && !*c) return true; metaObject = metaObject->superClass(); - } while (metaObject != 0); + } while (metaObject != nullptr); return false; } bool hasAttributes(NodePtr) const override @@ -1583,11 +1583,11 @@ public: QStringList nodeIds(NodePtr node) const override { return isNullNode(node) ? QStringList() : QStringList(OBJECT_PTR(node)->objectName()); } bool isNullNode(NodePtr node) const override - { return node.ptr == 0; } + { return node.ptr == nullptr; } NodePtr parentNode(NodePtr node) const override - { NodePtr n; n.ptr = isNullNode(node) ? 0 : parentObject(OBJECT_PTR(node)); return n; } + { NodePtr n; n.ptr = isNullNode(node) ? nullptr : parentObject(OBJECT_PTR(node)); return n; } NodePtr previousSiblingNode(NodePtr) const override - { NodePtr n; n.ptr = 0; return n; } + { NodePtr n; n.ptr = nullptr; return n; } NodePtr duplicateNode(NodePtr node) const override { return node; } void freeNode(NodePtr) const override @@ -1700,22 +1700,22 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w) #if QT_CONFIG(spinbox) if (qobject_cast(w)) - return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w); + return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, nullptr, w); #endif #if QT_CONFIG(combobox) if (qobject_cast(w)) - return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w); + return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, nullptr, w); #endif #if QT_CONFIG(menu) if (qobject_cast(w)) - return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w); + return base->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, w); #endif #if QT_CONFIG(menubar) if (qobject_cast(w)) - return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w); + return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, w); #endif #ifndef QT_NO_FRAME if (const QFrame *frame = qobject_cast(w)) { @@ -1725,9 +1725,9 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w) #endif if (qstrcmp(w->metaObject()->className(), "QTipLabel") == 0) - return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, w); + return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, w); - return base->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, w); + return base->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, w); } static quint64 pseudoClass(QStyle::State state) @@ -2243,21 +2243,21 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec case PseudoElement_Indicator: case PseudoElement_MenuCheckMark: if (sz.width() == -1) - sz.setWidth(base->pixelMetric(PM_IndicatorWidth, 0, w)); + sz.setWidth(base->pixelMetric(PM_IndicatorWidth, nullptr, w)); if (sz.height() == -1) - sz.setHeight(base->pixelMetric(PM_IndicatorHeight, 0, w)); + sz.setHeight(base->pixelMetric(PM_IndicatorHeight, nullptr, w)); break; case PseudoElement_ExclusiveIndicator: case PseudoElement_GroupBoxIndicator: if (sz.width() == -1) - sz.setWidth(base->pixelMetric(PM_ExclusiveIndicatorWidth, 0, w)); + sz.setWidth(base->pixelMetric(PM_ExclusiveIndicatorWidth, nullptr, w)); if (sz.height() == -1) - sz.setHeight(base->pixelMetric(PM_ExclusiveIndicatorHeight, 0, w)); + sz.setHeight(base->pixelMetric(PM_ExclusiveIndicatorHeight, nullptr, w)); break; case PseudoElement_PushButtonMenuIndicator: { - int pm = base->pixelMetric(PM_MenuButtonIndicator, 0, w); + int pm = base->pixelMetric(PM_MenuButtonIndicator, nullptr, w); if (sz.width() == -1) sz.setWidth(pm); if (sz.height() == -1) @@ -2291,12 +2291,12 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec case PseudoElement_ToolButtonMenu: if (sz.width() == -1) - sz.setWidth(base->pixelMetric(PM_MenuButtonIndicator, 0, w)); + sz.setWidth(base->pixelMetric(PM_MenuButtonIndicator, nullptr, w)); break; case PseudoElement_HeaderViewUpArrow: case PseudoElement_HeaderViewDownArrow: { - int pm = base->pixelMetric(PM_HeaderMargin, 0, w); + int pm = base->pixelMetric(PM_HeaderMargin, nullptr, w); if (sz.width() == -1) sz.setWidth(pm); if (sz.height() == 1) @@ -2309,7 +2309,7 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec case PseudoElement_ScrollBarAddLine: case PseudoElement_ScrollBarSubLine: case PseudoElement_ScrollBarSlider: { - int pm = pixelMetric(QStyle::PM_ScrollBarExtent, 0, w); + int pm = pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, w); if (sz.width() == -1) sz.setWidth(pm); if (sz.height() == -1) @@ -2319,7 +2319,7 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec case PseudoElement_DockWidgetCloseButton: case PseudoElement_DockWidgetFloatButton: { - int iconSize = pixelMetric(PM_SmallIconSize, 0, w); + int iconSize = pixelMetric(PM_SmallIconSize, nullptr, w); return QSize(iconSize, iconSize); } @@ -2956,7 +2956,7 @@ void QStyleSheetStyle::unpolish(QWidget *w) setGeometry(w); w->setAttribute(Qt::WA_StyleSheetTarget, false); w->setAttribute(Qt::WA_StyleSheet, false); - QObject::disconnect(w, 0, this, 0); + QObject::disconnect(w, nullptr, this, nullptr); #if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast(w)) { QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), @@ -3395,7 +3395,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC tb->icon.paint(p, ir); } else { int iconSize = pixelMetric(PM_SmallIconSize, tb, w); - pm = standardIcon(SP_TitleBarMenuButton, 0, w).pixmap(iconSize, iconSize); + pm = standardIcon(SP_TitleBarMenuButton, nullptr, w).pixmap(iconSize, iconSize); drawItemPixmap(p, ir, Qt::AlignCenter, pm); } } @@ -3407,9 +3407,9 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC QSize sz = subSubRule.contentsRect(ir).size(); if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool) - pm = standardIcon(SP_DockWidgetCloseButton, 0, w).pixmap(sz); + pm = standardIcon(SP_DockWidgetCloseButton, nullptr, w).pixmap(sz); else - pm = standardIcon(SP_TitleBarCloseButton, 0, w).pixmap(sz); + pm = standardIcon(SP_TitleBarCloseButton, nullptr, w).pixmap(sz); drawItemPixmap(p, ir, Qt::AlignCenter, pm); } @@ -3430,7 +3430,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC continue; QRenderRule subSubRule = renderRule(w, opt, pe); subSubRule.drawRule(p, ir); - pm = standardIcon(subControlIcon(pe), 0, w).pixmap(subSubRule.contentsRect(ir).size()); + pm = standardIcon(subControlIcon(pe), nullptr, w).pixmap(subSubRule.contentsRect(ir).size()); drawItemPixmap(p, ir, Qt::AlignCenter, pm); } @@ -4280,7 +4280,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (pe1 != PseudoElement_None) { QRenderRule subRule = renderRule(w, opt, pe1); - if (subRule.bg != 0 || subRule.hasDrawable()) { + if (subRule.bg != nullptr || subRule.hasDrawable()) { //We test subRule.bg directly because hasBackground() would return false for background:none. //But we still don't want the default drawning in that case (example for QScrollBar::add-page) (task 198926) subRule.drawRule(p, opt->rect); @@ -5088,7 +5088,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op case CT_GroupBox: case CT_LineEdit: #if QT_CONFIG(spinbox) - if (qobject_cast(w ? w->parentWidget() : 0)) + if (qobject_cast(w ? w->parentWidget() : nullptr)) return csz; // we only care about the size hint of the line edit #endif if (rule.hasBox() || !rule.hasNativeBorder()) { @@ -5729,7 +5729,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove); if (!subRule.hasDrawable()) break; - subRule.img = 0; + subRule.img = nullptr; QRect gr = positionRect(w, rule, subRule, PseudoElement_SliderGroove, opt->rect, opt->direction); switch (sc) { case SC_SliderGroove: @@ -5739,8 +5739,8 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp QRect cr = subRule.contentsRect(gr); QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SliderHandle); int len = horizontal ? subRule2.size().width() : subRule2.size().height(); - subRule2.img = 0; - subRule2.geo = 0; + subRule2.img = nullptr; + subRule2.geo = nullptr; cr = positionRect(w, subRule2, PseudoElement_SliderHandle, cr, opt->direction); int thickness = horizontal ? cr.height() : cr.width(); int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition, @@ -5848,7 +5848,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c QRect ir = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, opt, w); ir = visualRect(opt->direction, opt->rect, ir); - int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, 0, w); + int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, nullptr, w); QRect cr = rule.contentsRect(opt->rect); ir.setRect(ir.left() + ir.width() + spacing, cr.y(), cr.width() - ir.width() - spacing, cr.height()); diff --git a/src/widgets/util/qcolormap.cpp b/src/widgets/util/qcolormap.cpp index 6dacc97261..57e61690e9 100644 --- a/src/widgets/util/qcolormap.cpp +++ b/src/widgets/util/qcolormap.cpp @@ -59,7 +59,7 @@ public: int numcolors; }; -static QColormapPrivate *screenMap = 0; +static QColormapPrivate *screenMap = nullptr; void QColormap::initialize() { @@ -83,7 +83,7 @@ void QColormap::initialize() void QColormap::cleanup() { delete screenMap; - screenMap = 0; + screenMap = nullptr; } QColormap QColormap::instance(int /*screen*/) diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 3c0271e7c2..72fa557790 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1262,7 +1262,7 @@ Qt::MatchFlags QCompleter::filterMode() const void QCompleter::setPopup(QAbstractItemView *popup) { Q_D(QCompleter); - Q_ASSERT(popup != 0); + Q_ASSERT(popup != nullptr); if (d->popup) { QObject::disconnect(d->popup->selectionModel(), nullptr, this, nullptr); QObject::disconnect(d->popup, nullptr, this, nullptr); diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp index 03df937938..064be873b9 100644 --- a/src/widgets/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -114,19 +114,19 @@ static QMouseEvent *copyMouseEvent(QEvent *e) } #endif // QT_CONFIG(graphicsview) default: - return 0; + return nullptr; } } class PressDelayHandler : public QObject { private: - PressDelayHandler(QObject *parent = 0) + PressDelayHandler(QObject *parent = nullptr) : QObject(parent) , pressDelayTimer(0) , sendingEvent(false) , mouseButton(Qt::NoButton) - , mouseTarget(0) + , mouseTarget(nullptr) , mouseEventSource(Qt::MouseEventNotSynthesized) { } @@ -138,7 +138,7 @@ public: static PressDelayHandler *instance() { - static PressDelayHandler *inst = 0; + static PressDelayHandler *inst = nullptr; if (!inst) inst = new PressDelayHandler(QCoreApplication::instance()); return inst; @@ -192,10 +192,10 @@ public: result = true; // consume this event } else if (mouseTarget && scrollerIsActive) { // we grabbed the mouse expicitly when the scroller became active, so undo that now - sendMouseEvent(0, UngrabMouseBefore); + sendMouseEvent(nullptr, UngrabMouseBefore); } - pressDelayEvent.reset(0); - mouseTarget = 0; + pressDelayEvent.reset(nullptr); + mouseTarget = nullptr; return result; } @@ -208,9 +208,9 @@ public: killTimer(pressDelayTimer); pressDelayTimer = 0; } - pressDelayEvent.reset(0); + pressDelayEvent.reset(nullptr); } - mouseTarget = 0; + mouseTarget = nullptr; } void scrollerBecameActive() @@ -222,8 +222,8 @@ public: killTimer(pressDelayTimer); pressDelayTimer = 0; } - pressDelayEvent.reset(0); - mouseTarget = 0; + pressDelayEvent.reset(nullptr); + mouseTarget = nullptr; } else if (mouseTarget) { // we did send a press, so we need to fake a release now @@ -261,7 +261,7 @@ protected: qFGDebug() << "QFG: timer event: re-sending mouse press to " << mouseTarget; sendMouseEvent(pressDelayEvent.data(), UngrabMouseBefore); } - pressDelayEvent.reset(0); + pressDelayEvent.reset(nullptr); if (pressDelayTimer) { killTimer(pressDelayTimer); @@ -276,7 +276,7 @@ protected: sendingEvent = true; #if QT_CONFIG(graphicsview) - QGraphicsItem *grabber = 0; + QGraphicsItem *grabber = nullptr; if (mouseTarget->parentWidget()) { if (QGraphicsView *gv = qobject_cast(mouseTarget->parentWidget())) { if (gv->scene()) @@ -350,7 +350,7 @@ QFlickGesture::QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject { d_func()->q_ptr = this; d_func()->receiver = receiver; - d_func()->receiverScroller = (receiver && QScroller::hasScroller(receiver)) ? QScroller::scroller(receiver) : 0; + d_func()->receiverScroller = (receiver && QScroller::hasScroller(receiver)) ? QScroller::scroller(receiver) : nullptr; d_func()->button = button; } @@ -358,7 +358,7 @@ QFlickGesture::~QFlickGesture() { } QFlickGesturePrivate::QFlickGesturePrivate() - : receiverScroller(0), button(Qt::NoButton), macIgnoreWheel(false) + : receiverScroller(nullptr), button(Qt::NoButton), macIgnoreWheel(false) { } @@ -420,11 +420,11 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, return Ignore; } - const QMouseEvent *me = 0; + const QMouseEvent *me = nullptr; #if QT_CONFIG(graphicsview) - const QGraphicsSceneMouseEvent *gsme = 0; + const QGraphicsSceneMouseEvent *gsme = nullptr; #endif - const QTouchEvent *te = 0; + const QTouchEvent *te = nullptr; QPoint globalPos; // qFGDebug() << "FlickGesture "<receiver<<"event"<type()<<"button"<contains(target)) @@ -476,7 +476,7 @@ void QScroller::ungrabGesture(QObject *target) QGestureRecognizer::unregisterRecognizer(sp->recognizerType); // do not delete the recognizer. The QGestureManager is doing this. - sp->recognizer = 0; + sp->recognizer = nullptr; } #endif // QT_NO_GESTURES @@ -502,7 +502,7 @@ QScroller::~QScroller() #ifndef QT_NO_GESTURES QGestureRecognizer::unregisterRecognizer(d->recognizerType); // do not delete the recognizer. The QGestureManager is doing this. - d->recognizer = 0; + d->recognizer = nullptr; #endif qt_allScrollers()->remove(d->target); qt_activeScrollers()->removeOne(this); @@ -879,7 +879,7 @@ void QScroller::setSnapPositionsY(qreal first, qreal interval) QScrollerPrivate::QScrollerPrivate(QScroller *q, QObject *_target) : target(_target) #ifndef QT_NO_GESTURES - , recognizer(0) + , recognizer(nullptr) , recognizerType(Qt::CustomGesture) #endif , state(QScroller::Inactive) @@ -900,7 +900,7 @@ QScrollerPrivate::QScrollerPrivate(QScroller *q, QObject *_target) void QScrollerPrivate::init() { - setDpiFromWidget(0); + setDpiFromWidget(nullptr); monotonicTimer.start(); } diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp index df6b899fe4..0306f54faa 100644 --- a/src/widgets/util/qscrollerproperties.cpp +++ b/src/widgets/util/qscrollerproperties.cpp @@ -46,8 +46,8 @@ QT_BEGIN_NAMESPACE -static QScrollerPropertiesPrivate *userDefaults = 0; -static QScrollerPropertiesPrivate *systemDefaults = 0; +static QScrollerPropertiesPrivate *userDefaults = nullptr; +static QScrollerPropertiesPrivate *systemDefaults = nullptr; QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults() { @@ -200,7 +200,7 @@ void QScrollerProperties::setDefaultScrollerProperties(const QScrollerProperties void QScrollerProperties::unsetDefaultScrollerProperties() { delete userDefaults; - userDefaults = 0; + userDefaults = nullptr; } /*! diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index ae81cc5661..ee52139913 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -453,7 +453,7 @@ void QSystemTrayIconPrivate::_q_emitActivated(QPlatformSystemTrayIcon::Activatio } ////////////////////////////////////////////////////////////////////// -static QBalloonTip *theSolitaryBalloonTip = 0; +static QBalloonTip *theSolitaryBalloonTip = nullptr; void QBalloonTip::showBalloon(const QIcon &icon, const QString &title, const QString &message, QSystemTrayIcon *trayIcon, @@ -475,7 +475,7 @@ void QBalloonTip::hideBalloon() return; theSolitaryBalloonTip->hide(); delete theSolitaryBalloonTip; - theSolitaryBalloonTip = 0; + theSolitaryBalloonTip = nullptr; } void QBalloonTip::updateBalloonPosition(const QPoint& pos) @@ -493,7 +493,7 @@ bool QBalloonTip::isBalloonVisible() QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, const QString &message, QSystemTrayIcon *ti) - : QWidget(0, Qt::ToolTip), + : QWidget(nullptr, Qt::ToolTip), trayIcon(ti), timerId(-1), showArrow(true) @@ -583,7 +583,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, QBalloonTip::~QBalloonTip() { - theSolitaryBalloonTip = 0; + theSolitaryBalloonTip = nullptr; } void QBalloonTip::paintEvent(QPaintEvent *) diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index 0c7bb94a91..86c11f98ed 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -97,7 +97,7 @@ private: }; QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) - : QWidget(0, Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint) + : QWidget(nullptr, Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint) , q(qIn) { setObjectName(QStringLiteral("QSystemTrayIconSys")); @@ -218,7 +218,7 @@ private: //////////////////////////////////////////////////////////////////////////// QSystemTrayIconPrivate::QSystemTrayIconPrivate() - : sys(0), + : sys(nullptr), qpa_sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon()), visible(false), trayWatcher(nullptr) diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp index 9bd63d4232..ae439743bc 100644 --- a/src/widgets/util/qundogroup.cpp +++ b/src/widgets/util/qundogroup.cpp @@ -47,7 +47,7 @@ class QUndoGroupPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QUndoGroup) public: - QUndoGroupPrivate() : active(0) {} + QUndoGroupPrivate() : active(nullptr) {} QUndoStack *active; QList stack_list; @@ -113,7 +113,7 @@ QUndoGroup::~QUndoGroup() QList::iterator it = d->stack_list.begin(); QList::iterator end = d->stack_list.end(); while (it != end) { - (*it)->d_func()->group = 0; + (*it)->d_func()->group = nullptr; ++it; } } @@ -154,8 +154,8 @@ void QUndoGroup::removeStack(QUndoStack *stack) if (d->stack_list.removeAll(stack) == 0) return; if (stack == d->active) - setActiveStack(0); - stack->d_func()->group = 0; + setActiveStack(nullptr); + stack->d_func()->group = nullptr; } /*! @@ -190,7 +190,7 @@ void QUndoGroup::setActiveStack(QUndoStack *stack) if (d->active == stack) return; - if (d->active != 0) { + if (d->active != nullptr) { disconnect(d->active, SIGNAL(canUndoChanged(bool)), this, SIGNAL(canUndoChanged(bool))); disconnect(d->active, SIGNAL(undoTextChanged(QString)), @@ -207,7 +207,7 @@ void QUndoGroup::setActiveStack(QUndoStack *stack) d->active = stack; - if (d->active == 0) { + if (d->active == nullptr) { emit canUndoChanged(false); emit undoTextChanged(QString()); emit canRedoChanged(false); @@ -265,7 +265,7 @@ QUndoStack *QUndoGroup::activeStack() const void QUndoGroup::undo() { Q_D(QUndoGroup); - if (d->active != 0) + if (d->active != nullptr) d->active->undo(); } @@ -282,7 +282,7 @@ void QUndoGroup::undo() void QUndoGroup::redo() { Q_D(QUndoGroup); - if (d->active != 0) + if (d->active != nullptr) d->active->redo(); } @@ -298,7 +298,7 @@ void QUndoGroup::redo() bool QUndoGroup::canUndo() const { Q_D(const QUndoGroup); - return d->active != 0 && d->active->canUndo(); + return d->active != nullptr && d->active->canUndo(); } /*! @@ -313,7 +313,7 @@ bool QUndoGroup::canUndo() const bool QUndoGroup::canRedo() const { Q_D(const QUndoGroup); - return d->active != 0 && d->active->canRedo(); + return d->active != nullptr && d->active->canRedo(); } /*! @@ -328,7 +328,7 @@ bool QUndoGroup::canRedo() const QString QUndoGroup::undoText() const { Q_D(const QUndoGroup); - return d->active == 0 ? QString() : d->active->undoText(); + return d->active == nullptr ? QString() : d->active->undoText(); } /*! @@ -343,7 +343,7 @@ QString QUndoGroup::undoText() const QString QUndoGroup::redoText() const { Q_D(const QUndoGroup); - return d->active == 0 ? QString() : d->active->redoText(); + return d->active == nullptr ? QString() : d->active->redoText(); } /*! @@ -358,7 +358,7 @@ QString QUndoGroup::redoText() const bool QUndoGroup::isClean() const { Q_D(const QUndoGroup); - return d->active == 0 || d->active->isClean(); + return d->active == nullptr || d->active->isClean(); } #ifndef QT_NO_ACTION diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index 8788c42252..f188b8298a 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -128,7 +128,7 @@ QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent) QUndoCommand::QUndoCommand(QUndoCommand *parent) { d = new QUndoCommandPrivate; - if (parent != 0) + if (parent != nullptr) parent->d->child_list.append(this); } @@ -336,7 +336,7 @@ int QUndoCommand::childCount() const const QUndoCommand *QUndoCommand::child(int index) const { if (index < 0 || index >= d->child_list.count()) - return 0; + return nullptr; return d->child_list.at(index); } @@ -559,7 +559,7 @@ QUndoStack::~QUndoStack() { #if QT_CONFIG(undogroup) Q_D(QUndoStack); - if (d->group != 0) + if (d->group != nullptr) d->group->removeStack(this); #endif clear(); @@ -640,7 +640,7 @@ void QUndoStack::push(QUndoCommand *cmd) bool macro = !d->macro_stack.isEmpty(); - QUndoCommand *cur = 0; + QUndoCommand *cur = nullptr; if (macro) { QUndoCommand *macro_cmd = d->macro_stack.constLast(); if (!macro_cmd->d->child_list.isEmpty()) @@ -654,7 +654,7 @@ void QUndoStack::push(QUndoCommand *cmd) d->clean_index = -1; // we've deleted the clean state } - bool try_merge = cur != 0 + bool try_merge = cur != nullptr && cur->id() != -1 && cur->id() == cmd->id() && (macro || d->index != d->clean_index); @@ -1225,7 +1225,7 @@ const QUndoCommand *QUndoStack::command(int index) const Q_D(const QUndoStack); if (index < 0 || index >= d->command_list.count()) - return 0; + return nullptr; return d->command_list.at(index); } @@ -1305,11 +1305,11 @@ void QUndoStack::setActive(bool active) #else Q_D(QUndoStack); - if (d->group != 0) { + if (d->group != nullptr) { if (active) d->group->setActiveStack(this); else if (d->group->activeStack() == this) - d->group->setActiveStack(0); + d->group->setActiveStack(nullptr); } #endif } @@ -1320,7 +1320,7 @@ bool QUndoStack::isActive() const return true; #else Q_D(const QUndoStack); - return d->group == 0 || d->group->activeStack() == this; + return d->group == nullptr || d->group->activeStack() == this; #endif } diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index f59d87fb9d..9ca83a1da2 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -54,7 +54,7 @@ class QUndoModel : public QAbstractItemModel { Q_OBJECT public: - QUndoModel(QObject *parent = 0); + QUndoModel(QObject *parent = nullptr); QUndoStack *stack() const; @@ -92,7 +92,7 @@ private: QUndoModel::QUndoModel(QObject *parent) : QAbstractItemModel(parent) { - m_stack = 0; + m_stack = nullptr; m_sel_model = new QItemSelectionModel(this, this); connect(m_sel_model, SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(setStackCurrentIndex(QModelIndex))); @@ -114,13 +114,13 @@ void QUndoModel::setStack(QUndoStack *stack) if (m_stack == stack) return; - if (m_stack != 0) { + if (m_stack != nullptr) { disconnect(m_stack, SIGNAL(cleanChanged(bool)), this, SLOT(stackChanged())); disconnect(m_stack, SIGNAL(indexChanged(int)), this, SLOT(stackChanged())); disconnect(m_stack, SIGNAL(destroyed(QObject*)), this, SLOT(stackDestroyed(QObject*))); } m_stack = stack; - if (m_stack != 0) { + if (m_stack != nullptr) { connect(m_stack, SIGNAL(cleanChanged(bool)), this, SLOT(stackChanged())); connect(m_stack, SIGNAL(indexChanged(int)), this, SLOT(stackChanged())); connect(m_stack, SIGNAL(destroyed(QObject*)), this, SLOT(stackDestroyed(QObject*))); @@ -133,7 +133,7 @@ void QUndoModel::stackDestroyed(QObject *obj) { if (obj != m_stack) return; - m_stack = 0; + m_stack = nullptr; stackChanged(); } @@ -147,7 +147,7 @@ void QUndoModel::stackChanged() void QUndoModel::setStackCurrentIndex(const QModelIndex &index) { - if (m_stack == 0) + if (m_stack == nullptr) return; if (index == selectedIndex()) @@ -161,12 +161,12 @@ void QUndoModel::setStackCurrentIndex(const QModelIndex &index) QModelIndex QUndoModel::selectedIndex() const { - return m_stack == 0 ? QModelIndex() : createIndex(m_stack->index(), 0); + return m_stack == nullptr ? QModelIndex() : createIndex(m_stack->index(), 0); } QModelIndex QUndoModel::index(int row, int column, const QModelIndex &parent) const { - if (m_stack == 0) + if (m_stack == nullptr) return QModelIndex(); if (parent.isValid()) @@ -188,7 +188,7 @@ QModelIndex QUndoModel::parent(const QModelIndex&) const int QUndoModel::rowCount(const QModelIndex &parent) const { - if (m_stack == 0) + if (m_stack == nullptr) return 0; if (parent.isValid()) @@ -204,7 +204,7 @@ int QUndoModel::columnCount(const QModelIndex&) const QVariant QUndoModel::data(const QModelIndex &index, int role) const { - if (m_stack == 0) + if (m_stack == nullptr) return QVariant(); if (index.column() != 0) @@ -274,9 +274,9 @@ class QUndoViewPrivate : public QListViewPrivate public: QUndoViewPrivate() : #if QT_CONFIG(undogroup) - group(0), + group(nullptr), #endif - model(0) {} + model(nullptr) {} #if QT_CONFIG(undogroup) QPointer group; @@ -370,7 +370,7 @@ void QUndoView::setStack(QUndoStack *stack) { Q_D(QUndoView); #if QT_CONFIG(undogroup) - setGroup(0); + setGroup(nullptr); #endif d->model->setStack(stack); } @@ -393,19 +393,19 @@ void QUndoView::setGroup(QUndoGroup *group) if (d->group == group) return; - if (d->group != 0) { + if (d->group != nullptr) { disconnect(d->group, SIGNAL(activeStackChanged(QUndoStack*)), d->model, SLOT(setStack(QUndoStack*))); } d->group = group; - if (d->group != 0) { + if (d->group != nullptr) { connect(d->group, SIGNAL(activeStackChanged(QUndoStack*)), d->model, SLOT(setStack(QUndoStack*))); d->model->setStack(d->group->activeStack()); } else { - d->model->setStack(0); + d->model->setStack(nullptr); } } diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 19528d61d2..022f41738c 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -177,7 +177,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) checkable(false), checked(false), autoRepeat(false), autoExclusive(false), down(false), blockRefresh(false), pressed(false), #if QT_CONFIG(buttongroup) - group(0), + group(nullptr), #endif autoRepeatDelay(AUTO_REPEAT_DELAY), autoRepeatInterval(AUTO_REPEAT_INTERVAL), @@ -217,14 +217,14 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const Q_Q(const QAbstractButton); QList buttonList = queryButtonList(); if (!autoExclusive || buttonList.count() == 1) // no group - return 0; + return nullptr; for (int i = 0; i < buttonList.count(); ++i) { QAbstractButton *b = buttonList.at(i); if (b->d_func()->checked && b != q) return b; } - return checked ? const_cast(q) : 0; + return checked ? const_cast(q) : nullptr; } void QAbstractButtonPrivate::notifyChecked() @@ -257,7 +257,7 @@ void QAbstractButtonPrivate::moveFocus(int key) if (!fb || !buttonList.contains(fb)) return; - QAbstractButton *candidate = 0; + QAbstractButton *candidate = nullptr; int bestScore = -1; QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0))); QPoint goal = target.center(); @@ -1272,7 +1272,7 @@ QSize QAbstractButton::iconSize() const Q_D(const QAbstractButton); if (d->iconSize.isValid()) return d->iconSize; - int e = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this); + int e = style()->pixelMetric(QStyle::PM_ButtonIconSize, nullptr, this); return QSize(e, e); } diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index d2372a7be9..320b3bf7ef 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -161,10 +161,10 @@ QT_BEGIN_NAMESPACE */ QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() - :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), + :hbar(nullptr), vbar(nullptr), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), shownOnce(false), inResize(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), - viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), - xoffset(0), yoffset(0), viewportFilter(0) + viewport(nullptr), cornerWidget(nullptr), left(0), top(0), right(0), bottom(0), + xoffset(0), yoffset(0), viewportFilter(nullptr) { } @@ -329,12 +329,12 @@ void QAbstractScrollAreaPrivate::layoutChildren() void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrollbar, bool *needVerticalScrollbar) { Q_Q(QAbstractScrollArea); - bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, hbar); + bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, hbar); bool needh = *needHorizontalScrollbar || ((hbarpolicy != Qt::ScrollBarAlwaysOff) && ((hbarpolicy == Qt::ScrollBarAlwaysOn && !htransient) || ((hbarpolicy == Qt::ScrollBarAsNeeded || htransient) && hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty()))); - bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar); + bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, vbar); bool needv = *needVerticalScrollbar || ((vbarpolicy != Qt::ScrollBarAlwaysOff) && ((vbarpolicy == Qt::ScrollBarAlwaysOn && !vtransient) || ((vbarpolicy == Qt::ScrollBarAsNeeded || vtransient) && vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty()))); @@ -352,7 +352,7 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol const QRect widgetRect = q->rect(); - const bool hasCornerWidget = (cornerWidget != 0); + const bool hasCornerWidget = (cornerWidget != nullptr); QPoint cornerOffset((needv && vscrollOverlap == 0) ? vsbExt : 0, (needh && hscrollOverlap == 0) ? hsbExt : 0); QRect controlsRect; @@ -794,7 +794,7 @@ void QAbstractScrollArea::addScrollBarWidget(QWidget *widget, Qt::Alignment alig { Q_D(QAbstractScrollArea); - if (widget == 0) + if (widget == nullptr) return; const Qt::Orientation scrollBarOrientation @@ -894,8 +894,8 @@ bool QAbstractScrollArea::eventFilter(QObject *o, QEvent *e) if (d->hbarpolicy == Qt::ScrollBarAsNeeded && d->vbarpolicy == Qt::ScrollBarAsNeeded) { QScrollBar *sbar = static_cast(o); QScrollBar *sibling = sbar == d->hbar ? d->vbar : d->hbar; - if (sbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, sbar) && - sibling->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, sibling)) + if (sbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, sbar) && + sibling->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, sibling)) d->setScrollBarTransient(sibling, e->type() == QEvent::HoverLeave); } } @@ -1389,10 +1389,10 @@ bool QAbstractScrollAreaPrivate::canStartScrollingAt( const QPoint &startPos ) void QAbstractScrollAreaPrivate::flashScrollBars() { - bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, hbar); + bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, hbar); if ((hbarpolicy != Qt::ScrollBarAlwaysOff) && (hbarpolicy == Qt::ScrollBarAsNeeded || htransient)) hbar->d_func()->flash(); - bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar); + bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, vbar); if ((vbarpolicy != Qt::ScrollBarAlwaysOff) && (vbarpolicy == Qt::ScrollBarAsNeeded || vtransient)) vbar->d_func()->flash(); } diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index b1e1c9bc1b..6a0d2f5019 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -848,9 +848,9 @@ void QAbstractSpinBox::changeEvent(QEvent *event) switch (event->type()) { case QEvent::StyleChange: - d->spinClickTimerInterval = style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, 0, this); + d->spinClickTimerInterval = style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, nullptr, this); d->spinClickThresholdTimerInterval = - style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, 0, this); + style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, nullptr, this); if (d->edit) d->edit->setFrame(!style()->styleHint(QStyle::SH_SpinBox_ButtonsInsideFrame, nullptr, this)); d->stepModifier = static_cast(style()->styleHint(QStyle::SH_SpinBox_StepModifier, nullptr, this)); @@ -1043,7 +1043,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) steps *= 10; if (!up) steps *= -1; - if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) { + if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, nullptr, this)) { d->buttonState = (Keyboard | (up ? Up : Down)); } if (d->spinClickTimerId == -1) @@ -1421,14 +1421,14 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event) */ QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate() - : edit(0), type(QVariant::Invalid), spinClickTimerId(-1), + : edit(nullptr), type(QVariant::Invalid), spinClickTimerId(-1), spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1), effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")), cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false), ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true), cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue), stepModifier(Qt::ControlModifier), acceleration(0), hoverControl(QStyle::SC_None), - buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0), showGroupSeparator(0), + buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(nullptr), showGroupSeparator(0), wheelDeltaRemainder(0) { } diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index 669faa92c7..c3fd37d8e9 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE void QButtonGroupPrivate::detectCheckedButton() { QAbstractButton *previous = checkedButton; - checkedButton = 0; + checkedButton = nullptr; if (exclusive) return; for (int i = 0; i < buttonList.count(); i++) { @@ -119,7 +119,7 @@ QButtonGroup::~QButtonGroup() { Q_D(QButtonGroup); for (int i = 0; i < d->buttonList.count(); ++i) - d->buttonList.at(i)->d_func()->group = 0; + d->buttonList.at(i)->d_func()->group = nullptr; } /*! @@ -273,7 +273,7 @@ void QButtonGroup::removeButton(QAbstractButton *button) d->detectCheckedButton(); } if (button->d_func()->group == this) { - button->d_func()->group = 0; + button->d_func()->group = nullptr; d->buttonList.removeAll(button); d->mapping.remove(button); } diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 749ae96df2..fe1133c6c7 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -559,7 +559,7 @@ void QCalendarDateValidator::setFormat(const QString &format) separator += nextChar; quoting = false; } else { - QCalendarDateSectionValidator *validator = 0; + QCalendarDateSectionValidator *validator = nullptr; if (nextChar == QLatin1Char('d')) { offset = qMin(4, countRepeat(format, pos)); validator = &m_dayValidator; @@ -640,9 +640,9 @@ class QCalendarTextNavigator: public QObject { Q_OBJECT public: - QCalendarTextNavigator(QObject *parent = 0) - : QObject(parent), m_dateText(0), m_dateFrame(0), m_dateValidator(0), - m_widget(0), m_editDelay(1500), m_date(QDate::currentDate()) {} + QCalendarTextNavigator(QObject *parent = nullptr) + : QObject(parent), m_dateText(nullptr), m_dateFrame(nullptr), m_dateValidator(nullptr), + m_widget(nullptr), m_editDelay(1500), m_date(QDate::currentDate()) {} QWidget *widget() const; void setWidget(QWidget *widget); @@ -752,9 +752,9 @@ void QCalendarTextNavigator::removeDateLabel() m_dateFrame->hide(); m_dateFrame->deleteLater(); delete m_dateValidator; - m_dateFrame = 0; - m_dateText = 0; - m_dateValidator = 0; + m_dateFrame = nullptr; + m_dateText = nullptr; + m_dateValidator = nullptr; } bool QCalendarTextNavigator::eventFilter(QObject *o, QEvent *e) @@ -858,7 +858,7 @@ class QCalendarModel : public QAbstractTableModel { Q_OBJECT public: - QCalendarModel(QObject *parent = 0); + QCalendarModel(QObject *parent = nullptr); int rowCount(const QModelIndex &) const override { return RowCount + m_firstRow; } @@ -951,7 +951,7 @@ class QCalendarView : public QTableView { Q_OBJECT public: - QCalendarView(QWidget *parent = 0); + QCalendarView(QWidget *parent = nullptr); void internalUpdate() { updateGeometries(); } void setReadOnly(bool enable); @@ -1599,7 +1599,7 @@ class QCalendarDelegate : public QItemDelegate { Q_OBJECT public: - QCalendarDelegate(QCalendarWidgetPrivate *w, QObject *parent = 0) + QCalendarDelegate(QCalendarWidgetPrivate *w, QObject *parent = nullptr) : QItemDelegate(parent), calendarWidgetPrivate(w) { } virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, @@ -1734,11 +1734,11 @@ void QCalendarDelegate::paintCell(QPainter *painter, const QRect &rect, QDate da QCalendarWidgetPrivate::QCalendarWidgetPrivate() : QWidgetPrivate() { - m_model = 0; - m_view = 0; - m_delegate = 0; - m_selection = 0; - m_navigator = 0; + m_model = nullptr; + m_view = nullptr; + m_delegate = nullptr; + m_selection = nullptr; + m_navigator = nullptr; m_dateEditEnabled = false; navBarVisible = true; oldFocusPolicy = Qt::StrongFocus; @@ -1748,7 +1748,7 @@ void QCalendarWidgetPrivate::setNavigatorEnabled(bool enable) { Q_Q(QCalendarWidget); - bool navigatorEnabled = (m_navigator->widget() != 0); + bool navigatorEnabled = (m_navigator->widget() != nullptr); if (enable == navigatorEnabled) return; @@ -1760,7 +1760,7 @@ void QCalendarWidgetPrivate::setNavigatorEnabled(bool enable) q, SLOT(_q_editingFinished())); m_view->installEventFilter(m_navigator); } else { - m_navigator->setWidget(0); + m_navigator->setWidget(nullptr); q->disconnect(m_navigator, SIGNAL(dateChanged(QDate)), q, SLOT(_q_slotChangeDate(QDate))); q->disconnect(m_navigator, SIGNAL(editingFinished()), @@ -1847,8 +1847,8 @@ void QCalendarWidgetPrivate::createNavigationBar(QWidget *widget) void QCalendarWidgetPrivate::updateButtonIcons() { Q_Q(QCalendarWidget); - prevMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowRight : QStyle::SP_ArrowLeft, 0, q)); - nextMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowLeft : QStyle::SP_ArrowRight, 0, q)); + prevMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowRight : QStyle::SP_ArrowLeft, nullptr, q)); + nextMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowLeft : QStyle::SP_ArrowRight, nullptr, q)); } void QCalendarWidgetPrivate::updateMonthMenu() diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 3be163ff75..8c8aaf8ae3 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -764,7 +764,7 @@ QCalendarWidget *QDateTimeEdit::calendarWidget() const { Q_D(const QDateTimeEdit); if (!d->calendarPopup || !(d->sections & QDateTimeParser::DateSectionMask)) - return 0; + return nullptr; if (!d->monthCalendar) { const_cast(d)->initCalendarPopup(); } @@ -1221,7 +1221,7 @@ void QDateTimeEdit::focusInEvent(QFocusEvent *event) { Q_D(QDateTimeEdit); QAbstractSpinBox::focusInEvent(event); - QString *frm = 0; + QString *frm = nullptr; const int oldPos = d->edit->cursorPosition(); if (!d->formatExplicitlySet) { if (d->displayFormat == d->defaultTimeFormat) { @@ -1668,7 +1668,7 @@ QDateTimeEditPrivate::QDateTimeEditPrivate() minimum = QDATETIMEEDIT_COMPAT_DATE_MIN.startOfDay(); maximum = QDATETIMEEDIT_DATE_MAX.endOfDay(); arrowState = QStyle::State_None; - monthCalendar = 0; + monthCalendar = nullptr; readLocaleSettings(); #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 9096ee82f6..9867cb5540 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -178,15 +178,15 @@ public: }; QDialogButtonBoxPrivate::QDialogButtonBoxPrivate(Qt::Orientation orient) - : orientation(orient), buttonLayout(0), internalRemove(false), center(false) + : orientation(orient), buttonLayout(nullptr), internalRemove(false), center(false) { } void QDialogButtonBoxPrivate::initLayout() { Q_Q(QDialogButtonBox); - layoutPolicy = QDialogButtonBox::ButtonLayout(q->style()->styleHint(QStyle::SH_DialogButtonLayout, 0, q)); - bool createNewLayout = buttonLayout == 0 + layoutPolicy = QDialogButtonBox::ButtonLayout(q->style()->styleHint(QStyle::SH_DialogButtonLayout, nullptr, q)); + bool createNewLayout = buttonLayout == nullptr || (orientation == Qt::Horizontal && qobject_cast(buttonLayout) != 0) || (orientation == Qt::Vertical && qobject_cast(buttonLayout) != 0); if (createNewLayout) { @@ -329,8 +329,8 @@ void QDialogButtonBoxPrivate::layoutButtons() ++currentLayout; } - QWidget *lastWidget = 0; - q->setFocusProxy(0); + QWidget *lastWidget = nullptr; + q->setFocusProxy(nullptr); for (int i = 0; i < buttonLayout->count(); ++i) { QLayoutItem *item = buttonLayout->itemAt(i); if (QWidget *widget = item->widget()) { @@ -408,13 +408,13 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut icon = QStyle::SP_RestoreDefaultsButton; break; case QDialogButtonBox::NoButton: - return 0; + return nullptr; ; } QPushButton *button = new QPushButton(QGuiApplicationPrivate::platformTheme()->standardButtonText(sbutton), q); QStyle *style = q->style(); - if (style->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, 0, q) && icon != 0) - button->setIcon(style->standardIcon(QStyle::StandardPixmap(icon), 0, q)); + if (style->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, nullptr, q) && icon != 0) + button->setIcon(style->standardIcon(QStyle::StandardPixmap(icon), nullptr, q)); if (style != QApplication::style()) // Propagate style button->setStyle(style); standardButtonHash.insert(button, sbutton); @@ -743,7 +743,7 @@ void QDialogButtonBox::removeButton(QAbstractButton *button) } } if (!d->internalRemove) - button->setParent(0); + button->setParent(nullptr); } /*! @@ -781,7 +781,7 @@ QPushButton *QDialogButtonBox::addButton(const QString &text, ButtonRole role) Q_D(QDialogButtonBox); if (Q_UNLIKELY(role <= InvalidRole || role >= NRoles)) { qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added"); - return 0; + return nullptr; } QPushButton *button = new QPushButton(text, this); d->addButton(button, role); @@ -963,7 +963,7 @@ bool QDialogButtonBox::event(QEvent *event) QList acceptRoleList = d->buttonLists[AcceptRole]; QPushButton *firstAcceptButton = acceptRoleList.isEmpty() ? 0 : qobject_cast(acceptRoleList.at(0)); bool hasDefault = false; - QWidget *dialog = 0; + QWidget *dialog = nullptr; QWidget *p = this; while (p && !p->isWindow()) { p = p->parentWidget(); diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 5900326087..87f4519dd6 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -85,27 +85,27 @@ QPlaceHolderItem::QPlaceHolderItem(QWidget *w) */ QDockAreaLayoutItem::QDockAreaLayoutItem(QLayoutItem *_widgetItem) - : widgetItem(_widgetItem), subinfo(0), placeHolderItem(0), pos(0), size(-1), flags(NoFlags) + : widgetItem(_widgetItem), subinfo(nullptr), placeHolderItem(nullptr), pos(0), size(-1), flags(NoFlags) { } QDockAreaLayoutItem::QDockAreaLayoutItem(QDockAreaLayoutInfo *_subinfo) - : widgetItem(0), subinfo(_subinfo), placeHolderItem(0), pos(0), size(-1), flags(NoFlags) + : widgetItem(nullptr), subinfo(_subinfo), placeHolderItem(nullptr), pos(0), size(-1), flags(NoFlags) { } QDockAreaLayoutItem::QDockAreaLayoutItem(QPlaceHolderItem *_placeHolderItem) - : widgetItem(0), subinfo(0), placeHolderItem(_placeHolderItem), pos(0), size(-1), flags(NoFlags) + : widgetItem(nullptr), subinfo(nullptr), placeHolderItem(_placeHolderItem), pos(0), size(-1), flags(NoFlags) { } QDockAreaLayoutItem::QDockAreaLayoutItem(const QDockAreaLayoutItem &other) - : widgetItem(other.widgetItem), subinfo(0), placeHolderItem(0), pos(other.pos), + : widgetItem(other.widgetItem), subinfo(nullptr), placeHolderItem(nullptr), pos(other.pos), size(other.size), flags(other.flags) { - if (other.subinfo != 0) + if (other.subinfo != nullptr) subinfo = new QDockAreaLayoutInfo(*other.subinfo); - else if (other.placeHolderItem != 0) + else if (other.placeHolderItem != nullptr) placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem); } @@ -117,16 +117,16 @@ QDockAreaLayoutItem::~QDockAreaLayoutItem() bool QDockAreaLayoutItem::skip() const { - if (placeHolderItem != 0) + if (placeHolderItem != nullptr) return true; if (flags & GapItem) return false; - if (widgetItem != 0) + if (widgetItem != nullptr) return widgetItem->isEmpty(); - if (subinfo != 0) { + if (subinfo != nullptr) { for (int i = 0; i < subinfo->item_list.count(); ++i) { if (!subinfo->item_list.at(i).skip()) return false; @@ -140,7 +140,7 @@ QSize QDockAreaLayoutItem::minimumSize() const { if (widgetItem) return widgetItem->minimumSize().grownBy(widgetItem->widget()->contentsMargins()); - if (subinfo != 0) + if (subinfo != nullptr) return subinfo->minimumSize(); return QSize(0, 0); } @@ -149,7 +149,7 @@ QSize QDockAreaLayoutItem::maximumSize() const { if (widgetItem) return widgetItem->maximumSize().grownBy(widgetItem->widget()->contentsMargins()); - if (subinfo != 0) + if (subinfo != nullptr) return subinfo->maximumSize(); return QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); } @@ -161,22 +161,22 @@ bool QDockAreaLayoutItem::hasFixedSize(Qt::Orientation o) const bool QDockAreaLayoutItem::expansive(Qt::Orientation o) const { - if ((flags & GapItem) || placeHolderItem != 0) + if ((flags & GapItem) || placeHolderItem != nullptr) return false; - if (widgetItem != 0) + if (widgetItem != nullptr) return ((widgetItem->expandingDirections() & o) == o); - if (subinfo != 0) + if (subinfo != nullptr) return subinfo->expansive(o); return false; } QSize QDockAreaLayoutItem::sizeHint() const { - if (placeHolderItem != 0) + if (placeHolderItem != nullptr) return QSize(0, 0); if (widgetItem) return widgetItem->sizeHint().grownBy(widgetItem->widget()->contentsMargins()); - if (subinfo != 0) + if (subinfo != nullptr) return subinfo->sizeHint(); return QSize(-1, -1); } @@ -185,14 +185,14 @@ QDockAreaLayoutItem &QDockAreaLayoutItem::operator = (const QDockAreaLayoutItem &other) { widgetItem = other.widgetItem; - if (other.subinfo == 0) - subinfo = 0; + if (other.subinfo == nullptr) + subinfo = nullptr; else subinfo = new QDockAreaLayoutInfo(*other.subinfo); delete placeHolderItem; - if (other.placeHolderItem == 0) - placeHolderItem = 0; + if (other.placeHolderItem == nullptr) + placeHolderItem = nullptr; else placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem); @@ -210,7 +210,7 @@ QDockAreaLayoutItem #if QT_CONFIG(tabbar) static quintptr tabId(const QDockAreaLayoutItem &item) { - if (item.widgetItem == 0) + if (item.widgetItem == nullptr) return 0; return reinterpret_cast(item.widgetItem->widget()); } @@ -219,9 +219,9 @@ static quintptr tabId(const QDockAreaLayoutItem &item) static const int zero = 0; QDockAreaLayoutInfo::QDockAreaLayoutInfo() - : sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(0) + : sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(nullptr) #if QT_CONFIG(tabbar) - , tabbed(false), tabBar(0), tabBarShape(QTabBar::RoundedSouth) + , tabbed(false), tabBar(nullptr), tabBarShape(QTabBar::RoundedSouth) #endif { } @@ -231,7 +231,7 @@ QDockAreaLayoutInfo::QDockAreaLayoutInfo(const int *_sep, QInternal::DockPositio QMainWindow *window) : sep(_sep), dockPos(_dockPos), o(_o), mainWindow(window) #if QT_CONFIG(tabbar) - , tabbed(false), tabBar(0), tabBarShape(static_cast(tbshape)) + , tabbed(false), tabBar(nullptr), tabBarShape(static_cast(tbshape)) #endif { #if !QT_CONFIG(tabbar) @@ -250,7 +250,7 @@ void QDockAreaLayoutInfo::clear() rect = QRect(); #if QT_CONFIG(tabbar) tabbed = false; - tabBar = 0; + tabBar = nullptr; #endif } @@ -403,7 +403,7 @@ QSize QDockAreaLayoutInfo::sizeHint() const int a = 0, b = 0; int min_perp = 0; int max_perp = QWIDGETSIZE_MAX; - const QDockAreaLayoutItem *previous = 0; + const QDockAreaLayoutItem *previous = nullptr; for (int i = 0; i < item_list.size(); ++i) { const QDockAreaLayoutItem &item = item_list.at(i); if (item.skip()) @@ -552,7 +552,7 @@ void QDockAreaLayoutInfo::fitItems() int max_size = realMaxSize(*this); int last_index = -1; - const QDockAreaLayoutItem *previous = 0; + const QDockAreaLayoutItem *previous = nullptr; for (int i = 0; i < item_list.size(); ++i) { QDockAreaLayoutItem &item = item_list[i]; if (item.skip()) @@ -633,7 +633,7 @@ void QDockAreaLayoutInfo::fitItems() item.size = ls.size; item.pos = ls.pos; - if (item.subinfo != 0) { + if (item.subinfo != nullptr) { item.subinfo->rect = itemRect(i); item.subinfo->fitItems(); } @@ -771,7 +771,7 @@ QList QDockAreaLayoutInfo::gapIndex(const QPoint& _pos, if (item.pos + item.size < pos) continue; - if (item.subinfo != 0 + if (item.subinfo != nullptr #if QT_CONFIG(tabbar) && !item.subinfo->tabbed #endif @@ -967,7 +967,7 @@ int QDockAreaLayoutInfo::separatorMove(int index, int delta) const int separatorSpace = item.hasFixedSize(o) ? 0 : *sep; item.size = ls.size - separatorSpace; item.pos = ls.pos; - if (item.subinfo != 0) { + if (item.subinfo != nullptr) { item.subinfo->rect = itemRect(i); item.subinfo->fitItems(); } @@ -979,7 +979,7 @@ int QDockAreaLayoutInfo::separatorMove(int index, int delta) void QDockAreaLayoutInfo::unnest(int index) { QDockAreaLayoutItem &item = item_list[index]; - if (item.subinfo == 0) + if (item.subinfo == nullptr) return; if (item.subinfo->item_list.count() > 1) return; @@ -988,14 +988,14 @@ void QDockAreaLayoutInfo::unnest(int index) item_list.removeAt(index); } else if (item.subinfo->item_list.count() == 1) { QDockAreaLayoutItem &child = item.subinfo->item_list.first(); - if (child.widgetItem != 0) { + if (child.widgetItem != nullptr) { item.widgetItem = child.widgetItem; delete item.subinfo; - item.subinfo = 0; - } else if (child.subinfo != 0) { + item.subinfo = nullptr; + } else if (child.subinfo != nullptr) { QDockAreaLayoutInfo *tmp = item.subinfo; item.subinfo = child.subinfo; - child.subinfo = 0; + child.subinfo = nullptr; tmp->item_list.clear(); delete tmp; } @@ -1009,7 +1009,7 @@ void QDockAreaLayoutInfo::remove(const QList &path) if (path.count() > 1) { const int index = path.first(); QDockAreaLayoutItem &item = item_list[index]; - Q_ASSERT(item.subinfo != 0); + Q_ASSERT(item.subinfo != nullptr); item.subinfo->remove(path.mid(1)); unnest(index); } else { @@ -1028,13 +1028,13 @@ QLayoutItem *QDockAreaLayoutInfo::plug(const QList &path) if (path.count() > 1) { QDockAreaLayoutItem &item = item_list[index]; - Q_ASSERT(item.subinfo != 0); + Q_ASSERT(item.subinfo != nullptr); return item.subinfo->plug(path.mid(1)); } QDockAreaLayoutItem &item = item_list[index]; - Q_ASSERT(item.widgetItem != 0); + Q_ASSERT(item.widgetItem != nullptr); Q_ASSERT(item.flags & QDockAreaLayoutItem::GapItem); item.flags &= ~QDockAreaLayoutItem::GapItem; return item.widgetItem; @@ -1047,7 +1047,7 @@ QLayoutItem *QDockAreaLayoutInfo::unplug(const QList &path) const int index = path.first(); if (path.count() > 1) { QDockAreaLayoutItem &item = item_list[index]; - Q_ASSERT(item.subinfo != 0); + Q_ASSERT(item.subinfo != nullptr); return item.subinfo->unplug(path.mid(1)); } @@ -1078,7 +1078,7 @@ QLayoutItem *QDockAreaLayoutInfo::unplug(const QList &path) quintptr QDockAreaLayoutInfo::currentTabId() const { - if (!tabbed || tabBar == 0) + if (!tabbed || tabBar == nullptr) return 0; int index = tabBar->currentIndex(); @@ -1095,7 +1095,7 @@ void QDockAreaLayoutInfo::setCurrentTab(QWidget *widget) void QDockAreaLayoutInfo::setCurrentTabId(quintptr id) { - if (!tabbed || tabBar == 0) + if (!tabbed || tabBar == nullptr) return; for (int i = 0; i < tabBar->count(); ++i) { @@ -1114,7 +1114,7 @@ static QRect dockedGeometry(QWidget *widget) QDockWidgetLayout *layout = qobject_cast(widget->layout()); - if(layout != 0 && layout->nativeWindowDeco()) + if (layout && layout->nativeWindowDeco()) titleHeight = layout->titleHeight(); QRect result = widget->geometry(); @@ -1138,7 +1138,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList &path, QLayoutItem *dockWid if (path.count() > 1) { QDockAreaLayoutItem &item = item_list[index]; - if (item.subinfo == 0 + if (item.subinfo == nullptr #if QT_CONFIG(tabbar) || (item.subinfo->tabbed && !insert_tabbed) #endif @@ -1149,7 +1149,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList &path, QLayoutItem *dockWid QDockAreaLayoutInfo *subinfo = item.subinfo; QLayoutItem *widgetItem = item.widgetItem; QPlaceHolderItem *placeHolderItem = item.placeHolderItem; - QRect r = subinfo == 0 ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect; + QRect r = subinfo == nullptr ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect; Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal; #if !QT_CONFIG(tabbar) @@ -1160,11 +1160,11 @@ bool QDockAreaLayoutInfo::insertGap(const QList &path, QLayoutItem *dockWid //item become a new top-level item.subinfo = new_info; - item.widgetItem = 0; - item.placeHolderItem = 0; + item.widgetItem = nullptr; + item.placeHolderItem = nullptr; QDockAreaLayoutItem new_item - = widgetItem == 0 + = widgetItem == nullptr ? QDockAreaLayoutItem(subinfo) : widgetItem ? QDockAreaLayoutItem(widgetItem) : QDockAreaLayoutItem(placeHolderItem); new_item.size = pick(opposite, r.size()); @@ -1265,16 +1265,16 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(QWidget *widget) return this; #endif - if (item.widgetItem != 0 && item.widgetItem->widget() == widget) + if (item.widgetItem != nullptr && item.widgetItem->widget() == widget) return this; - if (item.subinfo != 0) { + if (item.subinfo != nullptr) { if (QDockAreaLayoutInfo *result = item.subinfo->info(widget)) return result; } } - return 0; + return nullptr; } QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList &path) @@ -1284,7 +1284,7 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList &path) index = -index - 1; if (index >= item_list.count()) return this; - if (path.count() == 1 || item_list[index].subinfo == 0) + if (path.count() == 1 || item_list[index].subinfo == nullptr) return this; return item_list[index].subinfo->info(path.mid(1)); } @@ -1341,7 +1341,7 @@ QRect QDockAreaLayoutInfo::itemRect(const QList &path) const const int index = path.first(); if (path.count() > 1) { const QDockAreaLayoutItem &item = item_list.at(index); - Q_ASSERT(item.subinfo != 0); + Q_ASSERT(item.subinfo != nullptr); return item.subinfo->itemRect(path.mid(1)); } @@ -1374,7 +1374,7 @@ QRect QDockAreaLayoutInfo::separatorRect(const QList &path) const const int index = path.first(); if (path.count() > 1) { const QDockAreaLayoutItem &item = item_list.at(index); - Q_ASSERT(item.subinfo != 0); + Q_ASSERT(item.subinfo != nullptr); return item.subinfo->separatorRect(path.mid(1)); } return separatorRect(index); @@ -1395,7 +1395,7 @@ QList QDockAreaLayoutInfo::findSeparator(const QPoint &_pos) const continue; if (item.pos + item.size > pos) { - if (item.subinfo != 0) { + if (item.subinfo != nullptr) { QList result = item.subinfo->findSeparator(_pos); if (!result.isEmpty()) { result.prepend(i); @@ -1428,7 +1428,7 @@ QList QDockAreaLayoutInfo::indexOfPlaceHolder(const QString &objectName) co for (int i = 0; i < item_list.size(); ++i) { const QDockAreaLayoutItem &item = item_list.at(i); - if (item.subinfo != 0) { + if (item.subinfo != nullptr) { QList result = item.subinfo->indexOfPlaceHolder(objectName); if (!result.isEmpty()) { result.prepend(i); @@ -1437,7 +1437,7 @@ QList QDockAreaLayoutInfo::indexOfPlaceHolder(const QString &objectName) co continue; } - if (item.placeHolderItem != 0 && item.placeHolderItem->objectName == objectName) { + if (item.placeHolderItem != nullptr && item.placeHolderItem->objectName == objectName) { QList result; result << i; return result; @@ -1452,10 +1452,10 @@ QList QDockAreaLayoutInfo::indexOf(QWidget *widget) const for (int i = 0; i < item_list.size(); ++i) { const QDockAreaLayoutItem &item = item_list.at(i); - if (item.placeHolderItem != 0) + if (item.placeHolderItem != nullptr) continue; - if (item.subinfo != 0) { + if (item.subinfo != nullptr) { QList result = item.subinfo->indexOf(widget); if (!result.isEmpty()) { result.prepend(i); @@ -1477,7 +1477,7 @@ QList QDockAreaLayoutInfo::indexOf(QWidget *widget) const QMainWindowLayout *QDockAreaLayoutInfo::mainWindowLayout() const { QMainWindowLayout *result = qt_mainwindow_layout(mainWindow); - Q_ASSERT(result != 0); + Q_ASSERT(result != nullptr); return result; } @@ -1536,7 +1536,7 @@ QDockWidget *QDockAreaLayoutInfo::apply(bool animate) if (item.flags & QDockAreaLayoutItem::GapItem) continue; - if (item.subinfo != 0) { + if (item.subinfo != nullptr) { item.subinfo->apply(animate); continue; } @@ -1681,7 +1681,7 @@ void QDockAreaLayoutInfo::tab(int index, QLayoutItem *dockWidgetItem) = new QDockAreaLayoutInfo(sep, dockPos, o, tabBarShape, mainWindow); item_list[index].subinfo = new_info; new_info->item_list.append(QDockAreaLayoutItem(item_list.at(index).widgetItem)); - item_list[index].widgetItem = 0; + item_list[index].widgetItem = nullptr; new_info->item_list.append(QDockAreaLayoutItem(dockWidgetItem)); new_info->tabbed = true; new_info->updateTabBar(); @@ -1703,7 +1703,7 @@ void QDockAreaLayoutInfo::split(int index, Qt::Orientation orientation, = new QDockAreaLayoutInfo(sep, dockPos, orientation, tabBarShape, mainWindow); item_list[index].subinfo = new_info; new_info->item_list.append(QDockAreaLayoutItem(item_list.at(index).widgetItem)); - item_list[index].widgetItem = 0; + item_list[index].widgetItem = nullptr; new_info->item_list.append(QDockAreaLayoutItem(dockWidgetItem)); } } @@ -1714,7 +1714,7 @@ QDockAreaLayoutItem &QDockAreaLayoutInfo::item(const QList &path) const int index = path.first(); if (path.count() > 1) { const QDockAreaLayoutItem &item = item_list[index]; - Q_ASSERT(item.subinfo != 0); + Q_ASSERT(item.subinfo != nullptr); return item.subinfo->item(path.mid(1)); } return item_list[index]; @@ -1724,7 +1724,7 @@ QLayoutItem *QDockAreaLayoutInfo::itemAt(int *x, int index) const { for (int i = 0; i < item_list.count(); ++i) { const QDockAreaLayoutItem &item = item_list.at(i); - if (item.placeHolderItem != 0) + if (item.placeHolderItem != nullptr) continue; if (item.subinfo) { if (QLayoutItem *ret = item.subinfo->itemAt(x, index)) @@ -1734,14 +1734,14 @@ QLayoutItem *QDockAreaLayoutInfo::itemAt(int *x, int index) const return item.widgetItem; } } - return 0; + return nullptr; } QLayoutItem *QDockAreaLayoutInfo::takeAt(int *x, int index) { for (int i = 0; i < item_list.count(); ++i) { QDockAreaLayoutItem &item = item_list[i]; - if (item.placeHolderItem != 0) + if (item.placeHolderItem != nullptr) continue; else if (item.subinfo) { if (QLayoutItem *ret = item.subinfo->takeAt(x, index)) { @@ -1752,14 +1752,14 @@ QLayoutItem *QDockAreaLayoutInfo::takeAt(int *x, int index) if ((*x)++ == index) { item.placeHolderItem = new QPlaceHolderItem(item.widgetItem->widget()); QLayoutItem *ret = item.widgetItem; - item.widgetItem = 0; + item.widgetItem = nullptr; if (item.size != -1) item.flags |= QDockAreaLayoutItem::KeepSize; return ret; } } } - return 0; + return nullptr; } void QDockAreaLayoutInfo::deleteAllLayoutItems() @@ -1770,7 +1770,7 @@ void QDockAreaLayoutInfo::deleteAllLayoutItems() item.subinfo->deleteAllLayoutItems(); } else { delete item.widgetItem; - item.widgetItem = 0; + item.widgetItem = nullptr; } } } @@ -1801,7 +1801,7 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const for (int i = 0; i < item_list.count(); ++i) { const QDockAreaLayoutItem &item = item_list.at(i); - if (item.widgetItem != 0) { + if (item.widgetItem != nullptr) { stream << (uchar) WidgetMarker; QWidget *w = item.widgetItem->widget(); QString name = w->objectName(); @@ -1825,7 +1825,7 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const stream << item.pos << item.size << pick(o, item.minimumSize()) << pick(o, item.maximumSize()); } - } else if (item.placeHolderItem != 0) { + } else if (item.placeHolderItem != nullptr) { stream << (uchar) WidgetMarker; stream << item.placeHolderItem->objectName; uchar flags = 0; @@ -1840,7 +1840,7 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const } else { stream << item.pos << item.size << (int)0 << (int)0; } - } else if (item.subinfo != 0) { + } else if (item.subinfo != nullptr) { stream << (uchar) SequenceMarker << item.pos << item.size << pick(o, item.minimumSize()) << pick(o, item.maximumSize()); item.subinfo->saveState(stream); } @@ -1894,7 +1894,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList continue; } - QDockWidget *widget = 0; + QDockWidget *widget = nullptr; for (int j = 0; j < widgets.count(); ++j) { if (widgets.at(j)->objectName() == name) { widget = widgets.takeAt(j); @@ -1902,7 +1902,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList } } - if (widget == 0) { + if (widget == nullptr) { QPlaceHolderItem *placeHolder = new QPlaceHolderItem; QDockAreaLayoutItem item(placeHolder); @@ -2081,7 +2081,7 @@ bool QDockAreaLayoutInfo::updateTabBar() const QDockAreaLayoutInfo *that = const_cast(this); - if (that->tabBar == 0) { + if (that->tabBar == nullptr) { that->tabBar = mainWindowLayout()->getTabBar(); that->tabBar->setShape(static_cast(tabBarShape)); that->tabBar->setDrawBase(true); @@ -2101,7 +2101,7 @@ bool QDockAreaLayoutInfo::updateTabBar() const gap = true; continue; } - if (item.widgetItem == 0) + if (item.widgetItem == nullptr) continue; QDockWidget *dw = qobject_cast(item.widgetItem->widget()); @@ -2155,12 +2155,12 @@ void QDockAreaLayoutInfo::setTabBarShape(int shape) if (shape == tabBarShape) return; tabBarShape = shape; - if (tabBar != 0) + if (tabBar != nullptr) tabBar->setShape(static_cast(shape)); for (int i = 0; i < item_list.count(); ++i) { QDockAreaLayoutItem &item = item_list[i]; - if (item.subinfo != 0) + if (item.subinfo != nullptr) item.subinfo->setTabBarShape(shape); } } @@ -2192,7 +2192,7 @@ QSet QDockAreaLayoutInfo::usedTabBars() const for (int i = 0; i < item_list.count(); ++i) { const QDockAreaLayoutItem &item = item_list.at(i); - if (item.subinfo != 0) + if (item.subinfo != nullptr) result += item.subinfo->usedTabBars(); } @@ -2212,7 +2212,7 @@ QSet QDockAreaLayoutInfo::usedSeparatorWidgets() const for (int i = 0; i < item_list.count(); ++i) { const QDockAreaLayoutItem &item = item_list.at(i); - if (item.subinfo != 0) + if (item.subinfo != nullptr) result += item.subinfo->usedSeparatorWidgets(); } @@ -2277,7 +2277,7 @@ void QDockAreaLayoutInfo::moveTab(int from, int to) QDockAreaLayout::QDockAreaLayout(QMainWindow *win) : fallbackToSizeHints(true) { mainWindow = win; - sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, win); + sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, nullptr, win); #if QT_CONFIG(tabbar) const int tabShape = QTabBar::RoundedSouth; #else @@ -2291,7 +2291,7 @@ QDockAreaLayout::QDockAreaLayout(QMainWindow *win) : fallbackToSizeHints(true) = QDockAreaLayoutInfo(&sep, QInternal::TopDock, Qt::Horizontal, tabShape, win); docks[QInternal::BottomDock] = QDockAreaLayoutInfo(&sep, QInternal::BottomDock, Qt::Horizontal, tabShape, win); - centralWidgetItem = 0; + centralWidgetItem = nullptr; corners[Qt::TopLeftCorner] = Qt::TopDockWidgetArea; @@ -2491,7 +2491,7 @@ QDockAreaLayoutInfo *QDockAreaLayout::info(QWidget *widget) return result; } - return 0; + return nullptr; } QDockAreaLayoutInfo *QDockAreaLayout::info(const QList &path) @@ -2623,7 +2623,7 @@ void QDockAreaLayout::getGrid(QVector *_ver_struct_list, QSize center_hint(0, 0); QSize center_min(0, 0); QSize center_max(0, 0); - const bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty(); + const bool have_central = centralWidgetItem != nullptr && !centralWidgetItem->isEmpty(); if (have_central) { center_hint = centralWidgetRect.size(); if (!center_hint.isValid()) @@ -2670,7 +2670,7 @@ void QDockAreaLayout::getGrid(QVector *_ver_struct_list, QSize bottom_max = docks[QInternal::BottomDock].maximumSize(); bottom_hint = bottom_hint.boundedTo(bottom_max).expandedTo(bottom_min); - if (_ver_struct_list != 0) { + if (_ver_struct_list != nullptr) { QVector &ver_struct_list = *_ver_struct_list; ver_struct_list.resize(3); @@ -2732,7 +2732,7 @@ void QDockAreaLayout::getGrid(QVector *_ver_struct_list, ver_struct_list[1].maximumSize = QWIDGETSIZE_MAX; } - if (_hor_struct_list != 0) { + if (_hor_struct_list != nullptr) { QVector &hor_struct_list = *_hor_struct_list; hor_struct_list.resize(3); @@ -2803,7 +2803,7 @@ void QDockAreaLayout::setGrid(QVector *ver_struct_list, if (!docks[QInternal::TopDock].isEmpty()) { QRect r = docks[QInternal::TopDock].rect; - if (hor_struct_list != 0) { + if (hor_struct_list != nullptr) { r.setLeft(corners[Qt::TopLeftCorner] == Qt::TopDockWidgetArea || docks[QInternal::LeftDock].isEmpty() ? rect.left() : hor_struct_list->at(1).pos); @@ -2811,7 +2811,7 @@ void QDockAreaLayout::setGrid(QVector *ver_struct_list, || docks[QInternal::RightDock].isEmpty() ? rect.right() : hor_struct_list->at(2).pos - sep - 1); } - if (ver_struct_list != 0) { + if (ver_struct_list != nullptr) { r.setTop(rect.top()); r.setBottom(ver_struct_list->at(1).pos - sep - 1); } @@ -2823,7 +2823,7 @@ void QDockAreaLayout::setGrid(QVector *ver_struct_list, if (!docks[QInternal::BottomDock].isEmpty()) { QRect r = docks[QInternal::BottomDock].rect; - if (hor_struct_list != 0) { + if (hor_struct_list != nullptr) { r.setLeft(corners[Qt::BottomLeftCorner] == Qt::BottomDockWidgetArea || docks[QInternal::LeftDock].isEmpty() ? rect.left() : hor_struct_list->at(1).pos); @@ -2831,7 +2831,7 @@ void QDockAreaLayout::setGrid(QVector *ver_struct_list, || docks[QInternal::RightDock].isEmpty() ? rect.right() : hor_struct_list->at(2).pos - sep - 1); } - if (ver_struct_list != 0) { + if (ver_struct_list != nullptr) { r.setTop(ver_struct_list->at(2).pos); r.setBottom(rect.bottom()); } @@ -2843,11 +2843,11 @@ void QDockAreaLayout::setGrid(QVector *ver_struct_list, if (!docks[QInternal::LeftDock].isEmpty()) { QRect r = docks[QInternal::LeftDock].rect; - if (hor_struct_list != 0) { + if (hor_struct_list != nullptr) { r.setLeft(rect.left()); r.setRight(hor_struct_list->at(1).pos - sep - 1); } - if (ver_struct_list != 0) { + if (ver_struct_list != nullptr) { r.setTop(corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea || docks[QInternal::TopDock].isEmpty() ? rect.top() : ver_struct_list->at(1).pos); @@ -2863,11 +2863,11 @@ void QDockAreaLayout::setGrid(QVector *ver_struct_list, if (!docks[QInternal::RightDock].isEmpty()) { QRect r = docks[QInternal::RightDock].rect; - if (hor_struct_list != 0) { + if (hor_struct_list != nullptr) { r.setLeft(hor_struct_list->at(2).pos); r.setRight(rect.right()); } - if (ver_struct_list != 0) { + if (ver_struct_list != nullptr) { r.setTop(corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea || docks[QInternal::TopDock].isEmpty() ? rect.top() : ver_struct_list->at(1).pos); @@ -2881,11 +2881,11 @@ void QDockAreaLayout::setGrid(QVector *ver_struct_list, // center --------------------------------------------------- - if (hor_struct_list != 0) { + if (hor_struct_list != nullptr) { centralWidgetRect.setLeft(hor_struct_list->at(1).pos); centralWidgetRect.setWidth(hor_struct_list->at(1).size); } - if (ver_struct_list != 0) { + if (ver_struct_list != nullptr) { centralWidgetRect.setTop(ver_struct_list->at(1).pos); centralWidgetRect.setHeight(ver_struct_list->at(1).size); } @@ -2919,7 +2919,7 @@ QSize QDockAreaLayout::sizeHint() const int top_sep = 0; int bottom_sep = 0; - if (centralWidgetItem != 0) { + if (centralWidgetItem != nullptr) { left_sep = docks[QInternal::LeftDock].isEmpty() ? 0 : sep; right_sep = docks[QInternal::RightDock].isEmpty() ? 0 : sep; top_sep = docks[QInternal::TopDock].isEmpty() ? 0 : sep; @@ -2930,7 +2930,7 @@ QSize QDockAreaLayout::sizeHint() const QSize right = docks[QInternal::RightDock].sizeHint() + QSize(right_sep, 0); QSize top = docks[QInternal::TopDock].sizeHint() + QSize(0, top_sep); QSize bottom = docks[QInternal::BottomDock].sizeHint() + QSize(0, bottom_sep); - QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->sizeHint(); + QSize center = centralWidgetItem == nullptr ? QSize(0, 0) : centralWidgetItem->sizeHint(); int row1 = top.width(); int row2 = left.width() + center.width() + right.width(); @@ -2969,7 +2969,7 @@ QSize QDockAreaLayout::minimumSize() const int top_sep = 0; int bottom_sep = 0; - if (centralWidgetItem != 0) { + if (centralWidgetItem != nullptr) { left_sep = docks[QInternal::LeftDock].isEmpty() ? 0 : sep; right_sep = docks[QInternal::RightDock].isEmpty() ? 0 : sep; top_sep = docks[QInternal::TopDock].isEmpty() ? 0 : sep; @@ -2980,7 +2980,7 @@ QSize QDockAreaLayout::minimumSize() const QSize right = docks[QInternal::RightDock].minimumSize() + QSize(right_sep, 0); QSize top = docks[QInternal::TopDock].minimumSize() + QSize(0, top_sep); QSize bottom = docks[QInternal::BottomDock].minimumSize() + QSize(0, bottom_sep); - QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->minimumSize(); + QSize center = centralWidgetItem == nullptr ? QSize(0, 0) : centralWidgetItem->minimumSize(); int row1 = top.width(); int row2 = left.width() + center.width() + right.width(); @@ -3040,7 +3040,7 @@ QRect QDockAreaLayout::constrainedRect(QRect rect, QWidget* widget) bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget) { - QDockAreaLayoutItem *item = 0; + QDockAreaLayoutItem *item = nullptr; const auto groups = mainWindow->findChildren(QString(), Qt::FindDirectChildrenOnly); for (QDockWidgetGroupWindow *dwgw : groups) { @@ -3059,7 +3059,7 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget) } QPlaceHolderItem *placeHolder = item->placeHolderItem; - Q_ASSERT(placeHolder != 0); + Q_ASSERT(placeHolder != nullptr); item->widgetItem = new QDockWidgetItem(dockWidget); @@ -3069,7 +3069,7 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget) } dockWidget->setVisible(!placeHolder->hidden); - item->placeHolderItem = 0; + item->placeHolderItem = nullptr; delete placeHolder; return true; @@ -3116,7 +3116,7 @@ void QDockAreaLayout::tabifyDockWidget(QDockWidget *first, QDockWidget *second) return; QDockAreaLayoutInfo *info = this->info(path); - Q_ASSERT(info != 0); + Q_ASSERT(info != nullptr); info->tab(path.last(), new QDockWidgetItem(second)); removePlaceHolder(second->objectName()); @@ -3181,7 +3181,7 @@ void QDockAreaLayout::splitDockWidget(QDockWidget *after, return; QDockAreaLayoutInfo *info = this->info(path); - Q_ASSERT(info != 0); + Q_ASSERT(info != nullptr); info->split(path.last(), orientation, new QDockWidgetItem(dockWidget)); removePlaceHolder(dockWidget->objectName()); @@ -3193,7 +3193,7 @@ void QDockAreaLayout::apply(bool animate) for (int i = 0; i < QInternal::DockCount; ++i) docks[i].apply(animate); - if (centralWidgetItem != 0 && !centralWidgetItem->isEmpty()) { + if (centralWidgetItem != nullptr && !centralWidgetItem->isEmpty()) { widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect, animate); } @@ -3255,9 +3255,9 @@ int QDockAreaLayout::separatorMove(const QList &separator, const QPoint &or QVector list; if (index == QInternal::LeftDock || index == QInternal::RightDock) - getGrid(0, &list); + getGrid(nullptr, &list); else - getGrid(&list, 0); + getGrid(&list, nullptr); int sep_index = index == QInternal::LeftDock || index == QInternal::TopDock ? 0 : 1; @@ -3271,9 +3271,9 @@ int QDockAreaLayout::separatorMove(const QList &separator, const QPoint &or fallbackToSizeHints = false; if (index == QInternal::LeftDock || index == QInternal::RightDock) - setGrid(0, &list); + setGrid(nullptr, &list); else - setGrid(&list, 0); + setGrid(&list, nullptr); apply(false); @@ -3330,7 +3330,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const { - Q_ASSERT(x != 0); + Q_ASSERT(x != nullptr); for (int i = 0; i < QInternal::DockCount; ++i) { const QDockAreaLayoutInfo &dock = docks[i]; @@ -3341,12 +3341,12 @@ QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const if (centralWidgetItem && (*x)++ == index) return centralWidgetItem; - return 0; + return nullptr; } QLayoutItem *QDockAreaLayout::takeAt(int *x, int index) { - Q_ASSERT(x != 0); + Q_ASSERT(x != nullptr); for (int i = 0; i < QInternal::DockCount; ++i) { QDockAreaLayoutInfo &dock = docks[i]; @@ -3356,11 +3356,11 @@ QLayoutItem *QDockAreaLayout::takeAt(int *x, int index) if (centralWidgetItem && (*x)++ == index) { QLayoutItem *ret = centralWidgetItem; - centralWidgetItem = 0; + centralWidgetItem = nullptr; return ret; } - return 0; + return nullptr; } void QDockAreaLayout::deleteAllLayoutItems() @@ -3399,7 +3399,7 @@ QSet QDockAreaLayout::usedSeparatorWidgets() const QRect QDockAreaLayout::gapRect(const QList &path) const { const QDockAreaLayoutInfo *info = this->info(path); - if (info == 0) + if (info == nullptr) return QRect(); int index = path.last(); if (index < 0 || index >= info->item_list.count()) @@ -3419,7 +3419,7 @@ void QDockAreaLayout::keepSize(QDockWidget *w) void QDockAreaLayout::styleChangedEvent() { - sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainWindow); + sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, nullptr, mainWindow); if (isValid()) fitLayout(); } diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index bcbd3dd2d4..299e5da8d3 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -197,7 +197,7 @@ QSize QDockWidgetTitleButton::sizeHint() const { ensurePolished(); - int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this); + int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, nullptr, this); if (!icon().isNull()) { const QSize sz = icon().actualSize(dockButtonIconSize()); size += qMax(sz.width(), sz.height()); @@ -226,7 +226,7 @@ void QDockWidgetTitleButton::paintEvent(QPaintEvent *) opt.init(this); opt.state |= QStyle::State_AutoRaise; - if (style()->styleHint(QStyle::SH_DockWidget_ButtonsHaveFrame, 0, this)) + if (style()->styleHint(QStyle::SH_DockWidget_ButtonsHaveFrame, nullptr, this)) { if (isEnabled() && underMouse() && !isChecked() && !isDown()) opt.state |= QStyle::State_Raised; @@ -311,12 +311,12 @@ QLayoutItem *QDockWidgetLayout::itemAt(int index) const int cnt = 0; for (int i = 0; i < item_list.count(); ++i) { QLayoutItem *item = item_list.at(i); - if (item == 0) + if (item == nullptr) continue; if (index == cnt++) return item; } - return 0; + return nullptr; } QLayoutItem *QDockWidgetLayout::takeAt(int index) @@ -324,7 +324,7 @@ QLayoutItem *QDockWidgetLayout::takeAt(int index) int j = 0; for (int i = 0; i < item_list.count(); ++i) { QLayoutItem *item = item_list.at(i); - if (item == 0) + if (item == nullptr) continue; if (index == j) { item_list[i] = 0; @@ -333,7 +333,7 @@ QLayoutItem *QDockWidgetLayout::takeAt(int index) } ++j; } - return 0; + return nullptr; } int QDockWidgetLayout::count() const @@ -362,7 +362,7 @@ QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) co const bool nativeDeco = nativeWindowDeco(floating); int fw = floating && !nativeDeco - ? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, w) + ? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, w) : 0; const int th = titleHeight(); @@ -394,7 +394,7 @@ QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) co uint explicitMin = 0; uint explicitMax = 0; - if (w->d_func()->extra != 0) { + if (w->d_func()->extra != nullptr) { explicitMin = w->d_func()->extra->explicitMinSize; explicitMax = w->d_func()->extra->explicitMaxSize; } @@ -448,7 +448,7 @@ QSize QDockWidgetLayout::minimumSize() const QWidget *QDockWidgetLayout::widgetForRole(Role r) const { QLayoutItem *item = item_list.at(r); - return item == 0 ? 0 : item->widget(); + return item == nullptr ? nullptr : item->widget(); } QLayoutItem *QDockWidgetLayout::itemForRole(Role r) const @@ -459,12 +459,12 @@ QLayoutItem *QDockWidgetLayout::itemForRole(Role r) const void QDockWidgetLayout::setWidgetForRole(Role r, QWidget *w) { QWidget *old = widgetForRole(r); - if (old != 0) { + if (old != nullptr) { old->hide(); removeWidget(old); } - if (w != 0) { + if (w != nullptr) { addChildWidget(w); item_list[r] = new QWidgetItemV2(w); w->show(); @@ -505,8 +505,8 @@ int QDockWidgetLayout::minimumTitleWidth() const int titleHeight = this->titleHeight(); - int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q); - int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q); + int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, nullptr, q); + int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q); return pick(verticalTitleBar, closeSize) + pick(verticalTitleBar, floatSize) @@ -531,7 +531,7 @@ int QDockWidgetLayout::titleHeight() const perp(verticalTitleBar, floatSize)); QFontMetrics titleFontMetrics = q->fontMetrics(); - int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q); + int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, nullptr, q); return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw); } @@ -543,7 +543,7 @@ void QDockWidgetLayout::setGeometry(const QRect &geometry) bool nativeDeco = nativeWindowDeco(); int fw = q->isFloating() && !nativeDeco - ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q) + ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q) : 0; if (nativeDeco) { @@ -730,7 +730,7 @@ void QDockWidgetPrivate::updateButtons() QStyleOptionDockWidget opt; q->initStyleOption(&opt); - bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0; + bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != nullptr; bool nativeDeco = dwLayout->nativeWindowDeco(); bool hideButtons = nativeDeco || customTitleBar; @@ -777,18 +777,18 @@ void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca) { Q_Q(QDockWidget); - if (state != 0) + if (state != nullptr) return; QMainWindowLayout *layout = qt_mainwindow_layout_from_dock(q); - Q_ASSERT(layout != 0); - if (layout->pluggingWidget != 0) // the main window is animating a docking operation + Q_ASSERT(layout != nullptr); + if (layout->pluggingWidget != nullptr) // the main window is animating a docking operation return; state = new QDockWidgetPrivate::DragState; state->pressPos = pos; state->dragging = false; - state->widgetItem = 0; + state->widgetItem = nullptr; state->ownWidgetItem = false; state->nca = nca; state->ctrlDrag = false; @@ -804,14 +804,14 @@ void QDockWidgetPrivate::startDrag(bool group) { Q_Q(QDockWidget); - if (state == 0 || state->dragging) + if (state == nullptr || state->dragging) return; QMainWindowLayout *layout = qt_mainwindow_layout_from_dock(q); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); state->widgetItem = layout->unplug(q, group); - if (state->widgetItem == 0) { + if (state->widgetItem == nullptr) { /* I have a QMainWindow parent, but I was never inserted with QMainWindow::addDockWidget, so the QMainWindowLayout has no widget item for me. :( I have to create it myself, and then @@ -838,7 +838,7 @@ void QDockWidgetPrivate::startDrag(bool group) void QDockWidgetPrivate::endDrag(bool abort) { Q_Q(QDockWidget); - Q_ASSERT(state != 0); + Q_ASSERT(state != nullptr); q->releaseMouse(); @@ -881,7 +881,7 @@ void QDockWidgetPrivate::endDrag(bool abort) } } delete state; - state = 0; + state = nullptr; } void QDockWidgetPrivate::setResizerActive(bool active) @@ -900,7 +900,7 @@ bool QDockWidgetPrivate::isAnimating() const Q_Q(const QDockWidget); QMainWindowLayout *mainWinLayout = qt_mainwindow_layout_from_dock(q); - if (mainWinLayout == 0) + if (mainWinLayout == nullptr) return false; return (const void*)mainWinLayout->pluggingWidget == (const void*)q; @@ -925,7 +925,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event) // is not (but allow moving if the window is floating) (!hasFeature(this, QDockWidget::DockWidgetMovable) && !q->isFloating()) || (qobject_cast(parent) == 0 && !floatingTab) || - isAnimating() || state != 0) { + isAnimating() || state != nullptr) { return false; } @@ -972,7 +972,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) QMainWindowLayout *mwlayout = qt_mainwindow_layout_from_dock(q); if (!dwlayout->nativeWindowDeco()) { if (!state->dragging - && mwlayout->pluggingWidget == 0 + && mwlayout->pluggingWidget == nullptr && (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) { startDrag(); @@ -1019,7 +1019,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) { Q_Q(QDockWidget); - int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q); + int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q); QWidget *tl = q->topLevelWidget(); QRect geo = tl->geometry(); @@ -1035,21 +1035,21 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) case QEvent::NonClientAreaMouseButtonPress: if (!titleRect.contains(event->globalPos())) break; - if (state != 0) + if (state != nullptr) break; if (qobject_cast(parent) == 0 && qobject_cast(parent) == 0) break; if (isAnimating()) break; initDrag(event->pos(), true); - if (state == 0) + if (state == nullptr) break; state->ctrlDrag = (event->modifiers() & Qt::ControlModifier) || (!hasFeature(this, QDockWidget::DockWidgetMovable) && q->isFloating()); startDrag(); break; case QEvent::NonClientAreaMouseMove: - if (state == 0 || !state->dragging) + if (state == nullptr || !state->dragging) break; #ifndef Q_OS_MAC @@ -1085,7 +1085,7 @@ void QDockWidgetPrivate::moveEvent(QMoveEvent *event) { Q_Q(QDockWidget); - if (state == 0 || !state->dragging || !state->nca) + if (state == nullptr || !state->dragging || !state->nca) return; if (!q->isWindow() && qobject_cast(parent) == 0) @@ -1098,7 +1098,7 @@ void QDockWidgetPrivate::moveEvent(QMoveEvent *event) return; QMainWindowLayout *layout = qt_mainwindow_layout_from_dock(q); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); QPoint globalMousePos = event->pos() + state->pressPos; layout->hover(state->widgetItem, globalMousePos); @@ -1384,7 +1384,7 @@ void QDockWidget::setFloating(bool floating) Q_D(QDockWidget); // the initial click of a double-click may have started a drag... - if (d->state != 0) + if (d->state != nullptr) d->endDrag(true); QRect r = d->undockedGeometry; @@ -1479,7 +1479,7 @@ void QDockWidget::paintEvent(QPaintEvent *event) QDockWidgetLayout *layout = qobject_cast(this->layout()); - bool customTitleBar = layout->widgetForRole(QDockWidgetLayout::TitleBar) != 0; + bool customTitleBar = layout->widgetForRole(QDockWidgetLayout::TitleBar) != nullptr; bool nativeDeco = layout->nativeWindowDeco(); if (!nativeDeco && !customTitleBar) { @@ -1516,7 +1516,7 @@ bool QDockWidget::event(QEvent *event) switch (event->type()) { #ifndef QT_NO_ACTION case QEvent::Hide: - if (layout != 0) + if (layout != nullptr) layout->keepSize(this); d->toggleViewAction->setChecked(false); emit visibilityChanged(false); @@ -1542,12 +1542,12 @@ bool QDockWidget::event(QEvent *event) break; case QEvent::ZOrderChange: { bool onTop = false; - if (win != 0) { + if (win != nullptr) { const QObjectList &siblings = win->children(); onTop = siblings.count() > 0 && siblings.last() == (QObject*)this; } #if QT_CONFIG(tabbar) - if (!isFloating() && layout != 0 && onTop) + if (!isFloating() && layout != nullptr && onTop) layout->raise(this); #endif break; @@ -1591,7 +1591,7 @@ bool QDockWidget::event(QEvent *event) break; case QEvent::Resize: // if the mainwindow is plugging us, we don't want to update undocked geometry - if (isFloating() && layout != 0 && layout->pluggingWidget != this) + if (isFloating() && layout != nullptr && layout->pluggingWidget != this) d->undockedGeometry = geometry(); // Usually the window won't get resized while it's being moved, but it can happen, diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index e69366d7c8..ee4095cb36 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -93,7 +93,7 @@ private: QElapsedTimer checkTime; }; -static QAlphaWidget* q_blend = 0; +static QAlphaWidget* q_blend = nullptr; /* Constructs a QAlphaWidget. @@ -285,7 +285,7 @@ void QAlphaWidget::render() lower(); } } - q_blend = 0; + q_blend = nullptr; deleteLater(); } else { alphaBlend(); @@ -377,13 +377,13 @@ private: QPixmap pm; }; -static QRollEffect* q_roll = 0; +static QRollEffect* q_roll = nullptr; /* Construct a QRollEffect widget. */ QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient) - : QWidget(0, f), orientation(orient) + : QWidget(nullptr, f), orientation(orient) { #ifndef Q_OS_WIN setEnabled(false); @@ -550,7 +550,7 @@ void QRollEffect::scroll() lower(); } } - q_roll = 0; + q_roll = nullptr; deleteLater(); } } @@ -563,7 +563,7 @@ void qScrollEffect(QWidget* w, QEffects::DirFlags orient, int time) { if (q_roll) { q_roll->deleteLater(); - q_roll = 0; + q_roll = nullptr; } if (!w) @@ -585,7 +585,7 @@ void qFadeEffect(QWidget* w, int time) { if (q_blend) { q_blend->deleteLater(); - q_blend = 0; + q_blend = nullptr; } if (!w) diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp index ee24e92c7e..4d64c24db3 100644 --- a/src/widgets/widgets/qfocusframe.cpp +++ b/src/widgets/widgets/qfocusframe.cpp @@ -55,8 +55,8 @@ class QFocusFramePrivate : public QWidgetPrivate bool showFrameAboveWidget; public: QFocusFramePrivate() { - widget = 0; - frameParent = 0; + widget = nullptr; + frameParent = nullptr; sendChildEvents = false; showFrameAboveWidget = false; } @@ -159,7 +159,7 @@ QFocusFrame::QFocusFrame(QWidget *parent) setAttribute(Qt::WA_TransparentForMouseEvents); setFocusPolicy(Qt::NoFocus); setAttribute(Qt::WA_NoChildEventsForParent, true); - setAttribute(Qt::WA_AcceptDrops, style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, 0, this)); + setAttribute(Qt::WA_AcceptDrops, style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, nullptr, this)); } /*! @@ -184,7 +184,7 @@ QFocusFrame::setWidget(QWidget *widget) { Q_D(QFocusFrame); - if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, 0, this)) + if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, nullptr, this)) d->showFrameAboveWidget = true; else d->showFrameAboveWidget = false; @@ -205,7 +205,7 @@ QFocusFrame::setWidget(QWidget *widget) d->widget = widget; d->widget->installEventFilter(this); QWidget *p = widget->parentWidget(); - QWidget *prev = 0; + QWidget *prev = nullptr; if (d->showFrameAboveWidget) { // Find the right parent for the focus frame. while (p) { @@ -231,7 +231,7 @@ QFocusFrame::setWidget(QWidget *widget) } d->update(); } else { - d->widget = 0; + d->widget = nullptr; hide(); } } @@ -290,7 +290,7 @@ QFocusFrame::eventFilter(QObject *o, QEvent *e) case QEvent::ParentChange: if (d->showFrameAboveWidget) { QWidget *w = d->widget; - setWidget(0); + setWidget(nullptr); setWidget(w); } else { d->update(); @@ -304,13 +304,13 @@ QFocusFrame::eventFilter(QObject *o, QEvent *e) setPalette(d->widget->palette()); break; case QEvent::ZOrderChange: - if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, 0, this)) + if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, nullptr, this)) raise(); else stackUnder(d->widget); break; case QEvent::Destroy: - setWidget(0); + setWidget(nullptr); break; default: break; diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index f7fe072302..048fe42948 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -424,8 +424,8 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason) Q_Q(QGroupBox); QWidget *fw = q->focusWidget(); if (!fw || fw == q) { - QWidget * best = 0; - QWidget * candidate = 0; + QWidget * best = nullptr; + QWidget * candidate = nullptr; QWidget * w = q; while ((w = w->nextInFocusChain()) != q) { if (q->isAncestorOf(w) && (w->focusPolicy() & Qt::TabFocus) == Qt::TabFocus && w->isVisibleTo(q)) { diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 282714843c..3ddada4514 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -51,7 +51,7 @@ class QLCDNumberPrivate : public QFramePrivate public: void init(); void internalSetString(const QString& s); - void drawString(const QString& s, QPainter &, QBitArray * = 0, bool = true); + void drawString(const QString& s, QPainter &, QBitArray * = nullptr, bool = true); //void drawString(const QString &, QPainter &, QBitArray * = 0) const; void drawDigit(const QPoint &, QPainter &, int, char, char = ' '); void drawSegment(const QPoint &, char, QPainter &, int, bool = false); @@ -212,7 +212,7 @@ static QString double2string(double num, int base, int ndigits, bool *oflow) *oflow = true; return s; } - s = int2string((int)num, base, ndigits, 0); + s = int2string((int)num, base, ndigits, nullptr); } else { // decimal base int nd = ndigits; do { @@ -706,7 +706,7 @@ void QLCDNumber::paintEvent(QPaintEvent *) if (d->smallPoint) d->drawString(d->digitStr, p, &d->points, false); else - d->drawString(d->digitStr, p, 0, false); + d->drawString(d->digitStr, p, nullptr, false); } diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index dc767cdae6..bcd6614ee4 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -446,7 +446,7 @@ void QLineEdit::addAction(QAction *action, ActionPosition position) { Q_D(QLineEdit); QWidget::addAction(action); - d->addAction(action, 0, position); + d->addAction(action, nullptr, position); } /*! @@ -640,15 +640,15 @@ void QLineEdit::setCompleter(QCompleter *c) if (c == d->control->completer()) return; if (d->control->completer()) { - disconnect(d->control->completer(), 0, this, 0); - d->control->completer()->setWidget(0); + disconnect(d->control->completer(), nullptr, this, nullptr); + d->control->completer()->setWidget(nullptr); if (d->control->completer()->parent() == this) delete d->control->completer(); } d->control->setCompleter(c); if (!c) return; - if (c->widget() == 0) + if (c->widget() == nullptr) c->setWidget(this); if (hasFocus()) { QObject::connect(d->control->completer(), SIGNAL(activated(QString)), @@ -683,7 +683,7 @@ QSize QLineEdit::sizeHint() const Q_D(const QLineEdit); ensurePolished(); QFontMetrics fm(font()); - const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); + const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this); const QMargins tm = d->effectiveTextMargins(); int h = qMax(fm.height(), qMax(14, iconSize - 2)) + 2 * QLineEditPrivate::verticalMargin + tm.top() + tm.bottom() @@ -1951,7 +1951,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e) #endif #if QT_CONFIG(completer) if (d->control->completer()) { - QObject::disconnect(d->control->completer(), 0, this, 0); + QObject::disconnect(d->control->completer(), nullptr, this, nullptr); } #endif QWidget::focusOutEvent(e); @@ -2190,7 +2190,7 @@ QMenu *QLineEdit::createStandardContextMenu() Q_D(QLineEdit); QMenu *popup = new QMenu(this); popup->setObjectName(QLatin1String("qt_edit_menu")); - QAction *action = 0; + QAction *action = nullptr; if (!isReadOnly()) { action = popup->addAction(QLineEdit::tr("&Undo") + ACCEL_KEY(QKeySequence::Undo)); diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index d2b5f87906..feb34ef403 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -487,7 +487,7 @@ QLineEditPrivate::SideWidgetParameters QLineEditPrivate::sideWidgetParameters() { Q_Q(const QLineEdit); SideWidgetParameters result; - result.iconSize = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q); + result.iconSize = q->style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, q); result.margin = result.iconSize / 4; result.widgetWidth = result.iconSize + 6; result.widgetHeight = result.iconSize + 2; @@ -566,12 +566,12 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE { Q_Q(QLineEdit); if (!newAction) - return 0; + return nullptr; if (!hasSideWidgets()) { // initial setup. QObject::connect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString))); lastTextSize = q->text().size(); } - QWidget *w = 0; + QWidget *w = nullptr; // Store flags about QWidgetAction here since removeAction() may be called from ~QAction, // in which a qobject_cast<> no longer works. #if QT_CONFIG(action) diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index a11fea6bbe..5ae402b992 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -151,7 +151,7 @@ public: }; QLineEditPrivate() - : control(0), frame(1), contextMenuEnabled(1), cursorVisible(0), + : control(nullptr), frame(1), contextMenuEnabled(1), cursorVisible(0), dragEnabled(0), clickCausedFocus(0), edited(0), hscroll(0), vscroll(0), alignment(Qt::AlignLeading | Qt::AlignVCenter), textMargins{0, 0, 0, 0}, diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 16ed699137..7f0f3342b6 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -78,7 +78,7 @@ class QMainWindowPrivate : public QWidgetPrivate Q_DECLARE_PUBLIC(QMainWindow) public: inline QMainWindowPrivate() - : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) + : layout(nullptr), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) #ifdef Q_OS_OSX , useUnifiedToolBar(false) #endif @@ -94,7 +94,7 @@ public: static inline QMainWindowLayout *mainWindowLayout(const QMainWindow *mainWindow) { - return mainWindow ? mainWindow->d_func()->layout : static_cast(0); + return mainWindow ? mainWindow->d_func()->layout : static_cast(nullptr); } }; @@ -152,10 +152,10 @@ void QMainWindowPrivate::init() topLayout->addItem(layout, 1, 1); #else - layout = new QMainWindowLayout(q, 0); + layout = new QMainWindowLayout(q, nullptr); #endif - const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); + const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, q); iconSize = QSize(metric, metric); q->setAttribute(Qt::WA_Hover); } @@ -452,7 +452,7 @@ void QMainWindow::setIconSize(const QSize &iconSize) Q_D(QMainWindow); QSize sz = iconSize; if (!sz.isValid()) { - const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, this); + const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, this); sz = QSize(metric, metric); } if (d->iconSize != sz) { @@ -652,8 +652,8 @@ QWidget *QMainWindow::takeCentralWidget() Q_D(QMainWindow); QWidget *oldcentralwidget = d->layout->centralWidget(); if (oldcentralwidget) { - oldcentralwidget->setParent(0); - d->layout->setCentralWidget(0); + oldcentralwidget->setParent(nullptr); + d->layout->setCentralWidget(nullptr); } return oldcentralwidget; } @@ -1478,7 +1478,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event) QMenu *QMainWindow::createPopupMenu() { Q_D(QMainWindow); - QMenu *menu = 0; + QMenu *menu = nullptr; #if QT_CONFIG(dockwidget) QList dockwidgets = findChildren(); if (dockwidgets.size()) { diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 0fb3a86cf8..30562d8270 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -101,14 +101,14 @@ static void dumpLayout(QTextStream &qout, const QDockAreaLayoutItem &item, QStri << " gap:" << (item.flags & QDockAreaLayoutItem::GapItem) << " keepSize:" << (item.flags & QDockAreaLayoutItem::KeepSize) << '\n'; indent += QLatin1String(" "); - if (item.widgetItem != 0) { + if (item.widgetItem != nullptr) { qout << indent << "widget: " << item.widgetItem->widget()->metaObject()->className() << " \"" << item.widgetItem->widget()->windowTitle() << "\"\n"; - } else if (item.subinfo != 0) { + } else if (item.subinfo != nullptr) { qout << indent << "subinfo:\n"; dumpLayout(qout, *item.subinfo, indent + QLatin1String(" ")); - } else if (item.placeHolderItem != 0) { + } else if (item.placeHolderItem != nullptr) { QRect r = item.placeHolderItem->topLevelRect; qout << indent << "placeHolder: " << "pos: " << item.pos << " size:" << item.size @@ -272,7 +272,7 @@ public: int frameWidth() const { return nativeWindowDeco() ? 0 : - parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, parentWidget()); + parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, parentWidget()); } QDockWidgetGroupWindow *groupWindow() const @@ -727,7 +727,7 @@ void QMainWindowLayoutState::deleteCentralWidgetItem() { #if QT_CONFIG(dockwidget) delete dockAreaLayout.centralWidgetItem; - dockAreaLayout.centralWidgetItem = 0; + dockAreaLayout.centralWidgetItem = nullptr; #else delete centralWidgetItem; centralWidgetItem = 0; @@ -749,7 +749,7 @@ QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const return centralWidgetItem; #endif - return 0; + return nullptr; } QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x) @@ -770,7 +770,7 @@ QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x) } #endif - return 0; + return nullptr; } QList QMainWindowLayoutState::indexOf(QWidget *widget) const @@ -803,7 +803,7 @@ QList QMainWindowLayoutState::indexOf(QWidget *widget) const bool QMainWindowLayoutState::contains(QWidget *widget) const { #if QT_CONFIG(dockwidget) - if (dockAreaLayout.centralWidgetItem != 0 && dockAreaLayout.centralWidgetItem->widget() == widget) + if (dockAreaLayout.centralWidgetItem != nullptr && dockAreaLayout.centralWidgetItem->widget() == widget) return true; if (!dockAreaLayout.indexOf(widget).isEmpty()) return true; @@ -821,11 +821,11 @@ bool QMainWindowLayoutState::contains(QWidget *widget) const void QMainWindowLayoutState::setCentralWidget(QWidget *widget) { - QLayoutItem *item = 0; + QLayoutItem *item = nullptr; //make sure we remove the widget deleteCentralWidgetItem(); - if (widget != 0) + if (widget != nullptr) item = new QWidgetItemV2(widget); #if QT_CONFIG(dockwidget) @@ -837,7 +837,7 @@ void QMainWindowLayoutState::setCentralWidget(QWidget *widget) QWidget *QMainWindowLayoutState::centralWidget() const { - QLayoutItem *item = 0; + QLayoutItem *item = nullptr; #if QT_CONFIG(dockwidget) item = dockAreaLayout.centralWidgetItem; @@ -845,9 +845,9 @@ QWidget *QMainWindowLayoutState::centralWidget() const item = centralWidgetItem; #endif - if (item != 0) + if (item != nullptr) return item->widget(); - return 0; + return nullptr; } QList QMainWindowLayoutState::gapIndex(QWidget *widget, @@ -978,7 +978,7 @@ QLayoutItem *QMainWindowLayoutState::item(const QList &path) return dockAreaLayout.item(path.mid(1)).widgetItem; #endif // QT_CONFIG(dockwidget) - return 0; + return nullptr; } QRect QMainWindowLayoutState::itemRect(const QList &path) const @@ -1029,7 +1029,7 @@ QLayoutItem *QMainWindowLayoutState::plug(const QList &path) return dockAreaLayout.plug(path.mid(1)); #endif // QT_CONFIG(dockwidget) - return 0; + return nullptr; } QLayoutItem *QMainWindowLayoutState::unplug(const QList &path, QMainWindowLayoutState *other) @@ -1040,7 +1040,7 @@ QLayoutItem *QMainWindowLayoutState::unplug(const QList &path, QMainWindowL Q_UNUSED(other); #else if (i == 0) - return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0); + return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : nullptr); #endif #if QT_CONFIG(dockwidget) @@ -1048,7 +1048,7 @@ QLayoutItem *QMainWindowLayoutState::unplug(const QList &path, QMainWindowL return dockAreaLayout.unplug(path.mid(1)); #endif // QT_CONFIG(dockwidget) - return 0; + return nullptr; } void QMainWindowLayoutState::saveState(QDataStream &stream) const @@ -1198,7 +1198,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream, continue; } QDockAreaLayoutInfo *info = dockAreaLayout.info(oldPath); - if (info == 0) { + if (info == nullptr) { continue; } info->item_list.append(QDockAreaLayoutItem(new QDockWidgetItem(w))); @@ -1249,7 +1249,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream, if (oldPath.isEmpty()) { continue; } - toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(0, w); + toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(nullptr, w); } } } @@ -1755,7 +1755,7 @@ void QMainWindowTabBar::mouseReleaseEvent(QMouseEvent *e) if (dockPriv->state && dockPriv->state->dragging) { dockPriv->endDrag(); } - draggingDock = 0; + draggingDock = nullptr; } QTabBar::mouseReleaseEvent(e); } @@ -1780,7 +1780,7 @@ bool QMainWindowTabBar::event(QEvent *e) QTabBar *QMainWindowLayout::getTabBar() { - QTabBar *result = 0; + QTabBar *result = nullptr; if (!unusedTabBars.isEmpty()) { result = unusedTabBars.takeLast(); } else { @@ -1800,7 +1800,7 @@ QTabBar *QMainWindowLayout::getTabBar() // Allocates a new separator widget if needed QWidget *QMainWindowLayout::getSeparatorWidget() { - QWidget *result = 0; + QWidget *result = nullptr; if (!unusedSeparatorWidgets.isEmpty()) { result = unusedSeparatorWidgets.takeLast(); } else { @@ -1829,16 +1829,16 @@ QDockAreaLayoutInfo *QMainWindowLayout::dockInfo(QWidget *widget) if (info) return info; } - return 0; + return nullptr; } void QMainWindowLayout::tabChanged() { QTabBar *tb = qobject_cast(sender()); - if (tb == 0) + if (tb == nullptr) return; QDockAreaLayoutInfo *info = dockInfo(tb); - if (info == 0) + if (info == nullptr) return; QDockWidget *activated = info->apply(false); @@ -1866,7 +1866,7 @@ void QMainWindowLayout::tabMoved(int from, int to) void QMainWindowLayout::raise(QDockWidget *widget) { QDockAreaLayoutInfo *info = dockInfo(widget); - if (info == 0) + if (info == nullptr) return; if (!info->tabbed) return; @@ -1897,7 +1897,7 @@ QLayoutItem *QMainWindowLayout::itemAt(int index) const if (statusbar && x++ == index) return statusbar; - return 0; + return nullptr; } QLayoutItem *QMainWindowLayout::takeAt(int index) @@ -1909,7 +1909,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index) if (QWidget *w = ret->widget()) { widgetAnimator.abort(w); if (w == pluggingWidget) - pluggingWidget = 0; + pluggingWidget = nullptr; } if (savedState.isValid() ) { @@ -1934,11 +1934,11 @@ QLayoutItem *QMainWindowLayout::takeAt(int index) if (statusbar && x++ == index) { QLayoutItem *ret = statusbar; - statusbar = 0; + statusbar = nullptr; return ret; } - return 0; + return nullptr; } void QMainWindowLayout::setGeometry(const QRect &_r) @@ -2033,7 +2033,7 @@ static void fixToolBarOrientation(QLayoutItem *item, int dockPos) { #if QT_CONFIG(toolbar) QToolBar *toolBar = qobject_cast(item->widget()); - if (toolBar == 0) + if (toolBar == nullptr) return; QRect oldGeo = toolBar->geometry(); @@ -2146,7 +2146,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) if (layout->nativeWindowDeco()) { globalRect.adjust(0, layout->titleHeight(), 0, 0); } else { - int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget); + int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, widget); globalRect.adjust(-fw, -fw, fw, fw); } } @@ -2214,7 +2214,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget) QDockAreaLayoutItem &item = dstParentInfo->item_list[idx]; Q_ASSERT(item.widgetItem->widget() == dwgw); delete item.widgetItem; - item.widgetItem = 0; + item.widgetItem = nullptr; item.subinfo = new QDockAreaLayoutInfo(std::move(*srcInfo)); *srcInfo = QDockAreaLayoutInfo(); item.subinfo->reparentWidgets(currentHoveredFloat ? currentHoveredFloat.data() @@ -2238,7 +2238,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget) savedState.clear(); currentGapPos.clear(); - pluggingWidget = 0; + pluggingWidget = nullptr; #if QT_CONFIG(dockwidget) setCurrentHoveredFloat(nullptr); #endif @@ -2283,16 +2283,16 @@ void QMainWindowLayout::restore(bool keepSavedState) if (!keepSavedState) savedState.clear(); currentGapPos.clear(); - pluggingWidget = 0; + pluggingWidget = nullptr; updateGapIndicator(); } QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLayout) - : QLayout(parentLayout ? static_cast(0) : mainwindow) + : QLayout(parentLayout ? static_cast(nullptr) : mainwindow) , layoutState(mainwindow) , savedState(mainwindow) , dockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks) - , statusbar(0) + , statusbar(nullptr) #if QT_CONFIG(dockwidget) #if QT_CONFIG(tabbar) , _documentMode(false) @@ -2303,14 +2303,14 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay #endif #endif // QT_CONFIG(dockwidget) , widgetAnimator(this) - , pluggingWidget(0) + , pluggingWidget(nullptr) { if (parentLayout) setParent(parentLayout); #if QT_CONFIG(dockwidget) #if QT_CONFIG(tabbar) - sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow); + sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, nullptr, mainwindow); #endif #if QT_CONFIG(tabwidget) @@ -2318,7 +2318,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay tabPositions[i] = QTabWidget::South; #endif #endif // QT_CONFIG(dockwidget) - pluggingWidget = 0; + pluggingWidget = nullptr; setObjectName(mainwindow->objectName() + QLatin1String("_layout")); } @@ -2354,7 +2354,7 @@ void QMainWindowLayout::setStatusBar(QStatusBar *sb) if (sb) addChildWidget(sb); delete statusbar; - statusbar = sb ? new QWidgetItemV2(sb) : 0; + statusbar = sb ? new QWidgetItemV2(sb) : nullptr; invalidate(); } #endif // QT_CONFIG(statusbar) @@ -2366,7 +2366,7 @@ QWidget *QMainWindowLayout::centralWidget() const void QMainWindowLayout::setCentralWidget(QWidget *widget) { - if (widget != 0) + if (widget != nullptr) addChildWidget(widget); layoutState.setCentralWidget(widget); if (savedState.isValid()) { @@ -2453,7 +2453,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) #endif QList path = layoutState.indexOf(widget); if (path.isEmpty()) - return 0; + return nullptr; QLayoutItem *item = layoutState.item(path); if (widget->isWindow()) @@ -2561,7 +2561,7 @@ static QTabBar::Shape tabwidgetPositionToTabBarShape(QWidget *w) void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) { if (!parentWidget()->isVisible() || parentWidget()->isMinimized() - || pluggingWidget != 0 || widgetItem == 0) + || pluggingWidget != nullptr || widgetItem == nullptr) return; QWidget *widget = widgetItem->widget(); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 6e3de1b1ff..3272ac440b 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -245,7 +245,7 @@ static inline bool useScrollBar(const QRect &childrenRect, const QSize &maxViewp static inline QMdiArea *mdiAreaParent(QWidget *widget) { if (!widget) - return 0; + return nullptr; QWidget *parent = widget->parentWidget(); while (parent) { @@ -253,7 +253,7 @@ static inline QMdiArea *mdiAreaParent(QWidget *widget) return area; parent = parent->parentWidget(); } - return 0; + return nullptr; } #if QT_CONFIG(tabwidget) @@ -352,7 +352,7 @@ void SimpleCascader::rearrange(QList &widgets, const QRect &domain) c int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0)); const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar")); const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1) - + widgets.at(0)->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, 0, widgets.at(0)); + + widgets.at(0)->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, nullptr, widgets.at(0)); const int n = widgets.size(); const int nrows = qMax((domain.height() - (topOffset + bottomOffset)) / dy, 1); @@ -648,7 +648,7 @@ void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event) QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const { if (index < 0 || index >= count()) - return 0; + return nullptr; QMdiArea *mdiArea = qobject_cast(parentWidget()); Q_ASSERT(mdiArea); @@ -667,15 +667,15 @@ QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const \internal */ QMdiAreaPrivate::QMdiAreaPrivate() - : cascader(0), - regularTiler(0), - iconTiler(0), - placer(0), + : cascader(nullptr), + regularTiler(nullptr), + iconTiler(nullptr), + placer(nullptr), #if QT_CONFIG(rubberband) - rubberBand(0), + rubberBand(nullptr), #endif #if QT_CONFIG(tabbar) - tabBar(0), + tabBar(nullptr), #endif activationOrder(QMdiArea::CreationOrder), viewMode(QMdiArea::SubWindowView), @@ -1070,7 +1070,7 @@ void QMdiAreaPrivate::emitWindowActivated(QMdiSubWindow *activeWindow) Q_ASSERT(aboutToBecomeActive == activeWindow); active = activeWindow; - aboutToBecomeActive = 0; + aboutToBecomeActive = nullptr; Q_ASSERT(active->d_func()->isActive); #if QT_CONFIG(tabbar) @@ -1093,20 +1093,20 @@ void QMdiAreaPrivate::resetActiveWindow(QMdiSubWindow *deactivatedWindow) if (deactivatedWindow) { if (deactivatedWindow != active) return; - active = 0; + active = nullptr; if ((aboutToBecomeActive || isActivated || lastWindowAboutToBeDestroyed()) && !isExplicitlyDeactivated(deactivatedWindow) && !q->window()->isMinimized()) { return; } - emit q->subWindowActivated(0); + emit q->subWindowActivated(nullptr); return; } if (aboutToBecomeActive) return; - active = 0; - emit q->subWindowActivated(0); + active = nullptr; + emit q->subWindowActivated(nullptr); } /*! @@ -1171,7 +1171,7 @@ void QMdiAreaPrivate::updateScrollBars() QSize hbarExtent = hbar->sizeHint(); QSize vbarExtent = vbar->sizeHint(); - if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) { + if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q)) { const int doubleFrameWidth = frameWidth * 2; if (hbarpolicy == Qt::ScrollBarAlwaysOn) maxSize.rheight() -= doubleFrameWidth; @@ -1232,7 +1232,7 @@ void QMdiAreaPrivate::internalRaise(QMdiSubWindow *mdiChild) const if (!sanityCheck(mdiChild, "QMdiArea::internalRaise") || childWindows.size() < 2) return; - QMdiSubWindow *stackUnderChild = 0; + QMdiSubWindow *stackUnderChild = nullptr; if (!windowStaysOnTop(mdiChild)) { const auto children = viewport->children(); // take a copy, as raising/stacking under changes the order for (QObject *object : children) { @@ -1282,8 +1282,8 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in minAreaHeight += hbar->height(); if (vbar->isVisible()) minAreaWidth += vbar->width(); - if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) { - const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q); + if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q)) { + const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, q); minAreaWidth += 2 * frame; minAreaHeight += 2 * frame; } @@ -1427,7 +1427,7 @@ void QMdiAreaPrivate::disconnectSubWindow(QObject *subWindow) return; Q_Q(QMdiArea); - QObject::disconnect(subWindow, 0, q, 0); + QObject::disconnect(subWindow, nullptr, q, nullptr); subWindow->removeEventFilter(q); } @@ -1438,11 +1438,11 @@ QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiAre int removedIndex, int fromIndex) const { if (childWindows.isEmpty()) - return 0; + return nullptr; Q_Q(const QMdiArea); const QList subWindows = q->subWindowList(order); - QMdiSubWindow *current = 0; + QMdiSubWindow *current = nullptr; if (removedIndex < 0) { if (fromIndex >= 0 && fromIndex < subWindows.size()) @@ -1482,7 +1482,7 @@ QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiAre if (!subWindows.at(index)->isHidden()) return subWindows.at(index); - return 0; + return nullptr; } /*! @@ -1603,7 +1603,7 @@ void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode) { // SubWindowView #if QT_CONFIG(tabbar) delete tabBar; - tabBar = 0; + tabBar = nullptr; #endif // QT_CONFIG(tabbar) viewMode = mode; @@ -1704,7 +1704,7 @@ QMdiArea::QMdiArea(QWidget *parent) setFrameStyle(QFrame::NoFrame); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setViewport(0); + setViewport(nullptr); setFocusPolicy(Qt::NoFocus); QApplication::instance()->installEventFilter(this); } @@ -1716,16 +1716,16 @@ QMdiArea::~QMdiArea() { Q_D(QMdiArea); delete d->cascader; - d->cascader = 0; + d->cascader = nullptr; delete d->regularTiler; - d->regularTiler = 0; + d->regularTiler = nullptr; delete d->iconTiler; - d->iconTiler = 0; + d->iconTiler = nullptr; delete d->placer; - d->placer = 0; + d->placer = nullptr; } /*! @@ -1760,8 +1760,8 @@ QSize QMdiArea::sizeHint() const QSize QMdiArea::minimumSizeHint() const { Q_D(const QMdiArea); - QSize size(style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, this), - style()->pixelMetric(QStyle::PM_TitleBarHeight, 0, this)); + QSize size(style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, nullptr, this), + style()->pixelMetric(QStyle::PM_TitleBarHeight, nullptr, this)); size = size.expandedTo(QAbstractScrollArea::minimumSizeHint()); if (!d->scrollBarsEnabled()) { for (QMdiSubWindow *child : d->childWindows) { @@ -1965,7 +1965,7 @@ QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFla { if (Q_UNLIKELY(!widget)) { qWarning("QMdiArea::addSubWindow: null pointer to widget"); - return 0; + return nullptr; } Q_D(QMdiArea); @@ -2027,7 +2027,7 @@ void QMdiArea::removeSubWindow(QWidget *widget) d->childWindows.removeAll(child); d->indicesToActivatedChildren.removeAll(index); d->updateActiveWindow(index, d->active == child); - child->setParent(0); + child->setParent(nullptr); return; } @@ -2036,7 +2036,7 @@ void QMdiArea::removeSubWindow(QWidget *widget) if (!sanityCheck(child, "QMdiArea::removeSubWindow")) continue; if (child->widget() == widget) { - child->setWidget(0); + child->setWidget(nullptr); Q_ASSERT(!child->widget()); found = true; break; diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index a0286dfcb1..84568c35db 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -253,7 +253,7 @@ static inline ControlElement *ptr(QWidget *widget) && strcmp(widget->metaObject()->className(), T::staticMetaObject.className()) == 0) { return static_cast *>(widget); } - return 0; + return nullptr; } QString QMdiSubWindowPrivate::originalWindowTitle() @@ -364,7 +364,7 @@ class ControlLabel : public QWidget { Q_OBJECT public: - ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = 0); + ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = nullptr); QSize sizeHint() const override; @@ -481,8 +481,8 @@ void ControlLabel::updateWindowIcon() { QIcon menuIcon = windowIcon(); if (menuIcon.isNull()) - menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget()); - const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, 0, parentWidget()); + menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, parentWidget()); + const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, nullptr, parentWidget()); label = menuIcon.pixmap(iconSize); update(); } @@ -496,7 +496,7 @@ class ControllerWidget : public QWidget { Q_OBJECT public: - ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = 0); + ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = nullptr); QSize sizeHint() const override; void setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible); inline bool hasVisibleControls() const @@ -542,7 +542,7 @@ ControllerWidget::ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent) activeControl(QStyle::SC_None), hoverControl(QStyle::SC_None), visibleControls(QStyle::SC_None), - mdiArea(0) + mdiArea(nullptr) { if (subWindow->parentWidget()) mdiArea = qobject_cast(subWindow->parentWidget()->parentWidget()); @@ -697,10 +697,10 @@ void ControllerWidget::initStyleOption(QStyleOptionComplex *option) const */ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild) : QObject(mdiChild), - previousLeft(0), - previousRight(0), + previousLeft(nullptr), + previousRight(nullptr), #if QT_CONFIG(menubar) - m_menuBar(0), + m_menuBar(nullptr), #endif mdiChild(mdiChild) { @@ -725,9 +725,9 @@ ControlContainer::~ControlContainer() removeButtonsFromMenuBar(); #endif delete m_menuLabel; - m_menuLabel = 0; + m_menuLabel = nullptr; delete m_controllerWidget; - m_controllerWidget = 0; + m_controllerWidget = nullptr; } #if QT_CONFIG(menubar) @@ -741,12 +741,12 @@ QMenuBar *QMdiSubWindowPrivate::menuBar() const #else Q_Q(const QMdiSubWindow); if (!q->isMaximized() || drawTitleBarWhenMaximized() || isChildOfTabbedQMdiArea(q)) - return 0; + return nullptr; if (QMainWindow *mainWindow = qobject_cast(q->window())) return mainWindow->menuBar(); - return 0; + return nullptr; #endif } @@ -790,50 +790,50 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar) { if (menuBar && menuBar != m_menuBar) { // m_menubar was deleted while sub-window was maximized - previousRight = 0; - previousLeft = 0; + previousRight = nullptr; + previousLeft = nullptr; m_menuBar = menuBar; } if (!m_menuBar || !mdiChild || qt_widget_private(mdiChild->window())->data.in_destructor) return; - QMdiSubWindow *child = 0; + QMdiSubWindow *child = nullptr; if (m_controllerWidget) { QWidget *currentRight = m_menuBar->cornerWidget(Qt::TopRightCorner); if (currentRight == m_controllerWidget) { if (ControlElement *ce = ptr(previousRight)) { if (!ce->mdiChild || !ce->mdiChild->isMaximized()) - previousRight = 0; + previousRight = nullptr; else child = ce->mdiChild; } m_menuBar->setCornerWidget(previousRight, Qt::TopRightCorner); if (previousRight) { previousRight->show(); - previousRight = 0; + previousRight = nullptr; } } m_controllerWidget->hide(); - m_controllerWidget->setParent(0); + m_controllerWidget->setParent(nullptr); } if (m_menuLabel) { QWidget *currentLeft = m_menuBar->cornerWidget(Qt::TopLeftCorner); if (currentLeft == m_menuLabel) { if (ControlElement *ce = ptr(previousLeft)) { if (!ce->mdiChild || !ce->mdiChild->isMaximized()) - previousLeft = 0; + previousLeft = nullptr; else if (!child) child = mdiChild; } m_menuBar->setCornerWidget(previousLeft, Qt::TopLeftCorner); if (previousLeft) { previousLeft->show(); - previousLeft = 0; + previousLeft = nullptr; } } m_menuLabel->hide(); - m_menuLabel->setParent(0); + m_menuLabel->setParent(nullptr); } m_menuBar->update(); if (child) @@ -854,14 +854,14 @@ void ControlContainer::updateWindowIcon(const QIcon &windowIcon) \internal */ QMdiSubWindowPrivate::QMdiSubWindowPrivate() - : baseWidget(0), - restoreFocusWidget(0), - controlContainer(0), + : baseWidget(nullptr), + restoreFocusWidget(nullptr), + controlContainer(nullptr), #if QT_CONFIG(sizegrip) - sizeGrip(0), + sizeGrip(nullptr), #endif #if QT_CONFIG(rubberband) - rubberBand(0), + rubberBand(nullptr), #endif userMinimumSize(0,0), resizeEnabled(true), @@ -926,7 +926,7 @@ void QMdiSubWindowPrivate::_q_enterInteractiveMode() pressPos = QPoint(q->width() / 2, titleBarHeight() - 1); } else if (actions[ResizeAction] && actions[ResizeAction] == action) { currentOperation = q->isLeftToRight() ? BottomRightResize : BottomLeftResize; - int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q) / 2; + int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q) / 2; int x = q->isLeftToRight() ? q->width() - offset : offset; pressPos = QPoint(x, q->height() - offset); } else { @@ -1009,8 +1009,8 @@ void QMdiSubWindowPrivate::removeBaseWidget() lastChildWindowTitle.clear(); // QTBUG-47993: parent widget can be reset before this call if (baseWidget->parentWidget() == q) - baseWidget->setParent(0); - baseWidget = 0; + baseWidget->setParent(nullptr); + baseWidget = nullptr; isWidgetHiddenByUs = false; } @@ -1047,19 +1047,19 @@ void QMdiSubWindowPrivate::createSystemMenu() systemMenu->installEventFilter(q); const QStyle *style = q->style(); addToSystemMenu(RestoreAction, QMdiSubWindow::tr("&Restore"), SLOT(showNormal())); - actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q)); + actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, nullptr, q)); actions[RestoreAction]->setEnabled(false); addToSystemMenu(MoveAction, QMdiSubWindow::tr("&Move"), SLOT(_q_enterInteractiveMode())); addToSystemMenu(ResizeAction, QMdiSubWindow::tr("&Size"), SLOT(_q_enterInteractiveMode())); addToSystemMenu(MinimizeAction, QMdiSubWindow::tr("Mi&nimize"), SLOT(showMinimized())); - actions[MinimizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMinButton, 0, q)); + actions[MinimizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMinButton, nullptr, q)); addToSystemMenu(MaximizeAction, QMdiSubWindow::tr("Ma&ximize"), SLOT(showMaximized())); - actions[MaximizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMaxButton, 0, q)); + actions[MaximizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMaxButton, nullptr, q)); addToSystemMenu(StayOnTopAction, QMdiSubWindow::tr("Stay on &Top"), SLOT(_q_updateStaysOnTopHint())); actions[StayOnTopAction]->setCheckable(true); systemMenu->addSeparator(); addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), SLOT(close())); - actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q)); + actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, nullptr, q)); #if !defined(QT_NO_SHORTCUT) actions[CloseAction]->setShortcuts(QKeySequence::Close); #endif @@ -1461,7 +1461,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus) ensureWindowState(Qt::WindowActive); } - int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); + int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q); int titleBarHeight = this->titleBarHeight(); QRegion windowDecoration = QRegion(0, 0, q->width(), q->height()); windowDecoration -= QRegion(frameWidth, titleBarHeight, q->width() - 2 * frameWidth, @@ -1543,7 +1543,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const int width = q->width(); int height = q->height(); int titleBarHeight = this->titleBarHeight(); - int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); + int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q); int cornerConst = titleBarHeight - frameWidth; int titleBarConst = 2 * titleBarHeight; @@ -1738,7 +1738,7 @@ void QMdiSubWindowPrivate::sizeParameters(int *margin, int *minWidth) const if (q->isMaximized() && !drawTitleBarWhenMaximized()) *margin = 0; else - *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); + *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q); QStyleOptionTitleBar opt = this->titleBarOptions(); int tempWidth = 0; @@ -1767,7 +1767,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; - if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)) + if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, nullptr, q)) return true; #if !QT_CONFIG(menubar) || !QT_CONFIG(mainwindow) Q_UNUSED(isChildOfQMdiSubWindow); @@ -1833,7 +1833,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar() if (!controlContainer || isChildOfTabbedQMdiArea(q)) return; - QMenuBar *currentMenuBar = 0; + QMenuBar *currentMenuBar = nullptr; #if QT_CONFIG(mainwindow) if (QMainWindow *mainWindow = qobject_cast(q->window())) { // NB! We can't use menuBar() here because that one will actually create @@ -1863,7 +1863,7 @@ void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild) return; } - QWidget *titleWidget = 0; + QWidget *titleWidget = nullptr; if (isRequestFromChild) titleWidget = baseWidget; else @@ -2131,7 +2131,7 @@ QSize QMdiSubWindowPrivate::iconSize() const Q_Q(const QMdiSubWindow); if (!parent || q->windowFlags() & Qt::FramelessWindowHint) return QSize(-1, -1); - return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight()); + return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, nullptr, q), titleBarHeight()); } #if QT_CONFIG(sizegrip) @@ -2233,7 +2233,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) // We don't want the menu icon by default on mac. #ifndef Q_OS_MAC if (windowIcon().isNull()) - d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); + d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, this); else d->menuIcon = windowIcon(); #endif @@ -2340,7 +2340,7 @@ QWidget *QMdiSubWindow::maximizedButtonsWidget() const && !isChildOfTabbedQMdiArea(this)) { return d->controlContainer->controllerWidget(); } - return 0; + return nullptr; } /*! @@ -2353,7 +2353,7 @@ QWidget *QMdiSubWindow::maximizedSystemMenuIconWidget() const && !isChildOfTabbedQMdiArea(this)) { return d->controlContainer->systemMenuLabel(); } - return 0; + return nullptr; } /*! @@ -2476,7 +2476,7 @@ void QMdiSubWindow::setSystemMenu(QMenu *systemMenu) if (d->systemMenu) { delete d->systemMenu; - d->systemMenu = 0; + d->systemMenu = nullptr; } if (!systemMenu) @@ -2860,7 +2860,7 @@ bool QMdiSubWindow::event(QEvent *event) case QEvent::WindowIconChange: d->menuIcon = windowIcon(); if (d->menuIcon.isNull()) - d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); + d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, this); if (d->controlContainer) d->controlContainer->updateWindowIcon(d->menuIcon); if (!maximizedSystemMenuIconWidget()) @@ -3135,7 +3135,7 @@ void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent) if (isMinimized() && !d->hasBorder(d->cachedStyleOptions)) return; - frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this); + frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, this); // ### Ensure that we do not require setting the cliprect for 4.4 if (!isMinimized() && !d->hasBorder(d->cachedStyleOptions)) @@ -3510,7 +3510,7 @@ QSize QMdiSubWindow::minimumSizeHint() const if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast(this))) sizeGripHeight = d->sizeGrip->height(); else if (parent() && isMacStyle(style()) && !d->sizeGrip) - sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this); + sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, nullptr, this); minHeight = qMax(minHeight, decorationHeight + sizeGripHeight); #endif diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 51b458f03a..e7f80263c8 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE -QMenu *QMenuPrivate::mouseDown = 0; +QMenu *QMenuPrivate::mouseDown = nullptr; /* QMenu code */ // internal class used for the torn off popup @@ -96,7 +96,7 @@ class QTornOffMenu : public QMenu public: QTornOffMenuPrivate(QMenu *p) : causedMenu(p), initialized(false) { tornoff = 1; - causedPopup.widget = 0; + causedPopup.widget = nullptr; causedPopup.action = p->d_func()->causedPopup.action; causedStack = p->d_func()->calcCausedStack(); } @@ -106,11 +106,11 @@ class QTornOffMenu : public QMenu QSize size = menuSize; const QPoint p = (!initialized) ? causedMenu->pos() : q->pos(); QRect screen = popupGeometry(QDesktopWidgetPrivate::screenNumber(p)); - const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q); - const int titleBarHeight = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, 0, q); + const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, q); + const int titleBarHeight = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, nullptr, q); if (scroll && (size.height() > screen.height() - titleBarHeight || size.width() > screen.width())) { - const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q); - const int hmargin = q->style()->pixelMetric(QStyle::PM_MenuHMargin, 0, q); + const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, q); + const int hmargin = q->style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr, q); scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown); size.setWidth(qMin(actionRects.at(getLastVisibleAction()).right() + fw + hmargin + rightmargin + 1, screen.width())); size.setHeight(screen.height() - desktopFrame * 2 - titleBarHeight); @@ -202,15 +202,15 @@ void QMenuPrivate::init() if (!tornPopup.isNull()) tornPopup->updateWindowTitle(); }); - q->setMouseTracking(q->style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, q)); - if (q->style()->styleHint(QStyle::SH_Menu_Scrollable, 0, q)) { + q->setMouseTracking(q->style()->styleHint(QStyle::SH_Menu_MouseTracking, nullptr, q)); + if (q->style()->styleHint(QStyle::SH_Menu_Scrollable, nullptr, q)) { scroll = new QMenuPrivate::QMenuScroller; scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; } sloppyState.initialize(q); delayState.initialize(q); - mousePopupDelay = q->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, q); + mousePopupDelay = q->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, nullptr, q); } QPlatformMenu *QMenuPrivate::createPlatformMenu() @@ -262,7 +262,7 @@ void QMenuPrivate::copyActionToPlatformItem(const QAction *action, QPlatformMenu item->setIconSize(w->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, w)); } else { QStyleOption opt; - item->setIconSize(QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, 0)); + item->setIconSize(QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, nullptr)); } } else { item->setIcon(QIcon()); @@ -283,7 +283,7 @@ void QMenuPrivate::copyActionToPlatformItem(const QAction *action, QPlatformMenu action->menu()->setPlatformMenu(platformMenu->createSubMenu()); item->setMenu(action->menu()->platformMenu()); } else { - item->setMenu(0); + item->setMenu(nullptr); } } @@ -304,7 +304,7 @@ QPlatformMenuItem * QMenuPrivate::insertActionInPlatformMenu(const QAction *acti int QMenuPrivate::scrollerHeight() const { Q_Q(const QMenu); - return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q)); + return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, q)); } // Windows and KDE allow menus to cover the taskbar, while GNOME and macOS @@ -541,9 +541,9 @@ void QMenuPrivate::hideUpToMenuBar() while(caused) { #if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(caused)) { - mb->d_func()->setCurrentAction(0); + mb->d_func()->setCurrentAction(nullptr); mb->d_func()->setKeyboardMode(false); - caused = 0; + caused = nullptr; } else #endif if (QMenu *m = qobject_cast(caused)) { @@ -551,12 +551,12 @@ void QMenuPrivate::hideUpToMenuBar() if (!m->d_func()->tornoff) hideMenu(m); if (!fadeMenus) // Mac doesn't clear the action until after hidden. - m->d_func()->setCurrentAction(0); - } else { caused = 0; + m->d_func()->setCurrentAction(nullptr); + } else { caused = nullptr; } } } - setCurrentAction(0); + setCurrentAction(nullptr); } void QMenuPrivate::hideMenu(QMenu *menu) @@ -573,7 +573,7 @@ void QMenuPrivate::hideMenu(QMenu *menu) QEventLoop eventLoop; QAction *activeAction = currentAction; - menu->setActiveAction(0); + menu->setActiveAction(nullptr); QTimer::singleShot(60, &eventLoop, SLOT(quit())); eventLoop.exec(); @@ -587,10 +587,10 @@ void QMenuPrivate::hideMenu(QMenu *menu) blocker.unblock(); #endif // QT_CONFIG(effects) if (activeMenu == menu) - activeMenu = 0; - menu->d_func()->causedPopup.action = 0; + activeMenu = nullptr; + menu->d_func()->causedPopup.action = nullptr; menu->close(); - menu->d_func()->causedPopup.widget = 0; + menu->d_func()->causedPopup.widget = nullptr; } void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst) @@ -617,7 +617,7 @@ void QMenuPrivate::setSyncAction() Q_Q(QMenu); QAction *current = currentAction; if(current && (!current->isEnabled() || current->menu() || current->isSeparator())) - current = 0; + current = nullptr; for(QWidget *caused = q; caused;) { if (QMenu *m = qobject_cast(caused)) { caused = m->d_func()->causedPopup.widget; @@ -645,7 +645,7 @@ void QMenuPrivate::setFirstActionActive() } QAction *act = actions.at(i); if (!act->isSeparator() && - (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q) + (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q) || act->isEnabled())) { setCurrentAction(act); break; @@ -661,7 +661,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason if (action && (action->isSeparator() - || (!action->isEnabled() && !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)))) + || (!action->isEnabled() && !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q)))) action = nullptr; // Reselect the currently active action in case mouse moved over other menu items when @@ -718,8 +718,8 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason if (popup == -1) { #if QT_CONFIG(effects) // kill any running effect - qFadeEffect(0); - qScrollEffect(0); + qFadeEffect(nullptr); + qScrollEffect(nullptr); #endif hideMenu(hideActiveMenu); } else if (!currentAction || !currentAction->menu()) { @@ -867,13 +867,13 @@ QWidget *QMenuPrivate::topCausedWidget() const QAction *QMenuPrivate::actionAt(QPoint p) const { if (!rect().contains(p)) //sanity check - return 0; + return nullptr; for(int i = 0; i < actionRects.count(); i++) { if (actionRects.at(i).contains(p)) return actions.at(i); } - return 0; + return nullptr; } void QMenuPrivate::setOverrideMenuAction(QAction *a) @@ -976,7 +976,7 @@ QMenuPrivate::ScrollerTearOffItem::ScrollerTearOffItem(QMenuPrivate::ScrollerTea : QWidget(parent, f), menuPrivate(mPrivate), scrollType(type) { if (parent) - setMouseTracking(parent->style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, parent)); + setMouseTracking(parent->style()->styleHint(QStyle::SH_Menu_MouseTracking, nullptr, parent)); } void QMenuPrivate::ScrollerTearOffItem::paintEvent(QPaintEvent *e) @@ -991,7 +991,7 @@ void QMenuPrivate::ScrollerTearOffItem::paintEvent(QPaintEvent *e) menuPrivate->drawScroller(&p, scrollType, QRect(0, 0, width(), menuPrivate->scrollerHeight())); //paint the tear off if (scrollType == QMenuPrivate::ScrollerTearOffItem::ScrollUp) { - QRect rect(0, 0, width(), parent->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, parent)); + QRect rect(0, 0, width(), parent->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, parent)); if (menuPrivate->scroll && menuPrivate->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) rect.translate(0, menuPrivate->scrollerHeight()); menuPrivate->drawTearOff(&p, rect); @@ -1066,8 +1066,8 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc int newOffset = 0; const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0; const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0; - const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q); - const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q); + const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr, q); + const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, q); if (location == QMenuScroller::ScrollTop) { for(int i = 0, saccum = 0; i < actions.count(); i++) { @@ -1108,7 +1108,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc if (!(newScrollFlags & QMenuScroller::ScrollDown) && (scroll->scrollFlags & QMenuScroller::ScrollDown)) { newOffset = q->height() - (saccum - newOffset) - fw*2 - vmargin - topmargin - bottommargin; //last item at bottom if (tearoff) - newOffset -= q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q); + newOffset -= q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, q); } if (!(newScrollFlags & QMenuScroller::ScrollUp) && (scroll->scrollFlags & QMenuScroller::ScrollUp)) { @@ -1119,7 +1119,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc newOffset -= vmargin; QRect screen = popupGeometry(); - const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q); + const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, q); if (q->height() < screen.height()-(desktopFrame*2)-1) { QRect geom = q->geometry(); if (newOffset > scroll->scrollOffset && (scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollUp)) { //scroll up @@ -1181,7 +1181,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ if (actionRects.at(i).isNull()) continue; if (!act->isSeparator() && - (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q) + (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q) || act->isEnabled())) { if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollBottom, active); @@ -1196,7 +1196,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ if (actionRects.at(i).isNull()) continue; if (!act->isSeparator() && - (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q) + (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q) || act->isEnabled())) { if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollTop, active); @@ -1217,8 +1217,8 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool pag updateActionRects(); const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0; const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0; - const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q); - const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q); + const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr, q); + const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, q); const int offset = topScroll ? topScroll-vmargin : 0; if (direction == QMenuScroller::ScrollUp) { for(int i = 0, saccum = 0; i < actions.count(); i++) { @@ -1299,7 +1299,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) tearRect.translate(0, scrollerHeight()); q->update(tearRect); if (tearRect.contains(pos) && hasMouseMoved(e->globalPos())) { - setCurrentAction(0); + setCurrentAction(nullptr); tearoffHighlighted = 1; if (e->type() == QEvent::MouseButtonRelease) { if (!tornPopup) @@ -1318,7 +1318,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) for(QWidget *caused = causedPopup.widget; caused;) { bool passOnEvent = false; - QWidget *next_widget = 0; + QWidget *next_widget = nullptr; QPoint cpos = caused->mapFromGlobal(e->globalPos()); #if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(caused)) { @@ -1439,7 +1439,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e #endif action->showStatusText(topCausedWidget()); } else { - actionAboutToTrigger = 0; + actionAboutToTrigger = nullptr; } } @@ -2258,7 +2258,7 @@ QAction *QMenu::actionAt(const QPoint &pt) const { if (QAction *ret = d_func()->actionAt(pt)) return ret; - return 0; + return nullptr; } /*! @@ -2380,7 +2380,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) const QSize menuSizeHint(sizeHint()); QSize size = menuSizeHint; - const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this); + const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, this); bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen); // if the screens have very different geometries and the menu is too big, we have to recalculate @@ -2424,7 +2424,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) pos.setY(newY); if (d->scroll && d->scroll->scrollFlags != QMenuPrivate::QMenuScroller::ScrollNone - && !style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, 0, this)) { + && !style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, nullptr, this)) { int below_height = above_height + d->scroll->scrollOffset; for (int i2 = i; i2 < d->actionRects.count(); i2++) below_height += d->actionRects.at(i2).height(); @@ -2483,7 +2483,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } } } - const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this); + const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr, this); QMenu *caused = qobject_cast(d_func()->causedPopup.widget); if (caused && caused->geometry().width() + menuSizeHint.width() + subMenuOffset < screen.width()) { QRect parentActionRect(caused->d_func()->actionRect(caused->d_func()->currentAction)); @@ -2553,8 +2553,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction) qScrollEffect(this, hGuess | vGuess); } else { // kill any running effect - qFadeEffect(0); - qScrollEffect(0); + qFadeEffect(nullptr); + qScrollEffect(nullptr); show(); } @@ -2690,22 +2690,22 @@ void QMenu::hideEvent(QHideEvent *) emit aboutToHide(); if (d->eventLoop) d->eventLoop->exit(); - d->setCurrentAction(0); + d->setCurrentAction(nullptr); #ifndef QT_NO_ACCESSIBILITY QAccessibleEvent event(this, QAccessible::PopupMenuEnd); QAccessible::updateAccessibility(&event); #endif #if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(d->causedPopup.widget)) - mb->d_func()->setCurrentAction(0); + mb->d_func()->setCurrentAction(nullptr); #endif if (QMenuPrivate::mouseDown == this) QMenuPrivate::mouseDown = nullptr; d->hasHadMouse = false; if (d->activeMenu) d->hideMenu(d->activeMenu); - d->causedPopup.widget = 0; - d->causedPopup.action = 0; + d->causedPopup.widget = nullptr; + d->causedPopup.action = nullptr; if (d->scroll) d->scroll->scrollTimer.stop(); //make sure the timer stops } @@ -2729,9 +2729,9 @@ void QMenu::paintEvent(QPaintEvent *e) style()->drawPrimitive(QStyle::PE_PanelMenu, &menuOpt, &p, this); //calculate the scroll up / down rect - const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); - const int hmargin = style()->pixelMetric(QStyle::PM_MenuHMargin,0, this); - const int vmargin = style()->pixelMetric(QStyle::PM_MenuVMargin, 0, this); + const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, this); + const int hmargin = style()->pixelMetric(QStyle::PM_MenuHMargin,nullptr, this); + const int vmargin = style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr, this); QRect scrollUpRect, scrollDownRect; const int leftmargin = fw + hmargin + d->leftmargin; @@ -2751,7 +2751,7 @@ void QMenu::paintEvent(QPaintEvent *e) QRect tearOffRect; if (d->tearoff) { tearOffRect.setRect(leftmargin, topmargin, contentWidth, - style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); + style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, this)); if (d->scroll && d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) tearOffRect.translate(0, d->scrollerHeight()); } @@ -2871,7 +2871,7 @@ void QMenu::mousePressEvent(QMouseEvent *e) && QRect(d->noReplayFor->mapToGlobal(QPoint()), d->noReplayFor->size()).contains(e->globalPos())) setAttribute(Qt::WA_NoMouseReplay); if (d->eventLoop) // synchronous operation - d->syncAction = 0; + d->syncAction = nullptr; d->hideUpToMenuBar(); return; } @@ -2921,12 +2921,12 @@ void QMenu::changeEvent(QEvent *e) if (e->type() == QEvent::StyleChange || e->type() == QEvent::FontChange || e->type() == QEvent::LayoutDirectionChange) { d->itemsDirty = 1; - setMouseTracking(style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, this)); + setMouseTracking(style()->styleHint(QStyle::SH_Menu_MouseTracking, nullptr, this)); if (isVisible()) resize(sizeHint()); - if (!style()->styleHint(QStyle::SH_Menu_Scrollable, 0, this)) { + if (!style()->styleHint(QStyle::SH_Menu_Scrollable, nullptr, this)) { delete d->scroll; - d->scroll = 0; + d->scroll = nullptr; } else if (!d->scroll) { d->scroll = new QMenuPrivate::QMenuScroller; d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; @@ -3095,7 +3095,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) case Qt::Key_Up: case Qt::Key_Down: { key_consumed = true; - QAction *nextAction = 0; + QAction *nextAction = nullptr; QMenuPrivate::QMenuScroller::ScrollLocation scroll_loc = QMenuPrivate::QMenuScroller::ScrollStay; if (!d->currentAction) { if(key == Qt::Key_Down) { @@ -3104,7 +3104,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (d->actionRects.at(i).isNull()) continue; if (!act->isSeparator() && - (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this) + (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this) || act->isEnabled())) { nextAction = act; break; @@ -3116,7 +3116,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (d->actionRects.at(i).isNull()) continue; if (!act->isSeparator() && - (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this) + (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this) || act->isEnabled())) { nextAction = act; break; @@ -3130,7 +3130,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (key == Qt::Key_Up) { for(int next_i = i-1; true; next_i--) { if (next_i == -1) { - if(!style()->styleHint(QStyle::SH_Menu_SelectionWrap, 0, this)) + if (!style()->styleHint(QStyle::SH_Menu_SelectionWrap, nullptr, this)) break; if (d->scroll) scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom; @@ -3143,13 +3143,13 @@ void QMenu::keyPressEvent(QKeyEvent *e) continue; if (next->isSeparator() || (!next->isEnabled() && - !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this))) + !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this))) continue; nextAction = next; if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)) { int topVisible = d->scrollerHeight(); if (d->tearoff) - topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this); + topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, this); if (((y + d->scroll->scrollOffset) - topVisible) <= d->actionRects.at(next_i).height()) scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop; } @@ -3161,7 +3161,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) y += d->actionRects.at(i).height(); for(int next_i = i+1; true; next_i++) { if (next_i == d->actionRects.count()) { - if(!style()->styleHint(QStyle::SH_Menu_SelectionWrap, 0, this)) + if (!style()->styleHint(QStyle::SH_Menu_SelectionWrap, nullptr, this)) break; if (d->scroll) scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop; @@ -3174,7 +3174,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) continue; if (next->isSeparator() || (!next->isEnabled() && - !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this))) + !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this))) continue; nextAction = next; if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)) { @@ -3182,7 +3182,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) bottomVisible -= d->scrollerHeight(); if (d->tearoff) - bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this); + bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, this); if ((y + d->scroll->scrollOffset + d->actionRects.at(next_i).height()) > bottomVisible) scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom; } @@ -3212,7 +3212,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) Q_FALLTHROUGH(); case Qt::Key_Left: { if (d->currentAction && !d->scroll) { - QAction *nextAction = 0; + QAction *nextAction = nullptr; if (key == Qt::Key_Left) { QRect actionR = d->actionRect(d->currentAction); for(int x = actionR.left()-1; !nextAction && x >= 0; x--) @@ -3241,7 +3241,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) break; key_consumed = true; - if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) + if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this)) { d->hideMenu(this); #if QT_CONFIG(menubar) @@ -3253,7 +3253,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) break; case Qt::Key_Space: - if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this)) + if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, nullptr, this)) break; // for motif, fall through Q_FALLTHROUGH(); @@ -3319,8 +3319,8 @@ void QMenu::keyPressEvent(QKeyEvent *e) if ((!e->modifiers() || e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ShiftModifier) && e->text().length()==1) { bool activateAction = false; - QAction *nextAction = 0; - if (style()->styleHint(QStyle::SH_Menu_KeyboardSearch, 0, this) && !e->modifiers()) { + QAction *nextAction = nullptr; + if (style()->styleHint(QStyle::SH_Menu_KeyboardSearch, nullptr, this) && !e->modifiers()) { int best_match_count = 0; d->searchBufferTimer.start(2000, this); d->searchBuffer += e->text(); @@ -3343,7 +3343,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) #ifndef QT_NO_SHORTCUT else { int clashCount = 0; - QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0; + QAction *first = nullptr, *currentSelected = nullptr, *firstAfterCurrent = nullptr; QChar c = e->text().at(0).toUpper(); for(int i = 0; i < d->actions.size(); ++i) { if (d->actionRects.at(i).isNull()) @@ -3432,7 +3432,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) QMenuPrivate::mouseDown = this; if (d->activeMenu) - d->activeMenu->d_func()->setCurrentAction(0); + d->activeMenu->d_func()->setCurrentAction(nullptr); QMenuSloppyState::MouseEventResult sloppyEventResult = d->sloppyState.processMouseEvent(e->localPos(), action, d->currentAction); if (sloppyEventResult == QMenuSloppyState::EventShouldBePropagated) { @@ -3462,7 +3462,7 @@ void QMenu::leaveEvent(QEvent *) Q_D(QMenu); d->hasReceievedEnter = false; if (!d->activeMenu && d->currentAction) - setActiveAction(0); + setActiveAction(nullptr); } /*! @@ -3525,7 +3525,7 @@ void QMenu::actionEvent(QActionEvent *e) } else if (e->type() == QEvent::ActionRemoved) { e->action()->disconnect(this); if (e->action() == d->currentAction) - d->currentAction = 0; + d->currentAction = nullptr; if (QWidgetAction *wa = qobject_cast(e->action())) { if (QWidget *widget = d->widgetItems.value(wa)) { #ifdef Q_OS_OSX @@ -3601,7 +3601,7 @@ void QMenu::internalDelayedPopup() #endif screen = d->popupGeometry(QDesktopWidgetPrivate::screenNumber(pos())); - int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this); + int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr, this); const QRect actionRect(d->actionRect(d->currentAction)); QPoint subMenuPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top()))); if (subMenuPos.x() > screen.right()) diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index afa5ca7142..2de7cdff71 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -90,7 +90,7 @@ QMenuBarExtension::QMenuBarExtension(QWidget *parent) #if QT_CONFIG(menu) setPopupMode(QToolButton::InstantPopup); #endif - setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, 0, parentWidget())); + setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, nullptr, parentWidget())); } void QMenuBarExtension::paintEvent(QPaintEvent *) @@ -106,7 +106,7 @@ void QMenuBarExtension::paintEvent(QPaintEvent *) QSize QMenuBarExtension::sizeHint() const { - int ext = style()->pixelMetric(QStyle::PM_ToolBarExtensionExtent, 0, parentWidget()); + int ext = style()->pixelMetric(QStyle::PM_ToolBarExtensionExtent, nullptr, parentWidget()); return QSize(ext, ext); } @@ -120,14 +120,14 @@ QAction *QMenuBarPrivate::actionAt(QPoint p) const if(actionRect(actions.at(i)).contains(p)) return actions.at(i); } - return 0; + return nullptr; } QRect QMenuBarPrivate::menuRect(bool extVisible) const { Q_Q(const QMenuBar); - int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); + int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q); QRect result = q->rect(); result.adjust(hmargin, 0, -hmargin, 0); @@ -167,13 +167,13 @@ void QMenuBarPrivate::updateGeometries() Q_Q(QMenuBar); if(!itemsDirty) return; - int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2); + int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q)*2); int q_start = -1; if(leftWidget || rightWidget) { - int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q) - + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); - int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q) - + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); + int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q) + + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q); + int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, q) + + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q); if (leftWidget && leftWidget->isVisible()) { QSize sz = leftWidget->sizeHint(); q_width -= sz.width(); @@ -198,7 +198,7 @@ void QMenuBarPrivate::updateGeometries() } #endif calcActionRects(q_width, q_start); - currentAction = 0; + currentAction = nullptr; #ifndef QT_NO_SHORTCUT if(itemsDirty) { for(int j = 0; j < shortcutIndexMap.size(); ++j) @@ -246,7 +246,7 @@ void QMenuBarPrivate::updateGeometries() pop->clear(); pop->addActions(hiddenActions); - int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q); + int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q); int x = q->isRightToLeft() ? menuRect.left() - extension->sizeHint().width() + 1 : menuRect.right(); @@ -285,8 +285,8 @@ void QMenuBarPrivate::focusFirstAction() void QMenuBarPrivate::setKeyboardMode(bool b) { Q_Q(QMenuBar); - if (b && !q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, q)) { - setCurrentAction(0); + if (b && !q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, q)) { + setCurrentAction(nullptr); return; } keyboardState = b; @@ -298,11 +298,11 @@ void QMenuBarPrivate::setKeyboardMode(bool b) q->setFocus(Qt::MenuBarFocusReason); } else { if(!popupState) - setCurrentAction(0); + setCurrentAction(nullptr); if(keyboardFocusWidget) { if (QApplication::focusWidget() == q) keyboardFocusWidget->setFocus(Qt::MenuBarFocusReason); - keyboardFocusWidget = 0; + keyboardFocusWidget = nullptr; } } q->update(); @@ -372,9 +372,9 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat doChildEffects = (popup && !activeMenu); Q_Q(QMenuBar); - QWidget *fw = 0; + QWidget *fw = nullptr; if(QMenu *menu = activeMenu) { - activeMenu = 0; + activeMenu = nullptr; if (popup) { fw = q->window()->focusWidget(); q->setFocus(Qt::NoFocusReason); @@ -419,14 +419,14 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const const QStyle *style = q->style(); - const int itemSpacing = style->pixelMetric(QStyle::PM_MenuBarItemSpacing, 0, q); + const int itemSpacing = style->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr, q); int max_item_height = 0, separator = -1, separator_start = 0, separator_len = 0; //calculate size const QFontMetrics fm = q->fontMetrics(); - const int hmargin = style->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q), - vmargin = style->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q), - icone = style->pixelMetric(QStyle::PM_SmallIconSize, 0, q); + const int hmargin = style->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, q), + vmargin = style->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q), + icone = style->pixelMetric(QStyle::PM_SmallIconSize, nullptr, q); for(int i = 0; i < actions.count(); i++) { QAction *action = actions.at(i); if(!action->isVisible()) @@ -436,7 +436,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const //calc what I think the size is.. if(action->isSeparator()) { - if (style->styleHint(QStyle::SH_DrawMenuBarSeparator, 0, q)) + if (style->styleHint(QStyle::SH_DrawMenuBarSeparator, nullptr, q)) separator = i; continue; //we don't really position these! } else { @@ -470,7 +470,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const } //calculate position - const int fw = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); + const int fw = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q); int x = fw + ((start == -1) ? hmargin : start) + itemSpacing; int y = fw + vmargin; for(int i = 0; i < actions.count(); i++) { @@ -703,7 +703,7 @@ void QMenuBarPrivate::init() q->hide(); q->setBackgroundRole(QPalette::Button); handleReparent(); - q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); + q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, nullptr, q)); extension = new QMenuBarExtension(q); extension->setFocusPolicy(Qt::NoFocus); @@ -715,7 +715,7 @@ QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) c { Q_Q(const QMenuBar); const_cast(this)->updateGeometries(); - bool allowActiveAndDisabled = q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q); + bool allowActiveAndDisabled = q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q); const int start = (_start == -1 && increment == -1) ? actions.count() : _start; const int end = increment == -1 ? 0 : actions.count() - 1; @@ -729,7 +729,7 @@ QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) c if (_start != -1) //let's try from the beginning or the end return getNextAction(-1, increment); - return 0; + return nullptr; } /*! @@ -749,7 +749,7 @@ QMenuBar::~QMenuBar() { Q_D(QMenuBar); delete d->platformMenuBar; - d->platformMenuBar = 0; + d->platformMenuBar = nullptr; } /*! @@ -1001,7 +1001,7 @@ void QMenuBar::paintEvent(QPaintEvent *e) style()->drawControl(QStyle::CE_MenuBarItem, &opt, &p, this); } //draw border - if(int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this)) { + if (int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this)) { QRegion borderReg; borderReg += QRect(0, 0, fw, height()); //left borderReg += QRect(width()-fw, 0, fw, height()); //right @@ -1054,7 +1054,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) QAction *action = d->actionAt(e->pos()); if (!action || !d->isVisible(action) || !action->isEnabled()) { - d->setCurrentAction(0); + d->setCurrentAction(nullptr); #if QT_CONFIG(whatsthis) if (QWhatsThis::inWhatsThisMode()) QWhatsThis::showText(e->globalPos(), d->whatsThis, this); @@ -1064,7 +1064,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) if(d->currentAction == action && d->popupState) { if(QMenu *menu = d->activeMenu) { - d->activeMenu = 0; + d->activeMenu = nullptr; menu->setAttribute(Qt::WA_NoMouseReplay); menu->hide(); } @@ -1124,7 +1124,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) case Qt::Key_Enter: case Qt::Key_Space: case Qt::Key_Return: { - if(!style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this) || !d->currentAction) + if (!style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this) || !d->currentAction) break; if(d->currentAction->menu()) { d->popupAction(d->currentAction, true); @@ -1153,7 +1153,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) #ifndef QT_NO_SHORTCUT if (!key_consumed && e->matches(QKeySequence::Cancel)) { - d->setCurrentAction(0); + d->setCurrentAction(nullptr); d->setKeyboardMode(false); key_consumed = true; } @@ -1163,7 +1163,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) (!e->modifiers() || (e->modifiers()&(Qt::MetaModifier|Qt::AltModifier))) && e->text().length()==1 && !d->popupState) { int clashCount = 0; - QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0; + QAction *first = nullptr, *currentSelected = nullptr, *firstAfterCurrent = nullptr; { const QChar c = e->text().at(0).toUpper(); for(int i = 0; i < d->actions.size(); ++i) { @@ -1187,7 +1187,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) } } } - QAction *next_action = 0; + QAction *next_action = nullptr; if(clashCount >= 1) { if(clashCount == 1 || !d->currentAction || (currentSelected && !firstAfterCurrent)) next_action = first; @@ -1233,14 +1233,14 @@ void QMenuBar::leaveEvent(QEvent *) { Q_D(QMenuBar); if((!hasFocus() && !d->popupState) || - (d->currentAction && d->currentAction->menu() == 0)) - d->setCurrentAction(0); + (d->currentAction && d->currentAction->menu() == nullptr)) + d->setCurrentAction(nullptr); } QPlatformMenu *QMenuBarPrivate::getPlatformMenu(const QAction *action) { if (!action || !action->menu()) - return 0; + return nullptr; QPlatformMenu *platformMenu = action->menu()->platformMenu(); if (!platformMenu && platformMenuBar) { @@ -1353,7 +1353,7 @@ void QMenuBar::focusOutEvent(QFocusEvent *) { Q_D(QMenuBar); if(!d->popupState) { - d->setCurrentAction(0); + d->setCurrentAction(nullptr); d->setKeyboardMode(false); } } @@ -1366,7 +1366,7 @@ void QMenuBar::timerEvent (QTimerEvent *e) Q_D(QMenuBar); if (e->timerId() == d->autoReleaseTimer.timerId()) { d->autoReleaseTimer.stop(); - d->setCurrentAction(0); + d->setCurrentAction(nullptr); } QWidget::timerEvent(e); } @@ -1420,7 +1420,7 @@ void QMenuBarPrivate::handleReparent() newWindow->createWinId(); platformMenuBar->handleReparent(newWindow->windowHandle()); } else { - platformMenuBar->handleReparent(0); + platformMenuBar->handleReparent(nullptr); } } } @@ -1433,7 +1433,7 @@ void QMenuBar::changeEvent(QEvent *e) Q_D(QMenuBar); if(e->type() == QEvent::StyleChange) { d->itemsDirty = true; - setMouseTracking(style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, this)); + setMouseTracking(style()->styleHint(QStyle::SH_MenuBar_MouseTracking, nullptr, this)); if(parentWidget()) resize(parentWidget()->width(), heightForWidth(parentWidget()->width())); d->updateGeometries(); @@ -1542,7 +1542,7 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event) d->platformMenuBar->handleReparent(handle); } - if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) { + if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this)) { if (d->altPressed) { switch (event->type()) { case QEvent::KeyPress: @@ -1618,10 +1618,10 @@ QSize QMenuBar::minimumSizeHint() const ensurePolished(); QSize ret(0, 0); const_cast(d)->updateGeometries(); - const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, this); - const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this); - int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this); - int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this); + const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, this); + const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); + int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); + int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); if(as_gui_menubar) { int w = parentWidget() ? parentWidget()->width() : QDesktopWidgetPrivate::width(); d->calcActionRects(w - (2 * fw), 0); @@ -1670,10 +1670,10 @@ QSize QMenuBar::sizeHint() const ensurePolished(); QSize ret(0, 0); const_cast(d)->updateGeometries(); - const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, this); - const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this); - int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this); - int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this); + const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, this); + const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); + int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); + int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); if(as_gui_menubar) { const int w = parentWidget() ? parentWidget()->width() : QDesktopWidgetPrivate::width(); d->calcActionRects(w - (2 * fw), 0); @@ -1722,9 +1722,9 @@ int QMenuBar::heightForWidth(int) const const_cast(d)->updateGeometries(); int height = 0; - const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this); - int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this); - int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this); + const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); + int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); + int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); if(as_gui_menubar) { for (int i = 0; i < d->actionRects.count(); ++i) height = qMax(height, d->actionRects.at(i).height()); @@ -1770,7 +1770,7 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id) activateAction(act, QAction::Trigger); //100 is the same as the default value in QPushButton::animateClick autoReleaseTimer.start(100, q); - } else if (act && q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, q)) { + } else if (act && q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, q)) { // When we open a menu using a shortcut, we should end up in keyboard state setKeyboardMode(true); } @@ -1836,7 +1836,7 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const { Q_D(const QMenuBar); - QWidget *w = 0; + QWidget *w = nullptr; switch(corner) { case Qt::TopLeftCorner: w = d->leftWidget; @@ -1875,7 +1875,7 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar) if (nativeMenuBar != bool(d->platformMenuBar)) { if (!nativeMenuBar) { delete d->platformMenuBar; - d->platformMenuBar = 0; + d->platformMenuBar = nullptr; } else { if (!d->platformMenuBar) d->platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar(); diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 0a81931b57..1856f0296b 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -81,7 +81,7 @@ class QPlainTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivat Q_DECLARE_PUBLIC(QPlainTextDocumentLayout) public: QPlainTextDocumentLayoutPrivate() { - mainViewPrivate = 0; + mainViewPrivate = nullptr; width = 0; maximumWidth = 0; maximumWidthBlockNumber = 0; @@ -755,7 +755,7 @@ void QPlainTextEditPrivate::updateViewport() } QPlainTextEditPrivate::QPlainTextEditPrivate() - : control(0), + : control(nullptr), tabChangesFocus(false), lineWrap(QPlainTextEdit::WidgetWidth), wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), @@ -1302,7 +1302,7 @@ QPlainTextEdit::~QPlainTextEdit() Q_D(QPlainTextEdit); if (d->documentLayoutPtr) { if (d->documentLayoutPtr->priv()->mainViewPrivate == d) - d->documentLayoutPtr->priv()->mainViewPrivate = 0; + d->documentLayoutPtr->priv()->mainViewPrivate = nullptr; } } @@ -1321,7 +1321,7 @@ QPlainTextEdit::~QPlainTextEdit() void QPlainTextEdit::setDocument(QTextDocument *document) { Q_D(QPlainTextEdit); - QPlainTextDocumentLayout *documentLayout = 0; + QPlainTextDocumentLayout *documentLayout = nullptr; if (!document) { document = new QTextDocument(d->control); @@ -1891,7 +1891,7 @@ void QPlainTextEditPrivate::relayoutDocument() int width = viewport->width(); - if (documentLayout->priv()->mainViewPrivate == 0 + if (documentLayout->priv()->mainViewPrivate == nullptr || documentLayout->priv()->mainViewPrivate == this || width > documentLayout->textWidth()) { documentLayout->priv()->mainViewPrivate = this; diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index f48b5706f7..b0d3ba51f9 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -297,7 +297,7 @@ QDialog *QPushButtonPrivate::dialogParent() const if (const QDialog *dialog = qobject_cast(p)) return const_cast(dialog); } - return 0; + return nullptr; } #endif @@ -353,7 +353,7 @@ bool QPushButton::autoDefault() const { Q_D(const QPushButton); if(d->autoDefault == QPushButtonPrivate::Auto) - return ( d->dialogParent() != 0 ); + return ( d->dialogParent() != nullptr ); return d->autoDefault; } @@ -496,7 +496,7 @@ void QPushButton::focusOutEvent(QFocusEvent *e) #if QT_CONFIG(dialog) QDialog *dlg = qobject_cast(window()); if (dlg) - dlg->d_func()->setDefault(0); + dlg->d_func()->setDefault(nullptr); else d->defaultButton = false; #endif diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index 68aa545082..ce08e3439a 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -259,7 +259,7 @@ void QScrollArea::setWidget(QWidget *widget) return; delete d->widget; - d->widget = 0; + d->widget = nullptr; d->hbar->setValue(0); d->vbar->setValue(0); if (widget->parentWidget() != d->viewport) @@ -285,9 +285,9 @@ QWidget *QScrollArea::takeWidget() { Q_D(QScrollArea); QWidget *w = d->widget; - d->widget = 0; + d->widget = nullptr; if (w) - w->setParent(0); + w->setParent(nullptr); return w; } diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 08d771a27a..34ea017279 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -224,7 +224,7 @@ void QScrollBarPrivate::setTransient(bool value) if (transient != value) { transient = value; if (q->isVisible()) { - if (q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, q)) + if (q->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, q)) q->update(); } else if (!transient) { q->show(); @@ -235,7 +235,7 @@ void QScrollBarPrivate::setTransient(bool value) void QScrollBarPrivate::flash() { Q_Q(QScrollBar); - if (!flashed && q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, q)) { + if (!flashed && q->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, q)) { flashed = true; if (!q->isVisible()) q->show(); @@ -319,7 +319,7 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const option->upsideDown = d->invertedAppearance; if (d->orientation == Qt::Horizontal) option->state |= QStyle::State_Horizontal; - if ((d->flashed || !d->transient) && style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this)) + if ((d->flashed || !d->transient) && style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, this)) option->state |= QStyle::State_On; } @@ -376,7 +376,7 @@ void QScrollBarPrivate::init() invertedControls = true; pressedControl = hoverControl = QStyle::SC_None; pointerOutsidePressedControl = false; - transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, q); + transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, q); flashed = false; flashTimer = 0; q->setFocusPolicy(Qt::NoFocus); @@ -392,7 +392,7 @@ void QScrollBarPrivate::init() /*! \reimp */ void QScrollBar::contextMenuEvent(QContextMenuEvent *event) { - if (!style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, this)) { + if (!style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, nullptr, this)) { QAbstractSlider::contextMenuEvent(event); return ; } @@ -412,7 +412,7 @@ void QScrollBar::contextMenuEvent(QContextMenuEvent *event) QAction *actScrollDn = menu->addAction(horiz ? tr("Scroll right") : tr("Scroll down")); QAction *actionSelected = menu->exec(event->globalPos()); delete menu; - if (actionSelected == 0) + if (actionSelected == nullptr) /* do nothing */ ; else if (actionSelected == actScrollHere) setValue(d_func()->pixelPosToRangeValue(horiz ? event->pos().x() : event->pos().y())); @@ -472,11 +472,11 @@ bool QScrollBar::event(QEvent *event) d_func()->updateHoverControl(he->pos()); break; case QEvent::StyleChange: - d_func()->setTransient(style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this)); + d_func()->setTransient(style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, this)); break; case QEvent::Timer: if (static_cast(event)->timerId() == d->flashTimer) { - if (d->flashed && style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this)) { + if (d->flashed && style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, this)) { d->flashed = false; update(); } @@ -545,7 +545,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e) d->stopRepeatAction(); bool midButtonAbsPos = style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition, - 0, this); + nullptr, this); QStyleOptionSlider opt; initStyleOption(&opt); diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index 662d4c9e92..2a4b4a0ad4 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -128,7 +128,7 @@ QSizeGripPrivate::QSizeGripPrivate() : dxMax(0) , dyMax(0) , gotMousePress(false) - , tlw(0) + , tlw(nullptr) , m_platformSizeGrip(false) { } diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp index b7c3426e08..70f05033ea 100644 --- a/src/widgets/widgets/qsplashscreen.cpp +++ b/src/widgets/widgets/qsplashscreen.cpp @@ -137,7 +137,7 @@ public: perhaps Qt::WindowStaysOnTopHint. */ QSplashScreen::QSplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) - : QWidget(*(new QSplashScreenPrivate()), 0, Qt::SplashScreen | Qt::FramelessWindowHint | f) + : QWidget(*(new QSplashScreenPrivate()), nullptr, Qt::SplashScreen | Qt::FramelessWindowHint | f) { setPixmap(pixmap); // Does an implicit repaint } @@ -271,14 +271,14 @@ inline static bool waitForWindowExposed(QWindow *window, int timeout = 1000) if (remaining <= 0) break; QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); #if defined(Q_OS_WINRT) WaitForSingleObjectEx(GetCurrentThread(), TimeOutMs, false); #elif defined(Q_OS_WIN) Sleep(uint(TimeOutMs)); #else struct timespec ts = { TimeOutMs / 1000, (TimeOutMs % 1000) * 1000 * 1000 }; - nanosleep(&ts, NULL); + nanosleep(&ts, nullptr); #endif } return window->isExposed(); diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 1a5fb7f251..090aa5cc8b 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1494,7 +1494,7 @@ int QSplitter::closestLegalPosition(int pos, int index) bool QSplitter::opaqueResize() const { Q_D(const QSplitter); - return d->opaqueResizeSet ? d->opaque : style()->styleHint(QStyle::SH_Splitter_OpaqueResize, 0, this); + return d->opaqueResizeSet ? d->opaque : style()->styleHint(QStyle::SH_Splitter_OpaqueResize, nullptr, this); } @@ -1639,7 +1639,7 @@ int QSplitter::handleWidth() const if (d->handleWidth >= 0) { return d->handleWidth; } else { - return style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this); + return style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr, this); } } diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp index f863964c58..a565d4ab4c 100644 --- a/src/widgets/widgets/qstackedwidget.cpp +++ b/src/widgets/widgets/qstackedwidget.cpp @@ -49,7 +49,7 @@ class QStackedWidgetPrivate : public QFramePrivate { Q_DECLARE_PUBLIC(QStackedWidget) public: - QStackedWidgetPrivate():layout(0){} + QStackedWidgetPrivate():layout(nullptr){} QStackedLayout *layout; bool blockChildAdd; }; diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp index 943b576ee3..4a1fef8b65 100644 --- a/src/widgets/widgets/qstatusbar.cpp +++ b/src/widgets/widgets/qstatusbar.cpp @@ -229,11 +229,11 @@ QStatusBar::QStatusBar(QWidget * parent) : QWidget(*new QStatusBarPrivate, parent, { }) { Q_D(QStatusBar); - d->box = 0; - d->timer = 0; + d->box = nullptr; + d->timer = nullptr; #if QT_CONFIG(sizegrip) - d->resizer = 0; + d->resizer = nullptr; setSizeGripEnabled(true); // causes reformat() #else reformat(); @@ -451,7 +451,7 @@ void QStatusBar::setSizeGripEnabled(bool enabled) d->showSizeGrip = true; } else { delete d->resizer; - d->resizer = 0; + d->resizer = nullptr; d->showSizeGrip = false; } reformat(); @@ -497,7 +497,7 @@ void QStatusBar::reformat() int i; QStatusBarPrivate::SBItem* item; - for (i=0,item=0; iitems.size(); ++i) { + for (i=0,item=nullptr; iitems.size(); ++i) { item = d->items.at(i); if (!item || item->p) break; @@ -508,7 +508,7 @@ void QStatusBar::reformat() l->addStretch(0); - for (item=0; iitems.size(); ++i) { + for (item=nullptr; iitems.size(); ++i) { item = d->items.at(i); if (!item) break; @@ -556,7 +556,7 @@ void QStatusBar::showMessage(const QString &message, int timeout) d->timer->start(timeout); } else if (d->timer) { delete d->timer; - d->timer = 0; + d->timer = nullptr; } if (d->tempItem == message) return; @@ -578,7 +578,7 @@ void QStatusBar::clearMessage() return; if (d->timer) { qDeleteInEventHandler(d->timer); - d->timer = 0; + d->timer = nullptr; } d->tempItem.clear(); hideOrShow(); @@ -617,7 +617,7 @@ void QStatusBar::hideOrShow() Q_D(QStatusBar); bool haveMessage = !d->tempItem.isEmpty(); - QStatusBarPrivate::SBItem* item = 0; + QStatusBarPrivate::SBItem* item = nullptr; for (int i=0; iitems.size(); ++i) { item = d->items.at(i); if (!item || item->p) @@ -711,7 +711,7 @@ bool QStatusBar::event(QEvent *e) // Calculate new strut height and call reformat() if it has changed int maxH = fontMetrics().height(); - QStatusBarPrivate::SBItem* item = 0; + QStatusBarPrivate::SBItem* item = nullptr; for (int i=0; iitems.size(); ++i) { item = d->items.at(i); if (!item) @@ -731,7 +731,7 @@ bool QStatusBar::event(QEvent *e) update(); } if (e->type() == QEvent::ChildRemoved) { - QStatusBarPrivate::SBItem* item = 0; + QStatusBarPrivate::SBItem* item = nullptr; for (int i=0; iitems.size(); ++i) { item = d->items.at(i); if (!item) diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index dfe362bdca..4e75cca704 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -76,7 +76,7 @@ class CloseButton : public QAbstractButton Q_OBJECT public: - explicit CloseButton(QWidget *parent = 0); + explicit CloseButton(QWidget *parent = nullptr); QSize sizeHint() const override; QSize minimumSizeHint() const override @@ -424,18 +424,18 @@ void QTabBarPrivate::init() rightB->setAccessibleName(QTabBar::tr("Scroll Right")); #endif q->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - elideMode = Qt::TextElideMode(q->style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, q)); - useScrollButtons = !q->style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, q); + elideMode = Qt::TextElideMode(q->style()->styleHint(QStyle::SH_TabBar_ElideMode, nullptr, q)); + useScrollButtons = !q->style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, nullptr, q); } QTabBarPrivate::Tab *QTabBarPrivate::at(int index) { - return validIndex(index)?&tabList[index]:0; + return validIndex(index)?&tabList[index]:nullptr; } const QTabBarPrivate::Tab *QTabBarPrivate::at(int index) const { - return validIndex(index)?&tabList[index]:0; + return validIndex(index)?&tabList[index]:nullptr; } int QTabBarPrivate::indexAtPos(const QPoint &p) const @@ -460,7 +460,7 @@ void QTabBarPrivate::layoutTabs() bool vertTabs = verticalTabs(shape); int tabChainIndex = 0; - Qt::Alignment tabAlignment = Qt::Alignment(q->style()->styleHint(QStyle::SH_TabBar_Alignment, 0, q)); + Qt::Alignment tabAlignment = Qt::Alignment(q->style()->styleHint(QStyle::SH_TabBar_Alignment, nullptr, q)); QVector tabChain(tabList.count() + 2); // We put an empty item at the front and back and set its expansive attribute @@ -787,7 +787,7 @@ void QTabBarPrivate::_q_closeTab() Q_Q(QTabBar); QObject *object = q->sender(); int tabToClose = -1; - QTabBar::ButtonPosition closeSide = (QTabBar::ButtonPosition)q->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, q); + QTabBar::ButtonPosition closeSide = (QTabBar::ButtonPosition)q->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, q); for (int i = 0; i < tabList.count(); ++i) { if (closeSide == QTabBar::LeftSide) { if (tabList.at(i).leftWidget == object) { @@ -984,7 +984,7 @@ int QTabBar::insertTab(int index, const QIcon& icon, const QString &text) if (d->closeButtonOnTabs) { QStyleOptionTab opt; initStyleOption(&opt, index); - ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); QAbstractButton *closeButton = new CloseButton(this); connect(closeButton, SIGNAL(clicked()), this, SLOT(_q_closeTab())); setTabButton(index, closeSide, closeButton); @@ -1019,12 +1019,12 @@ void QTabBar::removeTab(int index) if (d->tabList[index].leftWidget) { d->tabList[index].leftWidget->hide(); d->tabList[index].leftWidget->deleteLater(); - d->tabList[index].leftWidget = 0; + d->tabList[index].leftWidget = nullptr; } if (d->tabList[index].rightWidget) { d->tabList[index].rightWidget->hide(); d->tabList[index].rightWidget->deleteLater(); - d->tabList[index].rightWidget = 0; + d->tabList[index].rightWidget = nullptr; } int newIndex = d->tabList[index].lastTab; @@ -1395,7 +1395,7 @@ QSize QTabBar::iconSize() const Q_D(const QTabBar); if (d->iconSize.isValid()) return d->iconSize; - int iconExtent = style()->pixelMetric(QStyle::PM_TabBarIconSize, 0, this); + int iconExtent = style()->pixelMetric(QStyle::PM_TabBarIconSize, nullptr, this); return QSize(iconExtent, iconExtent); } @@ -1797,7 +1797,7 @@ void QTabBar::paintEvent(QPaintEvent *) if (!d->dragInProgress) p.drawControl(QStyle::CE_TabBarTab, tab); else { - int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this); + int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr, this); if (verticalTabs(d->shape)) d->movingTab->setGeometry(tab.rect.adjusted(0, -taboverlap, 0, taboverlap)); else @@ -2065,7 +2065,7 @@ void QTabBarPrivate::setupMovableTab() if (!movingTab) movingTab = new QMovableTabWidget(q); - int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q); + int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr ,q); QRect grabRect = q->tabRect(pressedIndex); if (verticalTabs(shape)) grabRect.adjust(0, -taboverlap, 0, taboverlap); @@ -2221,9 +2221,9 @@ void QTabBar::changeEvent(QEvent *event) switch (event->type()) { case QEvent::StyleChange: if (!d->elideModeSetByUser) - d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); + d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, nullptr, this)); if (!d->useScrollButtonsSetByUser) - d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); + d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, nullptr, this); Q_FALLTHROUGH(); case QEvent::FontChange: d->textSizes.clear(); @@ -2333,16 +2333,16 @@ void QTabBar::setTabsClosable(bool closable) if (d->closeButtonOnTabs == closable) return; d->closeButtonOnTabs = closable; - ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); if (!closable) { for (int i = 0; i < d->tabList.count(); ++i) { if (closeSide == LeftSide && d->tabList[i].leftWidget) { d->tabList[i].leftWidget->deleteLater(); - d->tabList[i].leftWidget = 0; + d->tabList[i].leftWidget = nullptr; } if (closeSide == RightSide && d->tabList[i].rightWidget) { d->tabList[i].rightWidget->deleteLater(); - d->tabList[i].rightWidget = 0; + d->tabList[i].rightWidget = nullptr; } } } else { @@ -2637,8 +2637,8 @@ CloseButton::CloseButton(QWidget *parent) QSize CloseButton::sizeHint() const { ensurePolished(); - int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this); - int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this); + int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, this); + int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, this); return QSize(width, height); } @@ -2671,7 +2671,7 @@ void CloseButton::paintEvent(QPaintEvent *) if (const QTabBar *tb = qobject_cast(parent())) { int index = tb->currentIndex(); - QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tb); + QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, tb); if (tb->tabButton(index, position) == this) opt.state |= QStyle::State_Selected; } diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 5552c43548..6f77579108 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -105,9 +105,9 @@ public: struct Tab { inline Tab(const QIcon &ico, const QString &txt) : enabled(true) , shortcutId(0), text(txt), icon(ico), - leftWidget(0), rightWidget(0), lastTab(-1), dragOffset(0) + leftWidget(nullptr), rightWidget(nullptr), lastTab(-1), dragOffset(0) #if QT_CONFIG(animation) - , animation(0) + , animation(nullptr) #endif // animation {} bool operator==(const Tab &other) const { return &other == this; } diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 2b3b8280bb..28c91a89e7 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -215,9 +215,9 @@ public: }; QTabWidgetPrivate::QTabWidgetPrivate() - : tabs(0), stack(0), dirty(true), + : tabs(nullptr), stack(nullptr), dirty(true), pos(QTabWidget::North), shape(QTabWidget::Rounded), - leftCornerWidget(0), rightCornerWidget(0) + leftCornerWidget(nullptr), rightCornerWidget(nullptr) {} QTabWidgetPrivate::~QTabWidgetPrivate() @@ -249,7 +249,7 @@ void QTabWidgetPrivate::init() q->setFocusPolicy(Qt::TabFocus); q->setFocusProxy(tabs); q->setTabPosition(static_cast (q->style()->styleHint( - QStyle::SH_TabWidget_DefaultTabPosition, 0, q ))); + QStyle::SH_TabWidget_DefaultTabPosition, nullptr, q ))); } @@ -280,7 +280,7 @@ void QTabWidgetPrivate::initBasicStyleOption(QStyleOptionTabWidgetFrame *option) if (q->documentMode()) option->lineWidth = 0; else - option->lineWidth = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q); + option->lineWidth = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, q); switch (pos) { case QTabWidget::North: @@ -319,7 +319,7 @@ void QTabWidget::initStyleOption(QStyleOptionTabWidgetFrame *option) const Q_D(const QTabWidget); d->initBasicStyleOption(option); - int exth = style()->pixelMetric(QStyle::PM_TabBarBaseHeight, 0, this); + int exth = style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr, this); QSize t(0, d->stack->frameWidth()); if (d->tabs->isVisibleTo(const_cast(this))) { t = d->tabs->sizeHint(); diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index dd2ea3f18f..10de7d0b9e 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -117,7 +117,7 @@ public: }; QTextEditPrivate::QTextEditPrivate() - : control(0), + : control(nullptr), autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false), lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0), wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0), diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index 79182dfa33..b4e90c7d71 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -91,7 +91,7 @@ void QToolBarPrivate::init() q->setAttribute(Qt::WA_X11NetWmWindowTypeToolBar); QStyle *style = q->style(); - int e = style->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); + int e = style->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, q); iconSize = QSize(e, e); layout = new QToolBarLayout(q); @@ -99,7 +99,7 @@ void QToolBarPrivate::init() toggleViewAction = new QAction(q); toggleViewAction->setCheckable(true); - q->setMovable(q->style()->styleHint(QStyle::SH_ToolBar_Movable, 0, q )); + q->setMovable(q->style()->styleHint(QStyle::SH_ToolBar_Movable, nullptr, q )); QObject::connect(toggleViewAction, SIGNAL(triggered(bool)), q, SLOT(_q_toggleView(bool))); } @@ -173,21 +173,21 @@ void QToolBarPrivate::initDrag(const QPoint &pos) { Q_Q(QToolBar); - if (state != 0) + if (state != nullptr) return; QMainWindow *win = qobject_cast(parent); - Q_ASSERT(win != 0); + Q_ASSERT(win != nullptr); QMainWindowLayout *layout = qt_mainwindow_layout(win); - Q_ASSERT(layout != 0); - if (layout->pluggingWidget != 0) // the main window is animating a docking operation + Q_ASSERT(layout != nullptr); + if (layout->pluggingWidget != nullptr) // the main window is animating a docking operation return; state = new DragState; state->pressPos = pos; state->dragging = false; state->moving = false; - state->widgetItem = 0; + state->widgetItem = nullptr; if (q->isRightToLeft()) state->pressPos = QPoint(q->width() - state->pressPos.x(), state->pressPos.y()); @@ -197,19 +197,19 @@ void QToolBarPrivate::startDrag(bool moving) { Q_Q(QToolBar); - Q_ASSERT(state != 0); + Q_ASSERT(state != nullptr); if ((moving && state->moving) || state->dragging) return; QMainWindow *win = qobject_cast(parent); - Q_ASSERT(win != 0); + Q_ASSERT(win != nullptr); QMainWindowLayout *layout = qt_mainwindow_layout(win); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); if (!moving) { state->widgetItem = layout->unplug(q); - Q_ASSERT(state->widgetItem != 0); + Q_ASSERT(state->widgetItem != nullptr); } state->dragging = !moving; state->moving = moving; @@ -218,13 +218,13 @@ void QToolBarPrivate::startDrag(bool moving) void QToolBarPrivate::endDrag() { Q_Q(QToolBar); - Q_ASSERT(state != 0); + Q_ASSERT(state != nullptr); q->releaseMouse(); if (state->dragging) { QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast(q->parentWidget())); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); if (!layout->plug(state->widgetItem)) { if (q->isFloatable()) { @@ -239,7 +239,7 @@ void QToolBarPrivate::endDrag() } delete state; - state = 0; + state = nullptr; } bool QToolBarPrivate::mousePressEvent(QMouseEvent *event) @@ -278,7 +278,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event) bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*) { - if (state != 0) { + if (state != nullptr) { endDrag(); return true; } else { @@ -310,13 +310,13 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) } QMainWindow *win = qobject_cast(parent); - if (win == 0) + if (win == nullptr) return true; QMainWindowLayout *layout = qt_mainwindow_layout(win); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); - if (layout->pluggingWidget == 0 + if (layout->pluggingWidget == nullptr && (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) { const bool wasDragging = state->dragging; const bool moving = !q->isWindow() && (orientation == Qt::Vertical ? @@ -673,16 +673,16 @@ void QToolBar::setIconSize(const QSize &iconSize) if (mw && mw->layout()) { QLayout *layout = mw->layout(); int i = 0; - QLayoutItem *item = 0; + QLayoutItem *item = nullptr; do { item = layout->itemAt(i++); if (item && (item->widget() == this)) sz = mw->iconSize(); - } while (!sz.isValid() && item != 0); + } while (!sz.isValid() && item != nullptr); } } if (!sz.isValid()) { - const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, this); + const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, this); sz = QSize(metric, metric); } if (d->iconSize != sz) { @@ -945,7 +945,7 @@ QAction *QToolBar::actionAt(const QPoint &p) const QWidget *widget = childAt(p); int index = d->layout->indexOf(widget); if (index == -1) - return 0; + return nullptr; QLayoutItem *item = d->layout->itemAt(index); return static_cast(item)->action; } @@ -966,7 +966,7 @@ void QToolBar::actionEvent(QActionEvent *event) switch (event->type()) { case QEvent::ActionAdded: { - Q_ASSERT_X(widgetAction == 0 || d->layout->indexOf(widgetAction) == -1, + Q_ASSERT_X(widgetAction == nullptr || d->layout->indexOf(widgetAction) == -1, "QToolBar", "widgets cannot be inserted multiple times"); // reparent the action to this toolbar if it has been created @@ -974,7 +974,7 @@ void QToolBar::actionEvent(QActionEvent *event) // preserve Qt 4.1.x behavior. The widget is already // reparented to us due to the createWidget call inside // createItem() - if (widgetAction != 0 && widgetAction->d_func()->autoCreated) + if (widgetAction != nullptr && widgetAction->d_func()->autoCreated) widgetAction->setParent(this); int index = d->layout->count(); @@ -1059,18 +1059,18 @@ void QToolBar::paintEvent(QPaintEvent *) */ static bool waitForPopup(QToolBar *tb, QWidget *popup) { - if (popup == 0 || popup->isHidden()) + if (popup == nullptr || popup->isHidden()) return false; QWidget *w = popup; - while (w != 0) { + while (w != nullptr) { if (w == tb) return true; w = w->parentWidget(); } QMenu *menu = qobject_cast(popup); - if (menu == 0) + if (menu == nullptr) return false; QAction *action = menu->menuAction(); @@ -1161,7 +1161,7 @@ bool QToolBar::event(QEvent *event) return true; break; case QEvent::Leave: - if (d->state != 0 && d->state->dragging) { + if (d->state != nullptr && d->state->dragging) { #ifdef Q_OS_WIN // This is a workaround for loosing the mouse on Vista. QPoint pos = QCursor::pos(); @@ -1213,7 +1213,7 @@ QWidget *QToolBar::widgetForAction(QAction *action) const int index = d->layout->indexOf(action); if (index == -1) - return 0; + return nullptr; return d->layout->itemAt(index)->widget(); } @@ -1233,7 +1233,7 @@ void QToolBar::initStyleOption(QStyleOptionToolBar *option) const option->initFrom(this); if (orientation() == Qt::Horizontal) option->state |= QStyle::State_Horizontal; - option->lineWidth = style()->pixelMetric(QStyle::PM_ToolBarFrameWidth, 0, this); + option->lineWidth = style()->pixelMetric(QStyle::PM_ToolBarFrameWidth, nullptr, this); option->features = d->layout->movable() ? QStyleOptionToolBar::Movable : QStyleOptionToolBar::None; @@ -1247,7 +1247,7 @@ void QToolBar::initStyleOption(QStyleOptionToolBar *option) const return; QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow); - Q_ASSERT_X(layout != 0, "QToolBar::initStyleOption()", + Q_ASSERT_X(layout != nullptr, "QToolBar::initStyleOption()", "QMainWindow->layout() != QMainWindowLayout"); layout->getStyleOptionInfo(option, const_cast(this)); diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp index adc329131c..493c094cc1 100644 --- a/src/widgets/widgets/qtoolbararealayout.cpp +++ b/src/widgets/widgets/qtoolbararealayout.cpp @@ -91,7 +91,7 @@ bool QToolBarAreaLayoutItem::skip() const { if (gap) return false; - return widgetItem == 0 || widgetItem->isEmpty(); + return widgetItem == nullptr || widgetItem->isEmpty(); } /****************************************************************************** @@ -302,7 +302,7 @@ QLayoutItem *QToolBarAreaLayoutInfo::insertToolBar(QToolBar *before, QToolBar *t void QToolBarAreaLayoutInfo::insertItem(QToolBar *before, QLayoutItem *item) { - if (before == 0) { + if (before == nullptr) { if (lines.isEmpty()) lines.append(QToolBarAreaLayoutLine(o)); lines.last().toolBarItems.append(item); @@ -330,7 +330,7 @@ void QToolBarAreaLayoutInfo::removeToolBar(QToolBar *toolBar) QToolBarAreaLayoutItem &item = line.toolBarItems[k]; if (item.widgetItem->widget() == toolBar) { delete item.widgetItem; - item.widgetItem = 0; + item.widgetItem = nullptr; line.toolBarItems.removeAt(k); if (line.toolBarItems.isEmpty() && j < lines.count() - 1) @@ -344,7 +344,7 @@ void QToolBarAreaLayoutInfo::removeToolBar(QToolBar *toolBar) void QToolBarAreaLayoutInfo::insertToolBarBreak(QToolBar *before) { - if (before == 0) { + if (before == nullptr) { if (!lines.isEmpty() && lines.constLast().toolBarItems.isEmpty()) return; lines.append(QToolBarAreaLayoutLine(o)); @@ -729,7 +729,7 @@ QRect QToolBarAreaLayout::rectHint(const QRect &r) const QLayoutItem *QToolBarAreaLayout::itemAt(int *x, int index) const { - Q_ASSERT(x != 0); + Q_ASSERT(x != nullptr); for (int i = 0; i < QInternal::DockCount; ++i) { const QToolBarAreaLayoutInfo &dock = docks[i]; @@ -744,12 +744,12 @@ QLayoutItem *QToolBarAreaLayout::itemAt(int *x, int index) const } } - return 0; + return nullptr; } QLayoutItem *QToolBarAreaLayout::takeAt(int *x, int index) { - Q_ASSERT(x != 0); + Q_ASSERT(x != nullptr); for (int i = 0; i < QInternal::DockCount; ++i) { QToolBarAreaLayoutInfo &dock = docks[i]; @@ -768,7 +768,7 @@ QLayoutItem *QToolBarAreaLayout::takeAt(int *x, int index) } } - return 0; + return nullptr; } void QToolBarAreaLayout::deleteAllLayoutItems() @@ -783,7 +783,7 @@ void QToolBarAreaLayout::deleteAllLayoutItems() QToolBarAreaLayoutItem &item = line.toolBarItems[k]; if (!item.gap) delete item.widgetItem; - item.widgetItem = 0; + item.widgetItem = nullptr; } } } @@ -811,7 +811,7 @@ QLayoutItem *QToolBarAreaLayout::insertToolBar(QToolBar *before, QToolBar *toolB { QInternal::DockPosition pos = findToolBar(before); if (pos == QInternal::DockCount) - return 0; + return nullptr; return docks[pos].insertToolBar(before, toolBar); } @@ -826,7 +826,7 @@ void QToolBarAreaLayout::removeToolBar(QToolBar *toolBar) QLayoutItem *QToolBarAreaLayout::addToolBar(QInternal::DockPosition pos, QToolBar *toolBar) { - return docks[pos].insertToolBar(0, toolBar); + return docks[pos].insertToolBar(nullptr, toolBar); } void QToolBarAreaLayout::insertToolBarBreak(QToolBar *before) @@ -847,7 +847,7 @@ void QToolBarAreaLayout::removeToolBarBreak(QToolBar *before) void QToolBarAreaLayout::addToolBarBreak(QInternal::DockPosition pos) { - docks[pos].insertToolBarBreak(0); + docks[pos].insertToolBarBreak(nullptr); } void QToolBarAreaLayout::moveToolBar(QToolBar *toolbar, int p) @@ -878,7 +878,7 @@ void QToolBarAreaLayout::insertItem(QToolBar *before, QLayoutItem *item) void QToolBarAreaLayout::apply(bool animate) { QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); Qt::LayoutDirection dir = mainWindow->layoutDirection(); @@ -1117,13 +1117,13 @@ QToolBarAreaLayoutItem *QToolBarAreaLayout::item(const QList &path) Q_ASSERT(path.count() == 3); if (path.at(0) < 0 || path.at(0) >= QInternal::DockCount) - return 0; + return nullptr; QToolBarAreaLayoutInfo &info = docks[path.at(0)]; if (path.at(1) < 0 || path.at(1) >= info.lines.count()) - return 0; + return nullptr; QToolBarAreaLayoutLine &line = info.lines[path.at(1)]; if (path.at(2) < 0 || path.at(2) >= line.toolBarItems.count()) - return 0; + return nullptr; return &(line.toolBarItems[path.at(2)]); } @@ -1143,10 +1143,10 @@ QLayoutItem *QToolBarAreaLayout::plug(const QList &path) QToolBarAreaLayoutItem *item = this->item(path); if (Q_UNLIKELY(!item)) { qWarning() << "No item at" << path; - return 0; + return nullptr; } Q_ASSERT(item->gap); - Q_ASSERT(item->widgetItem != 0); + Q_ASSERT(item->widgetItem != nullptr); item->gap = false; return item->widgetItem; } @@ -1352,14 +1352,14 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QListobjectName() == objectName) { toolBar = toolBars.takeAt(x); break; } } - if (toolBar == 0) { + if (toolBar == nullptr) { continue; } diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index ec60309806..89c7f32b28 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -69,13 +69,13 @@ extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window); */ QToolBarItem::QToolBarItem(QWidget *widget) - : QWidgetItem(widget), action(0), customWidget(false) + : QWidgetItem(widget), action(nullptr), customWidget(false) { } bool QToolBarItem::isEmpty() const { - return action == 0 || !action->isVisible(); + return action == nullptr || !action->isVisible(); } /****************************************************************************** @@ -84,7 +84,7 @@ bool QToolBarItem::isEmpty() const QToolBarLayout::QToolBarLayout(QWidget *parent) : QLayout(parent), expanded(false), animating(false), dirty(true), - expanding(false), empty(true), expandFlag(false), popupMenu(0) + expanding(false), empty(true), expandFlag(false), popupMenu(nullptr) { QToolBar *tb = qobject_cast(parent); if (!tb) @@ -132,15 +132,15 @@ bool QToolBarLayout::hasExpandFlag() const void QToolBarLayout::setUsePopupMenu(bool set) { - if (!dirty && ((popupMenu == 0) == set)) + if (!dirty && ((popupMenu == nullptr) == set)) invalidate(); if (!set) { QObject::connect(extension, SIGNAL(clicked(bool)), this, SLOT(setExpanded(bool)), Qt::UniqueConnection); extension->setPopupMode(QToolButton::DelayedPopup); - extension->setMenu(0); + extension->setMenu(nullptr); delete popupMenu; - popupMenu = 0; + popupMenu = nullptr; } else { QObject::disconnect(extension, SIGNAL(clicked(bool)), this, SLOT(setExpanded(bool))); @@ -169,21 +169,21 @@ void QToolBarLayout::addItem(QLayoutItem*) QLayoutItem *QToolBarLayout::itemAt(int index) const { if (index < 0 || index >= items.count()) - return 0; + return nullptr; return items.at(index); } QLayoutItem *QToolBarLayout::takeAt(int index) { if (index < 0 || index >= items.count()) - return 0; + return nullptr; QToolBarItem *item = items.takeAt(index); if (popupMenu) popupMenu->removeAction(item->action); QWidgetAction *widgetAction = qobject_cast(item->action); - if (widgetAction != 0 && item->customWidget) { + if (widgetAction != nullptr && item->customWidget) { widgetAction->releaseWidget(item->widget()); } else { // destroy the QToolButton/QToolBarSeparator @@ -251,7 +251,7 @@ bool QToolBarLayout::movable() const if (!tb) return false; QMainWindow *win = qobject_cast(tb->parentWidget()); - return tb->isMovable() && win != 0; + return tb->isMovable() && win != nullptr; } void QToolBarLayout::updateGeomArray() const @@ -343,7 +343,7 @@ void QToolBarLayout::updateGeomArray() const static bool defaultWidgetAction(QToolBarItem *item) { QWidgetAction *a = qobject_cast(item->action); - return a != 0 && a->defaultWidget() == item->widget(); + return a != nullptr && a->defaultWidget() == item->widget(); } void QToolBarLayout::updateMacBorderMetrics() @@ -568,7 +568,7 @@ bool QToolBarLayout::layoutActions(const QSize &size) // widgets into the menu. If only custom widget actions are chopped off, the popup menu // is empty. So we show the little extension button to show something is chopped off, // but we make it disabled. - extension->setEnabled(popupMenu == 0 || !extensionMenuContainsOnlyWidgetActions); + extension->setEnabled(popupMenu == nullptr || !extensionMenuContainsOnlyWidgetActions); // we have to do the show/hide here, because it triggers more calls to setGeometry :( for (int i = 0; i < showWidgets.count(); ++i) @@ -615,7 +615,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const ++rows; // we want to expand to at least two rows int space = total_w/rows + spacing + extensionExtent; space = qMax(space, min_w - pick(o, margins) - handleExtent); - if (win != 0) + if (win != nullptr) space = qMin(space, pick(o, win->size()) - pick(o, margins) - handleExtent); int w = 0; @@ -651,7 +651,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const w += pick(Qt::Horizontal, margins) + handleExtent + spacing + extensionExtent; w = qMax(w, min_w); - if (win != 0) + if (win != nullptr) w = qMin(w, pick(o, win->size())); h += pick(Qt::Vertical, margins) - spacing; //there is no spacing before the first row @@ -710,14 +710,14 @@ QToolBarItem *QToolBarLayout::createItem(QAction *action) { bool customWidget = false; bool standardButtonWidget = false; - QWidget *widget = 0; + QWidget *widget = nullptr; QToolBar *tb = qobject_cast(parentWidget()); if (!tb) - return (QToolBarItem *)0; + return (QToolBarItem *)nullptr; if (QWidgetAction *widgetAction = qobject_cast(action)) { widget = widgetAction->requestWidget(tb); - if (widget != 0) { + if (widget != nullptr) { widget->setAttribute(Qt::WA_LayoutUsesWidgetRect); customWidget = true; } diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index 4d7f543a99..4767394842 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -111,7 +111,7 @@ public: typedef std::vector> PageList; inline QToolBoxPrivate() - : currentPage(0) + : currentPage(nullptr) { } void _q_buttonClicked(); @@ -157,7 +157,7 @@ const QToolBoxPrivate::Page *QToolBoxPrivate::page(int index) const void QToolBoxPrivate::updateTabs() { - QToolBoxButton *lastButton = currentPage ? currentPage->button : 0; + QToolBoxButton *lastButton = currentPage ? currentPage->button : nullptr; bool after = false; int index = 0; for (const auto &page : pageList) { @@ -184,7 +184,7 @@ QSize QToolBoxButton::sizeHint() const { QSize iconSize(8, 8); if (!icon().isNull()) { - int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() /* QToolBox */); + int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, parentWidget() /* QToolBox */); iconSize += QSize(icone + 2, icone); } QSize textSize = fontMetrics().size(Qt::TextShowMnemonic, text()) + QSize(0, 8); @@ -197,7 +197,7 @@ QSize QToolBoxButton::minimumSizeHint() const { if (icon().isNull()) return QSize(); - int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() /* QToolBox */); + int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, parentWidget() /* QToolBox */); return QSize(icone + 8, icone + 8); } @@ -378,7 +378,7 @@ int QToolBox::insertItem(int index, QWidget *widget, const QIcon &icon, const QS QWidget *current = d->currentPage->widget; int oldindex = indexOf(current); if (index <= oldindex) { - d->currentPage = 0; // trigger change + d->currentPage = nullptr; // trigger change setCurrentIndex(oldindex); } } @@ -472,10 +472,10 @@ void QToolBoxPrivate::_q_widgetDestroyed(QObject *object) pageList.erase(std::remove_if(pageList.begin(), pageList.end(), pageEquals(c)), pageList.end()); if (pageList.empty()) { - currentPage = 0; + currentPage = nullptr; emit q->currentChanged(-1); } else if (removeCurrent) { - currentPage = 0; + currentPage = nullptr; q->setCurrentIndex(0); } } @@ -562,7 +562,7 @@ QWidget *QToolBox::widget(int index) const int QToolBox::indexOf(QWidget *widget) const { Q_D(const QToolBox); - const QToolBoxPrivate::Page *c = (widget ? d->page(widget) : 0); + const QToolBoxPrivate::Page *c = (widget ? d->page(widget) : nullptr); if (!c) return -1; const auto it = std::find_if(d->pageList.cbegin(), d->pageList.cend(), pageEquals(c)); diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index b00b219386..263fe5d8ce 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -202,7 +202,7 @@ QToolButton::QToolButton(QWidget * parent) void QToolButtonPrivate::init() { Q_Q(QToolButton); - defaultAction = 0; + defaultAction = nullptr; #if QT_CONFIG(toolbar) if (qobject_cast(parent)) autoRaise = true; @@ -227,7 +227,7 @@ void QToolButtonPrivate::init() #endif setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem); - delay = q->style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, q); + delay = q->style()->styleHint(QStyle::SH_ToolButton_PopupDelay, nullptr, q); } /*! @@ -477,10 +477,10 @@ void QToolButton::actionEvent(QActionEvent *event) break; case QEvent::ActionRemoved: if (d->defaultAction == action) - d->defaultAction = 0; + d->defaultAction = nullptr; #if QT_CONFIG(menu) if (action == d->menuAction) - d->menuAction = 0; + d->menuAction = nullptr; #endif action->disconnect(this); break; @@ -583,7 +583,7 @@ void QToolButton::changeEvent(QEvent *e) || e->type() == QEvent::MacSizeChange #endif ) { - d->delay = style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, this); + d->delay = style()->styleHint(QStyle::SH_ToolButton_PopupDelay, nullptr, this); d->setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem); } #endif @@ -649,7 +649,7 @@ void QToolButton::setMenu(QMenu* menu) { Q_D(QToolButton); - if (d->menuAction == (menu ? menu->menuAction() : 0)) + if (d->menuAction == (menu ? menu->menuAction() : nullptr)) return; if (d->menuAction) @@ -659,7 +659,7 @@ void QToolButton::setMenu(QMenu* menu) d->menuAction = menu->menuAction(); addAction(d->menuAction); } else { - d->menuAction = 0; + d->menuAction = nullptr; } // changing the menu set may change the size hint, so reset it diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp index 486d65d92c..cec6ba1dea 100644 --- a/src/widgets/widgets/qwidgetanimator.cpp +++ b/src/widgets/widgets/qwidgetanimator.cpp @@ -99,7 +99,7 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo #if QT_CONFIG(animation) //If the QStyle has animations, animate - if (const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, widget)) { + if (const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, widget)) { AnimationMap::const_iterator it = m_animation_map.constFind(widget); if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry) return; diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 9cdae4f28f..a242947c11 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -964,7 +964,7 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields) if (maskFields.isEmpty() || delimiter == 0) { if (m_maskData) { delete [] m_maskData; - m_maskData = 0; + m_maskData = nullptr; m_maxLength = 32767; internalSetText(QString(), -1, false); } diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 1c169c3325..0b3c30312d 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -125,7 +125,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor) } QWidgetTextControlPrivate::QWidgetTextControlPrivate() - : doc(0), cursorOn(false), cursorVisible(false), cursorIsFocusIndicator(false), + : doc(nullptr), cursorOn(false), cursorVisible(false), cursorIsFocusIndicator(false), #ifndef Q_OS_ANDROID interactionFlags(Qt::TextEditorInteraction), #else @@ -683,7 +683,7 @@ void QWidgetTextControlPrivate::_q_contentsChanged(int from, int charsRemoved, i // always report the right number of removed chars, but in lack of the real string use spaces QString oldText = QString(charsRemoved, QLatin1Char(' ')); - QAccessibleEvent *ev = 0; + QAccessibleEvent *ev = nullptr; if (charsRemoved == 0) { ev = new QAccessibleTextInsertEvent(q->parent(), from, newText); } else if (charsAdded == 0) { @@ -906,12 +906,12 @@ void QWidgetTextControl::setDocument(QTextDocument *document) d->doc->disconnect(this); d->doc->documentLayout()->disconnect(this); - d->doc->documentLayout()->setPaintDevice(0); + d->doc->documentLayout()->setPaintDevice(nullptr); if (d->doc->parent() == this) delete d->doc; - d->doc = 0; + d->doc = nullptr; d->setContent(Qt::RichText, QString(), document); } @@ -2302,7 +2302,7 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget d->linkToCopy = anchorAt(pos); if (d->linkToCopy.isEmpty() && !showTextSelectionActions) - return 0; + return nullptr; QMenu *menu = new QMenu(parent); QAction *a; @@ -2656,7 +2656,7 @@ void QWidgetTextControl::print(QPagedPaintDevice *printer) const Q_D(const QWidgetTextControl); if (!printer) return; - QTextDocument *tempDoc = 0; + QTextDocument *tempDoc = nullptr; const QTextDocument *doc = d->doc; if (QPagedPaintDevicePrivate::get(printer)->printSelectionOnly) { if (!d->cursor.hasSelection()) -- cgit v1.2.3