From 9f971ca816ea0aac7b0f639c031a379731632722 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 27 Jan 2019 17:47:01 +0100 Subject: 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 Reviewed-by: Paul Wicking --- src/widgets/widgets/qabstractscrollarea.cpp | 2 +- src/widgets/widgets/qbuttongroup.cpp | 8 ++++---- src/widgets/widgets/qcombobox.cpp | 4 ++-- src/widgets/widgets/qdialogbuttonbox.cpp | 2 +- src/widgets/widgets/qdockwidget.cpp | 4 ++-- src/widgets/widgets/qlineedit.cpp | 2 +- src/widgets/widgets/qmdiarea.cpp | 12 ++++++------ src/widgets/widgets/qmdisubwindow.cpp | 5 +++-- src/widgets/widgets/qmenu.cpp | 18 +++++++++--------- src/widgets/widgets/qpushbutton.cpp | 4 ++-- src/widgets/widgets/qscrollarea.cpp | 2 +- src/widgets/widgets/qstackedwidget.cpp | 6 +++--- src/widgets/widgets/qtabbar.cpp | 8 ++++---- src/widgets/widgets/qtabwidget.cpp | 8 ++++---- src/widgets/widgets/qtoolbox.cpp | 11 ++++++----- src/widgets/widgets/qtoolbutton.cpp | 5 +++-- 16 files changed, 52 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index fd5d7d8069..b378884275 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -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. diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index fa1ccd347f..669faa92c7 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -291,8 +291,8 @@ QList 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 { diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index bb09b984a6..2f67a9202c 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -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. */ diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index d93e71e32f..26b86f80be 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -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() */ diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index cd3accefff..ba8bd90da6 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -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() */ diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 4301a3a2e7..ad3d372bd3 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -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() diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 104cbdbcda..feea7cd050 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -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; } diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 1ed162482e..c7e0603309 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -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; } /*! diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 9b30ec4619..7dc67c8efe 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -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 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: diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 8f7271c2dc..b578aa0b18 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -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() */ diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index 0bfc56f7fa..9994344d79 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -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() */ diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp index 2217dab870..f863964c58 100644 --- a/src/widgets/widgets/qstackedwidget.cpp +++ b/src/widgets/widgets/qstackedwidget.cpp @@ -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() */ diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 68453e1842..05a98fc1a5 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -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 diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 8a848554e3..547b8a82f9 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -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 { diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index 46ade0277c..eee112f02f 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -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; } diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 6a24712319..b00b219386 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -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; } /*! -- cgit v1.2.3