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 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 All widgets set here will be deleted by the scroll area when it is
destroyed unless you separately reparent the widget after setting 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. 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 Returns the button group's checked button, or \nullptr if no
checked. buttons are checked.
\sa buttonClicked() \sa buttonClicked()
*/ */
@ -305,8 +305,8 @@ QAbstractButton *QButtonGroup::checkedButton() const
/*! /*!
\since 4.1 \since 4.1
Returns the button with the specified \a id, or 0 if no such button Returns the button with the specified \a id, or \nullptr if no
exists. such button exists.
*/ */
QAbstractButton *QButtonGroup::button(int id) const 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 Returns the line edit used to edit items in the combobox, or
is no line edit. \nullptr if there is no line edit.
Only editable combo boxes have a 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, 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() \sa standardButton(), standardButtons(), buttons()
*/ */

View File

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

View File

@ -586,7 +586,7 @@ void QLineEdit::setEchoMode(EchoMode mode)
#ifndef QT_NO_VALIDATOR #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. validator has been set.
\sa setValidator() \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. no current subwindow.
This function will return the same as activeSubWindow() if This function will return the same as activeSubWindow() if
@ -1786,13 +1786,13 @@ QMdiSubWindow *QMdiArea::currentSubWindow() const
{ {
Q_D(const QMdiArea); Q_D(const QMdiArea);
if (d->childWindows.isEmpty()) if (d->childWindows.isEmpty())
return 0; return nullptr;
if (d->active) if (d->active)
return d->active; return d->active;
if (d->isActivated && !window()->isMinimized()) if (d->isActivated && !window()->isMinimized())
return 0; return nullptr;
Q_ASSERT(d->indicesToActivatedChildren.count() > 0); Q_ASSERT(d->indicesToActivatedChildren.count() > 0);
int index = d->indicesToActivatedChildren.at(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 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 Subwindows are treated as top-level windows with respect to
window state, i.e., if a widget outside the MDI area is the active 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. current active window is deactivated.
\sa activeSubWindow() \sa activeSubWindow()
@ -1830,7 +1830,7 @@ void QMdiArea::setActiveSubWindow(QMdiSubWindow *window)
{ {
Q_D(QMdiArea); Q_D(QMdiArea);
if (!window) { if (!window) {
d->activateWindow(0); d->activateWindow(nullptr);
return; return;
} }

View File

@ -2576,7 +2576,8 @@ void QMdiSubWindow::showSystemMenu()
/*! /*!
\since 4.4 \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() \sa QMdiArea::addSubWindow()
*/ */
@ -2590,7 +2591,7 @@ QMdiArea *QMdiSubWindow::mdiArea() const
} }
parent = parent->parentWidget(); 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. action is currently highlighted.
*/ */
QAction *QMenu::activeAction() const QAction *QMenu::activeAction() const
@ -2564,8 +2564,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
This is equivalent to \c{exec(pos())}. This is equivalent to \c{exec(pos())}.
This returns the triggered QAction in either the popup menu or one This returns the triggered QAction in either the popup menu or one
of its submenus, or 0 if no item was triggered (normally because of its submenus, or \nullptr if no item was triggered (normally
the user pressed Esc). because the user pressed Esc).
In most situations you'll want to specify the position yourself, In most situations you'll want to specify the position yourself,
for example, the current mouse position: for example, the current mouse position:
@ -2591,8 +2591,8 @@ QAction *QMenu::exec()
coordinates into global coordinates, use QWidget::mapToGlobal(). coordinates into global coordinates, use QWidget::mapToGlobal().
This returns the triggered QAction in either the popup menu or one This returns the triggered QAction in either the popup menu or one
of its submenus, or 0 if no item was triggered (normally because of its submenus, or \nullptr if no item was triggered (normally
the user pressed Esc). because the user pressed Esc).
Note that all signals are emitted as usual. If you connect a 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 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; QPointer<QObject> guard = this;
(void) eventLoop.exec(); (void) eventLoop.exec();
if (guard.isNull()) if (guard.isNull())
return 0; return nullptr;
action = d->syncAction; action = d->syncAction;
d->syncAction = 0; d->syncAction = nullptr;
d->eventLoop = 0; d->eventLoop = nullptr;
return action; return action;
} }
@ -2650,7 +2650,7 @@ QAction *QMenu::exec(const QPoint &p, QAction *action)
QGraphicsView). QGraphicsView).
The function returns the triggered QAction in either the popup 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). (normally because the user pressed Esc).
This is equivalent to: 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 Returns the button's associated popup menu or \nullptr if no popup
has been set. menu has been set.
\sa setMenu() \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() \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() \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 Returns the widget at the given \a index, or \nullptr if there is
widget. no such widget.
\sa currentWidget(), indexOf() \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 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 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() \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 Returns the widget set a tab \a index and \a position or \nullptr
one is not set. if one is not set.
*/ */
QWidget *QTabBar::tabButton(int index, ButtonPosition position) const QWidget *QTabBar::tabButton(int index, ButtonPosition position) const
{ {
Q_D(const QTabBar); Q_D(const QTabBar);
if (index < 0 || index >= d->tabList.count()) if (index < 0 || index >= d->tabList.count())
return 0; return nullptr;
if (position == LeftSide) if (position == LeftSide)
return d->tabList.at(index).leftWidget; return d->tabList.at(index).leftWidget;
else 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 All widgets set here will be deleted by the tab widget when it is
destroyed unless you separately reparent the widget after setting 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; Note: Corner widgets are designed for \l North and \l South tab positions;
other orientations are known to not work properly. 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 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 Returns the tab page at index position \a index or \nullptr if the
index is out of range. \a index is out of range.
*/ */
QWidget *QTabWidget::widget(int index) const 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() \sa currentIndex(), setCurrentWidget()
*/ */
@ -512,7 +513,7 @@ int QToolBox::currentIndex() const
QWidget * QToolBox::currentWidget() const QWidget * QToolBox::currentWidget() const
{ {
Q_D(const QToolBox); 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 Returns the widget at position \a index, or \nullptr if there is
item. no such item.
*/ */
QWidget *QToolBox::widget(int index) const QWidget *QToolBox::widget(int index) const
{ {
Q_D(const QToolBox); Q_D(const QToolBox);
if (index < 0 || index >= (int) d->pageList.size()) if (index < 0 || index >= (int) d->pageList.size())
return 0; return nullptr;
return d->pageList.at(index).widget; 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() \sa setMenu()
*/ */
@ -678,7 +679,7 @@ QMenu* QToolButton::menu() const
Q_D(const QToolButton); Q_D(const QToolButton);
if (d->menuAction) if (d->menuAction)
return d->menuAction->menu(); return d->menuAction->menu();
return 0; return nullptr;
} }
/*! /*!