From 2bfb89e133b8dcb138e046700ef4fbecb9da8fa0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 27 Jan 2019 17:48:33 +0100 Subject: [PATCH] QtWidgets: replace 0 with \nullptr in documentation Replace 0 with \nullptr in the documentation. As a drive-by also replace some 0 with nullptr in the corresponding code. Change-Id: Id8056dc2364a372e40bc04e8cb9fcc443e49fb18 Reviewed-by: Paul Wicking --- .../graphicsview/qgraphicsgridlayout.cpp | 11 +-- src/widgets/graphicsview/qgraphicsitem.cpp | 96 ++++++++++--------- .../graphicsview/qgraphicslayoutitem.cpp | 14 +-- .../graphicsview/qgraphicsproxywidget.cpp | 4 +- src/widgets/graphicsview/qgraphicsscene.cpp | 43 +++++---- .../graphicsview/qgraphicssceneevent.cpp | 4 +- src/widgets/graphicsview/qgraphicsview.cpp | 2 +- src/widgets/graphicsview/qgraphicswidget.cpp | 32 +++---- src/widgets/itemviews/qabstractitemview.cpp | 4 +- src/widgets/itemviews/qcolumnview.cpp | 2 +- src/widgets/itemviews/qtableview.cpp | 9 +- src/widgets/itemviews/qtreewidget.cpp | 16 ++-- 12 files changed, 120 insertions(+), 117 deletions(-) diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp index d9005afbef..6b7052a0ab 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp @@ -552,20 +552,19 @@ int QGraphicsGridLayout::count() const } /*! - Returns the layout item at \a index, or 0 if there is no layout item at - this index. + Returns the layout item at \a index, or \nullptr if there is no + layout item at this index. */ QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int index) const { Q_D(const QGraphicsGridLayout); if (index < 0 || index >= d->engine.itemCount()) { qWarning("QGraphicsGridLayout::itemAt: invalid index %d", index); - return 0; + return nullptr; } - QGraphicsLayoutItem *item = 0; if (QGraphicsGridLayoutEngineItem *engineItem = static_cast(d->engine.itemAt(index))) - item = engineItem->layoutItem(); - return item; + return engineItem->layoutItem(); + return nullptr; } /*! diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 86f3d6a2f0..4476ecded3 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -661,9 +661,9 @@ \value ItemSceneChange The item is moved to a new scene. This notification is also sent when the item is added to its initial scene, and when it is removed. - The item's scene() is the old scene (or 0 if the item has not been added to a - scene yet). The value argument is the new scene (i.e., a QGraphicsScene - pointer), or a null pointer if the item is removed from a scene. Do not + The item's scene() is the old scene, or \nullptr if the item has not been added + to a scene yet. The value argument is the new scene (i.e., a QGraphicsScene + pointer), or \nullptr if the item is removed from a scene. Do not override this change by passing this item to QGraphicsScene::addItem() as this notification is delivered; instead, you can return the new scene from itemChange(). Use this feature with caution; objecting to a scene change can @@ -1542,7 +1542,7 @@ void QGraphicsItemCache::purge() Constructs a QGraphicsItem with the given \a parent item. It does not modify the parent object returned by QObject::parent(). - If \a parent is 0, you can add the item to a scene by calling + If \a parent is \nullptr, you can add the item to a scene by calling QGraphicsScene::addItem(). The item will then become a top-level item. \sa QGraphicsScene::addItem(), setParentItem() @@ -1650,8 +1650,8 @@ QGraphicsItem::~QGraphicsItem() } /*! - Returns the current scene for the item, or 0 if the item is not stored in - a scene. + Returns the current scene for the item, or \nullptr if the item is + not stored in a scene. To add or move an item to a scene, call QGraphicsScene::addItem(). */ @@ -1661,15 +1661,15 @@ QGraphicsScene *QGraphicsItem::scene() const } /*! - Returns a pointer to this item's item group, or 0 if this item is not - member of a group. + Returns a pointer to this item's item group, or \nullptr if this + item is not member of a group. \sa QGraphicsItemGroup, QGraphicsScene::createItemGroup() */ QGraphicsItemGroup *QGraphicsItem::group() const { if (!d_ptr->isMemberOfGroup) - return 0; + return nullptr; QGraphicsItem *parent = const_cast(this); while ((parent = parent->d_ptr->parent)) { if (QGraphicsItemGroup *group = qgraphicsitem_cast(parent)) @@ -1677,11 +1677,11 @@ QGraphicsItemGroup *QGraphicsItem::group() const } // Unreachable; if d_ptr->isMemberOfGroup is != 0, then one parent of this // item is a group item. - return 0; + return nullptr; } /*! - Adds this item to the item group \a group. If \a group is 0, this item is + Adds this item to the item group \a group. If \a group is \nullptr, this item is removed from any current group and added as a child of the previous group's parent. @@ -1699,7 +1699,7 @@ void QGraphicsItem::setGroup(QGraphicsItemGroup *group) /*! Returns a pointer to this item's parent item. If this item does not have a - parent, 0 is returned. + parent, \nullptr is returned. \sa setParentItem(), childItems() */ @@ -1710,8 +1710,9 @@ QGraphicsItem *QGraphicsItem::parentItem() const /*! Returns this item's top-level item. The top-level item is the item's - topmost ancestor item whose parent is 0. If an item has no parent, its own - pointer is returned (i.e., a top-level item is its own top-level item). + topmost ancestor item whose parent is \nullptr. If an item has no + parent, its own pointer is returned (i.e., a top-level item is its + own top-level item). \sa parentItem() */ @@ -1734,7 +1735,7 @@ QGraphicsItem *QGraphicsItem::topLevelItem() const QGraphicsObject *QGraphicsItem::parentObject() const { QGraphicsItem *p = d_ptr->parent; - return (p && p->d_ptr->isObject) ? static_cast(p) : 0; + return (p && p->d_ptr->isObject) ? static_cast(p) : nullptr; } /*! @@ -1757,23 +1758,24 @@ QGraphicsWidget *QGraphicsItem::parentWidget() const \since 4.4 Returns a pointer to the item's top level widget (i.e., the item's - ancestor whose parent is 0, or whose parent is not a widget), or 0 if this - item does not have a top level widget. If the item is its own top level - widget, this function returns a pointer to the item itself. + ancestor whose parent is \nullptr, or whose parent is not a widget), or + \nullptr if this item does not have a top level widget. If the item + is its own top level widget, this function returns a pointer to the + item itself. */ QGraphicsWidget *QGraphicsItem::topLevelWidget() const { if (const QGraphicsWidget *p = parentWidget()) return p->topLevelWidget(); - return isWidget() ? static_cast(const_cast(this)) : 0; + return isWidget() ? static_cast(const_cast(this)) : nullptr; } /*! \since 4.4 - Returns the item's window, or 0 if this item does not have a window. If - the item is a window, it will return itself. Otherwise it will return the - closest ancestor that is a window. + Returns the item's window, or \nullptr if this item does not have a + window. If the item is a window, it will return itself. Otherwise + it will return the closest ancestor that is a window. \sa QGraphicsWidget::isWindow() */ @@ -1782,15 +1784,15 @@ QGraphicsWidget *QGraphicsItem::window() const QGraphicsItem *p = panel(); if (p && p->isWindow()) return static_cast(p); - return 0; + return nullptr; } /*! \since 4.6 - Returns the item's panel, or 0 if this item does not have a panel. If the - item is a panel, it will return itself. Otherwise it will return the - closest ancestor that is a panel. + Returns the item's panel, or \nullptr if this item does not have a + panel. If the item is a panel, it will return itself. Otherwise it + will return the closest ancestor that is a panel. \sa isPanel(), ItemIsPanel */ @@ -1798,7 +1800,7 @@ QGraphicsItem *QGraphicsItem::panel() const { if (d_ptr->flags & ItemIsPanel) return const_cast(this); - return d_ptr->parent ? d_ptr->parent->panel() : 0; + return d_ptr->parent ? d_ptr->parent->panel() : nullptr; } /*! @@ -2397,7 +2399,7 @@ bool QGraphicsItem::isVisible() const /*! \since 4.4 Returns \c true if the item is visible to \a parent; otherwise, false is - returned. \a parent can be 0, in which case this function will return + returned. \a parent can be \nullptr, in which case this function will return whether the item is visible to the scene or not. An item may not be visible to its ancestors even if isVisible() is true. It @@ -2925,7 +2927,7 @@ void QGraphicsItem::setOpacity(qreal opacity) } /*! - Returns a pointer to this item's effect if it has one; otherwise 0. + Returns a pointer to this item's effect if it has one; otherwise \nullptr. \since 4.6 */ @@ -2939,7 +2941,7 @@ QGraphicsEffect *QGraphicsItem::graphicsEffect() const Sets \a effect as the item's effect. If there already is an effect installed on this item, QGraphicsItem will delete the existing effect before installing the new \a effect. You can delete an existing effect by calling - setGraphicsEffect(0). + setGraphicsEffect(\nullptr). If \a effect is the installed effect on a different item, setGraphicsEffect() will remove the effect from the item and install it on this item. @@ -3577,7 +3579,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenB /*! \since 4.6 - Returns this item's focus proxy, or 0 if this item has no + Returns this item's focus proxy, or \nullptr if this item has no focus proxy. \sa setFocusProxy(), setFocus(), hasFocus() @@ -3640,7 +3642,7 @@ void QGraphicsItem::setFocusProxy(QGraphicsItem *item) If this item, a child or descendant of this item currently has input focus, this function will return a pointer to that item. If - no descendant has input focus, 0 is returned. + no descendant has input focus, \nullptr is returned. \sa hasFocus(), setFocus(), QWidget::focusWidget() */ @@ -5790,7 +5792,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem /*! \internal - Sets the focusProxy pointer to 0 for all items that have this item as their + Sets the focusProxy pointer to \nullptr for all items that have this item as their focusProxy. */ void QGraphicsItemPrivate::resetFocusProxy() @@ -6001,7 +6003,7 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) Maps the point \a point, which is in this item's coordinate system, to \a item's coordinate system, and returns the mapped coordinate. - If \a item is 0, this function returns the same as mapToScene(). + If \a item is \nullptr, this function returns the same as mapToScene(). \sa itemTransform(), mapToParent(), mapToScene(), transform(), mapFromItem(), {The Graphics View Coordinate System} @@ -6071,7 +6073,7 @@ QPointF QGraphicsItem::mapToScene(const QPointF &point) const Maps the rectangle \a rect, which is in this item's coordinate system, to \a item's coordinate system, and returns the mapped rectangle as a polygon. - If \a item is 0, this function returns the same as mapToScene(). + If \a item is \nullptr, this function returns the same as mapToScene(). \sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System} @@ -6142,7 +6144,7 @@ QPolygonF QGraphicsItem::mapToScene(const QRectF &rect) const \a item's coordinate system, and returns the mapped rectangle as a new rectangle (i.e., the bounding rectangle of the resulting polygon). - If \a item is 0, this function returns the same as mapRectToScene(). + If \a item is \nullptr, this function returns the same as mapRectToScene(). \sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System} @@ -6217,7 +6219,7 @@ QRectF QGraphicsItem::mapRectToScene(const QRectF &rect) const this item's coordinate system, and returns the mapped rectangle as a new rectangle (i.e., the bounding rectangle of the resulting polygon). - If \a item is 0, this function returns the same as mapRectFromScene(). + If \a item is \nullptr, this function returns the same as mapRectFromScene(). \sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System} @@ -6290,7 +6292,7 @@ QRectF QGraphicsItem::mapRectFromScene(const QRectF &rect) const Maps the polygon \a polygon, which is in this item's coordinate system, to \a item's coordinate system, and returns the mapped polygon. - If \a item is 0, this function returns the same as mapToScene(). + If \a item is \nullptr, this function returns the same as mapToScene(). \sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System} @@ -6337,7 +6339,7 @@ QPolygonF QGraphicsItem::mapToScene(const QPolygonF &polygon) const Maps the path \a path, which is in this item's coordinate system, to \a item's coordinate system, and returns the mapped path. - If \a item is 0, this function returns the same as mapToScene(). + If \a item is \nullptr, this function returns the same as mapToScene(). \sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System} @@ -6384,7 +6386,7 @@ QPainterPath QGraphicsItem::mapToScene(const QPainterPath &path) const Maps the point \a point, which is in \a item's coordinate system, to this item's coordinate system, and returns the mapped coordinate. - If \a item is 0, this function returns the same as mapFromScene(). + If \a item is \nullptr, this function returns the same as mapFromScene(). \sa itemTransform(), mapFromParent(), mapFromScene(), transform(), mapToItem(), {The Graphics View Coordinate System} @@ -6456,7 +6458,7 @@ QPointF QGraphicsItem::mapFromScene(const QPointF &point) const this item's coordinate system, and returns the mapped rectangle as a polygon. - If \a item is 0, this function returns the same as mapFromScene() + If \a item is \nullptr, this function returns the same as mapFromScene() \sa itemTransform(), mapToItem(), mapFromParent(), transform(), {The Graphics View Coordinate System} @@ -6524,7 +6526,7 @@ QPolygonF QGraphicsItem::mapFromScene(const QRectF &rect) const Maps the polygon \a polygon, which is in \a item's coordinate system, to this item's coordinate system, and returns the mapped polygon. - If \a item is 0, this function returns the same as mapFromScene(). + If \a item is \nullptr, this function returns the same as mapFromScene(). \sa itemTransform(), mapToItem(), mapFromParent(), transform(), {The Graphics View Coordinate System} @@ -6569,7 +6571,7 @@ QPolygonF QGraphicsItem::mapFromScene(const QPolygonF &polygon) const Maps the path \a path, which is in \a item's coordinate system, to this item's coordinate system, and returns the mapped path. - If \a item is 0, this function returns the same as mapFromScene(). + If \a item is \nullptr, this function returns the same as mapFromScene(). \sa itemTransform(), mapFromParent(), mapFromScene(), mapToItem(), {The Graphics View Coordinate System} @@ -6633,15 +6635,15 @@ bool QGraphicsItem::isAncestorOf(const QGraphicsItem *child) const /*! \since 4.4 - Returns the closest common ancestor item of this item and \a other, or 0 - if either \a other is 0, or there is no common ancestor. + Returns the closest common ancestor item of this item and \a other, + or \nullptr if either \a other is \nullptr, or there is no common ancestor. \sa isAncestorOf() */ QGraphicsItem *QGraphicsItem::commonAncestorItem(const QGraphicsItem *other) const { if (!other) - return 0; + return nullptr; if (other == this) return const_cast(this); const QGraphicsItem *thisw = this; @@ -6726,7 +6728,7 @@ void QGraphicsItem::setData(int key, const QVariant &value) \since 4.2 Returns the given \a item cast to type T if \a item is of type T; - otherwise, 0 is returned. + otherwise, \nullptr is returned. \note To make this function work correctly with custom items, reimplement the \l{QGraphicsItem::}{type()} function for each custom QGraphicsItem diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp index aed154a95f..1192bad51e 100644 --- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp +++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp @@ -193,7 +193,7 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) /*! \internal - Returns the parent item of this layout, or 0 if this layout is + Returns the parent item of this layout, or \nullptr if this layout is not installed on any widget. If this is the item that the layout is installed on, it will return "itself". @@ -214,7 +214,7 @@ QGraphicsItem *QGraphicsLayoutItemPrivate::parentItem() const while (parent && parent->isLayout()) { parent = parent->parentLayoutItem(); } - return parent ? parent->graphicsItem() : 0; + return parent ? parent->graphicsItem() : nullptr; } /*! @@ -368,7 +368,7 @@ bool QGraphicsLayoutItemPrivate::hasWidthForHeight() const passing a QGraphicsLayoutItem pointer to QGraphicsLayoutItem's protected constructor, or by calling setParentLayoutItem(). The parentLayoutItem() function returns a pointer to the item's layoutItem - parent. If the item's parent is 0 or if the parent does not inherit + parent. If the item's parent is \nullptr or if the parent does not inherit from QGraphicsItem, the parentLayoutItem() function then returns \nullptr. isLayout() returns \c true if the QGraphicsLayoutItem subclass is itself a layout, or false otherwise. @@ -737,7 +737,7 @@ QRectF QGraphicsLayoutItem::geometry() const This virtual function provides the \a left, \a top, \a right and \a bottom contents margins for this QGraphicsLayoutItem. The default implementation assumes all contents margins are 0. The parameters point to values stored - in qreals. If any of the pointers is 0, that value will not be updated. + in qreals. If any of the pointers is \nullptr, that value will not be updated. \sa QGraphicsWidget::setContentsMargins() */ @@ -826,8 +826,8 @@ void QGraphicsLayoutItem::updateGeometry() } /*! - Returns the parent of this QGraphicsLayoutItem, or 0 if there is no parent, - or if the parent does not inherit from QGraphicsLayoutItem + Returns the parent of this QGraphicsLayoutItem, or \nullptr if there is + no parent, or if the parent does not inherit from QGraphicsLayoutItem (QGraphicsLayoutItem is often used through multiple inheritance with QObject-derived classes). @@ -917,7 +917,7 @@ QGraphicsItem *QGraphicsLayoutItem::graphicsItem() const * advantage of the automatic reparenting capabilities of QGraphicsLayout it * should set this value. * Note that if you delete \a item and not delete the layout item, you are - * responsible of calling setGraphicsItem(0) in order to avoid having a + * responsible of calling setGraphicsItem(\nullptr) in order to avoid having a * dangling pointer. * * \sa graphicsItem() diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 513cf9d361..e9f092020f 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -556,7 +556,7 @@ QGraphicsProxyWidget::~QGraphicsProxyWidget() exclusively either inside or outside of Graphics View. You cannot embed a widget as long as it is is visible elsewhere in the UI, at the same time. - \a widget must be a top-level widget whose parent is 0. + \a widget must be a top-level widget whose parent is \nullptr. When the widget is embedded, its state (e.g., visible, enabled, geometry, size hints) is copied into the proxy widget. If the embedded widget is @@ -739,7 +739,7 @@ QWidget *QGraphicsProxyWidget::widget() const Returns the rectangle for \a widget, which must be a descendant of widget(), or widget() itself, in this proxy item's local coordinates. - If no widget is embedded, \a widget is 0, or \a widget is not a + If no widget is embedded, \a widget is \nullptr, or \a widget is not a descendant of the embedded widget, this function returns an empty QRectF. \sa widget() diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index bba992144d..db7ce5251a 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -2144,8 +2144,8 @@ QList QGraphicsScene::collidingItems(const QGraphicsItem *item, \overload \obsolete - Returns the topmost visible item at the specified \a position, or 0 if - there are no items at this position. + Returns the topmost visible item at the specified \a position, or + \nullptr if there are no items at this position. This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes @@ -2159,7 +2159,7 @@ QList QGraphicsScene::collidingItems(const QGraphicsItem *item, /*! \since 4.6 - Returns the topmost visible item at the specified \a position, or 0 + Returns the topmost visible item at the specified \a position, or \nullptr if there are no items at this position. \a deviceTransform is the transformation that applies to the view, and needs to @@ -2173,7 +2173,7 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform { const QList itemsAtPoint = items(position, Qt::IntersectsItemShape, Qt::DescendingOrder, deviceTransform); - return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); + return itemsAtPoint.isEmpty() ? nullptr : itemsAtPoint.first(); } /*! @@ -2182,7 +2182,7 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform \since 4.6 Returns the topmost visible item at the position specified by (\a x, \a - y), or 0 if there are no items at this position. + y), or \nullptr if there are no items at this position. \a deviceTransform is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations. @@ -2199,7 +2199,7 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform \obsolete Returns the topmost visible item at the position specified by (\a x, \a - y), or 0 if there are no items at this position. + y), or \nullptr if there are no items at this position. This convenience function is equivalent to calling \c {itemAt(QPointF(x, y))}. @@ -2941,9 +2941,9 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) /*! When the scene is active, this functions returns the scene's current focus - item, or 0 if no item currently has focus. When the scene is inactive, this - functions returns the item that will gain input focus when the scene becomes - active. + item, or \nullptr if no item currently has focus. When the scene is inactive, + this functions returns the item that will gain input focus when the scene + becomes active. The focus item receives keyboard input when the scene receives a key event. @@ -2961,12 +2961,12 @@ QGraphicsItem *QGraphicsScene::focusItem() const focusReason, after removing focus from any previous item that may have had focus. - If \a item is 0, or if it either does not accept focus (i.e., it does not + If \a item is \nullptr, or if it either does not accept focus (i.e., it does not have the QGraphicsItem::ItemIsFocusable flag enabled), or is not visible or not enabled, this function only removes focus from any previous focusitem. - If item is not 0, and the scene does not currently have focus (i.e., + If item is not \nullptr, and the scene does not currently have focus (i.e., hasFocus() returns \c false), this function will call setFocus() automatically. @@ -3062,9 +3062,9 @@ bool QGraphicsScene::stickyFocus() const } /*! - Returns the current mouse grabber item, or 0 if no item is currently - grabbing the mouse. The mouse grabber item is the item that receives all - mouse events sent to the scene. + Returns the current mouse grabber item, or \nullptr if no item is + currently grabbing the mouse. The mouse grabber item is the item + that receives all mouse events sent to the scene. An item becomes a mouse grabber when it receives and accepts a mouse press event, and it stays the mouse grabber until either of @@ -5547,7 +5547,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next) \a oldFocusItem is a pointer to the item that previously had focus, or 0 if no item had focus before the signal was emitted. \a newFocusItem - is a pointer to the item that gained input focus, or 0 if focus was lost. + is a pointer to the item that gained input focus, or \nullptr if focus was lost. \a reason is the reason for the focus change (e.g., if the scene was deactivated while an input field had focus, \a oldFocusItem would point to the input field item, \a newFocusItem would be 0, and \a reason would be @@ -5582,7 +5582,7 @@ QStyle *QGraphicsScene::style() const the style for all widgets in the scene that do not have a style explicitly assigned to them. - If \a style is 0, QGraphicsScene will revert to QApplication::style(). + If \a style is \nullptr, QGraphicsScene will revert to QApplication::style(). \sa style() */ @@ -5703,7 +5703,8 @@ bool QGraphicsScene::isActive() const /*! \since 4.6 - Returns the current active panel, or 0 if no panel is currently active. + Returns the current active panel, or \nullptr if no panel is + currently active. \sa QGraphicsScene::setActivePanel() */ @@ -5720,7 +5721,7 @@ QGraphicsItem *QGraphicsScene::activePanel() const deactivate any currently active panel. If the scene is currently inactive, \a item remains inactive until the - scene becomes active (or, ir \a item is 0, no item will be activated). + scene becomes active (or, ir \a item is \nullptr, no item will be activated). \sa activePanel(), isActive(), QGraphicsItem::isActive() */ @@ -5733,8 +5734,8 @@ void QGraphicsScene::setActivePanel(QGraphicsItem *item) /*! \since 4.4 - Returns the current active window, or 0 if no window is currently - active. + Returns the current active window, or \nullptr if no window is + currently active. \sa QGraphicsScene::setActiveWindow() */ @@ -5743,7 +5744,7 @@ QGraphicsWidget *QGraphicsScene::activeWindow() const Q_D(const QGraphicsScene); if (d->activePanel && d->activePanel->isWindow()) return static_cast(d->activePanel); - return 0; + return nullptr; } /*! diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp index 398ef1aaf5..5077a39d67 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.cpp +++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp @@ -319,8 +319,8 @@ QGraphicsSceneEvent::~QGraphicsSceneEvent() } /*! - Returns the widget where the event originated, or 0 if the event - originates from another application. + Returns the widget where the event originated, or \nullptr if the + event originates from another application. */ QWidget *QGraphicsSceneEvent::widget() const { diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 24647dd74c..5fe520132f 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1676,7 +1676,7 @@ void QGraphicsView::setInteractive(bool allowed) /*! Returns a pointer to the scene that is currently visualized in the - view. If no scene is currently visualized, 0 is returned. + view. If no scene is currently visualized, \nullptr is returned. \sa setScene() */ diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index a4534c73dd..c994136091 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE manage the relationships between parent and child items. These functions control the stacking order of items as well as their ownership. - \note The QObject::parent() should always return 0 for QGraphicsWidgets, + \note The QObject::parent() should always return \nullptr for QGraphicsWidgets, but this policy is not strictly defined. \sa QGraphicsProxyWidget, QGraphicsItem, {Widgets and Layouts} @@ -518,7 +518,7 @@ void QGraphicsWidget::setContentsMargins(qreal left, qreal top, qreal right, qre /*! Gets the widget's contents margins. The margins are stored in \a left, \a top, \a right and \a bottom, as pointers to qreals. Each argument can - be \e {omitted} by passing 0. + be \e {omitted} by passing \nullptr. \sa setContentsMargins() */ @@ -573,7 +573,7 @@ void QGraphicsWidget::setWindowFrameMargins(qreal left, qreal top, qreal right, /*! Gets the widget's window frame margins. The margins are stored in \a left, \a top, \a right and \a bottom as pointers to qreals. Each argument can - be \e {omitted} by passing 0. + be \e {omitted} by passing \nullptr. \sa setWindowFrameMargins(), windowFrameRect() */ @@ -780,7 +780,7 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c \brief The layout of the widget Any existing layout manager is deleted before the new layout is assigned. If - \a layout is 0, the widget is left without a layout. Existing subwidgets' + \a layout is \nullptr, the widget is left without a layout. Existing subwidgets' geometries will remain unaffected. QGraphicsWidget takes ownership of \a layout. @@ -792,7 +792,7 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c explicitly managed by \a layout remain unaffected by the layout after it has been assigned to this widget. - If no layout is currently managing this widget, layout() will return 0. + If no layout is currently managing this widget, layout() will return \nullptr. */ @@ -803,8 +803,8 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c */ /*! - Returns this widget's layout, or 0 if no layout is currently managing this - widget. + Returns this widget's layout, or \nullptr if no layout is currently + managing this widget. \sa setLayout() */ @@ -818,7 +818,7 @@ QGraphicsLayout *QGraphicsWidget::layout() const \fn void QGraphicsWidget::setLayout(QGraphicsLayout *layout) Sets the layout for this widget to \a layout. Any existing layout manager - is deleted before the new layout is assigned. If \a layout is 0, the + is deleted before the new layout is assigned. If \a layout is \nullptr, the widget is left without a layout. Existing subwidgets' geometries will remain unaffected. @@ -937,11 +937,11 @@ QStyle *QGraphicsWidget::style() const Sets the widget's style to \a style. QGraphicsWidget does \e not take ownership of \a style. - If no style is assigned, or \a style is 0, the widget will use + If no style is assigned, or \a style is \nullptr, the widget will use QGraphicsScene::style() (if this has been set). Otherwise the widget will use QApplication::style(). - This function sets the Qt::WA_SetStyle attribute if \a style is not 0; + This function sets the Qt::WA_SetStyle attribute if \a style is not \nullptr; otherwise it clears the attribute. \sa style() @@ -1871,7 +1871,7 @@ void QGraphicsWidget::setFocusPolicy(Qt::FocusPolicy policy) /*! If this widget, a child or descendant of this widget currently has input focus, this function will return a pointer to that widget. If - no descendant widget has input focus, 0 is returned. + no descendant widget has input focus, \nullptr is returned. \sa QGraphicsItem::focusItem(), QWidget::focusWidget() */ @@ -1880,7 +1880,7 @@ QGraphicsWidget *QGraphicsWidget::focusWidget() const Q_D(const QGraphicsWidget); if (d->subFocusItem && d->subFocusItem->d_ptr->isWidget) return static_cast(d->subFocusItem); - return 0; + return nullptr; } #ifndef QT_NO_SHORTCUT @@ -2022,7 +2022,7 @@ void QGraphicsWidget::addActions(QList actions) \since 4.5 Inserts the action \a action to this widget's list of actions, - before the action \a before. It appends the action if \a before is 0 or + before the action \a before. It appends the action if \a before is \nullptr or \a before is not a valid action for this widget. A QGraphicsWidget should only have one of each action. @@ -2062,7 +2062,7 @@ void QGraphicsWidget::insertAction(QAction *before, QAction *action) \since 4.5 Inserts the actions \a actions to this widget's list of actions, - before the action \a before. It appends the action if \a before is 0 or + before the action \a before. It appends the action if \a before is \nullptr or \a before is not a valid action for this widget. A QGraphicsWidget can have at most one of each action. @@ -2131,9 +2131,9 @@ QList QGraphicsWidget::actions() const \snippet code/src_gui_graphicsview_qgraphicswidget.cpp 2 - If \a first is 0, this indicates that \a second should be the first widget + If \a first is \nullptr, this indicates that \a second should be the first widget to receive input focus should the scene gain Tab focus (i.e., the user - hits Tab so that focus passes into the scene). If \a second is 0, this + hits Tab so that focus passes into the scene). If \a second is \nullptr, this indicates that \a first should be the first widget to gain focus if the scene gained BackTab focus. diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 1151379e17..7441161e13 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -940,8 +940,8 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de \since 4.2 Returns the item delegate used by this view and model for the given \a row, - or 0 if no delegate has been assigned. You can call itemDelegate() to get a - pointer to the current delegate for a given index. + or \nullptr if no delegate has been assigned. You can call itemDelegate() + to get a pointer to the current delegate for a given index. \sa setItemDelegateForRow(), itemDelegateForColumn(), setItemDelegate() */ diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp index 1fe17721ba..a4eed2d885 100644 --- a/src/widgets/itemviews/qcolumnview.cpp +++ b/src/widgets/itemviews/qcolumnview.cpp @@ -801,7 +801,7 @@ void QColumnView::initializeColumn(QAbstractItemView *column) const } /*! - Returns the preview widget, or 0 if there is none. + Returns the preview widget, or \nullptr if there is none. \sa setPreviewWidget(), updatePreviewWidget() */ diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index a7d144672c..dd43c6d3e4 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -138,20 +138,21 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) } /** \internal - * \return a spans that spans over cell x,y (column,row) or 0 if there is none. + * \return a spans that spans over cell x,y (column,row) + * or \nullptr if there is none. */ QSpanCollection::Span *QSpanCollection::spanAt(int x, int y) const { Index::const_iterator it_y = index.lowerBound(-y); if (it_y == index.end()) - return 0; + return nullptr; SubIndex::const_iterator it_x = (*it_y).lowerBound(-x); if (it_x == (*it_y).end()) - return 0; + return nullptr; Span *span = *it_x; if (span->right() >= x && span->bottom() >= y) return span; - return 0; + return nullptr; } diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 6050bcd616..29cc199526 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2539,8 +2539,8 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, QStyle::SH_ItemView_ActivateItemOnSingleClick style hint) or pressing a special key (e.g., \uicontrol Enter). - The specified \a item is the item that was clicked, or 0 if no - item was clicked. The \a column is the item's column that was + The specified \a item is the item that was clicked, or \nullptr if + no item was clicked. The \a column is the item's column that was clicked, or -1 if no item was clicked. */ @@ -2550,8 +2550,8 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, This signal is emitted when the user presses a mouse button inside the widget. - The specified \a item is the item that was clicked, or 0 if no - item was clicked. The \a column is the item's column that was + The specified \a item is the item that was clicked, or \nullptr if + no item was clicked. The \a column is the item's column that was clicked, or -1 if no item was clicked. */ @@ -2571,8 +2571,8 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, This signal is emitted when the user double clicks inside the widget. - The specified \a item is the item that was clicked, or 0 if no - item was clicked. The \a column is the item's column that was + The specified \a item is the item that was clicked, or \nullptr if + no item was clicked. The \a column is the item's column that was clicked. If no item was double clicked, no signal will be emitted. */ @@ -2724,8 +2724,8 @@ QTreeWidgetItem *QTreeWidget::invisibleRootItem() const } /*! - Returns the top level item at the given \a index, or 0 if the item does - not exist. + Returns the top level item at the given \a index, or \nullptr if the + item does not exist. \sa topLevelItemCount(), insertTopLevelItem() */