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: I5e5bc1ae892f270d7c3419db1c179053561f1b26
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
bb10
Christian Ehrlicher 2019-01-27 17:49:07 +01:00
parent 0059de2d1b
commit 1b90684948
12 changed files with 90 additions and 88 deletions

View File

@ -422,7 +422,7 @@ QDialog::~QDialog()
/*!
\internal
This function is called by the push button \a pushButton when it
becomes the default button. If \a pushButton is 0, the dialogs
becomes the default button. If \a pushButton is \nullptr, the dialogs
default default button becomes the default button. This is what a
push button calls when it loses focus.
*/
@ -1014,7 +1014,7 @@ void QDialog::setExtension(QWidget* extension)
/*!
\obsolete
Returns the dialog's extension or 0 if no extension has been
Returns the dialog's extension or \nullptr if no extension has been
defined.
Instead of using this functionality, we recommend that you simply call

View File

@ -834,7 +834,7 @@ QMessageBox::QMessageBox(QWidget *parent)
The message box is an \l{Qt::ApplicationModal} {application modal}
dialog box.
On \macos, if \a parent is not 0 and you want your message box
On \macos, if \a parent is not \nullptr and you want your message box
to appear as a Qt::Sheet of that parent, set the message box's
\l{setWindowModality()} {window modality} to Qt::WindowModal
(default). Otherwise, the message box will be a standard dialog.
@ -983,7 +983,7 @@ QMessageBox::StandardButton QMessageBox::standardButton(QAbstractButton *button)
\since 4.2
Returns a pointer corresponding to the standard button \a which,
or 0 if the standard button doesn't exist in this message box.
or \nullptr if the standard button doesn't exist in this message box.
\sa standardButtons, standardButton()
*/
@ -1106,7 +1106,7 @@ void QMessageBoxPrivate::detectEscapeButton()
\since 4.2
Returns the button that was clicked by the user,
or 0 if the user hit the \uicontrol Esc key and
or \nullptr if the user hit the \uicontrol Esc key and
no \l{setEscapeButton()}{escape button} was set.
If exec() hasn't been called yet, returns nullptr.
@ -1173,7 +1173,7 @@ void QMessageBox::setDefaultButton(QMessageBox::StandardButton button)
/*! \since 5.2
Sets the checkbox \a cb on the message dialog. The message box takes ownership of the checkbox.
The argument \a cb can be 0 to remove an existing checkbox from the message box.
The argument \a cb can be \nullptr to remove an existing checkbox from the message box.
\sa checkBox()
*/
@ -1205,7 +1205,7 @@ void QMessageBox::setCheckBox(QCheckBox *cb)
/*! \since 5.2
Returns the checkbox shown on the dialog. This is 0 if no checkbox is set.
Returns the checkbox shown on the dialog. This is \nullptr if no checkbox is set.
\sa setCheckBox()
*/
@ -1570,7 +1570,7 @@ QList<QAbstractButton *> QMessageBox::buttons() const
\since 4.5
Returns the button role for the specified \a button. This function returns
\l InvalidRole if \a button is 0 or has not been added to the message box.
\l InvalidRole if \a button is \nullptr or has not been added to the message box.
\sa buttons(), addButton()
*/
@ -1835,7 +1835,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te
/*!
Displays a simple message box about Qt, with the given \a title
and centered over \a parent (if \a parent is not 0). The message
and centered over \a parent (if \a parent is not \nullptr). The message
includes the version number of Qt being used by the application.
This is useful for inclusion in the \uicontrol Help menu of an application,

View File

@ -2374,8 +2374,8 @@ void QWizard::removePage(int id)
/*!
\fn QWizardPage *QWizard::page(int id) const
Returns the page with the given \a id, or 0 if there is no such
page.
Returns the page with the given \a id, or \nullptr if there is no
such page.
\sa addPage(), setPage()
*/
@ -2462,8 +2462,8 @@ int QWizard::startId() const
}
/*!
Returns a pointer to the current page, or 0 if there is no current
page (e.g., before the wizard is shown).
Returns a pointer to the current page, or \nullptr if there is no
current page (e.g., before the wizard is shown).
This is equivalent to calling page(currentId()).
@ -2954,7 +2954,7 @@ void QWizard::setDefaultProperty(const char *className, const char *property,
Passing 0 shows no side widget.
When the \a widget is not 0 the wizard reparents it.
When the \a widget is not \nullptr the wizard reparents it.
Any previous side widget is hidden.
@ -2963,7 +2963,7 @@ void QWizard::setDefaultProperty(const char *className, const char *property,
All widgets set here will be deleted by the wizard when it is
destroyed unless you separately reparent the widget after setting
some other side widget (or 0).
some other side widget (or \nullptr).
By default, no side widget is present.
*/
@ -2981,7 +2981,7 @@ void QWizard::setSideWidget(QWidget *widget)
/*!
\since 4.7
Returns the widget on the left side of the wizard or 0.
Returns the widget on the left side of the wizard or \nullptr.
By default, no side widget is present.
*/
@ -3969,7 +3969,7 @@ void QWizardPage::registerField(const QString &name, QWidget *widget, const char
}
/*!
Returns the wizard associated with this page, or 0 if this page
Returns the wizard associated with this page, or \nullptr if this page
hasn't been inserted into a QWizard yet.
\sa QWizard::addPage(), QWizard::setPage()

View File

@ -316,8 +316,8 @@ bool QActionGroup::isEnabled() const
}
/*!
Returns the currently checked action in the group, or 0 if none
are checked.
Returns the currently checked action in the group, or \nullptr if
none are checked.
*/
QAction *QActionGroup::checkedAction() const
{

View File

@ -784,7 +784,7 @@ QWidget *QApplication::activeModalWidget()
/*!
Cleans up any window system resources that were allocated by this
application. Sets the global variable \c qApp to 0.
application. Sets the global variable \c qApp to \nullptr.
*/
QApplication::~QApplication()
@ -893,8 +893,8 @@ void qt_cleanup()
/*!
\fn QWidget *QApplication::widgetAt(const QPoint &point)
Returns the widget at global screen position \a point, or 0 if there is no
Qt widget there.
Returns the widget at global screen position \a point, or \nullptr
if there is no Qt widget there.
This function can be slow.
@ -904,9 +904,9 @@ QWidget *QApplication::widgetAt(const QPoint &p)
{
QWidget *window = QApplication::topLevelAt(p);
if (!window)
return 0;
return nullptr;
QWidget *child = 0;
QWidget *child = nullptr;
if (!window->testAttribute(Qt::WA_TransparentForMouseEvents))
child = window->childAt(window->mapFromGlobal(p));
@ -942,8 +942,8 @@ QWidget *QApplication::widgetAt(const QPoint &p)
\overload
Returns the widget at global screen position (\a x, \a y), or 0 if there is
no Qt widget there.
Returns the widget at global screen position (\a x, \a y), or
\nullptr if there is no Qt widget there.
*/
/*!
@ -1728,8 +1728,8 @@ QWidgetList QApplication::allWidgets()
}
/*!
Returns the application widget that has the keyboard input focus, or 0 if
no widget in this application has the focus.
Returns the application widget that has the keyboard input focus,
or \nullptr if no widget in this application has the focus.
\sa QWidget::setFocus(), QWidget::hasFocus(), activeWindow(), focusChanged()
*/
@ -1797,7 +1797,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
/*!
Returns the application top-level window that has the keyboard input focus,
or 0 if no application window has the focus. There might be an
or \nullptr if no application window has the focus. There might be an
activeWindow() even if there is no focusWidget(), for example if no widget
in that window accepts key events.

View File

@ -1330,8 +1330,8 @@ QLayoutItem *QGridLayout::itemAt(int index) const
/*!
\since 4.4
Returns the layout item that occupies cell (\a row, \a column), or 0 if
the cell is empty.
Returns the layout item that occupies cell (\a row, \a column), or
\nullptr if the cell is empty.
\sa getItemPosition(), indexOf()
*/
@ -1346,7 +1346,7 @@ QLayoutItem *QGridLayout::itemAtPosition(int row, int column) const
return box->item();
}
}
return 0;
return nullptr;
}
/*!

View File

@ -474,8 +474,8 @@ QRect QLayout::contentsRect() const
/*!
Returns the parent widget of this layout, or 0 if this layout is
not installed on any widget.
Returns the parent widget of this layout, or \nullptr if this
layout is not installed on any widget.
If the layout is a sub-layout, this function returns the parent
widget of the parent layout.
@ -490,11 +490,11 @@ QWidget *QLayout::parentWidget() const
QLayout *parentLayout = qobject_cast<QLayout*>(parent());
if (Q_UNLIKELY(!parentLayout)) {
qWarning("QLayout::parentWidget: A layout can only have another layout as a parent.");
return 0;
return nullptr;
}
return parentLayout->parentWidget();
} else {
return 0;
return nullptr;
}
} else {
Q_ASSERT(parent() && parent()->isWidgetType());
@ -950,8 +950,8 @@ void QLayout::setMenuBar(QWidget *widget)
}
/*!
Returns the menu bar set for this layout, or 0 if no menu bar is
set.
Returns the menu bar set for this layout, or \nullptr if no
menu bar is set.
*/
QWidget *QLayout::menuBar() const
@ -1130,8 +1130,9 @@ bool QLayout::activate()
Searches for widget \a from and replaces it with widget \a to if found.
Returns the layout item that contains the widget \a from on success.
Otherwise \c 0 is returned. If \a options contains \c Qt::FindChildrenRecursively
(the default), sub-layouts are searched for doing the replacement.
Otherwise \nullptr is returned.
If \a options contains \c Qt::FindChildrenRecursively (the default),
sub-layouts are searched for doing the replacement.
Any other flag in \a options is ignored.
Notice that the returned item therefore might not belong to this layout,

View File

@ -309,24 +309,24 @@ void QLayoutItem::invalidate()
/*!
If this item is a QLayout, it is returned as a QLayout; otherwise
0 is returned. This function provides type-safe casting.
\nullptr is returned. This function provides type-safe casting.
\sa spacerItem(), widget()
*/
QLayout * QLayoutItem::layout()
QLayout *QLayoutItem::layout()
{
return 0;
return nullptr;
}
/*!
If this item is a QSpacerItem, it is returned as a QSpacerItem;
otherwise 0 is returned. This function provides type-safe casting.
otherwise \nullptr is returned. This function provides type-safe casting.
\sa layout(), widget()
*/
QSpacerItem * QLayoutItem::spacerItem()
QSpacerItem *QLayoutItem::spacerItem()
{
return 0;
return nullptr;
}
/*!
@ -354,7 +354,7 @@ QSpacerItem * QSpacerItem::spacerItem()
/*!
If this item manages a QWidget, returns that widget. Otherwise,
\c nullptr is returned.
\nullptr is returned.
\note While the functions layout() and spacerItem() perform casts, this
function returns another object: QLayout and QSpacerItem inherit QLayoutItem,
@ -362,9 +362,9 @@ QSpacerItem * QSpacerItem::spacerItem()
\sa layout(), spacerItem()
*/
QWidget * QLayoutItem::widget()
QWidget *QLayoutItem::widget()
{
return 0;
return nullptr;
}
/*!

View File

@ -1118,8 +1118,8 @@ void QOpenGLWidget::setTextureFormat(GLenum texFormat)
/*!
\return the active internal texture format if the widget has already
initialized, the requested format if one was set but the widget has not yet
been made visible, or 0 if setTextureFormat() was not called and the widget
has not yet been made visible.
been made visible, or \nullptr if setTextureFormat() was not called and the
widget has not yet been made visible.
\since 5.10
*/

View File

@ -378,20 +378,20 @@ void QStackedLayout::setCurrentWidget(QWidget *widget)
/*!
Returns the current widget, or 0 if there are no widgets in this
layout.
Returns the current widget, or \nullptr if there are no widgets
in this layout.
\sa currentIndex(), setCurrentWidget()
*/
QWidget *QStackedLayout::currentWidget() const
{
Q_D(const QStackedLayout);
return d->index >= 0 ? d->list.at(d->index)->widget() : 0;
return d->index >= 0 ? d->list.at(d->index)->widget() : nullptr;
}
/*!
Returns the widget at the given \a index, or 0 if there is no
widget at the given position.
Returns the widget at the given \a index, or \nullptr if there is
no widget at the given position.
\sa currentWidget(), indexOf()
*/
@ -399,7 +399,7 @@ QWidget *QStackedLayout::widget(int index) const
{
Q_D(const QStackedLayout);
if (index < 0 || index >= d->list.size())
return 0;
return nullptr;
return d->list.at(index)->widget();
}

View File

@ -511,10 +511,10 @@ void QWidget::setAutoFillBackground(bool enabled)
Every widget's constructor accepts one or two standard arguments:
\list 1
\li \c{QWidget *parent = 0} is the parent of the new widget. If it is 0
(the default), the new widget will be a window. If not, it will be
a child of \e parent, and be constrained by \e parent's geometry
(unless you specify Qt::Window as window flag).
\li \c{QWidget *parent = \nullptr} is the parent of the new widget.
If it is \nullptr (the default), the new widget will be a window.
If not, it will be a child of \e parent, and be constrained by
\e parent's geometry (unless you specify Qt::Window as window flag).
\li \c{Qt::WindowFlags f = 0} (where available) sets the window flags;
the default is suitable for almost all widgets, but to get, for
example, a window without a window system frame, you must use
@ -1003,7 +1003,7 @@ struct QWidgetExceptionCleaner
Constructs a widget which is a child of \a parent, with widget
flags set to \a f.
If \a parent is 0, the new widget becomes a window. If
If \a parent is \nullptr, the new widget becomes a window. If
\a parent is another widget, this widget becomes a child window
inside \a parent. The new widget is deleted when its \a parent is
deleted.
@ -2497,12 +2497,12 @@ void QWidgetPrivate::deactivateWidgetCleanup()
The window identifier type depends on the underlying window
system, see \c qwindowdefs.h for the actual definition. If there
is no widget with this identifier, 0 is returned.
is no widget with this identifier, \nullptr is returned.
*/
QWidget *QWidget::find(WId id)
{
return QWidgetPrivate::mapper ? QWidgetPrivate::mapper->value(id, 0) : 0;
return QWidgetPrivate::mapper ? QWidgetPrivate::mapper->value(id, 0) : nullptr;
}
@ -3279,7 +3279,7 @@ void QWidget::addActions(QList<QAction*> actions)
/*!
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 QWidget should only have one of each action.
@ -3313,7 +3313,7 @@ void QWidget::insertAction(QAction *before, QAction *action)
/*!
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 QWidget can have at most one of each action.
@ -4336,7 +4336,8 @@ QWidget *QWidget::window() const
\since 4.4
Returns the native parent for this widget, i.e. the next ancestor widget
that has a system identifier, or 0 if it does not have any native parent.
that has a system identifier, or \nullptr if it does not have any native
parent.
\sa effectiveWinId()
*/
@ -5273,7 +5274,7 @@ QPixmap QWidget::grab(const QRect &rectangle)
\brief The graphicsEffect function returns a pointer to the
widget's graphics effect.
If the widget has no graphics effect, 0 is returned.
If the widget has no graphics effect, \nullptr is returned.
\since 4.6
@ -5917,10 +5918,10 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *
Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this
widget and its ancestors. The search starts at \a origin (inclusive).
If successful, the function returns the proxy that embeds the widget, or 0 if no embedded
widget was found.
If successful, the function returns the proxy that embeds the widget, or \nullptr if no
embedded widget was found.
*/
QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin)
QGraphicsProxyWidget *QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin)
{
if (origin) {
QWExtra *extra = origin->d_func()->extra;
@ -5928,7 +5929,7 @@ QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget
return extra->proxyWidget;
return nearestGraphicsProxyWidget(origin->parentWidget());
}
return 0;
return nullptr;
}
#endif
@ -6400,7 +6401,7 @@ void QWidget::setWindowRole(const QString &role)
/*!
Sets the widget's focus proxy to widget \a w. If \a w is 0, the
Sets the widget's focus proxy to widget \a w. If \a w is \nullptr, the
function resets this widget to have no focus proxy.
Some widgets can "have focus", but create a child widget, such as
@ -6433,15 +6434,15 @@ void QWidget::setFocusProxy(QWidget * w)
/*!
Returns the focus proxy, or 0 if there is no focus proxy.
Returns the focus proxy, or \nullptr if there is no focus proxy.
\sa setFocusProxy()
*/
QWidget * QWidget::focusProxy() const
QWidget *QWidget::focusProxy() const
{
Q_D(const QWidget);
return d->extra ? (QWidget *)d->extra->focus_proxy : 0;
return d->extra ? (QWidget *)d->extra->focus_proxy : nullptr;
}
@ -8819,7 +8820,7 @@ QSize QWidget::minimumSizeHint() const
/*!
\fn QWidget *QWidget::parentWidget() const
Returns the parent of this widget, or 0 if it does not have any
Returns the parent of this widget, or \nullptr if it does not have any
parent widget.
*/
@ -10229,7 +10230,7 @@ QRegion QWidget::mask() const
}
/*!
Returns the layout manager that is installed on this widget, or 0
Returns the layout manager that is installed on this widget, or \nullptr
if no layout manager is installed.
The layout manager sets the geometry of the widget's children
@ -12117,14 +12118,14 @@ bool QWidgetPrivate::navigateToDirection(Direction direction)
Searches for a widget that is positioned in the \a direction, starting
from the current focusWidget.
Returns the pointer to a found widget or 0, if there was no widget in
that direction.
Returns the pointer to a found widget or \nullptr, if there was no widget
in that direction.
*/
QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
{
const QWidget *sourceWidget = QApplication::focusWidget();
if (!sourceWidget)
return 0;
return nullptr;
const QRect sourceRect = sourceWidget->rect().translated(sourceWidget->mapToGlobal(QPoint()));
const int sourceX =
(direction == DirectionNorth || direction == DirectionSouth) ?
@ -12138,7 +12139,7 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
const QPoint sourceCenter = sourceRect.center();
const QWidget *sourceWindow = sourceWidget->window();
QWidget *targetWidget = 0;
QWidget *targetWidget = nullptr;
int shortestDistance = INT_MAX;
const auto targetCandidates = QApplication::allWidgets();
@ -12805,7 +12806,7 @@ void QWidget::releaseKeyboard()
Returns the widget that is currently grabbing the mouse input.
If no widget in this application is currently grabbing the mouse,
0 is returned.
\nullptr is returned.
\sa grabMouse(), keyboardGrabber()
*/
@ -12822,7 +12823,7 @@ QWidget *QWidget::mouseGrabber()
Returns the widget that is currently grabbing the keyboard input.
If no widget in this application is currently grabbing the
keyboard, 0 is returned.
keyboard, \nullptr is returned.
\sa grabMouse(), mouseGrabber()
*/

View File

@ -3270,7 +3270,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
\fn template <typename T> T qstyleoption_cast<T>(const QStyleOption *option)
\relates QStyleOption
Returns a T or 0 depending on the \l{QStyleOption::type}{type} and
Returns a T or \nullptr depending on the \l{QStyleOption::type}{type} and
\l{QStyleOption::version}{version} of the given \a option.
Example:
@ -3285,7 +3285,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
\overload
\relates QStyleOption
Returns a T or 0 depending on the type of the given \a option.
Returns a T or \nullptr depending on the type of the given \a option.
*/
#if QT_CONFIG(tabwidget)
@ -4006,7 +4006,7 @@ QStyleHintReturnVariant::~QStyleHintReturnVariant()
\fn template <typename T> T qstyleoption_cast<T>(const QStyleHintReturn *hint)
\relates QStyleHintReturn
Returns a T or 0 depending on the \l{QStyleHintReturn::type}{type}
Returns a T or \nullptr depending on the \l{QStyleHintReturn::type}{type}
and \l{QStyleHintReturn::version}{version} of \a hint.
Example:
@ -4021,7 +4021,7 @@ QStyleHintReturnVariant::~QStyleHintReturnVariant()
\overload
\relates QStyleHintReturn
Returns a T or 0 depending on the type of \a hint.
Returns a T or \nullptr depending on the type of \a hint.
*/
#if !defined(QT_NO_DEBUG_STREAM)