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: I8d7e9c838da1399988a830669d58fc7f2f010696
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
Christian Ehrlicher 2019-01-27 17:47:01 +01:00
parent 6298850293
commit 9f971ca816
17 changed files with 53 additions and 50 deletions

View File

@ -118,7 +118,7 @@ void QAnimationState::setAnimation(QAbstractAnimation *animation)
}
/*!
Returns the animation handle by this animation state, or 0 if there is no animation.
Returns the animation handle by this animation state, or \nullptr if there is no animation.
*/
QAbstractAnimation* QAnimationState::animation() const
{

View File

@ -820,7 +820,7 @@ QWidget *QAbstractScrollArea::cornerWidget() const
All widgets set here will be deleted by the scroll area when it is
destroyed unless you separately reparent the widget after setting
some other corner widget (or 0).
some other corner widget (or \nullptr).
Any \e newly set widget should have no current parent.

View File

@ -291,8 +291,8 @@ QList<QAbstractButton*> QButtonGroup::buttons() const
}
/*!
Returns the button group's checked button, or 0 if no buttons are
checked.
Returns the button group's checked button, or \nullptr if no
buttons are checked.
\sa buttonClicked()
*/
@ -305,8 +305,8 @@ QAbstractButton *QButtonGroup::checkedButton() const
/*!
\since 4.1
Returns the button with the specified \a id, or 0 if no such button
exists.
Returns the button with the specified \a id, or \nullptr if no
such button exists.
*/
QAbstractButton *QButtonGroup::button(int id) const
{

View File

@ -1888,8 +1888,8 @@ void QComboBox::setLineEdit(QLineEdit *edit)
}
/*!
Returns the line edit used to edit items in the combobox, or 0 if there
is no line edit.
Returns the line edit used to edit items in the combobox, or
\nullptr if there is no line edit.
Only editable combo boxes have a line edit.
*/

View File

@ -820,7 +820,7 @@ QDialogButtonBox::StandardButtons QDialogButtonBox::standardButtons() const
/*!
Returns the QPushButton corresponding to the standard button \a which,
or 0 if the standard button doesn't exist in this button box.
or \nullptr if the standard button doesn't exist in this button box.
\sa standardButton(), standardButtons(), buttons()
*/

View File

@ -1732,8 +1732,8 @@ void QDockWidget::setTitleBarWidget(QWidget *widget)
/*!
\since 4.3
Returns the custom title bar widget set on the QDockWidget, or 0 if no
custom title bar has been set.
Returns the custom title bar widget set on the QDockWidget, or
\nullptr if no custom title bar has been set.
\sa setTitleBarWidget()
*/

View File

@ -586,7 +586,7 @@ void QLineEdit::setEchoMode(EchoMode mode)
#ifndef QT_NO_VALIDATOR
/*!
Returns a pointer to the current input validator, or 0 if no
Returns a pointer to the current input validator, or \nullptr if no
validator has been set.
\sa setValidator()

View File

@ -1774,7 +1774,7 @@ QSize QMdiArea::minimumSizeHint() const
}
/*!
Returns a pointer to the current subwindow, or 0 if there is
Returns a pointer to the current subwindow, or \nullptr if there is
no current subwindow.
This function will return the same as activeSubWindow() if
@ -1786,13 +1786,13 @@ QMdiSubWindow *QMdiArea::currentSubWindow() const
{
Q_D(const QMdiArea);
if (d->childWindows.isEmpty())
return 0;
return nullptr;
if (d->active)
return d->active;
if (d->isActivated && !window()->isMinimized())
return 0;
return nullptr;
Q_ASSERT(d->indicesToActivatedChildren.count() > 0);
int index = d->indicesToActivatedChildren.at(0);
@ -1804,7 +1804,7 @@ QMdiSubWindow *QMdiArea::currentSubWindow() const
/*!
Returns a pointer to the current active subwindow. If no
window is currently active, 0 is returned.
window is currently active, \nullptr is returned.
Subwindows are treated as top-level windows with respect to
window state, i.e., if a widget outside the MDI area is the active
@ -1821,7 +1821,7 @@ QMdiSubWindow *QMdiArea::activeSubWindow() const
}
/*!
Activates the subwindow \a window. If \a window is 0, any
Activates the subwindow \a window. If \a window is \nullptr, any
current active window is deactivated.
\sa activeSubWindow()
@ -1830,7 +1830,7 @@ void QMdiArea::setActiveSubWindow(QMdiSubWindow *window)
{
Q_D(QMdiArea);
if (!window) {
d->activateWindow(0);
d->activateWindow(nullptr);
return;
}

View File

@ -2576,7 +2576,8 @@ void QMdiSubWindow::showSystemMenu()
/*!
\since 4.4
Returns the area containing this sub-window, or 0 if there is none.
Returns the area containing this sub-window, or \nullptr if there
is none.
\sa QMdiArea::addSubWindow()
*/
@ -2590,7 +2591,7 @@ QMdiArea *QMdiSubWindow::mdiArea() const
}
parent = parent->parentWidget();
}
return 0;
return nullptr;
}
/*!

View File

@ -2196,7 +2196,7 @@ void QMenu::setActiveAction(QAction *act)
/*!
Returns the currently highlighted action, or 0 if no
Returns the currently highlighted action, or \nullptr if no
action is currently highlighted.
*/
QAction *QMenu::activeAction() const
@ -2564,8 +2564,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
This is equivalent to \c{exec(pos())}.
This returns the triggered QAction in either the popup menu or one
of its submenus, or 0 if no item was triggered (normally because
the user pressed Esc).
of its submenus, or \nullptr if no item was triggered (normally
because the user pressed Esc).
In most situations you'll want to specify the position yourself,
for example, the current mouse position:
@ -2591,8 +2591,8 @@ QAction *QMenu::exec()
coordinates into global coordinates, use QWidget::mapToGlobal().
This returns the triggered QAction in either the popup menu or one
of its submenus, or 0 if no item was triggered (normally because
the user pressed Esc).
of its submenus, or \nullptr if no item was triggered (normally
because the user pressed Esc).
Note that all signals are emitted as usual. If you connect a
QAction to a slot and call the menu's exec(), you get the result
@ -2628,11 +2628,11 @@ QAction *QMenu::exec(const QPoint &p, QAction *action)
QPointer<QObject> guard = this;
(void) eventLoop.exec();
if (guard.isNull())
return 0;
return nullptr;
action = d->syncAction;
d->syncAction = 0;
d->eventLoop = 0;
d->syncAction = nullptr;
d->eventLoop = nullptr;
return action;
}
@ -2650,7 +2650,7 @@ QAction *QMenu::exec(const QPoint &p, QAction *action)
QGraphicsView).
The function returns the triggered QAction in either the popup
menu or one of its submenus, or 0 if no item was triggered
menu or one of its submenus, or \nullptr if no item was triggered
(normally because the user pressed Esc).
This is equivalent to:

View File

@ -545,8 +545,8 @@ void QPushButton::setMenu(QMenu* menu)
}
/*!
Returns the button's associated popup menu or 0 if no popup menu
has been set.
Returns the button's associated popup menu or \nullptr if no popup
menu has been set.
\sa setMenu()
*/

View File

@ -217,7 +217,7 @@ void QScrollAreaPrivate::updateScrollBars()
}
/*!
Returns the scroll area's widget, or 0 if there is none.
Returns the scroll area's widget, or \nullptr if there is none.
\sa setWidget()
*/

View File

@ -220,7 +220,7 @@ int QStackedWidget::currentIndex() const
}
/*!
Returns the current widget, or 0 if there are no child widgets.
Returns the current widget, or \nullptr if there are no child widgets.
\sa currentIndex(), setCurrentWidget()
*/
@ -260,8 +260,8 @@ int QStackedWidget::indexOf(QWidget *widget) const
}
/*!
Returns the widget at the given \a index, or 0 if there is no such
widget.
Returns the widget at the given \a index, or \nullptr if there is
no such widget.
\sa currentWidget(), indexOf()
*/

View File

@ -2567,7 +2567,7 @@ void QTabBar::setChangeCurrentOnDrag(bool change)
The tab bar will take ownership of the widget and so all widgets set here
will be deleted by the tab bar when it is destroyed unless you separately
reparent the widget after setting some other widget (or 0).
reparent the widget after setting some other widget (or \nullptr).
\sa tabsClosable()
*/
@ -2597,14 +2597,14 @@ void QTabBar::setTabButton(int index, ButtonPosition position, QWidget *widget)
}
/*!
Returns the widget set a tab \a index and \a position or 0 if
one is not set.
Returns the widget set a tab \a index and \a position or \nullptr
if one is not set.
*/
QWidget *QTabBar::tabButton(int index, ButtonPosition position) const
{
Q_D(const QTabBar);
if (index < 0 || index >= d->tabList.count())
return 0;
return nullptr;
if (position == LeftSide)
return d->tabList.at(index).leftWidget;
else

View File

@ -579,7 +579,7 @@ void QTabWidget::setTabEnabled(int index, bool enable)
All widgets set here will be deleted by the tab widget when it is
destroyed unless you separately reparent the widget after setting
some other corner widget (or 0).
some other corner widget (or \nullptr).
Note: Corner widgets are designed for \l North and \l South tab positions;
other orientations are known to not work properly.
@ -605,7 +605,7 @@ void QTabWidget::setCornerWidget(QWidget * widget, Qt::Corner corner)
}
/*!
Returns the widget shown in the \a corner of the tab widget or 0.
Returns the widget shown in the \a corner of the tab widget or \nullptr.
*/
QWidget * QTabWidget::cornerWidget(Qt::Corner corner) const
{
@ -1146,8 +1146,8 @@ void QTabWidget::keyPressEvent(QKeyEvent *e)
}
/*!
Returns the tab page at index position \a index or 0 if the \a
index is out of range.
Returns the tab page at index position \a index or \nullptr if the
\a index is out of range.
*/
QWidget *QTabWidget::widget(int index) const
{

View File

@ -504,7 +504,8 @@ int QToolBox::currentIndex() const
}
/*!
Returns a pointer to the current widget, or 0 if there is no such item.
Returns a pointer to the current widget, or \nullptr if there is
no such item.
\sa currentIndex(), setCurrentWidget()
*/
@ -512,7 +513,7 @@ int QToolBox::currentIndex() const
QWidget * QToolBox::currentWidget() const
{
Q_D(const QToolBox);
return d->currentPage ? d->currentPage->widget : 0;
return d->currentPage ? d->currentPage->widget : nullptr;
}
/*!
@ -530,15 +531,15 @@ void QToolBox::setCurrentWidget(QWidget *widget)
}
/*!
Returns the widget at position \a index, or 0 if there is no such
item.
Returns the widget at position \a index, or \nullptr if there is
no such item.
*/
QWidget *QToolBox::widget(int index) const
{
Q_D(const QToolBox);
if (index < 0 || index >= (int) d->pageList.size())
return 0;
return nullptr;
return d->pageList.at(index).widget;
}

View File

@ -669,7 +669,8 @@ void QToolButton::setMenu(QMenu* menu)
}
/*!
Returns the associated menu, or 0 if no menu has been defined.
Returns the associated menu, or \nullptr if no menu has been
defined.
\sa setMenu()
*/
@ -678,7 +679,7 @@ QMenu* QToolButton::menu() const
Q_D(const QToolButton);
if (d->menuAction)
return d->menuAction->menu();
return 0;
return nullptr;
}
/*!