summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-22 14:46:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-06 12:13:20 +0100
commitece0c0a5e7e0b18beb58ccd868bde54c7be64f78 (patch)
treefa4a0fdbda040d24f1a2d07a320635c76980f431 /src/widgets
parentb19220d17fa66de5ded41690ffff263ee2af5c63 (diff)
Tidy nullptr usage
Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/complexwidgets.cpp18
-rw-r--r--src/widgets/accessible/itemviews.cpp50
-rw-r--r--src/widgets/accessible/qaccessiblemenu.cpp14
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp8
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp6
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp28
-rw-r--r--src/widgets/accessible/simplewidgets.cpp4
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp22
-rw-r--r--src/widgets/dialogs/qdialog.cpp14
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp10
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp44
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp6
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp20
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp10
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp56
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp22
-rw-r--r--src/widgets/dialogs/qsidebar.cpp6
-rw-r--r--src/widgets/dialogs/qwizard.cpp38
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp2
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp50
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp8
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp84
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp52
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp144
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.cpp6
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp30
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp24
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp8
-rw-r--r--src/widgets/graphicsview/qsimplex_p.cpp10
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp48
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp12
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp8
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp20
-rw-r--r--src/widgets/itemviews/qheaderview.cpp18
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp18
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp14
-rw-r--r--src/widgets/itemviews/qlistview.cpp14
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp22
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp10
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp60
-rw-r--r--src/widgets/itemviews/qtreeview.cpp18
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp56
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp16
-rw-r--r--src/widgets/kernel/qaction.cpp2
-rw-r--r--src/widgets/kernel/qactiongroup.cpp6
-rw-r--r--src/widgets/kernel/qapplication.cpp174
-rw-r--r--src/widgets/kernel/qboxlayout.cpp20
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp2
-rw-r--r--src/widgets/kernel/qformlayout.cpp70
-rw-r--r--src/widgets/kernel/qgesture.cpp4
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp18
-rw-r--r--src/widgets/kernel/qgridlayout.cpp28
-rw-r--r--src/widgets/kernel/qlayout.cpp26
-rw-r--r--src/widgets/kernel/qlayoutengine.cpp2
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp4
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp26
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp14
-rw-r--r--src/widgets/kernel/qtooltip.cpp16
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp16
-rw-r--r--src/widgets/kernel/qwidget.cpp190
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp8
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager.cpp16
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp6
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp34
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp10
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp30
-rw-r--r--src/widgets/styles/qproxystyle.cpp2
-rw-r--r--src/widgets/styles/qstylefactory.cpp2
-rw-r--r--src/widgets/styles/qstylehelper.cpp2
-rw-r--r--src/widgets/styles/qstyleoption.cpp6
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp110
-rw-r--r--src/widgets/util/qcolormap.cpp4
-rw-r--r--src/widgets/util/qcompleter.cpp2
-rw-r--r--src/widgets/util/qflickgesture.cpp36
-rw-r--r--src/widgets/util/qscroller.cpp10
-rw-r--r--src/widgets/util/qscrollerproperties.cpp6
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp8
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp4
-rw-r--r--src/widgets/util/qundogroup.cpp26
-rw-r--r--src/widgets/util/qundostack.cpp18
-rw-r--r--src/widgets/util/qundoview.cpp32
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp10
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp22
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp10
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp6
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp38
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp6
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp22
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp234
-rw-r--r--src/widgets/widgets/qdockwidget.cpp80
-rw-r--r--src/widgets/widgets/qeffects.cpp14
-rw-r--r--src/widgets/widgets/qfocusframe.cpp18
-rw-r--r--src/widgets/widgets/qgroupbox.cpp4
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp6
-rw-r--r--src/widgets/widgets/qlineedit.cpp14
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp6
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp16
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp88
-rw-r--r--src/widgets/widgets/qmdiarea.cpp68
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp96
-rw-r--r--src/widgets/widgets/qmenu.cpp156
-rw-r--r--src/widgets/widgets/qmenubar.cpp112
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp10
-rw-r--r--src/widgets/widgets/qpushbutton.cpp6
-rw-r--r--src/widgets/widgets/qscrollarea.cpp6
-rw-r--r--src/widgets/widgets/qscrollbar.cpp18
-rw-r--r--src/widgets/widgets/qsizegrip.cpp2
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp6
-rw-r--r--src/widgets/widgets/qsplitter.cpp4
-rw-r--r--src/widgets/widgets/qstackedwidget.cpp2
-rw-r--r--src/widgets/widgets/qstatusbar.cpp22
-rw-r--r--src/widgets/widgets/qtabbar.cpp42
-rw-r--r--src/widgets/widgets/qtabbar_p.h4
-rw-r--r--src/widgets/widgets/qtabwidget.cpp10
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qtoolbar.cpp62
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp40
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp34
-rw-r--r--src/widgets/widgets/qtoolbox.cpp16
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp14
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp12
135 files changed, 1752 insertions, 1752 deletions
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 63c6fbb9bb..4d9a629ab6 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -97,10 +97,10 @@ public:
if (t == QAccessible::ActionInterface) {
return static_cast<QAccessibleActionInterface*>(this);
}
- return 0;
+ return nullptr;
}
- QObject *object() const override { return 0; }
+ QObject *object() const override { return nullptr; }
QAccessible::Role role() const override { return QAccessible::PageTab; }
QAccessible::State state() const override {
if (!isValid()) {
@@ -129,7 +129,7 @@ public:
return false;
}
- QAccessibleInterface *childAt(int, int) const override { return 0; }
+ QAccessibleInterface *childAt(int, int) const override { return nullptr; }
int childCount() const override { return 0; }
int indexOfChild(const QAccessibleInterface *) const override { return -1; }
@@ -168,7 +168,7 @@ public:
QAccessibleInterface *parent() const override {
return QAccessible::queryAccessibleInterface(m_parent.data());
}
- QAccessibleInterface *child(int) const override { return 0; }
+ QAccessibleInterface *child(int) const override { return nullptr; }
// action interface
QStringList actionNames() const override
@@ -237,7 +237,7 @@ QAccessibleInterface* QAccessibleTabBar::child(int index) const
return QAccessible::queryAccessibleInterface(tabBar()->d_func()->rightB);
}
}
- return 0;
+ return nullptr;
}
int QAccessibleTabBar::indexOfChild(const QAccessibleInterface *child) const
@@ -314,7 +314,7 @@ QAccessibleInterface *QAccessibleComboBox::child(int index) const
} else if (index == 1 && comboBox()->isEditable()) {
return QAccessible::queryAccessibleInterface(comboBox()->lineEdit());
}
- return 0;
+ return nullptr;
}
int QAccessibleComboBox::childCount() const
@@ -327,7 +327,7 @@ QAccessibleInterface *QAccessibleComboBox::childAt(int x, int y) const
{
if (comboBox()->isEditable() && comboBox()->lineEdit()->rect().contains(x, y))
return child(1);
- return 0;
+ return nullptr;
}
int QAccessibleComboBox::indexOfChild(const QAccessibleInterface *child) const
@@ -432,7 +432,7 @@ bool QAccessibleAbstractScrollArea::isValid() const
QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(int x, int y) const
{
if (!abstractScrollArea()->isVisible())
- return 0;
+ return nullptr;
for (int i = 0; i < childCount(); ++i) {
QPoint wpos = accessibleChildren().at(i)->mapToGlobal(QPoint(0, 0));
@@ -440,7 +440,7 @@ QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(int x, int y) const
if (rect.contains(x, y))
return child(i);
}
- return 0;
+ return nullptr;
}
QAbstractScrollArea *QAccessibleAbstractScrollArea::abstractScrollArea() const
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index 3bfe215c05..5a7fdf9a03 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -121,7 +121,7 @@ QAccessibleTable::~QAccessibleTable()
QHeaderView *QAccessibleTable::horizontalHeader() const
{
- QHeaderView *header = 0;
+ QHeaderView *header = nullptr;
if (false) {
#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
@@ -137,7 +137,7 @@ QHeaderView *QAccessibleTable::horizontalHeader() const
QHeaderView *QAccessibleTable::verticalHeader() const
{
- QHeaderView *header = 0;
+ QHeaderView *header = nullptr;
if (false) {
#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
@@ -150,19 +150,19 @@ QHeaderView *QAccessibleTable::verticalHeader() const
QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const
{
if (!view()->model())
- return 0;
+ return nullptr;
Q_ASSERT(role() != QAccessible::Tree);
QModelIndex index = view()->model()->index(row, column, view()->rootIndex());
if (Q_UNLIKELY(!index.isValid())) {
qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view();
- return 0;
+ return nullptr;
}
return child(logicalIndex(index));
}
QAccessibleInterface *QAccessibleTable::caption() const
{
- return 0;
+ return nullptr;
}
QString QAccessibleTable::columnDescription(int column) const
@@ -254,7 +254,7 @@ QList<int> QAccessibleTable::selectedRows() const
QAccessibleInterface *QAccessibleTable::summary() const
{
- return 0;
+ return nullptr;
}
bool QAccessibleTable::isColumnSelected(int column) const
@@ -422,7 +422,7 @@ QAccessibleInterface *QAccessibleTable::childAt(int x, int y) const
if (index.isValid()) {
return child(logicalIndex(index));
}
- return 0;
+ return nullptr;
}
int QAccessibleTable::childCount() const
@@ -485,13 +485,13 @@ QAccessibleInterface *QAccessibleTable::parent() const
}
return QAccessible::queryAccessibleInterface(view()->parent());
}
- return 0;
+ return nullptr;
}
QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
{
if (!view()->model())
- return 0;
+ return nullptr;
auto id = childToId.constFind(logicalIndex);
if (id != childToId.constEnd())
@@ -505,7 +505,7 @@ QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
int row = logicalIndex / columns;
int column = logicalIndex % columns;
- QAccessibleInterface *iface = 0;
+ QAccessibleInterface *iface = nullptr;
if (vHeader) {
if (column == 0) {
@@ -528,7 +528,7 @@ QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
QModelIndex index = view()->model()->index(row, column, view()->rootIndex());
if (Q_UNLIKELY(!index.isValid())) {
qWarning("QAccessibleTable::child: Invalid index at: %d %d", row, column);
- return 0;
+ return nullptr;
}
iface = new QAccessibleTableCell(view(), index, cellRole());
}
@@ -542,7 +542,7 @@ void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::TableInterface)
return static_cast<QAccessibleTableInterface*>(this);
- return 0;
+ return nullptr;
}
void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event)
@@ -676,13 +676,13 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
QAccessibleInterface *QAccessibleTree::childAt(int x, int y) const
{
if (!view()->model())
- return 0;
+ return nullptr;
QPoint viewportOffset = view()->viewport()->mapTo(view(), QPoint(0,0));
QPoint indexPosition = view()->mapFromGlobal(QPoint(x, y) - viewportOffset);
QModelIndex index = view()->indexAt(indexPosition);
if (!index.isValid())
- return 0;
+ return nullptr;
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0);
@@ -706,9 +706,9 @@ int QAccessibleTree::childCount() const
QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const
{
if (logicalIndex < 0 || !view()->model() || !view()->model()->columnCount())
- return 0;
+ return nullptr;
- QAccessibleInterface *iface = 0;
+ QAccessibleInterface *iface = nullptr;
int index = logicalIndex;
if (horizontalHeader()) {
@@ -724,7 +724,7 @@ QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const
int column = index % view()->model()->columnCount();
QModelIndex modelIndex = indexFromLogical(row, column);
if (!modelIndex.isValid())
- return 0;
+ return nullptr;
iface = new QAccessibleTableCell(view(), modelIndex, cellRole());
}
QAccessible::registerAccessibleInterface(iface);
@@ -772,7 +772,7 @@ QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const
QModelIndex index = indexFromLogical(row, column);
if (Q_UNLIKELY(!index.isValid())) {
qWarning("Requested invalid tree cell: %d %d", row, column);
- return 0;
+ return nullptr;
}
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
Q_ASSERT(treeView);
@@ -841,7 +841,7 @@ void *QAccessibleTableCell::interface_cast(QAccessible::InterfaceType t)
return static_cast<QAccessibleTableCellInterface*>(this);
if (t == QAccessible::ActionInterface)
return static_cast<QAccessibleActionInterface*>(this);
- return 0;
+ return nullptr;
}
int QAccessibleTableCell::columnExtent() const { return 1; }
@@ -869,7 +869,7 @@ QList<QAccessibleInterface*> QAccessibleTableCell::columnHeaderCells() const
QHeaderView *QAccessibleTableCell::horizontalHeader() const
{
- QHeaderView *header = 0;
+ QHeaderView *header = nullptr;
if (false) {
#if QT_CONFIG(tableview)
@@ -887,7 +887,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
QHeaderView *QAccessibleTableCell::verticalHeader() const
{
- QHeaderView *header = 0;
+ QHeaderView *header = nullptr;
#if QT_CONFIG(tableview)
if (const QTableView *tv = qobject_cast<const QTableView*>(view))
header = tv->verticalHeader();
@@ -1115,7 +1115,7 @@ QAccessibleInterface *QAccessibleTableCell::parent() const
QAccessibleInterface *QAccessibleTableCell::child(int) const
{
- return 0;
+ return nullptr;
}
QAccessibleTableHeaderCell::QAccessibleTableHeaderCell(QAbstractItemView *view_, int index_, Qt::Orientation orientation_)
@@ -1143,7 +1143,7 @@ QAccessible::State QAccessibleTableHeaderCell::state() const
QRect QAccessibleTableHeaderCell::rect() const
{
- QHeaderView *header = 0;
+ QHeaderView *header = nullptr;
if (false) {
#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
@@ -1206,12 +1206,12 @@ QAccessibleInterface *QAccessibleTableHeaderCell::parent() const
QAccessibleInterface *QAccessibleTableHeaderCell::child(int) const
{
- return 0;
+ return nullptr;
}
QHeaderView *QAccessibleTableHeaderCell::headerView() const
{
- QHeaderView *header = 0;
+ QHeaderView *header = nullptr;
if (false) {
#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp
index 7f87288520..51ba0adaa6 100644
--- a/src/widgets/accessible/qaccessiblemenu.cpp
+++ b/src/widgets/accessible/qaccessiblemenu.cpp
@@ -88,8 +88,8 @@ QAccessibleInterface *QAccessibleMenu::childAt(int x, int y) const
{
QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y)));
if(act && act->isSeparator())
- act = 0;
- return act ? getOrCreateMenu(menu(), act) : 0;
+ act = nullptr;
+ return act ? getOrCreateMenu(menu(), act) : nullptr;
}
QString QAccessibleMenu::text(QAccessible::Text t) const
@@ -112,7 +112,7 @@ QAccessibleInterface *QAccessibleMenu::child(int index) const
{
if (index < childCount())
return getOrCreateMenu(menu(), menu()->actions().at(index));
- return 0;
+ return nullptr;
}
QAccessibleInterface *QAccessibleMenu::parent() const
@@ -165,7 +165,7 @@ QAccessibleInterface *QAccessibleMenuBar::child(int index) const
if (index < childCount()) {
return getOrCreateMenu(menuBar(), menuBar()->actions().at(index));
}
- return 0;
+ return nullptr;
}
int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const
@@ -195,7 +195,7 @@ QAccessibleInterface *QAccessibleMenuItem::childAt(int x, int y ) const
return childInterface;
}
}
- return 0;
+ return nullptr;
}
int QAccessibleMenuItem::childCount() const
@@ -224,14 +224,14 @@ QAccessibleInterface *QAccessibleMenuItem::child(int index) const
{
if (index == 0 && action()->menu())
return QAccessible::queryAccessibleInterface(action()->menu());
- return 0;
+ return nullptr;
}
void *QAccessibleMenuItem::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::ActionInterface)
return static_cast<QAccessibleActionInterface*>(this);
- return 0;
+ return nullptr;
}
QObject *QAccessibleMenuItem::object() const
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 27e6b09dc7..c782e00f4f 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -363,7 +363,7 @@ QAccessibleInterface *QAccessibleWidget::child(int index) const
QWidgetList childList = childWidgets(widget());
if (index >= 0 && index < childList.size())
return QAccessible::queryAccessibleInterface(childList.at(index));
- return 0;
+ return nullptr;
}
/*! \reimp */
@@ -374,11 +374,11 @@ QAccessibleInterface *QAccessibleWidget::focusChild() const
QWidget *fw = widget()->focusWidget();
if (!fw)
- return 0;
+ return nullptr;
if (isAncestor(widget(), fw) || fw == widget())
return QAccessible::queryAccessibleInterface(fw);
- return 0;
+ return nullptr;
}
/*! \reimp */
@@ -522,7 +522,7 @@ void *QAccessibleWidget::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::ActionInterface)
return static_cast<QAccessibleActionInterface*>(this);
- return 0;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index 0bac45de27..d59da86076 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *object)
{
- QAccessibleInterface *iface = 0;
+ QAccessibleInterface *iface = nullptr;
if (!object || !object->isWidgetType())
return iface;
@@ -79,7 +79,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
#if QT_CONFIG(lineedit)
} else if (classname == QLatin1String("QLineEdit")) {
if (widget->objectName() == QLatin1String("qt_spinbox_lineedit"))
- iface = 0;
+ iface = nullptr;
else
iface = new QAccessibleLineEdit(widget);
#endif
@@ -223,7 +223,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
#endif
} else if (classname == QLatin1String("QDesktopScreenWidget")) {
- iface = 0;
+ iface = nullptr;
} else if (classname == QLatin1String("QWidget")) {
iface = new QAccessibleWidget(widget);
} else if (classname == QLatin1String("QWindowContainer")) {
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 52c953ed3a..574be1f5ea 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -332,14 +332,14 @@ QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget)
QAccessibleInterface *QAccessibleStackedWidget::childAt(int x, int y) const
{
if (!stackedWidget()->isVisible())
- return 0;
+ return nullptr;
QWidget *currentWidget = stackedWidget()->currentWidget();
if (!currentWidget)
- return 0;
+ return nullptr;
QPoint position = currentWidget->mapFromGlobal(QPoint(x, y));
if (currentWidget->rect().contains(position))
return child(stackedWidget()->currentIndex());
- return 0;
+ return nullptr;
}
int QAccessibleStackedWidget::childCount() const
@@ -359,7 +359,7 @@ int QAccessibleStackedWidget::indexOfChild(const QAccessibleInterface *child) co
QAccessibleInterface *QAccessibleStackedWidget::child(int index) const
{
if (index < 0 || index >= stackedWidget()->count())
- return 0;
+ return nullptr;
return QAccessible::queryAccessibleInterface(stackedWidget()->widget(index));
}
@@ -401,7 +401,7 @@ QAccessibleInterface *QAccessibleMdiArea::child(int index) const
QList<QMdiSubWindow *> subWindows = mdiArea()->subWindowList();
QWidget *targetObject = subWindows.value(index);
if (!targetObject)
- return 0;
+ return nullptr;
return QAccessible::queryAccessibleInterface(targetObject);
}
@@ -478,7 +478,7 @@ QAccessibleInterface *QAccessibleMdiSubWindow::child(int index) const
{
QMdiSubWindow *source = mdiSubWindow();
if (index != 0 || !source->widget())
- return 0;
+ return nullptr;
return QAccessible::queryAccessibleInterface(source->widget());
}
@@ -554,7 +554,7 @@ int QAccessibleCalendarWidget::indexOfChild(const QAccessibleInterface *child) c
QAccessibleInterface *QAccessibleCalendarWidget::child(int index) const
{
if (index < 0 || index >= childCount())
- return 0;
+ return nullptr;
if (childCount() > 1 && index == 0)
return QAccessible::queryAccessibleInterface(navigationBar());
@@ -573,7 +573,7 @@ QAbstractItemView *QAccessibleCalendarWidget::calendarView() const
if (child->objectName() == QLatin1String("qt_calendar_calendarview"))
return static_cast<QAbstractItemView *>(child);
}
- return 0;
+ return nullptr;
}
QWidget *QAccessibleCalendarWidget::navigationBar() const
@@ -582,7 +582,7 @@ QWidget *QAccessibleCalendarWidget::navigationBar() const
if (child->objectName() == QLatin1String("qt_calendar_navigationbar"))
return static_cast<QWidget *>(child);
}
- return 0;
+ return nullptr;
}
#endif // QT_CONFIG(calendarwidget)
@@ -624,7 +624,7 @@ QAccessibleInterface *QAccessibleDockWidget::child(int index) const
if (item)
return QAccessible::queryAccessibleInterface(item->widget());
}
- return 0;
+ return nullptr;
}
int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const
@@ -1109,7 +1109,7 @@ QAccessibleInterface *QAccessibleMainWindow::child(int index) const
if (index >= 0 && index < kids.count()) {
return QAccessible::queryAccessibleInterface(kids.at(index));
}
- return 0;
+ return nullptr;
}
int QAccessibleMainWindow::childCount() const
@@ -1128,10 +1128,10 @@ QAccessibleInterface *QAccessibleMainWindow::childAt(int x, int y) const
{
QWidget *w = widget();
if (!w->isVisible())
- return 0;
+ return nullptr;
QPoint gp = w->mapToGlobal(QPoint(0, 0));
if (!QRect(gp.x(), gp.y(), w->width(), w->height()).contains(x, y))
- return 0;
+ return nullptr;
const QWidgetList kids = childWidgets(mainWindow());
QPoint rp = mainWindow()->mapFromGlobal(QPoint(x, y));
@@ -1140,7 +1140,7 @@ QAccessibleInterface *QAccessibleMainWindow::childAt(int x, int y) const
return QAccessible::queryAccessibleInterface(child);
}
}
- return 0;
+ return nullptr;
}
QMainWindow *QAccessibleMainWindow::mainWindow() const
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index ca74ee4b12..9dbbe9c608 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -364,7 +364,7 @@ QAccessibleInterface *QAccessibleToolButton::child(int index) const
#else
Q_UNUSED(index)
#endif
- return 0;
+ return nullptr;
}
/*
@@ -976,7 +976,7 @@ QAccessibleInterface *QAccessibleWindowContainer::child(int i) const
{
if (i == 0)
return QAccessible::queryAccessibleInterface(container()->containedWindow());
- return 0;
+ return nullptr;
}
QWindowContainer *QAccessibleWindowContainer::container() const
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index d00a600424..689002b589 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -192,7 +192,7 @@ class QWellArray : public QWidget
Q_PROPERTY(int selectedRow READ selectedRow)
public:
- QWellArray(int rows, int cols, QWidget* parent=0);
+ QWellArray(int rows, int cols, QWidget* parent=nullptr);
~QWellArray() {}
QString cellContent(int row, int col) const;
@@ -744,7 +744,7 @@ class QColorLuminancePicker : public QWidget
{
Q_OBJECT
public:
- QColorLuminancePicker(QWidget* parent=0);
+ QColorLuminancePicker(QWidget* parent=nullptr);
~QColorLuminancePicker();
public slots:
@@ -789,7 +789,7 @@ QColorLuminancePicker::QColorLuminancePicker(QWidget* parent)
:QWidget(parent)
{
hue = 100; val = 100; sat = 100;
- pix = 0;
+ pix = nullptr;
// setAttribute(WA_NoErase, true);
}
@@ -812,7 +812,7 @@ void QColorLuminancePicker::setVal(int v)
if (val == v)
return;
val = qMax(0, qMin(v,255));
- delete pix; pix=0;
+ delete pix; pix=nullptr;
repaint();
emit newHsv(hue, sat, val);
}
@@ -861,7 +861,7 @@ void QColorLuminancePicker::setCol(int h, int s , int v)
val = v;
hue = h;
sat = s;
- delete pix; pix=0;
+ delete pix; pix=nullptr;
repaint();
}
@@ -1678,8 +1678,8 @@ void QColorDialogPrivate::init(const QColor &initial)
q->setWindowTitle(QColorDialog::tr("Select Color"));
// default: use the native dialog if possible. Can be overridden in setOptions()
- nativeDialogInUse = (platformColorDialogHelper() != 0);
- colorPickingEventFilter = 0;
+ nativeDialogInUse = (platformColorDialogHelper() != nullptr);
+ colorPickingEventFilter = nullptr;
nextCust = 0;
if (!nativeDialogInUse)
@@ -1703,7 +1703,7 @@ void QColorDialogPrivate::initWidgets()
QHBoxLayout *topLay = new QHBoxLayout();
mainLay->addLayout(topLay);
- leftLay = 0;
+ leftLay = nullptr;
#if defined(QT_SMALL_COLORDIALOG)
smallDisplay = true;
@@ -1773,8 +1773,8 @@ void QColorDialogPrivate::initWidgets()
pWidth = 150;
pHeight = 100;
#endif
- custom = 0;
- standard = 0;
+ custom = nullptr;
+ standard = nullptr;
}
QVBoxLayout *rightLay = new QVBoxLayout;
@@ -2302,7 +2302,7 @@ void QColorDialog::done(int result)
if (d->receiverToDisconnectOnClose) {
disconnect(this, SIGNAL(colorSelected(QColor)),
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
- d->receiverToDisconnectOnClose = 0;
+ d->receiverToDisconnectOnClose = nullptr;
}
d->memberToDisconnectOnClose.clear();
}
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 3cdd9a5f04..362200a4fd 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -187,7 +187,7 @@ QWindow *QDialogPrivate::transientParentWindow() const
return parent->windowHandle();
else if (q->windowHandle())
return q->windowHandle()->transientParent();
- return 0;
+ return nullptr;
}
bool QDialogPrivate::setNativeDialogVisible(bool visible)
@@ -214,7 +214,7 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
void QDialogPrivate::deletePlatformHelper()
{
delete m_platformHelper;
- m_platformHelper = 0;
+ m_platformHelper = nullptr;
m_platformHelperCreated = false;
nativeDialogInUse = false;
}
@@ -460,7 +460,7 @@ void QDialogPrivate::setDefault(QPushButton *pushButton)
*/
void QDialogPrivate::setMainDefault(QPushButton *pushButton)
{
- mainDef = 0;
+ mainDef = nullptr;
setDefault(pushButton);
}
@@ -602,7 +602,7 @@ int QDialog::exec()
}
if (guard.isNull())
return QDialog::Rejected;
- d->eventLoop = 0;
+ d->eventLoop = nullptr;
setAttribute(Qt::WA_ShowModal, wasShowModal);
@@ -679,12 +679,12 @@ void QDialog::contextMenuEvent(QContextMenuEvent *e)
#else
QWidget *w = childAt(e->pos());
if (!w) {
- w = rect().contains(e->pos()) ? this : 0;
+ w = rect().contains(e->pos()) ? this : nullptr;
if (!w)
return;
}
while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis))
- w = w->isWindow() ? 0 : w->parentWidget();
+ w = w->isWindow() ? nullptr : w->parentWidget();
if (w) {
QPointer<QMenu> p = new QMenu(this);
QAction *wt = p.data()->addAction(tr("What's This?"));
@@ -1191,7 +1191,7 @@ void QDialog::setSizeGripEnabled(bool enabled)
d->resizer->show();
} else {
delete d->resizer;
- d->resizer = 0;
+ d->resizer = nullptr;
}
}
#endif // QT_CONFIG(sizegrip)
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index f0ec2c0102..790d09414b 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -149,13 +149,13 @@ QSize QErrorMessageTextView::sizeHint() const
\sa QMessageBox, QStatusBar::showMessage(), {Standard Dialogs Example}
*/
-static QErrorMessage * qtMessageHandler = 0;
+static QErrorMessage * qtMessageHandler = nullptr;
static void deleteStaticcQErrorMessage() // post-routine
{
if (qtMessageHandler) {
delete qtMessageHandler;
- qtMessageHandler = 0;
+ qtMessageHandler = nullptr;
}
}
@@ -252,8 +252,8 @@ QErrorMessage::QErrorMessage(QWidget * parent)
QErrorMessage::~QErrorMessage()
{
if (this == qtMessageHandler) {
- qtMessageHandler = 0;
- QtMessageHandler tmp = qInstallMessageHandler(0);
+ qtMessageHandler = nullptr;
+ QtMessageHandler tmp = qInstallMessageHandler(nullptr);
// in case someone else has later stuck in another...
if (tmp != jump)
qInstallMessageHandler(tmp);
@@ -293,7 +293,7 @@ void QErrorMessage::done(int a)
QErrorMessage * QErrorMessage::qtHandler()
{
if (!qtMessageHandler) {
- qtMessageHandler = new QErrorMessage(0);
+ qtMessageHandler = new QErrorMessage(nullptr);
qAddPostRoutine(deleteStaticcQErrorMessage); // clean up
qtMessageHandler->setWindowTitle(QCoreApplication::applicationName());
qInstallMessageHandler(jump);
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index fbcc02accd..f0bd08a778 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -531,15 +531,15 @@ void QFileDialog::changeEvent(QEvent *e)
QFileDialogPrivate::QFileDialogPrivate()
:
#if QT_CONFIG(proxymodel)
- proxyModel(0),
+ proxyModel(nullptr),
#endif
- model(0),
+ model(nullptr),
currentHistoryLocation(-1),
- renameAction(0),
- deleteAction(0),
- showHiddenAction(0),
+ renameAction(nullptr),
+ deleteAction(nullptr),
+ showHiddenAction(nullptr),
useDefaultCaption(true),
- qFileDialogUi(0),
+ qFileDialogUi(nullptr),
options(QFileDialogOptions::create())
{
}
@@ -882,14 +882,14 @@ void QFileDialog::setVisible(bool visible)
#if QT_CONFIG(fscompleter)
// So the completer doesn't try to complete and therefore show a popup
if (!d->nativeDialogInUse)
- d->completer->setModel(0);
+ d->completer->setModel(nullptr);
#endif
} else {
d->createWidgets();
setAttribute(Qt::WA_DontShowOnScreen, false);
#if QT_CONFIG(fscompleter)
if (!d->nativeDialogInUse) {
- if (d->proxyModel != 0)
+ if (d->proxyModel != nullptr)
d->completer->setModel(d->proxyModel);
else
d->completer->setModel(d->model);
@@ -1824,7 +1824,7 @@ QModelIndex QFileDialogPrivate::rootIndex() const {
QAbstractItemView *QFileDialogPrivate::currentView() const {
if (!qFileDialogUi->stackedWidget)
- return 0;
+ return nullptr;
if (qFileDialogUi->stackedWidget->currentWidget() == qFileDialogUi->listView->parent())
return qFileDialogUi->listView;
return qFileDialogUi->treeView;
@@ -2038,7 +2038,7 @@ QAbstractItemDelegate *QFileDialog::itemDelegate() const
{
Q_D(const QFileDialog);
if (!d->usingWidgets())
- return 0;
+ return nullptr;
return d->qFileDialogUi->listView->itemDelegate();
}
@@ -2776,7 +2776,7 @@ void QFileDialog::done(int result)
if (d->receiverToDisconnectOnClose) {
disconnect(this, d->signalToDisconnectOnClose,
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
- d->receiverToDisconnectOnClose = 0;
+ d->receiverToDisconnectOnClose = nullptr;
}
d->memberToDisconnectOnClose.clear();
d->signalToDisconnectOnClose.clear();
@@ -3015,7 +3015,7 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter,
}
q->setAcceptMode(QFileDialog::AcceptOpen);
- nativeDialogInUse = platformFileDialogHelper() != 0;
+ nativeDialogInUse = platformFileDialogHelper() != nullptr;
if (!nativeDialogInUse)
createWidgets();
q->setFileMode(QFileDialog::AnyFile);
@@ -3273,7 +3273,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel)
this, SLOT(_q_rowsInserted(QModelIndex)));
}
- if (proxyModel != 0) {
+ if (proxyModel != nullptr) {
proxyModel->setParent(this);
d->proxyModel = proxyModel;
proxyModel->setSourceModel(d->model);
@@ -3286,13 +3286,13 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel)
connect(d->proxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(_q_rowsInserted(QModelIndex)));
} else {
- d->proxyModel = 0;
+ d->proxyModel = nullptr;
d->qFileDialogUi->listView->setModel(d->model);
d->qFileDialogUi->treeView->setModel(d->model);
#if QT_CONFIG(fscompleter)
d->completer->setModel(d->model);
d->completer->sourceModel = d->model;
- d->completer->proxyModel = 0;
+ d->completer->proxyModel = nullptr;
#endif
connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(_q_rowsInserted(QModelIndex)));
@@ -3330,27 +3330,27 @@ QAbstractProxyModel *QFileDialog::proxyModel() const
void QFileDialogPrivate::createToolButtons()
{
Q_Q(QFileDialog);
- qFileDialogUi->backButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowBack, 0, q));
+ qFileDialogUi->backButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowBack, nullptr, q));
qFileDialogUi->backButton->setAutoRaise(true);
qFileDialogUi->backButton->setEnabled(false);
QObject::connect(qFileDialogUi->backButton, SIGNAL(clicked()), q, SLOT(_q_navigateBackward()));
- qFileDialogUi->forwardButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowForward, 0, q));
+ qFileDialogUi->forwardButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowForward, nullptr, q));
qFileDialogUi->forwardButton->setAutoRaise(true);
qFileDialogUi->forwardButton->setEnabled(false);
QObject::connect(qFileDialogUi->forwardButton, SIGNAL(clicked()), q, SLOT(_q_navigateForward()));
- qFileDialogUi->toParentButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogToParent, 0, q));
+ qFileDialogUi->toParentButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogToParent, nullptr, q));
qFileDialogUi->toParentButton->setAutoRaise(true);
qFileDialogUi->toParentButton->setEnabled(false);
QObject::connect(qFileDialogUi->toParentButton, SIGNAL(clicked()), q, SLOT(_q_navigateToParent()));
- qFileDialogUi->listModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogListView, 0, q));
+ qFileDialogUi->listModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogListView, nullptr, q));
qFileDialogUi->listModeButton->setAutoRaise(true);
qFileDialogUi->listModeButton->setDown(true);
QObject::connect(qFileDialogUi->listModeButton, SIGNAL(clicked()), q, SLOT(_q_showListView()));
- qFileDialogUi->detailModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogDetailedView, 0, q));
+ qFileDialogUi->detailModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogDetailedView, nullptr, q));
qFileDialogUi->detailModeButton->setAutoRaise(true);
QObject::connect(qFileDialogUi->detailModeButton, SIGNAL(clicked()), q, SLOT(_q_showDetailsView()));
@@ -3361,7 +3361,7 @@ void QFileDialogPrivate::createToolButtons()
qFileDialogUi->forwardButton->setFixedSize(toolSize);
qFileDialogUi->toParentButton->setFixedSize(toolSize);
- qFileDialogUi->newFolderButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogNewFolder, 0, q));
+ qFileDialogUi->newFolderButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogNewFolder, nullptr, q));
qFileDialogUi->newFolderButton->setFixedSize(toolSize);
qFileDialogUi->newFolderButton->setAutoRaise(true);
qFileDialogUi->newFolderButton->setEnabled(false);
@@ -3598,7 +3598,7 @@ void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
Q_UNUSED(position);
#else
Q_Q(QFileDialog);
- QAbstractItemView *view = 0;
+ QAbstractItemView *view = nullptr;
if (q->viewMode() == QFileDialog::Detail)
view = qFileDialogUi->treeView;
else
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 79a7c23e0d..914c845565 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -586,9 +586,9 @@ QModelIndex QFileSystemModel::parent(const QModelIndex &index) const
return QModelIndex();
QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(index);
- Q_ASSERT(indexNode != 0);
+ Q_ASSERT(indexNode != nullptr);
QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent;
- if (parentNode == 0 || parentNode == &d->root)
+ if (parentNode == nullptr || parentNode == &d->root)
return QModelIndex();
// get the parent's row
@@ -608,7 +608,7 @@ QModelIndex QFileSystemModel::parent(const QModelIndex &index) const
QModelIndex QFileSystemModelPrivate::index(const QFileSystemModelPrivate::QFileSystemNode *node, int column) const
{
Q_Q(const QFileSystemModel);
- QFileSystemModelPrivate::QFileSystemNode *parentNode = (node ? node->parent : 0);
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = (node ? node->parent : nullptr);
if (node == &root || !parentNode)
return QModelIndex();
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 3da829d328..fe8f88d64f 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -276,7 +276,7 @@ void QFontDialogPrivate::init()
mainGrid->setColumnMinimumWidth(3, spacing);
int margin = 0;
- mainGrid->getContentsMargins(0, 0, 0, &margin);
+ mainGrid->getContentsMargins(nullptr, nullptr, nullptr, &margin);
mainGrid->setRowMinimumHeight(3, margin);
mainGrid->setRowMinimumHeight(6, 2);
@@ -435,7 +435,7 @@ bool QFontDialog::eventFilter(QObject *o , QEvent *e)
QCoreApplication::sendEvent(d->sizeList, k);
if (ci != d->sizeList->currentItem()
- && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, this))
+ && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, this))
d->sizeEdit->selectAll();
return true;
} else if ((o == d->familyList || o == d->styleList) &&
@@ -445,7 +445,7 @@ bool QFontDialog::eventFilter(QObject *o , QEvent *e)
return true;
}
} else if (e->type() == QEvent::FocusIn
- && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, this)) {
+ && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, this)) {
if (o == d->familyList)
d->familyEdit->selectAll();
else if (o == d->styleList)
@@ -550,7 +550,7 @@ void QFontDialogPrivate::updateFamilies()
else
familyList->setCurrentItem(0);
familyEdit->setText(familyList->currentText());
- if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
+ if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q)
&& familyList->hasFocus())
familyEdit->selectAll();
@@ -602,7 +602,7 @@ void QFontDialogPrivate::updateStyles()
}
styleEdit->setText(styleList->currentText());
- if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
+ if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q)
&& styleList->hasFocus())
styleEdit->selectAll();
@@ -641,7 +641,7 @@ void QFontDialogPrivate::updateSizes()
const QSignalBlocker blocker(sizeEdit);
sizeEdit->setText((smoothScalable ? QString::number(size) : sizeList->currentText()));
- if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
+ if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q)
&& sizeList->hasFocus())
sizeEdit->selectAll();
} else {
@@ -692,7 +692,7 @@ void QFontDialogPrivate::_q_familyHighlighted(int i)
Q_Q(QFontDialog);
family = familyList->text(i);
familyEdit->setText(family);
- if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
+ if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q)
&& familyList->hasFocus())
familyEdit->selectAll();
@@ -709,7 +709,7 @@ void QFontDialogPrivate::_q_styleHighlighted(int index)
Q_Q(QFontDialog);
QString s = styleList->text(index);
styleEdit->setText(s);
- if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
+ if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q)
&& styleList->hasFocus())
styleEdit->selectAll();
@@ -728,7 +728,7 @@ void QFontDialogPrivate::_q_sizeHighlighted(int index)
Q_Q(QFontDialog);
QString s = sizeList->text(index);
sizeEdit->setText(s);
- if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
+ if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, nullptr, q)
&& sizeEdit->hasFocus())
sizeEdit->selectAll();
@@ -1019,7 +1019,7 @@ void QFontDialog::done(int result)
if (d->receiverToDisconnectOnClose) {
disconnect(this, SIGNAL(fontSelected(QFont)),
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
- d->receiverToDisconnectOnClose = 0;
+ d->receiverToDisconnectOnClose = nullptr;
}
d->memberToDisconnectOnClose.clear();
}
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 3cfe8367e0..1cb4be0682 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -138,7 +138,7 @@ class QInputDialogDoubleSpinBox : public QDoubleSpinBox
Q_OBJECT
public:
- QInputDialogDoubleSpinBox(QWidget *parent = 0)
+ QInputDialogDoubleSpinBox(QWidget *parent = nullptr)
: QDoubleSpinBox(parent) {
connect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(notifyTextChanged()));
connect(this, SIGNAL(editingFinished()), this, SLOT(notifyTextChanged()));
@@ -171,7 +171,7 @@ private:
class QInputDialogListView : public QListView
{
public:
- QInputDialogListView(QWidget *parent = 0) : QListView(parent) {}
+ QInputDialogListView(QWidget *parent = nullptr) : QListView(parent) {}
QVariant inputMethodQuery(Qt::InputMethodQuery query) const override
{
if (query == Qt::ImEnabled)
@@ -223,8 +223,8 @@ public:
};
QInputDialogPrivate::QInputDialogPrivate()
- : label(0), buttonBox(0), lineEdit(0), plainTextEdit(0), intSpinBox(0), doubleSpinBox(0),
- comboBox(0), listView(0), inputWidget(0), mainLayout(0)
+ : label(nullptr), buttonBox(nullptr), lineEdit(nullptr), plainTextEdit(nullptr), intSpinBox(nullptr), doubleSpinBox(nullptr),
+ comboBox(nullptr), listView(nullptr), inputWidget(nullptr), mainLayout(nullptr)
{
}
@@ -1174,7 +1174,7 @@ void QInputDialog::done(int result)
if (d->receiverToDisconnectOnClose) {
disconnect(this, signalForMember(d->memberToDisconnectOnClose),
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
- d->receiverToDisconnectOnClose = 0;
+ d->receiverToDisconnectOnClose = nullptr;
}
d->memberToDisconnectOnClose.clear();
}
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 8dad212692..17d199cb4f 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -97,7 +97,7 @@ public:
class TextEdit : public QTextEdit
{
public:
- TextEdit(QWidget *parent=0) : QTextEdit(parent) { }
+ TextEdit(QWidget *parent=nullptr) : QTextEdit(parent) { }
#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent * e) override
{
@@ -108,7 +108,7 @@ public:
#endif // QT_NO_CONTEXTMENU
};
- QMessageBoxDetailsText(QWidget *parent=0)
+ QMessageBoxDetailsText(QWidget *parent=nullptr)
: QWidget(parent)
, copyAvailable(false)
{
@@ -197,12 +197,12 @@ class QMessageBoxPrivate : public QDialogPrivate
Q_DECLARE_PUBLIC(QMessageBox)
public:
- QMessageBoxPrivate() : escapeButton(0), defaultButton(0), checkbox(0), clickedButton(0), detailsButton(0),
+ QMessageBoxPrivate() : escapeButton(nullptr), defaultButton(nullptr), checkbox(nullptr), clickedButton(nullptr), detailsButton(nullptr),
#if QT_CONFIG(textedit)
- detailsText(0),
+ detailsText(nullptr),
#endif
compatMode(false), autoAddOkButton(true),
- detectedEscapeButton(0), informativeLabel(0),
+ detectedEscapeButton(nullptr), informativeLabel(nullptr),
options(QMessageDialogOptions::create()) { }
void init(const QString &title = QString(), const QString &text = QString());
@@ -274,7 +274,7 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
label = new QLabel;
label->setObjectName(QLatin1String("qt_msgbox_label"));
- label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q)));
+ label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, q)));
label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
label->setOpenExternalLinks(true);
iconLabel = new QLabel(q);
@@ -283,7 +283,7 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
buttonBox = new QDialogButtonBox;
buttonBox->setObjectName(QLatin1String("qt_msgbox_buttonbox"));
- buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, q));
+ buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, q));
QObject::connect(buttonBox, SIGNAL(clicked(QAbstractButton*)),
q, SLOT(_q_buttonClicked(QAbstractButton*)));
setupLayout();
@@ -927,9 +927,9 @@ void QMessageBox::removeButton(QAbstractButton *button)
Q_D(QMessageBox);
d->customButtonList.removeAll(button);
if (d->escapeButton == button)
- d->escapeButton = 0;
+ d->escapeButton = nullptr;
if (d->defaultButton == button)
- d->defaultButton = 0;
+ d->defaultButton = nullptr;
d->buttonBox->removeButton(button);
d->updateSize();
}
@@ -952,9 +952,9 @@ void QMessageBox::setStandardButtons(StandardButtons buttons)
QList<QAbstractButton *> buttonList = d->buttonBox->buttons();
if (!buttonList.contains(d->escapeButton))
- d->escapeButton = 0;
+ d->escapeButton = nullptr;
if (!buttonList.contains(d->defaultButton))
- d->defaultButton = 0;
+ d->defaultButton = nullptr;
d->autoAddOkButton = false;
d->updateSize();
}
@@ -1081,7 +1081,7 @@ void QMessageBoxPrivate::detectEscapeButton()
for (auto *button : buttons) {
if (buttonBox->buttonRole(button) == QDialogButtonBox::RejectRole) {
if (detectedEscapeButton) { // already detected!
- detectedEscapeButton = 0;
+ detectedEscapeButton = nullptr;
break;
}
detectedEscapeButton = button;
@@ -1094,7 +1094,7 @@ void QMessageBoxPrivate::detectEscapeButton()
for (auto *button : buttons) {
if (buttonBox->buttonRole(button) == QDialogButtonBox::NoRole) {
if (detectedEscapeButton) { // already detected!
- detectedEscapeButton = 0;
+ detectedEscapeButton = nullptr;
break;
}
detectedEscapeButton = button;
@@ -1189,7 +1189,7 @@ void QMessageBox::setCheckBox(QCheckBox *cb)
d->checkbox->hide();
layout()->removeWidget(d->checkbox);
if (d->checkbox->parentWidget() == this) {
- d->checkbox->setParent(0);
+ d->checkbox->setParent(nullptr);
d->checkbox->deleteLater();
}
}
@@ -1433,9 +1433,9 @@ void QMessageBox::changeEvent(QEvent *ev)
{
if (d->icon != NoIcon)
setIcon(d->icon);
- Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this));
+ Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this));
d->label->setTextInteractionFlags(flags);
- d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this));
+ d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, this));
if (d->informativeLabel)
d->informativeLabel->setTextInteractionFlags(flags);
Q_FALLTHROUGH();
@@ -1624,7 +1624,7 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent,
QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent);
QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox*>();
- Q_ASSERT(buttonBox != 0);
+ Q_ASSERT(buttonBox != nullptr);
uint mask = QMessageBox::FirstButton;
while (mask <= QMessageBox::LastButton) {
@@ -2001,7 +2001,7 @@ QAbstractButton *QMessageBoxPrivate::abstractButtonForId(int id) const
if (result)
return result;
if (id & QMessageBox::FlagMask) // for compatibility with Qt 4.0/4.1 (even if it is silly)
- return 0;
+ return nullptr;
return q->button(newButton(id));
}
@@ -2522,13 +2522,13 @@ void QMessageBox::setDetailedText(const QString &text)
d->detailsText->hide();
d->detailsText->deleteLater();
}
- d->detailsText = 0;
+ d->detailsText = nullptr;
removeButton(d->detailsButton);
if (d->detailsButton) {
d->detailsButton->hide();
d->detailsButton->deleteLater();
}
- d->detailsButton = 0;
+ d->detailsButton = nullptr;
} else {
if (!d->detailsText) {
d->detailsText = new QMessageBoxDetailsText(this);
@@ -2577,12 +2577,12 @@ void QMessageBox::setInformativeText(const QString &text)
d->informativeLabel->hide();
d->informativeLabel->deleteLater();
}
- d->informativeLabel = 0;
+ d->informativeLabel = nullptr;
} else {
if (!d->informativeLabel) {
QLabel *label = new QLabel;
label->setObjectName(QLatin1String("qt_msgbox_informativelabel"));
- label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this)));
+ label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this)));
label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
label->setOpenExternalLinks(true);
label->setWordWrap(true);
@@ -2644,20 +2644,20 @@ void QMessageBox::setWindowModality(Qt::WindowModality windowModality)
QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb)
{
QStyle *style = mb ? mb->style() : QApplication::style();
- int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, mb);
+ int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, mb);
QIcon tmpIcon;
switch (icon) {
case QMessageBox::Information:
- tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, mb);
+ tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, nullptr, mb);
break;
case QMessageBox::Warning:
- tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, mb);
+ tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, nullptr, mb);
break;
case QMessageBox::Critical:
- tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, mb);
+ tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, nullptr, mb);
break;
case QMessageBox::Question:
- tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mb);
+ tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, nullptr, mb);
default:
break;
}
@@ -2739,7 +2739,7 @@ void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHel
QPixmap QMessageBox::standardIcon(Icon icon)
{
- return QMessageBoxPrivate::standardIcon(icon, 0);
+ return QMessageBoxPrivate::standardIcon(icon, nullptr);
}
/*!
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 189dcd2989..94d3928c8b 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -65,13 +65,13 @@ class QProgressDialogPrivate : public QDialogPrivate
Q_DECLARE_PUBLIC(QProgressDialog)
public:
- QProgressDialogPrivate() : label(0), cancel(0), bar(0),
+ QProgressDialogPrivate() : label(nullptr), cancel(nullptr), bar(nullptr),
shown_once(false),
cancellation_flag(false),
setValue_called(false),
showTime(defaultShowTime),
#ifndef QT_NO_SHORTCUT
- escapeShortcut(0),
+ escapeShortcut(nullptr),
#endif
useDefaultCancelText(false)
{
@@ -112,7 +112,7 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance
label = new QLabel(labelText, q);
bar = new QProgressBar(q);
bar->setRange(min, max);
- int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q);
+ int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, nullptr, q);
label->setAlignment(Qt::Alignment(align));
autoClose = true;
autoReset = true;
@@ -132,12 +132,12 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance
void QProgressDialogPrivate::layout()
{
Q_Q(QProgressDialog);
- int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, q);
- int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q);
- int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q));
- int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q));
+ int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, nullptr, q);
+ int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr, q);
+ int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, q));
+ int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, q));
const bool centered =
- bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q));
+ bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, nullptr, q));
int additionalSpacing = 0;
QSize cs = cancel ? cancel->sizeHint() : QSize(0,0);
@@ -188,7 +188,7 @@ void QProgressDialogPrivate::_q_disconnectOnClose()
if (receiverToDisconnectOnClose) {
QObject::disconnect(q, SIGNAL(canceled()), receiverToDisconnectOnClose,
memberToDisconnectOnClose);
- receiverToDisconnectOnClose = 0;
+ receiverToDisconnectOnClose = nullptr;
}
memberToDisconnectOnClose.clear();
}
@@ -418,7 +418,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
} else {
#ifndef QT_NO_SHORTCUT
delete d->escapeShortcut;
- d->escapeShortcut = 0;
+ d->escapeShortcut = nullptr;
#endif
}
d->adoptChildWidget(cancelButton);
@@ -450,7 +450,7 @@ void QProgressDialogPrivate::setCancelButtonText(const QString &cancelButtonText
q->setCancelButton(new QPushButton(cancelButtonText, q));
}
} else {
- q->setCancelButton(0);
+ q->setCancelButton(nullptr);
}
ensureSizeIsAtLeastSizeHint();
}
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index 2c8c66e1e2..dfb707eda0 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -73,7 +73,7 @@ void QSideBarDelegate::initStyleOption(QStyleOptionViewItem *option,
Example usage: File dialog sidebar and combo box
*/
-QUrlModel::QUrlModel(QObject *parent) : QStandardItemModel(parent), showFullPath(false), fileSystemModel(0)
+QUrlModel::QUrlModel(QObject *parent) : QStandardItemModel(parent), showFullPath(false), fileSystemModel(nullptr)
{
}
@@ -298,7 +298,7 @@ void QUrlModel::setFileSystemModel(QFileSystemModel *model)
{
if (model == fileSystemModel)
return;
- if (fileSystemModel != 0) {
+ if (fileSystemModel != nullptr) {
disconnect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(dataChanged(QModelIndex,QModelIndex)));
disconnect(model, SIGNAL(layoutChanged()),
@@ -307,7 +307,7 @@ void QUrlModel::setFileSystemModel(QFileSystemModel *model)
this, SLOT(layoutChanged()));
}
fileSystemModel = model;
- if (fileSystemModel != 0) {
+ if (fileSystemModel != nullptr) {
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(dataChanged(QModelIndex,QModelIndex)));
connect(model, SIGNAL(layoutChanged()),
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 7c4a473976..a4789f40b1 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -115,7 +115,7 @@ static QWidget *iWantTheFocus(QWidget *ancestor)
return candidate;
}
}
- return 0;
+ return nullptr;
}
static bool objectInheritsXAndXIsCloserThanY(const QObject *object, const QByteArray &classX,
@@ -165,7 +165,7 @@ static const char *changed_signal(int which)
};
Q_STATIC_ASSERT(7 == NFallbackDefaultProperties);
Q_UNREACHABLE();
- return 0;
+ return nullptr;
}
class QWizardDefaultProperty
@@ -286,9 +286,9 @@ class QWizardHeader : public QWidget
public:
enum RulerType { Ruler };
- inline QWizardHeader(RulerType /* ruler */, QWidget *parent = 0)
+ inline QWizardHeader(RulerType /* ruler */, QWidget *parent = nullptr)
: QWidget(parent) { setFixedHeight(2); }
- QWizardHeader(QWidget *parent = 0);
+ QWizardHeader(QWidget *parent = nullptr);
void setup(const QWizardLayoutInfo &info, const QString &title,
const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
@@ -438,7 +438,7 @@ void QWizardHeader::paintEvent(QPaintEvent * /* event */)
class QWizardRuler : public QWizardHeader
{
public:
- inline QWizardRuler(QWidget *parent = 0)
+ inline QWizardRuler(QWidget *parent = nullptr)
: QWizardHeader(Ruler, parent) {}
};
@@ -684,7 +684,7 @@ void QWizardPrivate::init()
std::fill(btns, btns + QWizard::NButtons, nullptr);
antiFlickerWidget = new QWizardAntiFlickerWidget(q, this);
- wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q));
+ wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, nullptr, q));
if (wizStyle == QWizard::MacStyle) {
opts = (QWizard::NoDefaultButton | QWizard::NoCancelButton);
} else if (wizStyle == QWizard::ModernStyle) {
@@ -836,7 +836,7 @@ void QWizardPrivate::switchToPage(int newId, Direction direction)
newPage && newPage->isCommitPage() ? QWizard::CommitButton : QWizard::NextButton;
QAbstractButton *nextOrFinishButton =
btns[canContinue ? nextOrCommit : QWizard::FinishButton];
- QWidget *candidate = 0;
+ QWidget *candidate = nullptr;
/*
If there is no default button and the Next or Finish button
@@ -887,7 +887,7 @@ static const char * buttonSlots(QWizard::WizardButton which)
case QWizard::NoButton:
Q_UNREACHABLE();
};
- return 0;
+ return nullptr;
};
QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage()
@@ -898,14 +898,14 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage()
QWizardLayoutInfo info;
const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
- info.topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q);
- info.topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q);
- info.topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, 0, q);
- info.topLevelMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q);
- info.childMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, titleLabel);
- info.childMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, 0, titleLabel);
- info.childMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, 0, titleLabel);
- info.childMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, titleLabel);
+ info.topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, q);
+ info.topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, q);
+ info.topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr, q);
+ info.topLevelMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr, q);
+ info.childMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, titleLabel);
+ info.childMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, titleLabel);
+ info.childMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr, titleLabel);
+ info.childMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr, titleLabel);
info.hspacing = (layoutHorizontalSpacing == -1)
? style->layoutSpacing(QSizePolicy::DefaultType, QSizePolicy::DefaultType, Qt::Horizontal)
: layoutHorizontalSpacing;
@@ -959,7 +959,7 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info)
for (int i = mainLayout->count() - 1; i >= 0; --i) {
QLayoutItem *item = mainLayout->takeAt(i);
if (item->layout()) {
- item->layout()->setParent(0);
+ item->layout()->setParent(nullptr);
} else {
delete item;
}
@@ -2281,7 +2281,7 @@ void QWizard::removePage(int id)
{
Q_D(QWizard);
- QWizardPage *removedPage = 0;
+ QWizardPage *removedPage = nullptr;
// update startItem accordingly
if (d->pageMap.count() > 0) { // only if we have any pages
@@ -2792,7 +2792,7 @@ QAbstractButton *QWizard::button(WizardButton which) const
return d->vistaHelper->backButton();
#endif
if (!d->ensureButton(which))
- return 0;
+ return nullptr;
return d->btns[which];
}
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index 94188f3485..2eb74ce2a8 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -415,7 +415,7 @@ QGraphicsEffect::QGraphicsEffect(QGraphicsEffectPrivate &dd, QObject *parent)
QGraphicsEffect::~QGraphicsEffect()
{
Q_D(QGraphicsEffect);
- d->setGraphicsEffectSource(0);
+ d->setGraphicsEffectSource(nullptr);
}
/*!
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index e1e8175423..637c9c6aba 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -208,7 +208,7 @@ QRectF QPixmapFilter::boundingRectFor(const QRectF &rect) const
class QPixmapConvolutionFilterPrivate : public QPixmapFilterPrivate
{
public:
- QPixmapConvolutionFilterPrivate(): convolutionKernel(0), kernelWidth(0), kernelHeight(0), convoluteAlpha(false) {}
+ QPixmapConvolutionFilterPrivate(): convolutionKernel(nullptr), kernelWidth(0), kernelHeight(0), convoluteAlpha(false) {}
~QPixmapConvolutionFilterPrivate() {
delete[] convolutionKernel;
}
@@ -424,7 +424,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q
// raster implementation
- QImage *target = 0;
+ QImage *target = nullptr;
if (painter->paintEngine()->paintDevice()->devType() == QInternal::Image) {
target = static_cast<QImage *>(painter->paintEngine()->paintDevice());
@@ -432,18 +432,18 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q
if (mat.type() > QTransform::TxTranslate) {
// Disabled because of transformation...
- target = 0;
+ target = nullptr;
} else {
QRasterPaintEngine *pe = static_cast<QRasterPaintEngine *>(painter->paintEngine());
if (pe->clipType() == QRasterPaintEngine::ComplexClip)
// disabled because of complex clipping...
- target = 0;
+ target = nullptr;
else {
QRectF clip = pe->clipBoundingRect();
QRectF rect = boundingRectFor(srcRect.isEmpty() ? src.rect() : srcRect);
QTransform x = painter->deviceTransform();
if (!clip.contains(rect.translated(x.dx() + p.x(), x.dy() + p.y()))) {
- target = 0;
+ target = nullptr;
}
}
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
index ea6a8018ca..4f1855a606 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
@@ -353,7 +353,7 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem,
bool ok = true;
if (orientations & Qt::Horizontal) {
// Currently, if the first is ok, then the rest of the calls should be ok
- ok = addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft) != 0;
+ ok = addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft) != nullptr;
if (ok)
addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight);
}
@@ -465,7 +465,7 @@ void QGraphicsAnchorLayout::removeAt(int index)
d->removeAnchors(item);
d->items.remove(index);
- item->setParentLayoutItem(0);
+ item->setParentLayoutItem(nullptr);
invalidate();
}
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index 4f44373cad..af0ee3d38c 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
const qreal g_offset = (sizeof(qreal) == sizeof(double)) ? QWIDGETSIZE_MAX : QWIDGETSIZE_MAX / 32;
QGraphicsAnchorPrivate::QGraphicsAnchorPrivate(int version)
- : QObjectPrivate(version), layoutPrivate(0), data(0),
+ : QObjectPrivate(version), layoutPrivate(nullptr), data(nullptr),
sizePolicy(QSizePolicy::Fixed), preferredSize(0),
hasSize(true)
{
@@ -72,7 +72,7 @@ QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate()
if (data) {
// The QGraphicsAnchor was already deleted at this moment. We must clean
// the dangling pointer to avoid double deletion in the AnchorData dtor.
- data->graphicsAnchor = 0;
+ data->graphicsAnchor = nullptr;
layoutPrivate->removeAnchor(data->from, data->to);
}
@@ -631,9 +631,9 @@ QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate()
spacings[i] = -1;
graphHasConflicts[i] = false;
- layoutFirstVertex[i] = 0;
- layoutCentralVertex[i] = 0;
- layoutLastVertex[i] = 0;
+ layoutFirstVertex[i] = nullptr;
+ layoutCentralVertex[i] = nullptr;
+ layoutLastVertex[i] = nullptr;
}
}
@@ -981,7 +981,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyVertices(Orientation orientation)
feasible &= replaceVertex(orientation, next, newV, newV->m_secondAnchors);
// Update the layout vertex information if one of the vertices is a layout vertex.
- AnchorVertex *layoutVertex = 0;
+ AnchorVertex *layoutVertex = nullptr;
if (v->m_item == q)
layoutVertex = v;
else if (next->m_item == q)
@@ -1035,7 +1035,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
QSet<AnchorVertex *> visited;
QStack<QPair<AnchorVertex *, AnchorVertex *> > stack;
- stack.push(qMakePair(static_cast<AnchorVertex *>(0), layoutFirstVertex[orientation]));
+ stack.push(qMakePair(static_cast<AnchorVertex *>(nullptr), layoutFirstVertex[orientation]));
QVector<AnchorVertex*> candidates;
// Walk depth-first, in the stack we store start of the candidate sequence (beforeSequence)
@@ -1384,7 +1384,7 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges()
// Save a reference to layout vertices
layoutFirstVertex[Horizontal] = internalVertex(layout, Qt::AnchorLeft);
- layoutCentralVertex[Horizontal] = 0;
+ layoutCentralVertex[Horizontal] = nullptr;
layoutLastVertex[Horizontal] = internalVertex(layout, Qt::AnchorRight);
// Vertical
@@ -1395,7 +1395,7 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges()
// Save a reference to layout vertices
layoutFirstVertex[Vertical] = internalVertex(layout, Qt::AnchorTop);
- layoutCentralVertex[Vertical] = 0;
+ layoutCentralVertex[Vertical] = nullptr;
layoutLastVertex[Vertical] = internalVertex(layout, Qt::AnchorBottom);
}
@@ -1581,7 +1581,7 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors(
}
if (item == q) {
- layoutCentralVertex[orientation] = 0;
+ layoutCentralVertex[orientation] = nullptr;
}
}
@@ -1636,29 +1636,29 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
qreal *spacing)
{
Q_Q(QGraphicsAnchorLayout);
- if ((firstItem == 0) || (secondItem == 0)) {
+ if ((firstItem == nullptr) || (secondItem == nullptr)) {
qWarning("QGraphicsAnchorLayout::addAnchor(): "
"Cannot anchor NULL items");
- return 0;
+ return nullptr;
}
if (firstItem == secondItem) {
qWarning("QGraphicsAnchorLayout::addAnchor(): "
"Cannot anchor the item to itself");
- return 0;
+ return nullptr;
}
if (edgeOrientation(secondEdge) != edgeOrientation(firstEdge)) {
qWarning("QGraphicsAnchorLayout::addAnchor(): "
"Cannot anchor edges of different orientations");
- return 0;
+ return nullptr;
}
const QGraphicsLayoutItem *parentWidget = q->parentLayoutItem();
if (firstItem == parentWidget || secondItem == parentWidget) {
qWarning("QGraphicsAnchorLayout::addAnchor(): "
"You cannot add the parent of the layout to the layout.");
- return 0;
+ return nullptr;
}
// In QGraphicsAnchorLayout, items are represented in its internal
@@ -1770,13 +1770,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::getAnchor(QGraphicsLayoutItem *fi
{
// Do not expose internal anchors
if (firstItem == secondItem)
- return 0;
+ return nullptr;
const Orientation orientation = edgeOrientation(firstEdge);
AnchorVertex *v1 = internalVertex(firstItem, firstEdge);
AnchorVertex *v2 = internalVertex(secondItem, secondEdge);
- QGraphicsAnchor *graphicsAnchor = 0;
+ QGraphicsAnchor *graphicsAnchor = nullptr;
AnchorData *data = graph[orientation].edgeData(v1, v2);
if (data) {
@@ -1811,7 +1811,7 @@ void QGraphicsAnchorLayoutPrivate::removeAnchor(AnchorVertex *firstVertex,
removeAnchor_helper(firstVertex, secondVertex);
// Ensure no dangling pointer is left behind
- firstVertex = secondVertex = 0;
+ firstVertex = secondVertex = nullptr;
// Checking if the item stays in the layout or not
bool keepFirstItem = false;
@@ -2017,13 +2017,13 @@ QLayoutStyleInfo &QGraphicsAnchorLayoutPrivate::styleInfo() const
if (styleInfoDirty) {
Q_Q(const QGraphicsAnchorLayout);
//### Fix this if QGV ever gets support for Metal style or different Aqua sizes.
- QWidget *wid = 0;
+ QWidget *wid = nullptr;
QGraphicsLayoutItem *parent = q->parentLayoutItem();
while (parent && parent->isLayout()) {
parent = parent->parentLayoutItem();
}
- QGraphicsWidget *w = 0;
+ QGraphicsWidget *w = nullptr;
if (parent) {
QGraphicsItem *parentItem = parent->graphicsItem();
if (parentItem && parentItem->isWidget())
@@ -2404,7 +2404,7 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin
// Look for the layout edge. That can be either the first half in case the
// layout is split in two, or the whole layout anchor.
Orientation orient = Orientation(anchors.first()->orientation);
- AnchorData *layoutEdge = 0;
+ AnchorData *layoutEdge = nullptr;
if (layoutCentralVertex[orient]) {
layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]);
} else {
@@ -2423,7 +2423,7 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin
actualMax = -layoutEdge->minSize;
}
if (actualMax != expectedMax) {
- layoutEdge = 0;
+ layoutEdge = nullptr;
}
// For each variable, create constraints based on size hints
@@ -2496,8 +2496,8 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation)
Q_ASSERT(layoutFirstVertex[orientation] && layoutLastVertex[orientation]);
- AnchorData *edgeL1 = 0;
- AnchorData *edgeL2 = 0;
+ AnchorData *edgeL1 = nullptr;
+ AnchorData *edgeL2 = nullptr;
// The layout may have a single anchor between Left and Right or two half anchors
// passing through the center
@@ -2625,7 +2625,7 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom)
qreal left;
qreal right;
- q->getContentsMargins(&left, &top, &right, 0);
+ q->getContentsMargins(&left, &top, &right, nullptr);
const Qt::LayoutDirection visualDir = visualDirection();
if (visualDir == Qt::RightToLeft)
qSwap(left, right);
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
index 6b7052a0ab..260e1861c7 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
@@ -137,7 +137,7 @@ QGraphicsGridLayout::~QGraphicsGridLayout()
// ~QGraphicsLayoutItem.
removeAt(i);
if (item) {
- item->setParentLayoutItem(0);
+ item->setParentLayoutItem(nullptr);
if (item->ownedByLayout())
delete item;
}
@@ -535,11 +535,11 @@ QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int row, int column) const
Q_D(const QGraphicsGridLayout);
if (row < 0 || row >= rowCount() || column < 0 || column >= columnCount()) {
qWarning("QGraphicsGridLayout::itemAt: invalid row, column %d, %d", row, column);
- return 0;
+ return nullptr;
}
if (QGraphicsGridLayoutEngineItem *engineItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(row, column)))
return engineItem->layoutItem();
- return 0;
+ return nullptr;
}
/*!
@@ -583,7 +583,7 @@ void QGraphicsGridLayout::removeAt(int index)
if (QGraphicsGridLayoutEngineItem *gridItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(index))) {
if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem())
- layoutItem->setParentLayoutItem(0);
+ layoutItem->setParentLayoutItem(nullptr);
d->engine.removeItem(gridItem);
// recalculate rowInfo.count if we remove an item that is on the right/bottommost row
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 7c0f836156..6f1eb4b346 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1250,7 +1250,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (isWidget)
static_cast<QGraphicsWidgetPrivate *>(this)->fixFocusChainBeforeReparenting((newParent &&
- newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : 0,
+ newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : nullptr,
scene);
if (scene) {
// Deliver the change to the index
@@ -1293,7 +1293,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
// Ensure any last parent focus scope does not point to this item or any of
// its descendents.
QGraphicsItem *p = parent;
- QGraphicsItem *parentFocusScopeItem = 0;
+ QGraphicsItem *parentFocusScopeItem = nullptr;
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
// If this item's focus scope's focus scope item points
@@ -1301,7 +1301,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
QGraphicsItem *fsi = p->d_ptr->focusScopeItem;
if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
parentFocusScopeItem = fsi;
- p->d_ptr->focusScopeItem = 0;
+ p->d_ptr->focusScopeItem = nullptr;
fsi->d_ptr->focusScopeItemChange(false);
}
break;
@@ -1321,7 +1321,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
if (subFocusItem && subFocusItem != q_ptr) {
// Find the subFocusItem's topmost focus scope within the new parent's focusscope
- QGraphicsItem *ancestorScope = 0;
+ QGraphicsItem *ancestorScope = nullptr;
QGraphicsItem *p2 = subFocusItem->d_ptr->parent;
while (p2 && p2 != p) {
if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
@@ -1587,7 +1587,7 @@ QGraphicsItem::~QGraphicsItem()
if (QAbstractDeclarativeData::destroyed)
QAbstractDeclarativeData::destroyed(p->declarativeData, o);
}
- p->declarativeData = 0;
+ p->declarativeData = nullptr;
p->wasDeleted = false;
}
}
@@ -1607,14 +1607,14 @@ QGraphicsItem::~QGraphicsItem()
#endif
clearFocus();
- setFocusProxy(0);
+ setFocusProxy(nullptr);
// Update focus scope item ptr.
QGraphicsItem *p = d_ptr->parent;
while (p) {
if (p->flags() & ItemIsFocusScope) {
if (p->d_ptr->focusScopeItem == this)
- p->d_ptr->focusScopeItem = 0;
+ p->d_ptr->focusScopeItem = nullptr;
break;
}
p = p->d_ptr->parent;
@@ -1630,7 +1630,7 @@ QGraphicsItem::~QGraphicsItem()
d_ptr->scene->d_func()->removeItemHelper(this);
} else {
d_ptr->resetFocusProxy();
- setParentItem(0);
+ setParentItem(nullptr);
}
#if QT_CONFIG(graphicseffect)
@@ -1639,7 +1639,7 @@ QGraphicsItem::~QGraphicsItem()
if (d_ptr->transformData) {
for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
- static_cast<QGraphicsTransformPrivate *>(t->d_ptr.data())->item = 0;
+ static_cast<QGraphicsTransformPrivate *>(t->d_ptr.data())->item = nullptr;
delete t;
}
}
@@ -1751,7 +1751,7 @@ QGraphicsWidget *QGraphicsItem::parentWidget() const
QGraphicsItem *p = parentItem();
while (p && !p->isWidget())
p = p->parentItem();
- return (p && p->isWidget()) ? static_cast<QGraphicsWidget *>(p) : 0;
+ return (p && p->isWidget()) ? static_cast<QGraphicsWidget *>(p) : nullptr;
}
/*!
@@ -1811,7 +1811,7 @@ QGraphicsItem *QGraphicsItem::panel() const
*/
QGraphicsObject *QGraphicsItem::toGraphicsObject()
{
- return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : 0;
+ return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : nullptr;
}
/*!
@@ -1822,7 +1822,7 @@ QGraphicsObject *QGraphicsItem::toGraphicsObject()
*/
const QGraphicsObject *QGraphicsItem::toGraphicsObject() const
{
- return d_ptr->isObject ? static_cast<const QGraphicsObject *>(this) : 0;
+ return d_ptr->isObject ? static_cast<const QGraphicsObject *>(this) : nullptr;
}
/*!
@@ -2224,7 +2224,7 @@ bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const
return false;
- QGraphicsItem *dummy = 0;
+ QGraphicsItem *dummy = nullptr;
if (!blockingPanel)
blockingPanel = &dummy;
@@ -2420,7 +2420,7 @@ bool QGraphicsItem::isVisibleTo(const QGraphicsItem *parent) const
if (p->d_ptr->explicitlyHidden)
return false;
} while ((p = p->d_ptr->parent));
- return parent == 0;
+ return parent == nullptr;
}
/*!
@@ -2959,7 +2959,7 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
if (d_ptr->graphicsEffect) {
delete d_ptr->graphicsEffect;
- d_ptr->graphicsEffect = 0;
+ d_ptr->graphicsEffect = nullptr;
} else if (d_ptr->parent) {
d_ptr->parent->d_ptr->updateChildWithGraphicsEffectFlagRecursively();
}
@@ -2984,7 +2984,7 @@ void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
if (itemPrivate->mayHaveChildWithGraphicsEffect)
return;
itemPrivate->mayHaveChildWithGraphicsEffect = 1;
- } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
+ } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : nullptr));
#endif
}
@@ -3396,13 +3396,13 @@ void QGraphicsItem::setActive(bool active)
if (!activePanel || activePanel == thisPanel) {
// Deactivate this item, and reactivate the parent panel,
// or the last active panel (if any).
- QGraphicsItem *nextToActivate = 0;
+ QGraphicsItem *nextToActivate = nullptr;
if (d_ptr->parent)
nextToActivate = d_ptr->parent->panel();
if (!nextToActivate)
nextToActivate = d_ptr->scene->d_func()->lastActivePanel;
if (nextToActivate == this || isAncestorOf(nextToActivate))
- nextToActivate = 0;
+ nextToActivate = nullptr;
d_ptr->scene->setActivePanel(nextToActivate);
}
}
@@ -3499,7 +3499,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
}
// Update the child focus chain.
- QGraphicsItem *commonAncestor = 0;
+ QGraphicsItem *commonAncestor = nullptr;
if (scene && scene->focusItem() && scene->focusItem()->panel() == q_ptr->panel()) {
commonAncestor = scene->focusItem()->commonAncestorItem(f);
scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor);
@@ -3552,7 +3552,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenB
while (p) {
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
if (p->d_ptr->focusScopeItem == q_ptr) {
- p->d_ptr->focusScopeItem = 0;
+ p->d_ptr->focusScopeItem = nullptr;
if (!subFocusItem->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere
focusScopeItemChange(false);
}
@@ -3572,7 +3572,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenB
clearSubFocus(q_ptr);
// If this item has the scene's input focus, clear it.
- scene->setFocusItem(0);
+ scene->setFocusItem(nullptr);
}
}
@@ -3621,7 +3621,7 @@ void QGraphicsItem::setFocusProxy(QGraphicsItem *item)
qWarning("QGraphicsItem::setFocusProxy: focus proxy must be in same scene");
return;
}
- for (QGraphicsItem *f = item->focusProxy(); f != 0; f = f->focusProxy()) {
+ for (QGraphicsItem *f = item->focusProxy(); f != nullptr; f = f->focusProxy()) {
if (f == this) {
qWarning("QGraphicsItem::setFocusProxy: %p is already in the focus proxy chain", item);
return;
@@ -4452,7 +4452,7 @@ QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) c
QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) const
{
// Catch simple cases first.
- if (other == 0) {
+ if (other == nullptr) {
qWarning("QGraphicsItem::itemTransform: null pointer passed");
return QTransform();
}
@@ -4892,7 +4892,7 @@ void QGraphicsItem::stackBefore(const QGraphicsItem *sibling)
}
QList<QGraphicsItem *> *siblings = d_ptr->parent
? &d_ptr->parent->d_ptr->children
- : (d_ptr->scene ? &d_ptr->scene->d_func()->topLevelItems : 0);
+ : (d_ptr->scene ? &d_ptr->scene->d_func()->topLevelItems : nullptr);
if (!siblings) {
qWarning("QGraphicsItem::stackUnder: cannot stack under %p, which must be a sibling", sibling);
return;
@@ -4949,7 +4949,7 @@ QRectF QGraphicsItem::childrenBoundingRect() const
return d_ptr->childrenBoundingRect;
d_ptr->childrenBoundingRect = QRectF();
- d_ptr->childrenBoundingRectHelper(0, &d_ptr->childrenBoundingRect, 0);
+ d_ptr->childrenBoundingRectHelper(nullptr, &d_ptr->childrenBoundingRect, nullptr);
d_ptr->dirtyChildrenBoundingRect = 0;
return d_ptr->childrenBoundingRect;
}
@@ -5422,7 +5422,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c
// Render
QStyleOptionGraphicsItem option;
- const_cast<QGraphicsItem *>(this)->paint(&p, &option, 0);
+ const_cast<QGraphicsItem *>(this)->paint(&p, &option, nullptr);
p.end();
// Transform QRegion back to device space
@@ -5575,7 +5575,7 @@ void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively()
if (!itemPrivate->updateDueToGraphicsEffect)
static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
}
- } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
+ } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : nullptr));
}
void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::InvalidateReason reason)
@@ -5739,7 +5739,7 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost
if (*topMostDirtyItem == q_ptr) {
if (!dirtySceneTransform)
return; // OK, neither my ancestors nor I have dirty scene transforms.
- *topMostDirtyItem = 0;
+ *topMostDirtyItem = nullptr;
} else if (*topMostDirtyItem) {
return; // Continue backtrack.
}
@@ -5771,7 +5771,7 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *s
if (parent != q_ptr && parent->d_ptr->subFocusItem) {
if (parent->d_ptr->subFocusItem == q_ptr)
break;
- parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem);
+ parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(nullptr, stopItem);
}
parent->d_ptr->subFocusItem = q_ptr;
parent->d_ptr->subFocusItemChange();
@@ -5793,7 +5793,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem
do {
if (parent->d_ptr->subFocusItem != q_ptr)
break;
- parent->d_ptr->subFocusItem = 0;
+ parent->d_ptr->subFocusItem = nullptr;
if (parent != stopItem && !parent->isAncestorOf(stopItem))
parent->d_ptr->subFocusItemChange();
} while (!parent->isPanel() && (parent = parent->d_ptr->parent));
@@ -5808,7 +5808,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem
void QGraphicsItemPrivate::resetFocusProxy()
{
for (int i = 0; i < focusProxyRefs.size(); ++i)
- *focusProxyRefs.at(i) = 0;
+ *focusProxyRefs.at(i) = nullptr;
focusProxyRefs.clear();
}
@@ -7322,7 +7322,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
// Find the active view.
- QGraphicsView *view = 0;
+ QGraphicsView *view = nullptr;
if (event->widget())
view = qobject_cast<QGraphicsView *>(event->widget()->parentWidget());
@@ -7330,7 +7330,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
int i = 0;
bool movedMe = false;
while (i <= selectedItems.size()) {
- QGraphicsItem *item = 0;
+ QGraphicsItem *item = nullptr;
if (i < selectedItems.size())
item = selectedItems.at(i);
else
@@ -7891,7 +7891,7 @@ void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObj
if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
item->setParentItem(graphicsObject);
} else {
- QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
+ QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, nullptr, nullptr);
}
}
}
@@ -7908,7 +7908,7 @@ QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGra
if (index >= 0 && index < d->children.count())
return d->children.at(index)->toGraphicsObject();
else
- return 0;
+ return nullptr;
}
void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObject> *list)
@@ -7917,10 +7917,10 @@ void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObje
int childCount = d->children.count();
if (d->sendParentChangeNotification) {
for (int index = 0; index < childCount; index++)
- d->children.at(0)->setParentItem(0);
+ d->children.at(0)->setParentItem(nullptr);
} else {
for (int index = 0; index < childCount; index++)
- QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, 0, 0);
+ QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(nullptr, nullptr, nullptr);
}
}
@@ -9949,7 +9949,7 @@ class QGraphicsTextItemPrivate
{
public:
QGraphicsTextItemPrivate()
- : control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0)
+ : control(nullptr), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0)
{ }
mutable QWidgetTextControl *control;
@@ -11232,7 +11232,7 @@ void QGraphicsItemGroup::removeFromGroup(QGraphicsItem *item)
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization
item->setTransform(itemTransform);
- item->d_func()->setIsMemberOfGroup(item->group() != 0);
+ item->d_func()->setIsMemberOfGroup(item->group() != nullptr);
// ### Quite expensive. But removeFromGroup() isn't called very often.
prepareGeometryChange();
@@ -11412,18 +11412,18 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
QTransform sceneTransform = item->sceneTransform();
QTransform newEffectTransform = sceneTransform.inverted();
newEffectTransform *= effectTransform;
- scened->draw(item, &pixmapPainter, 0, &sceneTransform, 0, 0, qreal(1.0),
+ scened->draw(item, &pixmapPainter, nullptr, &sceneTransform, nullptr, nullptr, qreal(1.0),
&newEffectTransform, false, true);
} else if (deviceCoordinates) {
// Device coordinates with info.
- scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
+ scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, nullptr,
info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform,
info->drawItem);
} else {
// Item coordinates with info.
QTransform newEffectTransform = info->transformPtr->inverted();
newEffectTransform *= effectTransform;
- scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
+ scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, nullptr,
info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform,
info->drawItem);
}
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
index ad77e2f260..1c5dbf265c 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
@@ -106,7 +106,7 @@ class QGraphicsItemAnimationPrivate
{
public:
inline QGraphicsItemAnimationPrivate()
- : q(0), timeLine(0), item(0), step(0)
+ : q(nullptr), timeLine(nullptr), item(nullptr), step(0)
{ }
QGraphicsItemAnimation *q;
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.cpp b/src/widgets/graphicsview/qgraphicslayout_p.cpp
index 59ed7acd72..c10763d065 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout_p.cpp
@@ -97,7 +97,7 @@ void QGraphicsLayoutPrivate::getMargin(qreal *result, qreal userMargin, QStyle::
*result = 0.0;
if (QGraphicsItem *layoutParentItem = parentItem()) {
if (layoutParentItem->isWidget())
- *result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0);
+ *result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, nullptr);
}
}
}
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
index 1192bad51e..8694dcb36b 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
@@ -105,7 +105,7 @@ static void normalizeHints(qreal &minimum, qreal &preferred, qreal &maximum, qre
\internal
*/
QGraphicsLayoutItemPrivate::QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *par, bool layout)
- : parent(par), userSizeHints(0), isLayout(layout), ownedByLayout(false), graphicsItem(0)
+ : parent(par), userSizeHints(nullptr), isLayout(layout), ownedByLayout(false), graphicsItem(nullptr)
{
}
diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp
index da2510a8cb..2f1526cc78 100644
--- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp
+++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp
@@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
QGraphicsLayoutStyleInfo::QGraphicsLayoutStyleInfo(const QGraphicsLayoutPrivate *layout)
- : m_layout(layout), m_style(0)
+ : m_layout(layout), m_style(nullptr)
{
m_widget.reset(new QWidget); // pixelMetric might need a widget ptr
m_styleOption.initFrom(m_widget.get());
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
index 22633df4e3..f76cc61586 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
@@ -211,7 +211,7 @@ QGraphicsLinearLayout::~QGraphicsLinearLayout()
// ~QGraphicsLayoutItem.
removeAt(i);
if (item) {
- item->setParentLayoutItem(0);
+ item->setParentLayoutItem(nullptr);
if (item->ownedByLayout())
delete item;
}
@@ -310,7 +310,7 @@ void QGraphicsLinearLayout::removeItem(QGraphicsLayoutItem *item)
{
Q_D(QGraphicsLinearLayout);
if (QGraphicsGridLayoutEngineItem *gridItem = d->engine.findLayoutItem(item)) {
- item->setParentLayoutItem(0);
+ item->setParentLayoutItem(nullptr);
d->removeGridItem(gridItem);
delete gridItem;
invalidate();
@@ -333,7 +333,7 @@ void QGraphicsLinearLayout::removeAt(int index)
if (QGraphicsGridLayoutEngineItem *gridItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(index))) {
if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem())
- layoutItem->setParentLayoutItem(0);
+ layoutItem->setParentLayoutItem(nullptr);
d->removeGridItem(gridItem);
delete gridItem;
invalidate();
@@ -483,9 +483,9 @@ QGraphicsLayoutItem *QGraphicsLinearLayout::itemAt(int index) const
Q_D(const QGraphicsLinearLayout);
if (index < 0 || index >= d->engine.itemCount()) {
qWarning("QGraphicsLinearLayout::itemAt: invalid index %d", index);
- return 0;
+ return nullptr;
}
- QGraphicsLayoutItem *item = 0;
+ QGraphicsLayoutItem *item = nullptr;
if (QGraphicsGridLayoutEngineItem *gridItem = static_cast<QGraphicsGridLayoutEngineItem *>(d->engine.itemAt(index)))
item = gridItem->layoutItem();
return item;
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index c60dca7a90..4d4958c674 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -291,7 +291,7 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent
}
if (!lastWidgetUnderMouse) {
- QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : receiver, 0, event->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : receiver, nullptr, event->screenPos());
lastWidgetUnderMouse = receiver;
}
@@ -315,10 +315,10 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent
if (q->rect().contains(event->pos()) && q->acceptHoverEvents())
lastWidgetUnderMouse = alienWidget ? alienWidget : widget;
else // released on the frame our outside the item, or doesn't accept hover events.
- lastWidgetUnderMouse = 0;
+ lastWidgetUnderMouse = nullptr;
QApplicationPrivate::dispatchEnterLeave(lastWidgetUnderMouse, embeddedMouseGrabber, event->screenPos());
- embeddedMouseGrabber = 0;
+ embeddedMouseGrabber = nullptr;
#ifndef QT_NO_CURSOR
// ### Restore the cursor, don't override it.
@@ -368,7 +368,7 @@ void QGraphicsProxyWidgetPrivate::removeSubFocusHelper(QWidget *widget, Qt::Focu
QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) const
{
if (!widget)
- return 0;
+ return nullptr;
// Run around the focus chain until we find a widget that can take tab focus.
if (!child) {
@@ -376,12 +376,12 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next)
} else {
child = next ? child->d_func()->focus_next : child->d_func()->focus_prev;
if ((next && child == widget) || (!next && child == widget->d_func()->focus_prev)) {
- return 0;
+ return nullptr;
}
}
if (!child)
- return 0;
+ return nullptr;
QWidget *oldChild = child;
uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus;
@@ -394,7 +394,7 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next)
}
child = next ? child->d_func()->focus_next : child->d_func()->focus_prev;
} while (child != oldChild && !(next && child == widget) && !(!next && child == widget->d_func()->focus_prev));
- return 0;
+ return nullptr;
}
/*!
@@ -405,9 +405,9 @@ void QGraphicsProxyWidgetPrivate::_q_removeWidgetSlot()
Q_Q(QGraphicsProxyWidget);
if (!widget.isNull()) {
if (const auto &extra = widget->d_func()->extra)
- extra->proxyWidget = 0;
+ extra->proxyWidget = nullptr;
}
- widget = 0;
+ widget = nullptr;
delete q;
}
@@ -430,7 +430,7 @@ void QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget()
QRectF widgetGeometry = widget->geometry();
QWidget *parentWidget = widget->parentWidget();
if (widget->isWindow()) {
- QGraphicsProxyWidget *proxyParent = 0;
+ QGraphicsProxyWidget *proxyParent = nullptr;
if (parentWidget && (proxyParent = qobject_cast<QGraphicsProxyWidget *>(q->parentWidget()))) {
// Nested window proxy (e.g., combobox popup), map widget to the
// parent widget's global coordinates, and map that to the parent
@@ -497,7 +497,7 @@ void QGraphicsProxyWidgetPrivate::unembedSubWindow(QWidget *subWin)
if (child->isWidget()) {
if (QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(static_cast<QGraphicsWidget *>(child))) {
if (proxy->widget() == subWin) {
- proxy->setWidget(0);
+ proxy->setWidget(nullptr);
scene->removeItem(proxy);
delete proxy;
return;
@@ -598,7 +598,7 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto
QObject::disconnect(widget, SIGNAL(destroyed()), q, SLOT(_q_removeWidgetSlot()));
widget->removeEventFilter(q);
widget->setAttribute(Qt::WA_DontShowOnScreen, false);
- widget->d_func()->extra->proxyWidget = 0;
+ widget->d_func()->extra->proxyWidget = nullptr;
resolveFont(inheritedFontResolveMask);
resolvePalette(inheritedPaletteResolveMask);
widget->update();
@@ -1081,7 +1081,7 @@ void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
return;
QDragLeaveEvent proxyDragLeave;
QCoreApplication::sendEvent(d->dragDropWidget, &proxyDragLeave);
- d->dragDropWidget = 0;
+ d->dragDropWidget = nullptr;
#endif
}
@@ -1143,7 +1143,7 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
// Leave the last drag drop item
QDragLeaveEvent dragLeave;
QCoreApplication::sendEvent(d->dragDropWidget, &dragLeave);
- d->dragDropWidget = 0;
+ d->dragDropWidget = nullptr;
}
// Propagate
event->setDropAction(Qt::IgnoreAction);
@@ -1165,7 +1165,7 @@ void QGraphicsProxyWidget::dropEvent(QGraphicsSceneDragDropEvent *event)
QDropEvent dropEvent(widgetPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers());
QCoreApplication::sendEvent(d->dragDropWidget, &dropEvent);
event->setAccepted(dropEvent.isAccepted());
- d->dragDropWidget = 0;
+ d->dragDropWidget = nullptr;
}
#endif
}
@@ -1188,8 +1188,8 @@ void QGraphicsProxyWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Q_D(QGraphicsProxyWidget);
// If hoverMove was compressed away, make sure we update properly here.
if (d->lastWidgetUnderMouse) {
- QApplicationPrivate::dispatchEnterLeave(0, d->lastWidgetUnderMouse, event->screenPos());
- d->lastWidgetUnderMouse = 0;
+ QApplicationPrivate::dispatchEnterLeave(nullptr, d->lastWidgetUnderMouse, event->screenPos());
+ d->lastWidgetUnderMouse = nullptr;
}
}
@@ -1205,13 +1205,13 @@ void QGraphicsProxyWidget::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
// Ignore events on the window frame.
if (!d->widget || !rect().contains(event->pos())) {
if (d->lastWidgetUnderMouse) {
- QApplicationPrivate::dispatchEnterLeave(0, d->lastWidgetUnderMouse, event->screenPos());
- d->lastWidgetUnderMouse = 0;
+ QApplicationPrivate::dispatchEnterLeave(nullptr, d->lastWidgetUnderMouse, event->screenPos());
+ d->lastWidgetUnderMouse = nullptr;
}
return;
}
- d->embeddedMouseGrabber = 0;
+ d->embeddedMouseGrabber = nullptr;
d->sendWidgetMouseEvent(event);
}
@@ -1230,7 +1230,7 @@ void QGraphicsProxyWidget::ungrabMouseEvent(QEvent *event)
{
Q_D(QGraphicsProxyWidget);
Q_UNUSED(event);
- d->embeddedMouseGrabber = 0;
+ d->embeddedMouseGrabber = nullptr;
}
/*!
@@ -1372,12 +1372,12 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event)
switch (event->reason()) {
case Qt::TabFocusReason: {
- if (QWidget *focusChild = d->findFocusChild(0, true))
+ if (QWidget *focusChild = d->findFocusChild(nullptr, true))
focusChild->setFocus(event->reason());
break;
}
case Qt::BacktabFocusReason:
- if (QWidget *focusChild = d->findFocusChild(0, false))
+ if (QWidget *focusChild = d->findFocusChild(nullptr, false))
focusChild->setFocus(event->reason());
break;
default:
@@ -1578,16 +1578,16 @@ QGraphicsProxyWidget *QGraphicsProxyWidget::createProxyForChildWidget(QWidget *c
return proxy;
if (!child->parentWidget()) {
qWarning("QGraphicsProxyWidget::createProxyForChildWidget: top-level widget not in a QGraphicsScene");
- return 0;
+ return nullptr;
}
QGraphicsProxyWidget *parentProxy = createProxyForChildWidget(child->parentWidget());
if (!parentProxy)
- return 0;
+ return nullptr;
if (!QMetaObject::invokeMethod(parentProxy, "newProxyWidget", Qt::DirectConnection,
Q_RETURN_ARG(QGraphicsProxyWidget*, proxy), Q_ARG(const QWidget*, child)))
- return 0;
+ return nullptr;
proxy->setParent(parentProxy);
proxy->setWidget(child);
return proxy;
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index d641d17232..1c6e68def1 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -278,7 +278,7 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph
*/
QGraphicsScenePrivate::QGraphicsScenePrivate()
: indexMethod(QGraphicsScene::BspTreeIndex),
- index(0),
+ index(nullptr),
lastItemCount(0),
hasSceneRect(false),
dirtyGrowingItemsBoundingRect(true),
@@ -301,19 +301,19 @@ QGraphicsScenePrivate::QGraphicsScenePrivate()
minimumRenderSize(0.0),
selectionChanging(0),
rectAdjust(2),
- focusItem(0),
- lastFocusItem(0),
- passiveFocusItem(0),
- tabFocusFirst(0),
- activePanel(0),
- lastActivePanel(0),
+ focusItem(nullptr),
+ lastFocusItem(nullptr),
+ passiveFocusItem(nullptr),
+ tabFocusFirst(nullptr),
+ activePanel(nullptr),
+ lastActivePanel(nullptr),
activationRefCount(0),
childExplicitActivation(0),
- lastMouseGrabberItem(0),
- dragDropItem(0),
- enterWidget(0),
+ lastMouseGrabberItem(nullptr),
+ dragDropItem(nullptr),
+ enterWidget(nullptr),
lastDropAction(Qt::IgnoreAction),
- style(0)
+ style(nullptr)
{
}
@@ -443,8 +443,8 @@ void QGraphicsScenePrivate::_q_polishItems()
return;
const QVariant booleanTrueVariant(true);
- QGraphicsItem *item = 0;
- QGraphicsItemPrivate *itemd = 0;
+ QGraphicsItem *item = nullptr;
+ QGraphicsItemPrivate *itemd = nullptr;
const int oldUnpolishedCount = unpolishedItems.count();
for (int i = 0; i < oldUnpolishedCount; ++i) {
@@ -602,7 +602,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
unregisterScenePosItem(item);
QGraphicsScene *oldScene = item->d_func()->scene;
- item->d_func()->scene = 0;
+ item->d_func()->scene = nullptr;
//We need to remove all children first because they might use their parent
//attributes (e.g. sceneTransform).
@@ -614,7 +614,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
if (!item->d_ptr->inDestructor && !item->parentItem() && item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
- widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0);
+ widget->d_func()->fixFocusChainBeforeReparenting(nullptr, oldScene, nullptr);
}
// Unregister focus proxy.
@@ -625,7 +625,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
if (parentItem->scene()) {
Q_ASSERT_X(parentItem->scene() == q, "QGraphicsScene::removeItem",
"Parent item's scene is different from this item's scene");
- item->setParentItem(0);
+ item->setParentItem(nullptr);
}
} else {
unregisterTopLevelItem(item);
@@ -633,17 +633,17 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
// Reset the mouse grabber and focus item data.
if (item == focusItem)
- focusItem = 0;
+ focusItem = nullptr;
if (item == lastFocusItem)
- lastFocusItem = 0;
+ lastFocusItem = nullptr;
if (item == passiveFocusItem)
- passiveFocusItem = 0;
+ passiveFocusItem = nullptr;
if (item == activePanel) {
// ### deactivate...
- activePanel = 0;
+ activePanel = nullptr;
}
if (item == lastActivePanel)
- lastActivePanel = 0;
+ lastActivePanel = nullptr;
// Change tabFocusFirst to the next widget in focus chain if removing the current one.
if (item == tabFocusFirst) {
@@ -651,7 +651,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
if (wd->focusNext && wd->focusNext != tabFocusFirst && wd->focusNext->scene() == q)
tabFocusFirst = wd->focusNext;
else
- tabFocusFirst = 0;
+ tabFocusFirst = nullptr;
}
// Cancel active touches
@@ -705,11 +705,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
// Reset the last mouse grabber item
if (item == lastMouseGrabberItem)
- lastMouseGrabberItem = 0;
+ lastMouseGrabberItem = nullptr;
// Reset the current drop item
if (item == dragDropItem)
- dragDropItem = 0;
+ dragDropItem = nullptr;
// Reenable selectionChanged() for individual items
--selectionChanging;
@@ -752,8 +752,8 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin
q->setFocus(Qt::ActiveWindowFocusReason);
// Find the item's panel.
- QGraphicsItem *panel = item ? item->panel() : 0;
- lastActivePanel = panel ? activePanel : 0;
+ QGraphicsItem *panel = item ? item->panel() : nullptr;
+ lastActivePanel = panel ? activePanel : nullptr;
if (panel == activePanel || (!q->isActive() && !duringActivationEvent))
return;
@@ -764,7 +764,7 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin
if (QGraphicsItem *fi = activePanel->focusItem()) {
// Remove focus from the current focus item.
if (fi == q->focusItem())
- setFocusItemHelper(0, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false);
+ setFocusItemHelper(nullptr, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false);
}
QEvent event(QEvent::WindowDeactivate);
@@ -841,7 +841,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
// accept input focus.
if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable)
|| !item->isVisible() || !item->isEnabled())) {
- item = 0;
+ item = nullptr;
}
// Set focus on the scene if an item requests focus.
@@ -849,7 +849,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
q->setFocus(focusReason);
if (item == focusItem) {
if (emitFocusChanged)
- emit q->focusItemChanged(focusItem, (QGraphicsItem *)0, focusReason);
+ emit q->focusItemChanged(focusItem, (QGraphicsItem *)nullptr, focusReason);
return;
}
}
@@ -869,7 +869,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
}
#endif //QT_NO_IM
- focusItem = 0;
+ focusItem = nullptr;
QFocusEvent event(QEvent::FocusOut, focusReason);
sendEvent(lastFocusItem, &event);
}
@@ -877,7 +877,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
// This handles the case that the item has been removed from the
// scene in response to the FocusOut event.
if (item && item->scene() != q)
- item = 0;
+ item = nullptr;
if (item)
focusItem = item;
@@ -1039,7 +1039,7 @@ void QGraphicsScenePrivate::clearMouseGrabber()
{
if (!mouseGrabberItems.isEmpty())
mouseGrabberItems.first()->ungrabMouse();
- lastMouseGrabberItem = 0;
+ lastMouseGrabberItem = nullptr;
}
/*!
@@ -1365,10 +1365,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
// Update window activation.
QGraphicsItem *topItem = cachedItemsUnderMouse.value(0);
- QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : 0;
+ QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : nullptr;
if (newActiveWindow && newActiveWindow->isBlockedByModalPanel(&topItem)) {
// pass activation to the blocking modal window
- newActiveWindow = topItem ? topItem->window() : 0;
+ newActiveWindow = topItem ? topItem->window() : nullptr;
}
if (newActiveWindow != q->activeWindow())
@@ -1409,7 +1409,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
// If nobody could take focus, clear it.
if (!stickyFocus && !setFocus && !sceneModality)
- q->setFocusItem(0, Qt::MouseFocusReason);
+ q->setFocusItem(nullptr, Qt::MouseFocusReason);
// Any item will do.
if (sceneModality && cachedItemsUnderMouse.isEmpty())
@@ -1694,7 +1694,7 @@ QGraphicsScene::~QGraphicsScene()
// Remove this scene from all associated views.
for (int j = 0; j < d->views.size(); ++j)
- d->views.at(j)->setScene(0);
+ d->views.at(j)->setScene(nullptr);
}
/*!
@@ -2432,7 +2432,7 @@ QGraphicsItemGroup *QGraphicsScene::createItemGroup(const QList<QGraphicsItem *>
}
// Find the common ancestor for all items
- QGraphicsItem *commonAncestor = 0;
+ QGraphicsItem *commonAncestor = nullptr;
if (!ancestors.isEmpty()) {
while (n < items.size()) {
int commonIndex = -1;
@@ -2446,7 +2446,7 @@ QGraphicsItemGroup *QGraphicsScene::createItemGroup(const QList<QGraphicsItem *>
} while ((parent = parent->parentItem()));
if (commonIndex == -1) {
- commonAncestor = 0;
+ commonAncestor = nullptr;
break;
}
@@ -2545,7 +2545,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// from this scene.
if (QGraphicsItem *itemParent = item->d_ptr->parent) {
if (itemParent->d_ptr->scene != this)
- item->setParentItem(0);
+ item->setParentItem(nullptr);
}
// Add the item to this scene
@@ -2911,7 +2911,7 @@ QGraphicsSimpleTextItem *QGraphicsScene::addSimpleText(const QString &text, cons
*/
QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags)
{
- QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, wFlags);
+ QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(nullptr, wFlags);
proxy->setWidget(widget);
addItem(proxy);
return proxy;
@@ -2944,7 +2944,7 @@ void QGraphicsScene::removeItem(QGraphicsItem *item)
const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange,
QVariant::fromValue<QGraphicsScene *>(0)));
QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant);
- if (targetScene != 0 && targetScene != this) {
+ if (targetScene != nullptr && targetScene != this) {
targetScene->addItem(item);
return;
}
@@ -3046,7 +3046,7 @@ void QGraphicsScene::clearFocus()
if (d->hasFocus) {
d->hasFocus = false;
d->passiveFocusItem = d->focusItem;
- setFocusItem(0, Qt::OtherFocusReason);
+ setFocusItem(nullptr, Qt::OtherFocusReason);
}
}
@@ -3492,7 +3492,7 @@ bool QGraphicsScene::event(QEvent *event)
// Deactivate the active panel (but keep it so we can
// reactivate it later).
QGraphicsItem *lastActivePanel = d->activePanel;
- d->setActivePanelHelper(0, true);
+ d->setActivePanelHelper(nullptr, true);
d->lastActivePanel = lastActivePanel;
} else {
// Activate all toplevel items.
@@ -3621,7 +3621,7 @@ void QGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMen
void QGraphicsScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
Q_D(QGraphicsScene);
- d->dragDropItem = 0;
+ d->dragDropItem = nullptr;
d->lastDropAction = Qt::IgnoreAction;
event->accept();
}
@@ -3705,7 +3705,7 @@ void QGraphicsScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave);
d->cloneDragDropEvent(&dragLeave, event);
d->sendDragDropEvent(d->dragDropItem, &dragLeave);
- d->dragDropItem = 0;
+ d->dragDropItem = nullptr;
}
// Propagate
event->setDropAction(Qt::IgnoreAction);
@@ -3725,7 +3725,7 @@ void QGraphicsScene::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
if (d->dragDropItem) {
// Leave the last drag drop item
d->sendDragDropEvent(d->dragDropItem, event);
- d->dragDropItem = 0;
+ d->dragDropItem = nullptr;
}
}
@@ -3743,7 +3743,7 @@ void QGraphicsScene::dropEvent(QGraphicsSceneDragDropEvent *event)
if (d->dragDropItem) {
// Drop on the last drag drop item
d->sendDragDropEvent(d->dragDropItem, event);
- d->dragDropItem = 0;
+ d->dragDropItem = nullptr;
}
}
@@ -3793,7 +3793,7 @@ void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent)
Q_D(QGraphicsScene);
d->hasFocus = false;
d->passiveFocusItem = d->focusItem;
- setFocusItem(0, focusEvent->reason());
+ setFocusItem(nullptr, focusEvent->reason());
// Remove all popups when the scene loses focus.
if (!d->popupWidgets.isEmpty())
@@ -3825,7 +3825,7 @@ void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent)
QList<QGraphicsItem *> itemsAtPos = d->itemsAtPosition(helpEvent->screenPos(),
helpEvent->scenePos(),
helpEvent->widget());
- QGraphicsItem *toolTipItem = 0;
+ QGraphicsItem *toolTipItem = nullptr;
for (int i = 0; i < itemsAtPos.size(); ++i) {
QGraphicsItem *tmp = itemsAtPos.at(i);
if (tmp->d_func()->isProxyWidget()) {
@@ -3883,7 +3883,7 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
hoverEvent->widget());
}
- QGraphicsItem *item = 0;
+ QGraphicsItem *item = nullptr;
for (int i = 0; i < cachedItemsUnderMouse.size(); ++i) {
QGraphicsItem *tmp = cachedItemsUnderMouse.at(i);
if (itemAcceptsHoverEvents_helper(tmp)) {
@@ -3894,13 +3894,13 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
// Find the common ancestor item for the new topmost hoverItem and the
// last item in the hoverItem list.
- QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.constLast()) : 0;
+ QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.constLast()) : nullptr;
while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem))
commonAncestorItem = commonAncestorItem->parentItem();
if (commonAncestorItem && commonAncestorItem->panel() != item->panel()) {
// The common ancestor isn't in the same panel as the two hovered
// items.
- commonAncestorItem = 0;
+ commonAncestorItem = nullptr;
}
// Check if the common ancestor item is known.
@@ -4130,7 +4130,7 @@ void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
if (d->lastMouseGrabberItemHasImplicitMouseGrab)
d->mouseGrabberItems.constLast()->ungrabMouse();
} else {
- d->lastMouseGrabberItem = 0;
+ d->lastMouseGrabberItem = nullptr;
}
// Generate a hoverevent
@@ -4362,7 +4362,7 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
pixmapPainter.setWorldTransform(itemToPixmap, true);
// Render.
- _q_paintItem(item, &pixmapPainter, option, 0, false, painterStateProtection);
+ _q_paintItem(item, &pixmapPainter, option, nullptr, false, painterStateProtection);
pixmapPainter.end();
if (!subPix.isNull()) {
@@ -4756,7 +4756,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
return;
QTransform transform(Qt::Uninitialized);
- QTransform *transformPtr = 0;
+ QTransform *transformPtr = nullptr;
bool translateOnlyTransform = false;
#define ENSURE_TRANSFORM_PTR \
if (!transformPtr) { \
@@ -4866,7 +4866,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
item->d_ptr->graphicsEffect->draw(painter);
painter->setWorldTransform(restoreTransform);
- sourced->info = 0;
+ sourced->info = nullptr;
} else
#endif // QT_CONFIG(graphicseffect)
{
@@ -4944,7 +4944,7 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
Q_ASSERT(!(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents));
Q_ASSERT(transformPtr);
item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion
- ? *exposedRegion : QRegion(), exposedRegion == 0);
+ ? *exposedRegion : QRegion(), exposedRegion == nullptr);
const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape;
bool restorePainterClip = false;
@@ -5330,7 +5330,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
if (itemClipsChildrenToShape) {
// Reset updateClip.
for (int i = 0; i < views.size(); ++i)
- views.at(i)->d_func()->setUpdateClip(0);
+ views.at(i)->d_func()->setUpdateClip(nullptr);
}
} else if (wasDirtyParentSceneTransform) {
item->d_ptr->invalidateChildrenSceneTransform();
@@ -5386,7 +5386,7 @@ void QGraphicsScene::drawItems(QPainter *painter,
// Determine view, expose and flags.
QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0;
- QRegion *expose = 0;
+ QRegion *expose = nullptr;
const quint32 oldRectAdjust = d->rectAdjust;
if (view) {
d->updateAll = false;
@@ -5470,7 +5470,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next)
}
// The item must be a widget.
- QGraphicsWidget *widget = 0;
+ QGraphicsWidget *widget = nullptr;
if (!item) {
widget = next ? d->tabFocusFirst : d->tabFocusFirst->d_func()->focusPrev;
} else {
@@ -5486,7 +5486,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next)
// Run around the focus chain until we find a widget that can take tab focus.
do {
if (widget->flags() & QGraphicsItem::ItemIsFocusable
- && widget->isEnabled() && widget->isVisibleTo(0)
+ && widget->isEnabled() && widget->isVisibleTo(nullptr)
&& (widget->focusPolicy() & Qt::TabFocus)
&& (!item || !item->isPanel() || item->isAncestorOf(widget))
) {
@@ -5771,7 +5771,7 @@ void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget)
}
// Activate the widget's panel (all windows are panels).
- QGraphicsItem *panel = widget ? widget->panel() : 0;
+ QGraphicsItem *panel = widget ? widget->panel() : nullptr;
setActivePanel(panel);
// Raise
@@ -5953,7 +5953,7 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
const QTouchEvent::TouchPoint &touchPoint = sceneTouchEvent->touchPoints().at(i);
// update state
- QGraphicsItem *item = 0;
+ QGraphicsItem *item = nullptr;
if (touchPoint.state() == Qt::TouchPointPressed) {
if (sceneTouchEvent->device()->type() == QTouchDevice::TouchPad) {
// on touch-pad devices, send all touch points to the same item
@@ -6111,7 +6111,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
// If nobody could take focus, clear it.
if (!stickyFocus && !setFocus)
- q->setFocusItem(0, Qt::MouseFocusReason);
+ q->setFocusItem(nullptr, Qt::MouseFocusReason);
}
bool res = false;
@@ -6125,7 +6125,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
eventAccepted = touchEvent->isAccepted();
if (itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0) {
// item was deleted
- item = 0;
+ item = nullptr;
} else {
item->d_ptr->acceptedTouchBeginEvent = (res && eventAccepted);
}
@@ -6259,7 +6259,7 @@ void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &ges
if (!gesture->hasHotSpot())
continue;
const Qt::GestureType gestureType = gesture->gestureType();
- QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0);
+ QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, nullptr);
for (int j = 0; j < items.size(); ++j) {
QGraphicsItem *item = items.at(j);
@@ -6331,7 +6331,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
if (!startedGestures.isEmpty()) {
QSet<QGesture *> normalGestures; // that have just one target
QSet<QGesture *> conflictedGestures; // that have multiple possible targets
- gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0,
+ gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, nullptr,
&normalGestures, &conflictedGestures);
cachedTargetItems = cachedItemGestures.keys();
std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
@@ -6505,7 +6505,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
}
gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures,
- &cachedItemGestures, &targetsSet, 0, 0);
+ &cachedItemGestures, &targetsSet, nullptr, nullptr);
cachedTargetItems = targetsSet.values();
std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
@@ -6545,7 +6545,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
{
Q_ASSERT(original);
QGraphicsItem *originalItem = gestureTargets.value(original);
- if (originalItem == 0) // we only act on accepted gestures, which implies it has a target.
+ if (originalItem == nullptr) // we only act on accepted gestures, which implies it has a target.
return;
// iterate over all active gestures and for each find the owner
@@ -6568,13 +6568,13 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
QSet<QGesture *> almostCanceledGestures = canceledGestures;
QSet<QGesture *>::Iterator setIter;
while (!almostCanceledGestures.isEmpty()) {
- QGraphicsObject *target = 0;
+ QGraphicsObject *target = nullptr;
QSet<QGesture*> gestures;
setIter = almostCanceledGestures.begin();
// sort per target item
while (setIter != almostCanceledGestures.end()) {
QGraphicsObject *item = gestureTargets.value(*setIter);
- if (target == 0)
+ if (target == nullptr)
target = item;
if (target == item) {
gestures << *setIter;
@@ -6598,7 +6598,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
if (!g->hasHotSpot())
continue;
- QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0);
+ QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, nullptr);
for (int j = 0; j < items.size(); ++j) {
QGraphicsObject *item = items.at(j)->toGraphicsObject();
if (!item)
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp
index 768dd07d4e..048ea6dc7d 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp
@@ -278,8 +278,8 @@ class QGraphicsSceneEventPrivate
{
public:
inline QGraphicsSceneEventPrivate()
- : widget(0),
- q_ptr(0)
+ : widget(nullptr),
+ q_ptr(nullptr)
{ }
inline virtual ~QGraphicsSceneEventPrivate()
@@ -1290,7 +1290,7 @@ class QGraphicsSceneDragDropEventPrivate : public QGraphicsSceneEventPrivate
Q_DECLARE_PUBLIC(QGraphicsSceneDragDropEvent)
public:
inline QGraphicsSceneDragDropEventPrivate()
- : source(0), mimeData(0)
+ : source(nullptr), mimeData(nullptr)
{ }
QPointF pos;
diff --git a/src/widgets/graphicsview/qgraphicstransform.cpp b/src/widgets/graphicsview/qgraphicstransform.cpp
index 0f0d9aaddc..fa763de05d 100644
--- a/src/widgets/graphicsview/qgraphicstransform.cpp
+++ b/src/widgets/graphicsview/qgraphicstransform.cpp
@@ -112,7 +112,7 @@ void QGraphicsTransformPrivate::setItem(QGraphicsItem *i)
Q_ASSERT(d_ptr->transformData);
d_ptr->transformData->graphicsTransforms.removeAll(q);
d_ptr->dirtySceneTransform = 1;
- item = 0;
+ item = nullptr;
}
item = i;
@@ -138,7 +138,7 @@ QGraphicsTransform::QGraphicsTransform(QObject *parent)
QGraphicsTransform::~QGraphicsTransform()
{
Q_D(QGraphicsTransform);
- d->setItem(0);
+ d->setItem(nullptr);
}
/*!
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 4c270b1af2..7589a1ebbd 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -352,7 +352,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate()
alignment(Qt::AlignCenter),
transformationAnchor(QGraphicsView::AnchorViewCenter), resizeAnchor(QGraphicsView::NoAnchor),
viewportUpdateMode(QGraphicsView::MinimalViewportUpdate),
- scene(0),
+ scene(nullptr),
#if QT_CONFIG(rubberband)
rubberBanding(false),
rubberBandSelectionMode(Qt::IntersectsItemShape),
@@ -362,7 +362,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate()
#ifndef QT_NO_CURSOR
hasStoredOriginalCursor(false),
#endif
- lastDragDropEvent(0),
+ lastDragDropEvent(nullptr),
updateSceneSlotReimplementedChecked(false)
{
styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS);
@@ -384,7 +384,7 @@ void QGraphicsViewPrivate::recalculateContentSize()
int height = maxSize.height();
QRectF viewRect = matrix.mapRect(q->sceneRect());
- bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q));
+ bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q));
if (frameOnlyAround) {
if (hbarpolicy == Qt::ScrollBarAlwaysOn)
height -= frameWidth * 2;
@@ -394,7 +394,7 @@ void QGraphicsViewPrivate::recalculateContentSize()
// Adjust the maximum width and height of the viewport based on the width
// of visible scroll bars.
- int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q);
+ int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, q);
if (frameOnlyAround)
scrollBarExtent += frameWidth * 2;
@@ -1162,7 +1162,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
void QGraphicsViewPrivate::updateInputMethodSensitivity()
{
Q_Q(QGraphicsView);
- QGraphicsItem *focusItem = 0;
+ QGraphicsItem *focusItem = nullptr;
bool enabled = scene && (focusItem = scene->focusItem())
&& (focusItem->d_ptr->flags & QGraphicsItem::ItemAcceptsInputMethod);
q->setAttribute(Qt::WA_InputMethodEnabled, enabled);
@@ -1174,7 +1174,7 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity()
}
QGraphicsProxyWidget *proxy = focusItem->d_ptr->isWidget && focusItem->d_ptr->isProxyWidget()
- ? static_cast<QGraphicsProxyWidget *>(focusItem) : 0;
+ ? static_cast<QGraphicsProxyWidget *>(focusItem) : nullptr;
if (!proxy) {
q->setInputMethodHints(focusItem->inputMethodHints());
} else if (QWidget *widget = proxy->widget()) {
@@ -1192,7 +1192,7 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity()
QGraphicsView::QGraphicsView(QWidget *parent)
: QAbstractScrollArea(*new QGraphicsViewPrivate, parent)
{
- setViewport(0);
+ setViewport(nullptr);
setAcceptDrops(true);
setBackgroundRole(QPalette::Base);
// Investigate leaving these disabled by default.
@@ -1208,7 +1208,7 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent)
: QAbstractScrollArea(*new QGraphicsViewPrivate, parent)
{
setScene(scene);
- setViewport(0);
+ setViewport(nullptr);
setAcceptDrops(true);
setBackgroundRole(QPalette::Base);
// Investigate leaving these disabled by default.
@@ -1222,7 +1222,7 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent)
QGraphicsView::QGraphicsView(QGraphicsViewPrivate &dd, QWidget *parent)
: QAbstractScrollArea(dd, parent)
{
- setViewport(0);
+ setViewport(nullptr);
setAcceptDrops(true);
setBackgroundRole(QPalette::Base);
// Investigate leaving these disabled by default.
@@ -2374,7 +2374,7 @@ QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const
{
Q_D(const QGraphicsView);
if (!d->scene)
- return 0;
+ return nullptr;
const QList<QGraphicsItem *> itemsAtPos = items(pos);
return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first();
}
@@ -2888,7 +2888,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
}
d->useLastMouseEvent = false;
// a hack to pass a viewport pointer to the scene inside the leave event
- Q_ASSERT(event->d == 0);
+ Q_ASSERT(event->d == nullptr);
QScopedValueRollback<QEventPrivate *> rb(event->d);
event->d = reinterpret_cast<QEventPrivate *>(viewport());
QCoreApplication::sendEvent(d->scene, event);
@@ -3019,7 +3019,7 @@ void QGraphicsView::dropEvent(QDropEvent *event)
event->setDropAction(sceneEvent.dropAction());
delete d->lastDragDropEvent;
- d->lastDragDropEvent = 0;
+ d->lastDragDropEvent = nullptr;
}
/*!
@@ -3077,7 +3077,7 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event)
sceneEvent.setWidget(d->lastDragDropEvent->widget());
sceneEvent.setSource(d->lastDragDropEvent->source());
delete d->lastDragDropEvent;
- d->lastDragDropEvent = 0;
+ d->lastDragDropEvent = nullptr;
// Send it to the scene.
QCoreApplication::sendEvent(d->scene, &sceneEvent);
@@ -3525,7 +3525,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
d->scene->d_func()->rectAdjust = 1;
else
d->scene->d_func()->rectAdjust = 2;
- d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : 0,
+ d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : nullptr,
&d->exposedRegion, viewport());
d->scene->d_func()->rectAdjust = oldRectAdjust;
// Make sure the painter's world transform is restored correctly when
@@ -3794,7 +3794,7 @@ void QGraphicsView::drawItems(QPainter *painter, int numItems,
{
Q_D(QGraphicsView);
if (d->scene) {
- QWidget *widget = painter->device() == viewport() ? viewport() : 0;
+ QWidget *widget = painter->device() == viewport() ? viewport() : nullptr;
d->scene->drawItems(painter, numItems, items, options, widget);
}
}
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index cf041b9817..1035ed3575 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -172,7 +172,7 @@ QT_BEGIN_NAMESPACE
window, a tool, a popup, etc).
*/
QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QGraphicsObject(*new QGraphicsWidgetPrivate, 0), QGraphicsLayoutItem(0, false)
+ : QGraphicsObject(*new QGraphicsWidgetPrivate, nullptr), QGraphicsLayoutItem(nullptr, false)
{
Q_D(QGraphicsWidget);
d->init(parent, wFlags);
@@ -184,7 +184,7 @@ QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)
Constructs a new QGraphicsWidget, using \a dd as parent.
*/
QGraphicsWidget::QGraphicsWidget(QGraphicsWidgetPrivate &dd, QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QGraphicsObject(dd, 0), QGraphicsLayoutItem(0, false)
+ : QGraphicsObject(dd, nullptr), QGraphicsLayoutItem(nullptr, false)
{
Q_D(QGraphicsWidget);
d->init(parent, wFlags);
@@ -241,7 +241,7 @@ QGraphicsWidget::~QGraphicsWidget()
if (QGraphicsScene *scn = scene()) {
QGraphicsScenePrivate *sceneD = scn->d_func();
if (sceneD->tabFocusFirst == this)
- sceneD->tabFocusFirst = (d->focusNext == this ? 0 : d->focusNext);
+ sceneD->tabFocusFirst = (d->focusNext == this ? nullptr : d->focusNext);
}
d->focusPrev->d_func()->focusNext = d->focusNext;
d->focusNext->d_func()->focusPrev = d->focusPrev;
@@ -263,15 +263,15 @@ QGraphicsWidget::~QGraphicsWidget()
if (item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
if (widget->parentLayoutItem() == d->layout)
- widget->setParentLayoutItem(0);
+ widget->setParentLayoutItem(nullptr);
}
}
- d->layout = 0;
+ d->layout = nullptr;
delete temp;
}
// Remove this graphics widget from widgetStyles
- widgetStyles()->setStyleForWidget(this, 0);
+ widgetStyles()->setStyleForWidget(this, nullptr);
// Unset the parent here, when we're still a QGraphicsWidget.
// It is otherwise done in ~QGraphicsItem() where we'd be
@@ -942,7 +942,7 @@ QStyle *QGraphicsWidget::style() const
*/
void QGraphicsWidget::setStyle(QStyle *style)
{
- setAttribute(Qt::WA_SetStyle, style != 0);
+ setAttribute(Qt::WA_SetStyle, style != nullptr);
widgetStyles()->setStyleForWidget(this, style);
// Deliver StyleChange to the widget itself (doesn't propagate).
@@ -1557,7 +1557,7 @@ bool QGraphicsWidget::focusNextPrevChild(bool next)
{
Q_D(QGraphicsWidget);
// Let the parent's focusNextPrevChild implementation decide what to do.
- QGraphicsWidget *parent = 0;
+ QGraphicsWidget *parent = nullptr;
if (!isWindow() && (parent = parentWidget()))
return parent->focusNextPrevChild(next);
if (!d->scene)
@@ -1995,7 +1995,7 @@ void QGraphicsWidget::setShortcutAutoRepeat(int id, bool enabled)
*/
void QGraphicsWidget::addAction(QAction *action)
{
- insertAction(0, action);
+ insertAction(nullptr, action);
}
/*!
@@ -2012,7 +2012,7 @@ void QGraphicsWidget::addActions(QList<QAction *> actions)
#endif
{
for (int i = 0; i < actions.count(); ++i)
- insertAction(0, actions.at(i));
+ insertAction(nullptr, actions.at(i));
}
/*!
@@ -2041,7 +2041,7 @@ void QGraphicsWidget::insertAction(QAction *before, QAction *action)
int pos = d->actions.indexOf(before);
if (pos < 0) {
- before = 0;
+ before = nullptr;
pos = d->actions.size();
}
d->actions.insert(pos, action);
@@ -2346,7 +2346,7 @@ void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGrap
frameOptions.palette.setCurrentColorGroup(isActive ? QPalette::Active : QPalette::Normal);
frameOptions.rect = windowFrameRect;
- frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, widget);
+ frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, widget);
frameOptions.midLineWidth = 1;
style()->drawPrimitive(QStyle::PE_FrameWindow, &frameOptions, painter, widget);
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index 0156faf8e4..e6f39d6803 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -322,7 +322,7 @@ void QGraphicsWidgetPrivate::initStyleOptionTitleBar(QStyleOptionTitleBar *optio
option->titleBarState = Qt::WindowNoState;
}
QFont windowTitleFont = QApplication::font("QMdiSubWindowTitleBar");
- QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, 0);
+ QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, nullptr);
option->text = QFontMetrics(windowTitleFont).elidedText(
windowData->windowTitle, Qt::ElideRight, textRect.width());
}
@@ -690,7 +690,7 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent
break;
case Qt::TitleBarArea:
windowData->buttonRect = q->style()->subControlRect(
- QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0);
+ QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, nullptr);
if (windowData->buttonRect.contains(pos.toPoint()))
windowData->buttonMouseOver = true;
event->ignore();
@@ -707,7 +707,7 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent
Q_UNUSED(cursorShape);
#endif
// update buttons if we hover over them
- windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), 0);
+ windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), nullptr);
if (windowData->hoveredSubControl != QStyle::SC_TitleBarCloseButton)
windowData->hoveredSubControl = QStyle::SC_TitleBarLabel;
@@ -781,7 +781,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
if (!parent && oldScene && oldScene != newScene && oldScene->d_func()->tabFocusFirst == q) {
// detach from old scene's top level focus chain.
- oldScene->d_func()->tabFocusFirst = (focusAfter != q) ? focusAfter : 0;
+ oldScene->d_func()->tabFocusFirst = (focusAfter != q) ? focusAfter : nullptr;
}
// detach from current focus chain; skip this widget subtree.
diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp
index e18f1fa4c4..38c2df5fc6 100644
--- a/src/widgets/graphicsview/qsimplex_p.cpp
+++ b/src/widgets/graphicsview/qsimplex_p.cpp
@@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
/*!
\internal
*/
-QSimplex::QSimplex() : objective(0), rows(0), columns(0), firstArtificial(0), matrix(0)
+QSimplex::QSimplex() : objective(nullptr), rows(0), columns(0), firstArtificial(0), matrix(nullptr)
{
}
@@ -93,7 +93,7 @@ QSimplex::~QSimplex()
*/
void QSimplex::clearDataStructures()
{
- if (matrix == 0)
+ if (matrix == nullptr)
return;
// Matrix
@@ -101,7 +101,7 @@ void QSimplex::clearDataStructures()
columns = 0;
firstArtificial = 0;
free(matrix);
- matrix = 0;
+ matrix = nullptr;
// Constraints
for (int i = 0; i < constraints.size(); ++i) {
@@ -113,7 +113,7 @@ void QSimplex::clearDataStructures()
// Other
variables.clear();
- objective = 0;
+ objective = nullptr;
}
/*!
@@ -195,7 +195,7 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints)
QSimplexVariable *artificial;
Q_ASSERT(constraints[i]->helper.first == 0);
- Q_ASSERT(constraints[i]->artificial == 0);
+ Q_ASSERT(constraints[i]->artificial == nullptr);
switch(constraints[i]->ratio) {
case QSimplexConstraint::LessOrEqual:
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index eecc18e5c7..bb47881c03 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -255,7 +255,7 @@ QWidget *QAbstractItemDelegate::createEditor(QWidget *,
const QStyleOptionViewItem &,
const QModelIndex &) const
{
- return 0;
+ return nullptr;
}
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index b1557e9af4..67c01adea7 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -77,13 +77,13 @@ QT_BEGIN_NAMESPACE
QAbstractItemViewPrivate::QAbstractItemViewPrivate()
: model(QAbstractItemModelPrivate::staticEmptyModel()),
- itemDelegate(0),
- selectionModel(0),
+ itemDelegate(nullptr),
+ selectionModel(nullptr),
ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate),
noSelectionOnMousePress(false),
selectionMode(QAbstractItemView::ExtendedSelection),
selectionBehavior(QAbstractItemView::SelectItems),
- currentlyCommittingEditor(0),
+ currentlyCommittingEditor(nullptr),
pressedModifiers(Qt::NoModifier),
pressedPosition(QPoint(-1, -1)),
pressedAlreadySelected(false),
@@ -145,8 +145,8 @@ void QAbstractItemViewPrivate::init()
q->setAttribute(Qt::WA_InputMethodEnabled);
- verticalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0));
- horizontalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0));
+ verticalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, q, nullptr));
+ horizontalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, q, nullptr));
}
void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
@@ -757,7 +757,7 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
QAbstractItemModel *QAbstractItemView::model() const
{
Q_D(const QAbstractItemView);
- return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model);
+ return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? nullptr : d->model);
}
/*!
@@ -915,7 +915,7 @@ QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const
void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *delegate)
{
Q_D(QAbstractItemView);
- if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0)) {
+ if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, nullptr)) {
if (d->delegateRefCount(rowDelegate) == 1) {
disconnect(rowDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
@@ -949,7 +949,7 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de
QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const
{
Q_D(const QAbstractItemView);
- return d->rowDelegates.value(row, 0);
+ return d->rowDelegates.value(row, nullptr);
}
/*!
@@ -975,7 +975,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const
void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate)
{
Q_D(QAbstractItemView);
- if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0)) {
+ if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, nullptr)) {
if (d->delegateRefCount(columnDelegate) == 1) {
disconnect(columnDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
@@ -1009,7 +1009,7 @@ void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelega
QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) const
{
Q_D(const QAbstractItemView);
- return d->columnDelegates.value(column, 0);
+ return d->columnDelegates.value(column, nullptr);
}
/*!
@@ -1084,7 +1084,7 @@ void QAbstractItemView::setCurrentIndex(const QModelIndex &index)
{
Q_D(QAbstractItemView);
if (d->selectionModel && (!index.isValid() || d->isIndexEnabled(index))) {
- QItemSelectionModel::SelectionFlags command = selectionCommand(index, 0);
+ QItemSelectionModel::SelectionFlags command = selectionCommand(index, nullptr);
d->selectionModel->setCurrentIndex(index, command);
d->currentIndexSet = true;
if ((command & QItemSelectionModel::Current) == 0)
@@ -1201,7 +1201,7 @@ void QAbstractItemView::edit(const QModelIndex &index)
Q_D(QAbstractItemView);
if (Q_UNLIKELY(!d->isIndexValid(index)))
qWarning("edit: index was invalid");
- if (Q_UNLIKELY(!edit(index, AllEditTriggers, 0)))
+ if (Q_UNLIKELY(!edit(index, AllEditTriggers, nullptr)))
qWarning("edit: editing failed");
}
@@ -1286,7 +1286,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const
void QAbstractItemView::resetVerticalScrollMode()
{
- auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0));
+ auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, this, nullptr));
setVerticalScrollMode(sm);
d_func()->verticalScrollModeSet = false;
}
@@ -1323,7 +1323,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::horizontalScrollMode() const
void QAbstractItemView::resetHorizontalScrollMode()
{
- auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0));
+ auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, this, nullptr));
setHorizontalScrollMode(sm);
d_func()->horizontalScrollModeSet = false;
}
@@ -1964,7 +1964,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
QPersistentModelIndex persistent = index;
emit doubleClicked(persistent);
if ((event->button() == Qt::LeftButton) && !edit(persistent, DoubleClicked, event)
- && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
+ && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this))
emit activated(persistent);
d->pressedIndex = QModelIndex();
}
@@ -2388,7 +2388,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
setFocus();
QItemSelectionModel::SelectionFlags command = selectionCommand(newCurrent, event);
if (command != QItemSelectionModel::NoUpdate
- || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this)) {
+ || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, nullptr, this)) {
// note that we don't check if the new current index is enabled because moveCursor() makes sure it is
if (command & QItemSelectionModel::Current) {
d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate);
@@ -2654,7 +2654,7 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve
if (!d->isIndexValid(index))
return false;
- if (QWidget *w = (d->persistent.isEmpty() ? static_cast<QWidget*>(0) : d->editorForIndex(index).widget.data())) {
+ if (QWidget *w = (d->persistent.isEmpty() ? static_cast<QWidget*>(nullptr) : d->editorForIndex(index).widget.data())) {
if (w->focusPolicy() == Qt::NoFocus)
return false;
w->setFocus();
@@ -2692,7 +2692,7 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve
if (trigger == SelectedClicked)
d->delayedEditing.start(QApplication::doubleClickInterval(), this);
else
- d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0);
+ d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : nullptr);
return true;
}
@@ -2909,7 +2909,7 @@ void QAbstractItemView::commitData(QWidget *editor)
editor->removeEventFilter(delegate);
delegate->setModelData(editor, d->model, index);
editor->installEventFilter(delegate);
- d->currentlyCommittingEditor = 0;
+ d->currentlyCommittingEditor = nullptr;
}
/*!
@@ -3260,7 +3260,7 @@ QWidget* QAbstractItemView::indexWidget(const QModelIndex &index) const
if (QWidget *editor = d->editorForIndex(index).widget.data())
return editor;
- return 0;
+ return nullptr;
}
/*!
@@ -3673,7 +3673,7 @@ void QAbstractItemView::currentChanged(const QModelIndex &current, const QModelI
if (d->autoScroll)
scrollTo(current);
update(current);
- edit(current, CurrentChanged, 0);
+ edit(current, CurrentChanged, nullptr);
if (current.row() == (d->model->rowCount(d->root) - 1))
d->fetchMore();
} else {
@@ -3737,7 +3737,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const
if (d->iconSize.isValid()) {
option.decorationSize = d->iconSize;
} else {
- int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+ int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
option.decorationSize = QSize(pm, pm);
}
option.decorationPosition = QStyleOptionViewItem::Left;
@@ -3745,7 +3745,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const
option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
option.textElideMode = d->textElideMode;
option.rect = QRect();
- option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, this);
+ option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, this);
if (d->wrapItemText)
option.features = QStyleOptionViewItem::WrapText;
option.locale = locale();
@@ -4231,7 +4231,7 @@ QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index,
if (!w) {
QAbstractItemDelegate *delegate = delegateForIndex(index);
if (!delegate)
- return 0;
+ return nullptr;
w = delegate->createEditor(viewport, options, index);
if (w) {
w->installEventFilter(delegate);
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index a4eed2d885..4d0161025c 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -142,7 +142,7 @@ void QColumnView::setResizeGripsVisible(bool visible)
connect(grip, SIGNAL(gripMoved(int)), this, SLOT(_q_gripMoved(int)));
} else {
QWidget *widget = view->cornerWidget();
- view->setCornerWidget(0);
+ view->setCornerWidget(nullptr);
widget->deleteLater();
}
}
@@ -327,7 +327,7 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
}
#if QT_CONFIG(animation)
- if (const int animationDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, this)) {
+ if (const int animationDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, this)) {
d->currentAnimation.setDuration(animationDuration);
d->currentAnimation.setEndValue(newScrollbarValue);
d->currentAnimation.start();
@@ -638,7 +638,7 @@ void QColumnViewPrivate::_q_clicked(const QModelIndex &index)
{
Q_Q(QColumnView);
QModelIndex parent = index.parent();
- QAbstractItemView *columnClicked = 0;
+ QAbstractItemView *columnClicked = nullptr;
for (int column = 0; column < columns.count(); ++column) {
if (columns.at(column)->rootIndex() == parent) {
columnClicked = columns[column];
@@ -666,7 +666,7 @@ void QColumnViewPrivate::_q_clicked(const QModelIndex &index)
QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bool show)
{
Q_Q(QColumnView);
- QAbstractItemView *view = 0;
+ QAbstractItemView *view = nullptr;
if (model->hasChildren(index)) {
view = q->createColumn(index);
q->connect(view, SIGNAL(clicked(QModelIndex)),
@@ -1045,8 +1045,8 @@ QColumnViewPrivate::QColumnViewPrivate()
: QAbstractItemViewPrivate()
,showResizeGrips(true)
,offset(0)
-,previewWidget(0)
-,previewColumn(0)
+,previewWidget(nullptr)
+,previewColumn(nullptr)
{
}
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 125ee73194..24039c42f6 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -56,7 +56,7 @@ public:
Q_DECLARE_PUBLIC(QDataWidgetMapper)
QDataWidgetMapperPrivate()
- : model(QAbstractItemModelPrivate::staticEmptyModel()), delegate(0),
+ : model(QAbstractItemModelPrivate::staticEmptyModel()), delegate(nullptr),
orientation(Qt::Horizontal), submitPolicy(QDataWidgetMapper::AutoSubmit)
{
}
@@ -226,7 +226,7 @@ void QDataWidgetMapperPrivate::_q_modelDestroyed()
{
Q_Q(QDataWidgetMapper);
- model = 0;
+ model = nullptr;
q->setModel(QAbstractItemModelPrivate::staticEmptyModel());
}
@@ -374,7 +374,7 @@ QAbstractItemModel *QDataWidgetMapper::model() const
{
Q_D(const QDataWidgetMapper);
return d->model == QAbstractItemModelPrivate::staticEmptyModel()
- ? static_cast<QAbstractItemModel *>(0)
+ ? static_cast<QAbstractItemModel *>(nullptr)
: d->model;
}
@@ -567,7 +567,7 @@ QWidget *QDataWidgetMapper::mappedWidgetAt(int section) const
return e.widget;
}
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index c9e7c7b7a6..0d387d7def 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -75,7 +75,7 @@ class QDirModelPrivate : public QAbstractItemModelPrivate
public:
struct QDirNode
{
- QDirNode() : parent(0), populated(false), stat(false) {}
+ QDirNode() : parent(nullptr), populated(false), stat(false) {}
QDirNode *parent;
QFileInfo info;
QIcon icon; // cache the icon
@@ -238,7 +238,7 @@ QDirModel::QDirModel(const QStringList &nameFilters,
d->nameFilters = nameFilters.isEmpty() ? QStringList(QLatin1String("*")) : nameFilters;
d->filters = filters;
d->sort = sort;
- d->root.parent = 0;
+ d->root.parent = nullptr;
d->root.info = QFileInfo();
d->clear(&d->root);
}
@@ -293,7 +293,7 @@ QModelIndex QDirModel::index(int row, int column, const QModelIndex &parent) con
if (row >= p->children.count())
return QModelIndex();
// now get the internal pointer for the index
- QDirModelPrivate::QDirNode *n = d->node(row, d->indexValid(parent) ? p : 0);
+ QDirModelPrivate::QDirNode *n = d->node(row, d->indexValid(parent) ? p : nullptr);
Q_ASSERT(n);
return createIndex(row, column, n);
@@ -310,8 +310,8 @@ QModelIndex QDirModel::parent(const QModelIndex &child) const
if (!d->indexValid(child))
return QModelIndex();
QDirModelPrivate::QDirNode *node = d->node(child);
- QDirModelPrivate::QDirNode *par = (node ? node->parent : 0);
- if (par == 0) // parent is the root node
+ QDirModelPrivate::QDirNode *par = (node ? node->parent : nullptr);
+ if (par == nullptr) // parent is the root node
return QModelIndex();
// get the parent's row
@@ -1159,7 +1159,7 @@ void QDirModelPrivate::init()
filters = QDir::AllEntries | QDir::NoDotAndDotDot;
sort = QDir::Name;
nameFilters << QLatin1String("*");
- root.parent = 0;
+ root.parent = nullptr;
root.info = QFileInfo();
clear(&root);
roleNames.insert(QDirModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration
@@ -1170,7 +1170,7 @@ void QDirModelPrivate::init()
QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) const
{
if (row < 0)
- return 0;
+ return nullptr;
bool isDir = !parent || parent->info.isDir();
QDirNode *p = (parent ? parent : &root);
@@ -1179,7 +1179,7 @@ QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) co
if (Q_UNLIKELY(row >= p->children.count())) {
qWarning("node: the row does not exist");
- return 0;
+ return nullptr;
}
return const_cast<QDirNode*>(&p->children.at(row));
@@ -1190,7 +1190,7 @@ QVector<QDirModelPrivate::QDirNode> QDirModelPrivate::children(QDirNode *parent,
Q_ASSERT(parent);
QFileInfoList infoList;
if (parent == &root) {
- parent = 0;
+ parent = nullptr;
infoList = QDir::drives();
} else if (parent->info.isDir()) {
//resolve directory links only if requested.
@@ -1333,7 +1333,7 @@ void QDirModelPrivate::appendChild(QDirModelPrivate::QDirNode *parent, const QSt
QDirModelPrivate::QDirNode node;
node.populated = false;
node.stat = shouldStat;
- node.parent = (parent == &root ? 0 : parent);
+ node.parent = (parent == &root ? nullptr : parent);
node.info = QFileInfo(path);
node.info.setCaching(true);
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index d7bdf6aa4c..790f305463 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1583,7 +1583,7 @@ int QHeaderView::minimumSectionSize() const
Q_D(const QHeaderView);
if (d->minimumSectionSize == -1) {
QSize strut = QApplication::globalStrut();
- int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this);
+ int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, nullptr, this);
if (d->orientation == Qt::Horizontal)
return qMax(strut.width(), (fontMetrics().maxWidth() + margin));
return qMax(strut.height(), (fontMetrics().height() + margin));
@@ -2883,12 +2883,12 @@ void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logical
opt.text = d->model->headerData(logicalIndex, d->orientation,
Qt::DisplayRole).toString();
- int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this);
+ int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, nullptr, this);
- const Qt::Alignment headerArrowAlignment = static_cast<Qt::Alignment>(style()->styleHint(QStyle::SH_Header_ArrowAlignment, 0, this));
+ const Qt::Alignment headerArrowAlignment = static_cast<Qt::Alignment>(style()->styleHint(QStyle::SH_Header_ArrowAlignment, nullptr, this));
const bool isHeaderArrowOnTheSide = headerArrowAlignment & Qt::AlignVCenter;
if (isSortIndicatorShown() && sortIndicatorSection() == logicalIndex && isHeaderArrowOnTheSide)
- margin += style()->pixelMetric(QStyle::PM_HeaderMarkSize, 0, this);
+ margin += style()->pixelMetric(QStyle::PM_HeaderMarkSize, nullptr, this);
const QVariant variant = d->model->headerData(logicalIndex, d->orientation,
Qt::DecorationRole);
@@ -2896,8 +2896,8 @@ void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logical
if (opt.icon.isNull())
opt.icon = qvariant_cast<QPixmap>(variant);
if (!opt.icon.isNull()) // see CT_HeaderSection
- margin += style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this) +
- style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this);
+ margin += style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this) +
+ style()->pixelMetric(QStyle::PM_HeaderMargin, nullptr, this);
if (d->textElideMode != Qt::ElideNone) {
const QRect textRect = style()->subElementRect(QStyle::SE_HeaderLabel, &opt, this);
@@ -3275,7 +3275,7 @@ int QHeaderViewPrivate::sectionHandleAt(int position)
return -1;
int log = logicalIndex(visual);
int pos = q->sectionViewportPosition(log);
- int grip = q->style()->pixelMetric(QStyle::PM_HeaderGripMargin, 0, q);
+ int grip = q->style()->pixelMetric(QStyle::PM_HeaderGripMargin, nullptr, q);
bool atLeft = position < pos + grip;
bool atRight = (position > pos + q->sectionSize(log) - grip);
@@ -3814,10 +3814,10 @@ void QHeaderViewPrivate::updateDefaultSectionSizeFromStyle()
{
Q_Q(QHeaderView);
if (orientation == Qt::Horizontal) {
- defaultSectionSize = q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, 0, q);
+ defaultSectionSize = q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, nullptr, q);
} else {
defaultSectionSize = qMax(q->minimumSectionSize(),
- q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, 0, q));
+ q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, nullptr, q));
}
}
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index 460764f1b8..daea907963 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -77,7 +77,7 @@ class QItemDelegatePrivate : public QAbstractItemDelegatePrivate
Q_DECLARE_PUBLIC(QItemDelegate)
public:
- QItemDelegatePrivate() : f(0), clipPainting(true) {}
+ QItemDelegatePrivate() : f(nullptr), clipPainting(true) {}
inline const QItemEditorFactory *editorFactory() const
{ return f ? f : QItemEditorFactory::defaultFactory(); }
@@ -149,7 +149,7 @@ QRect QItemDelegatePrivate::textLayoutBounds(const QStyleOptionViewItem &option,
QStyle *style = w ? w->style() : QApplication::style();
const bool wrapText = option.features & QStyleOptionViewItem::WrapText;
// see QItemDelegate::drawDisplay
- const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, w) + 1;
+ const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, w) + 1;
switch (option.decorationPosition) {
case QStyleOptionViewItem::Left:
case QStyleOptionViewItem::Right:
@@ -502,9 +502,9 @@ QWidget *QItemDelegate::createEditor(QWidget *parent,
{
Q_D(const QItemDelegate);
if (!index.isValid())
- return 0;
+ return nullptr;
const QItemEditorFactory *factory = d->f;
- if (factory == 0)
+ if (factory == nullptr)
factory = QItemEditorFactory::defaultFactory();
QWidget *w = factory->createEditor(index.data(Qt::EditRole).userType(), parent);
if (w)
@@ -533,7 +533,7 @@ void QItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) con
if (!n.isEmpty()) {
if (!v.isValid())
- v = QVariant(editor->property(n).userType(), (const void *)0);
+ v = QVariant(editor->property(n).userType(), (const void *)nullptr);
editor->setProperty(n, v);
}
#endif
@@ -586,7 +586,7 @@ void QItemDelegate::updateEditorGeometry(QWidget *editor,
QPixmap pixmap = decoration(option, index.data(Qt::DecorationRole));
QString text = QItemDelegatePrivate::replaceNewLine(index.data(Qt::DisplayRole).toString());
QRect pixmapRect = QRect(QPoint(0, 0), option.decorationSize).intersected(pixmap.rect());
- QRect textRect = textRectangle(0, option.rect, option.font, text);
+ QRect textRect = textRectangle(nullptr, option.rect, option.font, text);
QRect checkRect = doCheck(option, textRect, index.data(Qt::CheckStateRole));
QStyleOptionViewItem opt = option;
opt.showDecorationSelected = true; // let the editor take up all available space
@@ -654,7 +654,7 @@ void QItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &o
const QWidget *widget = d->widget(option);
QStyle *style = widget ? widget->style() : QApplication::style();
- const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1;
+ const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1;
QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding
const bool wrapText = opt.features & QStyleOptionViewItem::WrapText;
d->textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap);
@@ -841,7 +841,7 @@ void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
const bool hasText = textRect->isValid();
const bool hasMargin = (hasText | hasPixmap | hasCheck);
const int frameHMargin = hasMargin ?
- style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1 : 0;
+ style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1 : 0;
const int textMargin = hasText ? frameHMargin : 0;
const int pixmapMargin = hasPixmap ? frameHMargin : 0;
const int checkMargin = hasCheck ? frameHMargin : 0;
@@ -1242,7 +1242,7 @@ QStyleOptionViewItem QItemDelegate::setOptions(const QModelIndex &index,
opt.palette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value));
// disable style animations for checkboxes etc. within itemviews (QTBUG-30146)
- opt.styleObject = 0;
+ opt.styleObject = nullptr;
return opt;
}
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 8ed2ee5f28..f874597d59 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -91,7 +91,7 @@ class QUIntSpinBox : public QSpinBox
Q_OBJECT
Q_PROPERTY(uint value READ uintValue WRITE setUIntValue NOTIFY uintValueChanged USER true)
public:
- explicit QUIntSpinBox(QWidget *parent = 0)
+ explicit QUIntSpinBox(QWidget *parent = nullptr)
: QSpinBox(parent)
{
connect(this, SIGNAL(valueChanged(int)), SIGNAL(uintValueChanged()));
@@ -176,7 +176,7 @@ QWidget *QItemEditorFactory::createEditor(int userType, QWidget *parent) const
QItemEditorCreatorBase *creator = creatorMap.value(userType, 0);
if (!creator) {
const QItemEditorFactory *dfactory = defaultFactory();
- return dfactory == this ? 0 : dfactory->createEditor(userType, parent);
+ return dfactory == this ? nullptr : dfactory->createEditor(userType, parent);
}
return creator->createWidget(parent);
}
@@ -295,8 +295,8 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
default: {
// the default editor is a lineedit
QExpandingLineEdit *le = new QExpandingLineEdit(parent);
- le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le));
- if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, le))
+ le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, nullptr, le));
+ if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, le))
le->setWidgetOwnsGeometry(true);
return le; }
#else
@@ -304,7 +304,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
break;
#endif
}
- return 0;
+ return nullptr;
}
QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
@@ -335,11 +335,11 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
}
}
-static QItemEditorFactory *q_default_factory = 0;
+static QItemEditorFactory *q_default_factory = nullptr;
struct QDefaultFactoryCleaner
{
inline QDefaultFactoryCleaner() {}
- ~QDefaultFactoryCleaner() { delete q_default_factory; q_default_factory = 0; }
+ ~QDefaultFactoryCleaner() { delete q_default_factory; q_default_factory = nullptr; }
};
/*!
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 04cddf2926..de32082b5a 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -933,8 +933,8 @@ QStyleOptionViewItem QListView::viewOptions() const
QStyleOptionViewItem option = QAbstractItemView::viewOptions();
if (!d->iconSize.isValid()) { // otherwise it was already set in abstractitemview
int pm = (d->viewMode == QListView::ListMode
- ? style()->pixelMetric(QStyle::PM_ListViewIconSize, 0, this)
- : style()->pixelMetric(QStyle::PM_IconViewIconSize, 0, this));
+ ? style()->pixelMetric(QStyle::PM_ListViewIconSize, nullptr, this)
+ : style()->pixelMetric(QStyle::PM_IconViewIconSize, nullptr, this));
option.decorationSize = QSize(pm, pm);
}
if (d->viewMode == QListView::IconMode) {
@@ -1688,7 +1688,7 @@ bool QListView::event(QEvent *e)
QListViewPrivate::QListViewPrivate()
: QAbstractItemViewPrivate(),
- commonListView(0),
+ commonListView(nullptr),
wrap(false),
space(0),
flow(QListView::TopToBottom),
@@ -1733,10 +1733,10 @@ void QListViewPrivate::prepareItemsLayout()
// Qt::ScrollBarAlwaysOn but scrollbar extent must be deduced if policy
// is Qt::ScrollBarAsNeeded
int verticalMargin = vbarpolicy==Qt::ScrollBarAsNeeded
- ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, vbar) + frameAroundContents
+ ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, vbar) + frameAroundContents
: 0;
int horizontalMargin = hbarpolicy==Qt::ScrollBarAsNeeded
- ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, hbar) + frameAroundContents
+ ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, hbar) + frameAroundContents
: 0;
layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin);
@@ -3072,7 +3072,7 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info)
moved.resize(items.count());
QRect rect(QPoint(), topLeft);
- QListViewItem *item = 0;
+ QListViewItem *item = nullptr;
for (int row = info.first; row <= info.last; ++row) {
item = &items[row];
if (isHidden(row)) {
@@ -3178,7 +3178,7 @@ QVector<QModelIndex> QIconModeViewBase::intersectingSet(const QRect &area) const
QVector<QModelIndex> res;
that->interSectingVector = &res;
that->tree.climbTree(area, &QIconModeViewBase::addLeaf, data);
- that->interSectingVector = 0;
+ that->interSectingVector = nullptr;
return res;
}
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 1931360dbc..f71e0f2822 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -75,7 +75,7 @@ void QListModel::clear()
for (int i = 0; i < items.count(); ++i) {
if (items.at(i)) {
items.at(i)->d->theid = -1;
- items.at(i)->view = 0;
+ items.at(i)->view = nullptr;
delete items.at(i);
}
}
@@ -96,7 +96,7 @@ void QListModel::remove(QListWidgetItem *item)
Q_ASSERT(row != -1);
beginRemoveRows(QModelIndex(), row, row);
items.at(row)->d->theid = -1;
- items.at(row)->view = 0;
+ items.at(row)->view = nullptr;
items.removeAt(row);
endRemoveRows();
}
@@ -156,11 +156,11 @@ void QListModel::insert(int row, const QStringList &labels)
QListWidgetItem *QListModel::take(int row)
{
if (row < 0 || row >= items.count())
- return 0;
+ return nullptr;
beginRemoveRows(QModelIndex(), row, row);
items.at(row)->d->theid = -1;
- items.at(row)->view = 0;
+ items.at(row)->view = nullptr;
QListWidgetItem *item = items.takeAt(row);
endRemoveRows();
return item;
@@ -263,7 +263,7 @@ bool QListModel::insertRows(int row, int count, const QModelIndex &parent)
beginInsertRows(QModelIndex(), row, row + count - 1);
QListWidget *view = qobject_cast<QListWidget*>(QObject::parent());
- QListWidgetItem *itm = 0;
+ QListWidgetItem *itm = nullptr;
for (int r = row; r < row + count; ++r) {
itm = new QListWidgetItem;
@@ -282,10 +282,10 @@ bool QListModel::removeRows(int row, int count, const QModelIndex &parent)
return false;
beginRemoveRows(QModelIndex(), row, row + count - 1);
- QListWidgetItem *itm = 0;
+ QListWidgetItem *itm = nullptr;
for (int r = row; r < row + count; ++r) {
itm = items.takeAt(row);
- itm->view = 0;
+ itm->view = nullptr;
itm->d->theid = -1;
delete itm;
}
@@ -1220,7 +1220,7 @@ void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
//persistentCurrent is invalid if something changed the model in response
//to the currentItemChanged signal emission and the item was removed
if (!persistentCurrent.isValid()) {
- currentItem = 0;
+ currentItem = nullptr;
}
emit q->currentTextChanged(currentItem ? currentItem->text() : QString());
@@ -1478,7 +1478,7 @@ QListWidgetItem *QListWidget::item(int row) const
{
Q_D(const QListWidget);
if (row < 0 || row >= d->model->rowCount())
- return 0;
+ return nullptr;
return d->listModel()->at(row);
}
@@ -1548,7 +1548,7 @@ QListWidgetItem *QListWidget::takeItem(int row)
{
Q_D(QListWidget);
if (row < 0 || row >= d->model->rowCount())
- return 0;
+ return nullptr;
return d->listModel()->take(row);
}
@@ -2064,7 +2064,7 @@ QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const
Q_D(const QListWidget);
if (d->isIndexValid(index))
return d->listModel()->at(index.row());
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 702e290da3..f42af2ea00 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -83,7 +83,7 @@ class QStyledItemDelegatePrivate : public QAbstractItemDelegatePrivate
Q_DECLARE_PUBLIC(QStyledItemDelegate)
public:
- QStyledItemDelegatePrivate() : factory(0) { }
+ QStyledItemDelegatePrivate() : factory(nullptr) { }
static const QWidget *widget(const QStyleOptionViewItem &option)
{
@@ -351,7 +351,7 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
option->backgroundBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
// disable style animations for checkboxes etc. within itemviews (QTBUG-30146)
- option->styleObject = 0;
+ option->styleObject = nullptr;
}
/*!
@@ -426,7 +426,7 @@ QWidget *QStyledItemDelegate::createEditor(QWidget *parent,
{
Q_D(const QStyledItemDelegate);
if (!index.isValid())
- return 0;
+ return nullptr;
return d->editorFactory()->createEditor(index.data(Qt::EditRole).userType(), parent);
}
@@ -450,7 +450,7 @@ void QStyledItemDelegate::setEditorData(QWidget *editor, const QModelIndex &inde
if (!n.isEmpty()) {
if (!v.isValid())
- v = QVariant(editor->property(n).userType(), (const void *)0);
+ v = QVariant(editor->property(n).userType(), (const void *)nullptr);
editor->setProperty(n, v);
}
#endif
@@ -507,7 +507,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
//or it is in a QTableView
#if QT_CONFIG(tableview) && QT_CONFIG(lineedit)
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
- opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
+ opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, editor);
else
#endif
opt.showDecorationSelected = true;
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 91860341ee..8f37ef4c3d 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
QTableModel::QTableModel(int rows, int columns, QTableWidget *parent)
: QAbstractTableModel(parent),
- prototype(0),
+ prototype(nullptr),
tableItems(rows * columns, 0),
verticalHeaderItems(rows, 0),
horizontalHeaderItems(columns, 0)
@@ -104,18 +104,18 @@ bool QTableModel::removeRows(int row, int count, const QModelIndex &)
beginRemoveRows(QModelIndex(), row, row + count - 1);
int i = tableIndex(row, 0);
int n = count * columnCount();
- QTableWidgetItem *oldItem = 0;
+ QTableWidgetItem *oldItem = nullptr;
for (int j = i; j < n + i; ++j) {
oldItem = tableItems.at(j);
if (oldItem)
- oldItem->view = 0;
+ oldItem->view = nullptr;
delete oldItem;
}
tableItems.remove(qMax(i, 0), n);
for (int v = row; v < row + count; ++v) {
oldItem = verticalHeaderItems.at(v);
if (oldItem)
- oldItem->view = 0;
+ oldItem->view = nullptr;
delete oldItem;
}
verticalHeaderItems.remove(row, count);
@@ -129,13 +129,13 @@ bool QTableModel::removeColumns(int column, int count, const QModelIndex &)
return false;
beginRemoveColumns(QModelIndex(), column, column + count - 1);
- QTableWidgetItem *oldItem = 0;
+ QTableWidgetItem *oldItem = nullptr;
for (int row = rowCount() - 1; row >= 0; --row) {
int i = tableIndex(row, column);
for (int j = i; j < i + count; ++j) {
oldItem = tableItems.at(j);
if (oldItem)
- oldItem->view = 0;
+ oldItem->view = nullptr;
delete oldItem;
}
tableItems.remove(i, count);
@@ -143,7 +143,7 @@ bool QTableModel::removeColumns(int column, int count, const QModelIndex &)
for (int h=column; h<column+count; ++h) {
oldItem = horizontalHeaderItems.at(h);
if (oldItem)
- oldItem->view = 0;
+ oldItem->view = nullptr;
delete oldItem;
}
horizontalHeaderItems.remove(column, count);
@@ -162,7 +162,7 @@ void QTableModel::setItem(int row, int column, QTableWidgetItem *item)
// remove old
if (oldItem)
- oldItem->view = 0;
+ oldItem->view = nullptr;
delete tableItems.at(i);
QTableWidget *view = qobject_cast<QTableWidget*>(QObject::parent());
@@ -180,7 +180,7 @@ void QTableModel::setItem(int row, int column, QTableWidgetItem *item)
if (row < colItems.count())
colItems.remove(row);
int sortedRow;
- if (item == 0) {
+ if (item == nullptr) {
// move to after all non-0 (sortable) items
sortedRow = colItems.count();
} else {
@@ -222,7 +222,7 @@ QTableWidgetItem *QTableModel::takeItem(int row, int column)
long i = tableIndex(row, column);
QTableWidgetItem *itm = tableItems.value(i);
if (itm) {
- itm->view = 0;
+ itm->view = nullptr;
itm->d->id = -1;
tableItems[i] = 0;
const QModelIndex ind = index(row, column);
@@ -239,7 +239,7 @@ QTableWidgetItem *QTableModel::item(int row, int column) const
QTableWidgetItem *QTableModel::item(const QModelIndex &index) const
{
if (!isValid(index))
- return 0;
+ return nullptr;
return tableItems.at(tableIndex(index.row(), index.column()));
}
@@ -277,7 +277,7 @@ void QTableModel::setHorizontalHeaderItem(int section, QTableWidgetItem *item)
return;
if (oldItem)
- oldItem->view = 0;
+ oldItem->view = nullptr;
delete oldItem;
QTableWidget *view = qobject_cast<QTableWidget*>(QObject::parent());
@@ -299,7 +299,7 @@ void QTableModel::setVerticalHeaderItem(int section, QTableWidgetItem *item)
return;
if (oldItem)
- oldItem->view = 0;
+ oldItem->view = nullptr;
delete oldItem;
QTableWidget *view = qobject_cast<QTableWidget*>(QObject::parent());
@@ -315,10 +315,10 @@ void QTableModel::setVerticalHeaderItem(int section, QTableWidgetItem *item)
QTableWidgetItem *QTableModel::takeHorizontalHeaderItem(int section)
{
if (section < 0 || section >= horizontalHeaderItems.count())
- return 0;
+ return nullptr;
QTableWidgetItem *itm = horizontalHeaderItems.at(section);
if (itm) {
- itm->view = 0;
+ itm->view = nullptr;
itm->itemFlags &= ~ItemIsHeaderItem;
horizontalHeaderItems[section] = 0;
}
@@ -328,10 +328,10 @@ QTableWidgetItem *QTableModel::takeHorizontalHeaderItem(int section)
QTableWidgetItem *QTableModel::takeVerticalHeaderItem(int section)
{
if (section < 0 || section >= verticalHeaderItems.count())
- return 0;
+ return nullptr;
QTableWidgetItem *itm = verticalHeaderItems.at(section);
if (itm) {
- itm->view = 0;
+ itm->view = nullptr;
itm->itemFlags &= ~ItemIsHeaderItem;
verticalHeaderItems[section] = 0;
}
@@ -571,7 +571,7 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
sorting.reserve(count);
for (int row = start; row <= end; ++row) {
QTableWidgetItem *itm = item(row, column);
- if (itm == 0) {
+ if (itm == nullptr) {
// no more sortable items (all 0-items are
// at the end of the table when it is sorted)
break;
@@ -649,7 +649,7 @@ QVector<QTableWidgetItem*> QTableModel::columnItems(int column) const
items.reserve(rc);
for (int row = 0; row < rc; ++row) {
QTableWidgetItem *itm = item(row, column);
- if (itm == 0) {
+ if (itm == nullptr) {
// no more sortable items (all 0-items are
// at the end of the table when it is sorted)
break;
@@ -718,7 +718,7 @@ QVariant QTableModel::headerData(int section, Qt::Orientation orientation, int r
if (section < 0)
return QVariant();
- QTableWidgetItem *itm = 0;
+ QTableWidgetItem *itm = nullptr;
if (orientation == Qt::Horizontal && section < horizontalHeaderItems.count())
itm = horizontalHeaderItems.at(section);
else if (orientation == Qt::Vertical && section < verticalHeaderItems.count())
@@ -741,7 +741,7 @@ bool QTableModel::setHeaderData(int section, Qt::Orientation orientation,
(orientation == Qt::Vertical && verticalHeaderItems.size() <= section))
return false;
- QTableWidgetItem *itm = 0;
+ QTableWidgetItem *itm = nullptr;
if (orientation == Qt::Horizontal)
itm = horizontalHeaderItems.at(section);
else
@@ -764,14 +764,14 @@ void QTableModel::clear()
{
for (int j = 0; j < verticalHeaderItems.count(); ++j) {
if (verticalHeaderItems.at(j)) {
- verticalHeaderItems.at(j)->view = 0;
+ verticalHeaderItems.at(j)->view = nullptr;
delete verticalHeaderItems.at(j);
verticalHeaderItems[j] = 0;
}
}
for (int k = 0; k < horizontalHeaderItems.count(); ++k) {
if (horizontalHeaderItems.at(k)) {
- horizontalHeaderItems.at(k)->view = 0;
+ horizontalHeaderItems.at(k)->view = nullptr;
delete horizontalHeaderItems.at(k);
horizontalHeaderItems[k] = 0;
}
@@ -784,7 +784,7 @@ void QTableModel::clearContents()
beginResetModel();
for (int i = 0; i < tableItems.count(); ++i) {
if (tableItems.at(i)) {
- tableItems.at(i)->view = 0;
+ tableItems.at(i)->view = nullptr;
delete tableItems.at(i);
tableItems[i] = 0;
}
@@ -853,7 +853,7 @@ QMimeData *QTableModel::mimeData(const QModelIndexList &indexes) const
// cachedIndexes is a little hack to avoid copying from QModelIndexList to
// QList<QTreeWidgetItem*> and back again in the view
cachedIndexes = indexes;
- QMimeData *mimeData = (view ? view->mimeData(items) : 0);
+ QMimeData *mimeData = (view ? view->mimeData(items) : nullptr);
cachedIndexes.clear();
return mimeData;
}
@@ -2040,7 +2040,7 @@ QTableWidgetItem *QTableWidget::takeItem(int row, int column)
Q_D(QTableWidget);
QTableWidgetItem *item = d->tableModel()->takeItem(row, column);
if (item)
- item->view = 0;
+ item->view = nullptr;
return item;
}
@@ -2076,7 +2076,7 @@ QTableWidgetItem *QTableWidget::takeVerticalHeaderItem(int row)
Q_D(QTableWidget);
QTableWidgetItem *itm = d->tableModel()->takeVerticalHeaderItem(row);
if (itm)
- itm->view = 0;
+ itm->view = nullptr;
return itm;
}
@@ -2115,7 +2115,7 @@ QTableWidgetItem *QTableWidget::takeHorizontalHeaderItem(int column)
Q_D(QTableWidget);
QTableWidgetItem *itm = d->tableModel()->takeHorizontalHeaderItem(column);
if (itm)
- itm->view = 0;
+ itm->view = nullptr;
return itm;
}
@@ -2126,7 +2126,7 @@ void QTableWidget::setVerticalHeaderLabels(const QStringList &labels)
{
Q_D(QTableWidget);
QTableModel *model = d->tableModel();
- QTableWidgetItem *item = 0;
+ QTableWidgetItem *item = nullptr;
for (int i = 0; i < model->rowCount() && i < labels.count(); ++i) {
item = model->verticalHeaderItem(i);
if (!item) {
@@ -2144,7 +2144,7 @@ void QTableWidget::setHorizontalHeaderLabels(const QStringList &labels)
{
Q_D(QTableWidget);
QTableModel *model = d->tableModel();
- QTableWidgetItem *item = 0;
+ QTableWidgetItem *item = nullptr;
for (int i = 0; i < model->columnCount() && i < labels.count(); ++i) {
item = model->horizontalHeaderItem(i);
if (!item) {
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 442369c2ec..9aba17be70 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1517,7 +1517,7 @@ void QTreeView::drawTree(QPainter *painter, const QRegion &region) const
/// ### move to QObject :)
static inline bool ancestorOf(QObject *widget, QObject *other)
{
- for (QObject *parent = other; parent != 0; parent = parent->parent()) {
+ for (QObject *parent = other; parent != nullptr; parent = parent->parent()) {
if (parent == widget)
return true;
}
@@ -1888,7 +1888,7 @@ void QTreeView::mousePressEvent(QMouseEvent *event)
{
Q_D(QTreeView);
bool handled = false;
- if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonPress)
+ if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, this) == QEvent::MouseButtonPress)
handled = d->expandOrCollapseItemAtPos(event->pos());
if (!handled && d->itemDecorationAt(event->pos()) == -1)
QAbstractItemView::mousePressEvent(event);
@@ -1907,7 +1907,7 @@ void QTreeView::mouseReleaseEvent(QMouseEvent *event)
} else {
if (state() == QAbstractItemView::DragSelectingState || state() == QAbstractItemView::DraggingState)
setState(QAbstractItemView::NoState);
- if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonRelease)
+ if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, this) == QEvent::MouseButtonRelease)
d->expandOrCollapseItemAtPos(event->pos());
}
}
@@ -1944,7 +1944,7 @@ void QTreeView::mouseDoubleClickEvent(QMouseEvent *event)
if (edit(persistent, DoubleClicked, event) || state() != NoState)
return; // the double click triggered editing
- if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
+ if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this))
emit activated(persistent);
d->pressedIndex = QModelIndex();
@@ -2208,7 +2208,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
d->collapse(vi, true);
d->moveCursorUpdatedView = true;
} else {
- bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this);
+ bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, nullptr, this);
if (descend) {
QModelIndex par = current.parent();
if (par.isValid() && par != rootIndex())
@@ -2244,7 +2244,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
d->expand(vi, true);
d->moveCursorUpdatedView = true;
} else {
- bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this);
+ bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, nullptr, this);
if (descend) {
QModelIndex idx = d->modelIndex(d->below(vi));
if (idx.parent() == current)
@@ -3051,7 +3051,7 @@ void QTreeViewPrivate::initialize()
header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter);
q->setHeader(header);
#if QT_CONFIG(animation)
- animationsEnabled = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, q) > 0;
+ animationsEnabled = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, q) > 0;
QObject::connect(&animatedOperation, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation()));
#endif // animation
}
@@ -3344,7 +3344,7 @@ void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninit
int hidden = 0;
int last = 0;
int children = 0;
- QTreeViewItem *item = 0;
+ QTreeViewItem *item = nullptr;
for (int j = first; j < first + count; ++j) {
current = model->index(j - first, 0, parent);
if (isRowHidden(current)) {
@@ -3955,7 +3955,7 @@ int QTreeViewPrivate::accessibleTree2Index(const QModelIndex &index) const
void QTreeViewPrivate::updateIndentationFromStyle()
{
Q_Q(const QTreeView);
- indent = q->style()->pixelMetric(QStyle::PM_TreeViewIndentation, 0, q);
+ indent = q->style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr, q);
}
/*!
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index cce0773fec..ddb31523fd 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -144,7 +144,7 @@ QTreeModel::~QTreeModel()
clear();
headerItem->view = nullptr;
delete headerItem;
- rootItem->view = 0;
+ rootItem->view = nullptr;
delete rootItem;
}
@@ -160,8 +160,8 @@ void QTreeModel::clear()
beginResetModel();
for (int i = 0; i < rootItem->childCount(); ++i) {
QTreeWidgetItem *item = rootItem->children.at(i);
- item->par = 0;
- item->view = 0;
+ item->par = nullptr;
+ item->view = nullptr;
delete item;
}
rootItem->children.clear();
@@ -214,7 +214,7 @@ void QTreeModel::setColumnCount(int columns)
QTreeWidgetItem *QTreeModel::item(const QModelIndex &index) const
{
if (!index.isValid())
- return 0;
+ return nullptr;
return static_cast<QTreeWidgetItem*>(index.internalPointer());
}
@@ -515,9 +515,9 @@ bool QTreeModel::removeRows(int row, int count, const QModelIndex &parent) {
for (int i = row + count - 1; i >= row; --i) {
QTreeWidgetItem *child = itm ? itm->takeChild(i) : rootItem->children.takeAt(i);
Q_ASSERT(child);
- child->view = 0;
+ child->view = nullptr;
delete child;
- child = 0;
+ child = nullptr;
}
blocker.unblock();
@@ -1612,11 +1612,11 @@ QTreeWidgetItem::~QTreeWidgetItem()
}
} else if (model) {
if (this == model->headerItem) {
- model->headerItem = 0;
+ model->headerItem = nullptr;
} else {
int i = model->rootItem->children.indexOf(this);
if (i >= 0) {
- model->beginRemoveItems(0, i, 1);
+ model->beginRemoveItems(nullptr, i, 1);
// users _could_ do changes when connected to rowsAboutToBeRemoved,
// so we check again to make sure 'i' is valid
if (!model->rootItem->children.isEmpty() && model->rootItem->children.at(i) == this)
@@ -1630,9 +1630,9 @@ QTreeWidgetItem::~QTreeWidgetItem()
for (int i = 0; i < children.count(); ++i) {
QTreeWidgetItem *child = children.at(i);
// make sure the child does not try to remove itself from our children list
- child->par = 0;
+ child->par = nullptr;
// make sure the child does not try to remove itself from the top level list
- child->view = 0;
+ child->view = nullptr;
delete child;
}
@@ -1648,16 +1648,16 @@ QTreeWidgetItem::~QTreeWidgetItem()
*/
QTreeWidgetItem *QTreeWidgetItem::clone() const
{
- QTreeWidgetItem *copy = 0;
+ QTreeWidgetItem *copy = nullptr;
QStack<const QTreeWidgetItem*> stack;
QStack<QTreeWidgetItem*> parentStack;
stack.push(this);
parentStack.push(0);
- QTreeWidgetItem *root = 0;
- const QTreeWidgetItem *item = 0;
- QTreeWidgetItem *parent = 0;
+ QTreeWidgetItem *root = nullptr;
+ const QTreeWidgetItem *item = nullptr;
+ QTreeWidgetItem *parent = nullptr;
while (!stack.isEmpty()) {
// get current item, and copied parent
item = stack.pop();
@@ -1992,8 +1992,8 @@ void QTreeWidgetItem::write(QDataStream &out) const
\sa data(), flags()
*/
QTreeWidgetItem::QTreeWidgetItem(const QTreeWidgetItem &other)
- : rtti(Type), values(other.values), view(0),
- d(new QTreeWidgetItemPrivate(this)), par(0),
+ : rtti(Type), values(other.values), view(nullptr),
+ d(new QTreeWidgetItemPrivate(this)), par(nullptr),
itemFlags(other.itemFlags)
{
d->display = other.d->display;
@@ -2036,14 +2036,14 @@ void QTreeWidgetItem::addChild(QTreeWidgetItem *child)
*/
void QTreeWidgetItem::insertChild(int index, QTreeWidgetItem *child)
{
- if (index < 0 || index > children.count() || child == 0 || child->view != 0 || child->par != 0)
+ if (index < 0 || index > children.count() || child == nullptr || child->view != nullptr || child->par != nullptr)
return;
if (QTreeModel *model = treeModel()) {
const bool wasSkipSort = model->skipPendingSort;
model->skipPendingSort = true;
if (model->rootItem == this)
- child->par = 0;
+ child->par = nullptr;
else
child->par = this;
if (view->isSortingEnabled()) {
@@ -2103,12 +2103,12 @@ QTreeWidgetItem *QTreeWidgetItem::takeChild(int index)
if (model) model->beginRemoveItems(this, index, 1);
d->updateHiddenStatus(children.at(index), false);
QTreeWidgetItem *item = children.takeAt(index);
- item->par = 0;
+ item->par = nullptr;
QStack<QTreeWidgetItem*> stack;
stack.push(item);
while (!stack.isEmpty()) {
QTreeWidgetItem *i = stack.pop();
- i->view = 0;
+ i->view = nullptr;
for (int c = 0; c < i->children.count(); ++c)
stack.push(i->children.at(c));
}
@@ -2116,7 +2116,7 @@ QTreeWidgetItem *QTreeWidgetItem::takeChild(int index)
if (model) model->endRemoveRows();
return item;
}
- return 0;
+ return nullptr;
}
/*!
@@ -2163,7 +2163,7 @@ void QTreeWidgetItem::insertChildren(int index, const QList<QTreeWidgetItem*> &c
stack.push(child);
}
if (model && (model->rootItem == this))
- child->par = 0;
+ child->par = nullptr;
else
child->par = this;
}
@@ -2206,12 +2206,12 @@ QList<QTreeWidgetItem*> QTreeWidgetItem::takeChildren()
if (model) model->beginRemoveItems(this, 0, children.count());
for (int n = 0; n < children.count(); ++n) {
QTreeWidgetItem *item = children.at(n);
- item->par = 0;
+ item->par = nullptr;
QStack<QTreeWidgetItem*> stack;
stack.push(item);
while (!stack.isEmpty()) {
QTreeWidgetItem *i = stack.pop();
- i->view = 0;
+ i->view = nullptr;
for (int c = 0; c < i->children.count(); ++c)
stack.push(i->children.at(c));
}
@@ -3306,7 +3306,7 @@ QTreeWidgetItem *QTreeWidget::itemAbove(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
if (item == d->treeModel()->headerItem)
- return 0;
+ return nullptr;
const QModelIndex index = d->index(item);
const QModelIndex above = indexAbove(index);
return d->item(above);
@@ -3321,7 +3321,7 @@ QTreeWidgetItem *QTreeWidget::itemBelow(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
if (item == d->treeModel()->headerItem)
- return 0;
+ return nullptr;
const QModelIndex index = d->index(item);
const QModelIndex below = indexBelow(index);
return d->item(below);
@@ -3424,14 +3424,14 @@ QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
for (const auto *item : items) {
if (Q_UNLIKELY(!item)) {
qWarning("QTreeWidget::mimeData: Null-item passed");
- return 0;
+ return nullptr;
}
for (int c = 0; c < item->values.count(); ++c) {
const QModelIndex index = indexFromItem(item, c);
if (Q_UNLIKELY(!index.isValid())) {
qWarning() << "QTreeWidget::mimeData: No index associated with item :" << item;
- return 0;
+ return nullptr;
}
indexes << index;
}
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index 14c19fcb9c..a24106d90e 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -90,7 +90,7 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(const QTreeWidgetItemIterator &
*/
QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFlags flags)
-: current(0), flags(flags)
+: current(nullptr), flags(flags)
{
Q_ASSERT(widget);
QTreeModel *model = qobject_cast<QTreeModel*>(widget->model());
@@ -266,7 +266,7 @@ bool QTreeWidgetItemIterator::matchesFlags(const QTreeWidgetItem *item) const
QTreeWidgetItem* QTreeWidgetItemIteratorPrivate::nextSibling(const QTreeWidgetItem* item) const
{
Q_ASSERT(item);
- QTreeWidgetItem *next = 0;
+ QTreeWidgetItem *next = nullptr;
if (QTreeWidgetItem *par = item->parent()) {
int i = par->indexOfChild(const_cast<QTreeWidgetItem*>(item));
next = par->child(i + 1);
@@ -280,9 +280,9 @@ QTreeWidgetItem* QTreeWidgetItemIteratorPrivate::nextSibling(const QTreeWidgetIt
QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::next(const QTreeWidgetItem *current)
{
- if (!current) return 0;
+ if (!current) return nullptr;
- QTreeWidgetItem *next = 0;
+ QTreeWidgetItem *next = nullptr;
if (current->childCount()) {
// walk the child
m_parentIndex.push(m_currentIndex);
@@ -307,9 +307,9 @@ QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::next(const QTreeWidgetItem *cur
QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::previous(const QTreeWidgetItem *current)
{
- if (!current) return 0;
+ if (!current) return nullptr;
- QTreeWidgetItem *prev = 0;
+ QTreeWidgetItem *prev = nullptr;
// walk the previous sibling
QTreeWidgetItem *parent = current->parent();
prev = parent ? parent->child(m_currentIndex - 1)
@@ -347,7 +347,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem *
// we need to adjust the iterator.
if (nextItem == itemToBeRemoved) {
QTreeWidgetItem *parent = nextItem;
- nextItem = 0;
+ nextItem = nullptr;
while (parent && !nextItem) {
nextItem = nextSibling(parent);
parent = parent->parent();
@@ -358,7 +358,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem *
if (!(q->matchesFlags(nextItem))) ++(*q);
} else {
// set it to null.
- q->current = 0;
+ q->current = nullptr;
m_parentIndex.clear();
return;
}
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 19ad65692b..64b0d69f6d 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -658,7 +658,7 @@ void QAction::setMenu(QMenu *menu)
{
Q_D(QAction);
if (d->menu)
- d->menu->d_func()->setOverrideMenuAction(0); //we reset the default action of any previous menu
+ d->menu->d_func()->setOverrideMenuAction(nullptr); //we reset the default action of any previous menu
d->menu = menu;
if (menu)
menu->d_func()->setOverrideMenuAction(this);
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index 1d9213de0c..5dc12c48a4 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -81,7 +81,7 @@ void QActionGroupPrivate::_q_actionChanged()
current = action;
}
} else if (action == current) {
- current = 0;
+ current = nullptr;
}
}
}
@@ -271,11 +271,11 @@ void QActionGroup::removeAction(QAction *action)
Q_D(QActionGroup);
if (d->actions.removeAll(action)) {
if (action == d->current)
- d->current = 0;
+ d->current = nullptr;
QObject::disconnect(action, SIGNAL(triggered()), this, SLOT(_q_actionTriggered()));
QObject::disconnect(action, SIGNAL(changed()), this, SLOT(_q_actionChanged()));
QObject::disconnect(action, SIGNAL(hovered()), this, SLOT(_q_actionHovered()));
- action->d_func()->group = 0;
+ action->d_func()->group = nullptr;
}
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 6d4baacfef..57771b3e12 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT void qt_call_post_routines();
Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1);
-QApplicationPrivate *QApplicationPrivate::self = 0;
+QApplicationPrivate *QApplicationPrivate::self = nullptr;
static void initSystemPalette()
{
@@ -158,7 +158,7 @@ static void initSystemPalette()
static void clearSystemPalette()
{
delete QApplicationPrivate::sys_pal;
- QApplicationPrivate::sys_pal = 0;
+ QApplicationPrivate::sys_pal = nullptr;
}
bool QApplicationPrivate::autoSipEnabled = true;
@@ -169,8 +169,8 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
application_type = QApplicationPrivate::Gui;
#ifndef QT_NO_GESTURES
- gestureManager = 0;
- gestureWidget = 0;
+ gestureManager = nullptr;
+ gestureWidget = nullptr;
#endif // QT_NO_GESTURES
if (!self)
@@ -180,7 +180,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
QApplicationPrivate::~QApplicationPrivate()
{
if (self == this)
- self = 0;
+ self = nullptr;
}
void QApplicationPrivate::createEventDispatcher()
@@ -357,7 +357,7 @@ QWidget *QApplication::topLevelAt(const QPoint &pos)
if (const QWidgetWindow *widgetWindow = qobject_cast<const QWidgetWindow *>(window))
return widgetWindow->widget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -372,22 +372,22 @@ QWidget *QApplication::topLevelAt(const QPoint &pos)
void qt_init_tooltip_palette();
void qt_cleanup();
-QStyle *QApplicationPrivate::app_style = 0; // default application style
+QStyle *QApplicationPrivate::app_style = nullptr; // default application style
#ifndef QT_NO_STYLE_STYLESHEET
QString QApplicationPrivate::styleSheet; // default application stylesheet
#endif
-QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
+QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = nullptr;
-QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
-QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
+QPalette *QApplicationPrivate::sys_pal = nullptr; // default system palette
+QPalette *QApplicationPrivate::set_pal = nullptr; // default palette set by programmer
-QFont *QApplicationPrivate::sys_font = 0; // default system font
-QFont *QApplicationPrivate::set_font = 0; // default font set by programmer
+QFont *QApplicationPrivate::sys_font = nullptr; // default system font
+QFont *QApplicationPrivate::set_font = nullptr; // default font set by programmer
-QWidget *QApplicationPrivate::main_widget = 0; // main application widget
-QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus
-QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show()
-QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus
+QWidget *QApplicationPrivate::main_widget = nullptr; // main application widget
+QWidget *QApplicationPrivate::focus_widget = nullptr; // has keyboard input focus
+QWidget *QApplicationPrivate::hidden_focus_widget = nullptr; // will get keyboard input focus after show()
+QWidget *QApplicationPrivate::active_window = nullptr; // toplevel with keyboard focus
#if QT_CONFIG(wheelevent)
QPointer<QWidget> QApplicationPrivate::wheel_widget;
#endif
@@ -419,9 +419,9 @@ Q_GLOBAL_STATIC(FontHash, app_fonts)
PaletteHash *qt_app_palettes_hash() { return app_palettes(); }
FontHash *qt_app_fonts_hash() { return app_fonts(); }
-QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus
+QWidgetList *QApplicationPrivate::popupWidgets = nullptr; // has keyboard input focus
-QDesktopWidget *qt_desktopWidget = 0; // root window widgets
+QDesktopWidget *qt_desktopWidget = nullptr; // root window widgets
/*!
\internal
@@ -434,7 +434,7 @@ void QApplicationPrivate::process_cmdline()
if (!styleOverride.isEmpty()) {
if (app_style) {
delete app_style;
- app_style = 0;
+ app_style = nullptr;
}
}
@@ -473,7 +473,7 @@ void QApplicationPrivate::process_cmdline()
}
if(j < argc) {
- argv[j] = 0;
+ argv[j] = nullptr;
argc = j;
}
}
@@ -620,7 +620,7 @@ void QApplicationPrivate::initialize()
static void setPossiblePalette(const QPalette *palette, const char *className)
{
- if (palette == 0)
+ if (palette == nullptr)
return;
QApplicationPrivate::setPalette_helper(*palette, className, false);
}
@@ -746,7 +746,7 @@ QWidget *QApplication::activePopupWidget()
QWidget *QApplication::activeModalWidget()
{
QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(modalWindow());
- return widgetWindow ? widgetWindow->widget() : 0;
+ return widgetWindow ? widgetWindow->widget() : nullptr;
}
/*!
@@ -769,12 +769,12 @@ QApplication::~QApplication()
QApplicationPrivate::is_app_running = false;
delete QWidgetPrivate::mapper;
- QWidgetPrivate::mapper = 0;
+ QWidgetPrivate::mapper = nullptr;
// delete all widgets
if (QWidgetPrivate::allWidgets) {
QWidgetSet *mySet = QWidgetPrivate::allWidgets;
- QWidgetPrivate::allWidgets = 0;
+ QWidgetPrivate::allWidgets = nullptr;
for (QWidgetSet::ConstIterator it = mySet->constBegin(), cend = mySet->constEnd(); it != cend; ++it) {
QWidget *w = *it;
if (!w->parent()) // window
@@ -784,23 +784,23 @@ QApplication::~QApplication()
}
delete qt_desktopWidget;
- qt_desktopWidget = 0;
+ qt_desktopWidget = nullptr;
delete QApplicationPrivate::app_pal;
- QApplicationPrivate::app_pal = 0;
+ QApplicationPrivate::app_pal = nullptr;
clearSystemPalette();
delete QApplicationPrivate::set_pal;
- QApplicationPrivate::set_pal = 0;
+ QApplicationPrivate::set_pal = nullptr;
app_palettes()->clear();
delete QApplicationPrivate::sys_font;
- QApplicationPrivate::sys_font = 0;
+ QApplicationPrivate::sys_font = nullptr;
delete QApplicationPrivate::set_font;
- QApplicationPrivate::set_font = 0;
+ QApplicationPrivate::set_font = nullptr;
app_fonts()->clear();
delete QApplicationPrivate::app_style;
- QApplicationPrivate::app_style = 0;
+ QApplicationPrivate::app_style = nullptr;
#if QT_CONFIG(draganddrop)
if (qt_is_gui_used)
@@ -846,7 +846,7 @@ void qt_cleanup()
QPixmapCache::clear();
QColormap::cleanup();
- QApplicationPrivate::active_window = 0; //### this should not be necessary
+ QApplicationPrivate::active_window = nullptr; //### this should not be necessary
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
if (displayDC) {
@@ -892,7 +892,7 @@ QWidget *QApplication::widgetAt(const QPoint &p)
QRegion newmask = (oldmask.isEmpty() ? QRegion(window->rect()) : oldmask)
- QRegion(wpoint.x(), wpoint.y(), 1, 1);
window->setMask(newmask);
- QWidget *recurse = 0;
+ QWidget *recurse = nullptr;
if (QApplication::topLevelAt(p) != window) // verify recursion will terminate
recurse = widgetAt(x, y);
if (oldmask.isEmpty())
@@ -925,7 +925,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::LanguageChange)) {
for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
const QPostEvent &cur = *it;
- if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type())
+ if (cur.receiver != receiver || cur.event == nullptr || cur.event->type() != event->type())
continue;
if (cur.event->type() == QEvent::LayoutRequest
|| cur.event->type() == QEvent::UpdateRequest) {
@@ -1020,7 +1020,7 @@ QStyle *QApplication::style()
return QApplicationPrivate::app_style;
if (!qobject_cast<QApplication *>(QCoreApplication::instance())) {
Q_ASSERT(!"No style available without QApplication!");
- return 0;
+ return nullptr;
}
if (!QApplicationPrivate::app_style) {
@@ -1048,7 +1048,7 @@ QStyle *QApplication::style()
}
if (!app_style) {
Q_ASSERT(!"No styles available!");
- return 0;
+ return nullptr;
}
}
// take ownership of the style
@@ -1202,7 +1202,7 @@ QStyle* QApplication::setStyle(const QString& style)
{
QStyle *s = QStyleFactory::create(style);
if (!s)
- return 0;
+ return nullptr;
setStyle(s);
return s;
@@ -1695,7 +1695,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
return;
#endif
- hidden_focus_widget = 0;
+ hidden_focus_widget = nullptr;
if (focus != focus_widget) {
if (focus && focus->isHidden()) {
@@ -1893,7 +1893,7 @@ bool QApplication::event(QEvent *e)
#endif
} else if (e->type() == QEvent::Timer) {
QTimerEvent *te = static_cast<QTimerEvent*>(e);
- Q_ASSERT(te != 0);
+ Q_ASSERT(te != nullptr);
if (te->timerId() == d->toolTipWakeUp.timerId()) {
d->toolTipWakeUp.stop();
if (d->toolTipWidget) {
@@ -1905,14 +1905,14 @@ bool QApplication::event(QEvent *e)
while (w && !showToolTip) {
showToolTip = w->isActiveWindow();
w = w->parentWidget();
- w = w ? w->window() : 0;
+ w = w ? w->window() : nullptr;
}
if (showToolTip) {
QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos);
QCoreApplication::sendEvent(d->toolTipWidget, &e);
if (e.isAccepted()) {
QStyle *s = d->toolTipWidget->style();
- int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, 0, d->toolTipWidget, 0);
+ int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, nullptr, d->toolTipWidget, nullptr);
d->toolTipFallAsleep.start(sleepDelay, this);
}
}
@@ -1982,7 +1982,7 @@ void QApplicationPrivate::notifyLayoutDirectionChange()
*/
void QApplication::setActiveWindow(QWidget* act)
{
- QWidget* window = act?act->window():0;
+ QWidget* window = act?act->window():nullptr;
if (QApplicationPrivate::active_window == window)
return;
@@ -1998,7 +1998,7 @@ void QApplication::setActiveWindow(QWidget* act)
QWidgetList toBeDeactivated;
if (QApplicationPrivate::active_window) {
- if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) {
+ if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
const QWidgetList list = topLevelWidgets();
for (auto *w : list) {
if (w->isVisible() && w->isActiveWindow())
@@ -2020,7 +2020,7 @@ void QApplication::setActiveWindow(QWidget* act)
QApplicationPrivate::active_window = window;
if (QApplicationPrivate::active_window) {
- if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) {
+ if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
const QWidgetList list = topLevelWidgets();
for (auto *w : list) {
if (w->isVisible() && w->isActiveWindow())
@@ -2049,10 +2049,10 @@ void QApplication::setActiveWindow(QWidget* act)
sendSpontaneousEvent(w, &activationChange);
}
- if (QApplicationPrivate::popupWidgets == 0) { // !inPopupMode()
+ if (QApplicationPrivate::popupWidgets == nullptr) { // !inPopupMode()
// then focus events
if (!QApplicationPrivate::active_window && QApplicationPrivate::focus_widget) {
- QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);
+ QApplicationPrivate::setFocusWidget(nullptr, Qt::ActiveWindowFocusReason);
} else if (QApplicationPrivate::active_window) {
QWidget *w = QApplicationPrivate::active_window->focusWidget();
if (w && w->isVisible() /*&& w->focusPolicy() != QWidget::NoFocus*/)
@@ -2067,7 +2067,7 @@ void QApplication::setActiveWindow(QWidget* act)
if (!w && QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus)
QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason);
else if (!QApplicationPrivate::active_window->isAncestorOf(w))
- QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);
+ QApplicationPrivate::setFocusWidget(nullptr, Qt::ActiveWindowFocusReason);
}
}
}
@@ -2095,7 +2095,7 @@ QWidget *qt_tlw_for_window(QWindow *wnd)
return tlw;
}
}
- return 0;
+ return nullptr;
}
void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
@@ -2158,7 +2158,7 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
test = test->d_func()->focus_next;
}
- if (wrappingOccurred != 0)
+ if (wrappingOccurred != nullptr)
*wrappingOccurred = next ? focusWidgetAfterWindow : !focusWidgetAfterWindow;
if (w == f) {
@@ -2166,7 +2166,7 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
w->window()->setAttribute(Qt::WA_KeyboardFocusChange);
w->update();
}
- return 0;
+ return nullptr;
}
return w;
}
@@ -2248,7 +2248,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
QEvent leaveEvent(QEvent::Leave);
for (int i = 0; i < leaveList.size(); ++i) {
auto *w = leaveList.at(i);
- if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
+ if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, nullptr)) {
QCoreApplication::sendEvent(w, &leaveEvent);
if (w->testAttribute(Qt::WA_Hover) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
@@ -2267,7 +2267,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
const QPoint windowPos = qAsConst(enterList).back()->window()->mapFromGlobal(globalPos);
for (auto it = enterList.crbegin(), end = enterList.crend(); it != end; ++it) {
auto *w = *it;
- if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
+ if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, nullptr)) {
const QPointF localPos = w->mapFromGlobal(globalPos);
QEnterEvent enterEvent(localPos, windowPos, globalPosF);
QCoreApplication::sendEvent(w, &enterEvent);
@@ -2287,7 +2287,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
const bool enterOnAlien = (enter && (isAlien(enter) || enter->testAttribute(Qt::WA_DontShowOnScreen)));
// Whenever we leave an alien widget on X11/QPA, we need to reset its nativeParentWidget()'s cursor.
// This is not required on Windows as the cursor is reset on every single mouse move.
- QWidget *parentOfLeavingCursor = 0;
+ QWidget *parentOfLeavingCursor = nullptr;
for (int i = 0; i < leaveList.size(); ++i) {
auto *w = leaveList.at(i);
if (!isAlien(w))
@@ -2353,7 +2353,7 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget)
bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const
{
- QWindow *unused = 0;
+ QWindow *unused = nullptr;
if (Q_UNLIKELY(!window)) {
qWarning().nospace() << "window == 0 passed.";
return false;
@@ -2362,13 +2362,13 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
blockingWindow = &unused;
if (modalWindowList.isEmpty()) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
QWidget *popupWidget = QApplication::activePopupWidget();
- QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0;
+ QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : nullptr;
if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -2378,7 +2378,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
// A window is not blocked by another modal window if the two are
// the same, or if the window is a child of the modal window.
if (window == modalWindow || modalWindow->isAncestorOf(window, QWindow::IncludeTransients)) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -2389,7 +2389,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
// modalWindow's widget, this normally happens when waiting for a
// native dialog. use WindowModal if we are the child of a group
// leader; otherwise use ApplicationModal.
- QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0;
+ QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : nullptr;
while (m && !m->testAttribute(Qt::WA_GroupLeader)) {
m = m->parentWidget();
if (m)
@@ -2404,13 +2404,13 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
case Qt::ApplicationModal:
{
QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(window);
- QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : 0;
+ QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : nullptr;
while (groupLeaderForWidget && !groupLeaderForWidget->testAttribute(Qt::WA_GroupLeader))
groupLeaderForWidget = groupLeaderForWidget->parentWidget();
if (groupLeaderForWidget) {
// if \a widget has WA_GroupLeader, it can only be blocked by ApplicationModal children
- QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0;
+ QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : nullptr;
while (m && m != groupLeaderForWidget && !m->testAttribute(Qt::WA_GroupLeader))
m = m->parentWidget();
if (m == groupLeaderForWidget) {
@@ -2450,7 +2450,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
break;
}
}
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -2474,7 +2474,7 @@ bool QApplicationPrivate::tryModalHelper(QWidget *widget, QWidget **rettop)
bool qt_try_modal(QWidget *widget, QEvent::Type type)
{
- QWidget * top = 0;
+ QWidget * top = nullptr;
if (QApplicationPrivate::tryModalHelper(widget, &top))
return true;
@@ -2499,7 +2499,7 @@ bool qt_try_modal(QWidget *widget, QEvent::Type type)
break;
}
- if (block_event && top && top->parentWidget() == 0)
+ if (block_event && top && top->parentWidget() == nullptr)
top->raise();
return !block_event;
@@ -2523,11 +2523,11 @@ QWidget *QApplicationPrivate::pickMouseReceiver(QWidget *candidate, const QPoint
QWidget *mouseGrabber = QWidget::mouseGrabber();
if (((type == QEvent::MouseMove && buttons) || (type == QEvent::MouseButtonRelease))
&& !buttonDown && !mouseGrabber) {
- return 0;
+ return nullptr;
}
if (alienWidget && alienWidget->internalWinId())
- alienWidget = 0;
+ alienWidget = nullptr;
QWidget *receiver = candidate;
@@ -2560,7 +2560,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
Q_ASSERT(buttonDown);
if (alienWidget && !isAlien(alienWidget))
- alienWidget = 0;
+ alienWidget = nullptr;
QPointer<QWidget> receiverGuard = receiver;
QPointer<QWidget> nativeGuard = nativeWidget;
@@ -2575,7 +2575,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
// leaveAfterRelease has not been updated.
// This happens e.g. when modal dialog or popup is shown as a response to button click.
if (leaveAfterRelease && !*buttonDown && !event->buttons())
- leaveAfterRelease = 0;
+ leaveAfterRelease = nullptr;
if (*buttonDown) {
if (!graphicsWidget) {
@@ -2584,7 +2584,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
if ((alienWidget || !receiver->internalWinId()) && !leaveAfterRelease && !QWidget::mouseGrabber())
leaveAfterRelease = *buttonDown;
if (event->type() == QEvent::MouseButtonRelease && !event->buttons())
- *buttonDown = 0;
+ *buttonDown = nullptr;
}
} else if (lastMouseReceiver && widgetUnderMouse) {
// Dispatch enter/leave if we move:
@@ -2612,7 +2612,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
// We need this quard in case someone opens a modal dialog / popup. If that's the case
// leaveAfterRelease is set to null, but we shall not update lastMouseReceiver.
- const bool wasLeaveAfterRelease = leaveAfterRelease != 0;
+ const bool wasLeaveAfterRelease = leaveAfterRelease != nullptr;
bool result = true;
// This code is used for sending the synthetic enter/leave events for cases where it is needed
// due to other events causing the widget under the mouse to change. However in those cases
@@ -2630,18 +2630,18 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
// Dispatch enter/leave if:
// 1) the mouse grabber is an alien widget
// 2) the button is released on an alien widget
- QWidget *enter = 0;
+ QWidget *enter = nullptr;
if (nativeGuard)
enter = alienGuard ? alienWidget : nativeWidget;
else // The receiver is typically deleted on mouse release with drag'n'drop.
enter = QApplication::widgetAt(event->globalPos());
dispatchEnterLeave(enter, leaveAfterRelease, event->screenPos());
- leaveAfterRelease = 0;
+ leaveAfterRelease = nullptr;
lastMouseReceiver = enter;
} else if (!wasLeaveAfterRelease) {
if (activePopupWidget) {
if (!QWidget::mouseGrabber())
- lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : 0);
+ lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : nullptr);
} else {
lastMouseReceiver = receiverGuard ? receiver : QApplication::widgetAt(event->globalPos());
}
@@ -2696,7 +2696,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
return; // Mouse cursor not inside the widget or any of its children.
if (widget->data->in_destructor && qt_button_down == widget)
- qt_button_down = 0;
+ qt_button_down = nullptr;
// A mouse move is not actually sent, but we utilize the sendMouseEvent() call to send the
// enter/leave events as appropriate
@@ -3048,9 +3048,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
key->accept();
else
key->ignore();
- QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0;
+ QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : nullptr;
#if QT_CONFIG(graphicsview)
- QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0;
+ QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : nullptr;
#endif
res = d->notify_helper(receiver, e);
@@ -3112,7 +3112,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
d->toolTipPos = relpos;
d->toolTipGlobalPos = mouse->globalPos();
QStyle *s = d->toolTipWidget->style();
- int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, 0, d->toolTipWidget, 0);
+ int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, nullptr, d->toolTipWidget, nullptr);
d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive() ? 20 : wakeDelay, this);
}
}
@@ -3442,7 +3442,7 @@ QT_WARNING_POP
&& !isProxyWidget
#endif
)
- QDragManager::self()->setCurrentTarget(0, e->type() == QEvent::Drop);
+ QDragManager::self()->setCurrentTarget(nullptr, e->type() == QEvent::Drop);
}
break;
#endif
@@ -3473,7 +3473,7 @@ QT_WARNING_POP
eventAccepted = touchEvent->isAccepted();
if (p.isNull()) {
// widget was deleted
- widget = 0;
+ widget = nullptr;
} else {
widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted);
}
@@ -3698,7 +3698,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
bool QApplicationPrivate::inPopupMode()
{
- return QApplicationPrivate::popupWidgets != 0;
+ return QApplicationPrivate::popupWidgets != nullptr;
}
static void ungrabKeyboardForPopup(QWidget *popup)
@@ -3742,13 +3742,13 @@ void QApplicationPrivate::closePopup(QWidget *popup)
popupWidgets->removeAll(popup);
if (popup == qt_popup_down) {
- qt_button_down = 0;
- qt_popup_down = 0;
+ qt_button_down = nullptr;
+ qt_popup_down = nullptr;
}
if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup
delete QApplicationPrivate::popupWidgets;
- QApplicationPrivate::popupWidgets = 0;
+ QApplicationPrivate::popupWidgets = nullptr;
if (popupGrabOk) {
popupGrabOk = false;
@@ -4116,7 +4116,7 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven
{
const bool setFocusOnRelease = QGuiApplication::styleHints()->setFocusOnTouchRelease();
Qt::FocusPolicy focusPolicy = Qt::ClickFocus;
- static QPointer<QWidget> focusedWidgetOnTouchBegin = 0;
+ static QPointer<QWidget> focusedWidgetOnTouchBegin = nullptr;
switch (event->type()) {
case QEvent::MouseButtonPress:
@@ -4223,7 +4223,7 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device,
{
const QPointF screenPos = touchPoint.screenPos();
int closestTouchPointId = -1;
- QObject *closestTarget = 0;
+ QObject *closestTarget = nullptr;
qreal closestDistance = qreal(0.);
QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(),
ite = activeTouchPoints.constEnd();
@@ -4309,7 +4309,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
if (!target)
continue;
}
- Q_ASSERT(target.data() != 0);
+ Q_ASSERT(target.data() != nullptr);
QWidget *targetWidget = static_cast<QWidget *>(target.data());
@@ -4335,7 +4335,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd();
for (; it != end; ++it) {
const QPointer<QWidget> widget = it.key();
- if (!QApplicationPrivate::tryModalHelper(widget, 0))
+ if (!QApplicationPrivate::tryModalHelper(widget, nullptr))
continue;
QEvent::Type eventType;
@@ -4462,7 +4462,7 @@ QGestureManager* QGestureManager::instance(InstanceCreation ic)
{
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
if (!qAppPriv)
- return 0;
+ return nullptr;
if (!qAppPriv->gestureManager && ic == ForceCreation)
qAppPriv->gestureManager = new QGestureManager(qApp);
return qAppPriv->gestureManager;
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index 78d37f381e..7b09adfbf0 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -278,7 +278,7 @@ void QBoxLayoutPrivate::setupGeom()
int fixedSpacing = q->spacing();
int previousNonEmptyIndex = -1;
- QStyle *style = 0;
+ QStyle *style = nullptr;
if (fixedSpacing < 0) {
if (QWidget *parentWidget = q->parentWidget())
style = parentWidget->style();
@@ -318,7 +318,7 @@ void QBoxLayoutPrivate::setupGeom()
if (style) {
spacing = style->combinedLayoutSpacing(actual1, actual2,
horz(dir) ? Qt::Horizontal : Qt::Vertical,
- 0, q->parentWidget());
+ nullptr, q->parentWidget());
if (spacing < 0)
spacing = 0;
}
@@ -433,10 +433,10 @@ QLayoutItem* QBoxLayoutPrivate::replaceAt(int index, QLayoutItem *item)
{
Q_Q(QBoxLayout);
if (!item)
- return 0;
+ return nullptr;
QBoxLayoutItem *b = list.value(index);
if (!b)
- return 0;
+ return nullptr;
QLayoutItem *r = b->item;
b->item = item;
@@ -551,7 +551,7 @@ QLayoutItem* QBoxLayoutPrivate::replaceAt(int index, QLayoutItem *item)
\sa direction()
*/
QBoxLayout::QBoxLayout(Direction dir, QWidget *parent)
- : QLayout(*new QBoxLayoutPrivate, 0, parent)
+ : QLayout(*new QBoxLayoutPrivate, nullptr, parent)
{
Q_D(QBoxLayout);
d->dir = dir;
@@ -684,7 +684,7 @@ int QBoxLayout::minimumHeightForWidth(int w) const
Q_D(const QBoxLayout);
(void) heightForWidth(w);
int top, bottom;
- d->effectiveMargins(0, &top, 0, &bottom);
+ d->effectiveMargins(nullptr, &top, nullptr, &bottom);
return d->hasHfw ? (d->hfwMinHeight + top + bottom) : -1;
}
@@ -713,7 +713,7 @@ int QBoxLayout::count() const
QLayoutItem *QBoxLayout::itemAt(int index) const
{
Q_D(const QBoxLayout);
- return index >= 0 && index < d->list.count() ? d->list.at(index)->item : 0;
+ return index >= 0 && index < d->list.count() ? d->list.at(index)->item : nullptr;
}
/*!
@@ -723,16 +723,16 @@ QLayoutItem *QBoxLayout::takeAt(int index)
{
Q_D(QBoxLayout);
if (index < 0 || index >= d->list.count())
- return 0;
+ return nullptr;
QBoxLayoutItem *b = d->list.takeAt(index);
QLayoutItem *item = b->item;
- b->item = 0;
+ b->item = nullptr;
delete b;
if (QLayout *l = item->layout()) {
// sanity check in case the user passed something weird to QObject::setParent()
if (l->parent() == this)
- l->setParent(0);
+ l->setParent(nullptr);
}
invalidate();
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 9e90adec46..9f98af86e3 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -205,7 +205,7 @@ QT_WARNING_POP
}
QDesktopWidget::QDesktopWidget()
- : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop)
+ : QWidget(*new QDesktopWidgetPrivate, nullptr, Qt::Desktop)
{
Q_D(QDesktopWidget);
setObjectName(QLatin1String("desktop"));
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index c2838083f3..4ffa226d7f 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -295,11 +295,11 @@ void QFormLayoutPrivate::updateSizes()
bool expandH = false;
bool expandV = false;
- QFormLayoutItem *prevLbl = 0;
- QFormLayoutItem *prevFld = 0;
+ QFormLayoutItem *prevLbl = nullptr;
+ QFormLayoutItem *prevFld = nullptr;
QWidget *parent = q->parentWidget();
- QStyle *style = parent ? parent->style() : 0;
+ QStyle *style = parent ? parent->style() : nullptr;
int userVSpacing = q->verticalSpacing();
int userHSpacing = wrapAllRows ? 0 : q->horizontalSpacing();
@@ -364,9 +364,9 @@ void QFormLayoutPrivate::updateSizes()
QSizePolicy::ControlTypes fldtoptypes =
QSizePolicy::ControlTypes(fldtop ? fldtop->controlTypes() : QSizePolicy::DefaultType);
if (label && lbltop)
- label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent);
+ label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent);
if (field && fldtop)
- field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent);
+ field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent);
} else {
// Side by side.. we have to also consider the spacings to empty cells, which can strangely be more than
// non empty cells..
@@ -380,21 +380,21 @@ void QFormLayoutPrivate::updateSizes()
// To be compatible to QGridLayout, we have to compare solitary labels & fields with both predecessors
if (label) {
if (!field) {
- int lblspacing = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent);
- int fldspacing = style->combinedLayoutSpacing(fldtoptypes, lbltypes, Qt::Vertical, 0, parent);
+ int lblspacing = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent);
+ int fldspacing = style->combinedLayoutSpacing(fldtoptypes, lbltypes, Qt::Vertical, nullptr, parent);
label->vSpace = qMax(lblspacing, fldspacing);
} else
- label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent);
+ label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent);
}
if (field) {
// check spacing against both the previous label and field
if (!label) {
- int lblspacing = style->combinedLayoutSpacing(lbltoptypes, fldtypes, Qt::Vertical, 0, parent);
- int fldspacing = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent);
+ int lblspacing = style->combinedLayoutSpacing(lbltoptypes, fldtypes, Qt::Vertical, nullptr, parent);
+ int fldspacing = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent);
field->vSpace = qMax(lblspacing, fldspacing);
} else
- field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent);
+ field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent);
}
}
}
@@ -403,7 +403,7 @@ void QFormLayoutPrivate::updateSizes()
// hard-coded the left and right control types so that all the rows have the same
// inter-column spacing (otherwise the right column isn't always left aligned)
if (userHSpacing < 0 && !wrapAllRows && (label || !field->fullRow) && field)
- field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, 0, parent);
+ field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, nullptr, parent);
}
// Now update our min/sizehint widths
@@ -594,13 +594,13 @@ static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing
QSizePolicy::ControlTypes(item1 ? item1->controlTypes() : QSizePolicy::DefaultType);
int spacing2 = 0;
- spacing = style->combinedLayoutSpacing(itemtypes, prevItem1->controlTypes(), Qt::Vertical, 0, parent);
+ spacing = style->combinedLayoutSpacing(itemtypes, prevItem1->controlTypes(), Qt::Vertical, nullptr, parent);
// At most of one of item2 and prevItem2 will be nonnull
if (item2)
- spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, 0, parent);
+ spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, nullptr, parent);
else if (prevItem2)
- spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, 0, parent);
+ spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, nullptr, parent);
spacing = qMax(spacing, spacing2);
}
@@ -648,7 +648,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
vLayouts.clear();
vLayouts.resize((2 * rr) + 2); // a max, some may be unused
- QStyle *style = 0;
+ QStyle *style = nullptr;
int userVSpacing = q->verticalSpacing();
@@ -676,8 +676,8 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
maxLabelWidth = width;
}
- QFormLayoutItem *prevItem1 = 0;
- QFormLayoutItem *prevItem2 = 0;
+ QFormLayoutItem *prevItem1 = nullptr;
+ QFormLayoutItem *prevItem2 = nullptr;
bool prevRowSplit = false;
for (int i = 0; i < rr; ++i) {
@@ -711,13 +711,13 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
initLayoutStruct(vLayouts[vidx], label);
if (vidx > 1)
- vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, 0, prevItem1, prevItem2);
+ vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, nullptr, prevItem1, prevItem2);
label->vLayoutIndex = vidx;
label->sideBySide = false;
prevItem1 = label;
- prevItem2 = 0;
+ prevItem2 = nullptr;
if (vLayouts[vidx].stretch > 0)
addTopBottomStretch = false;
@@ -729,13 +729,13 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
initLayoutStruct(vLayouts[vidx], field);
if (vidx > 1)
- vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, 0, prevItem1, prevItem2);
+ vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, nullptr, prevItem1, prevItem2);
field->vLayoutIndex = vidx;
field->sideBySide = false;
prevItem1 = field;
- prevItem2 = 0;
+ prevItem2 = nullptr;
if (vLayouts[vidx].stretch > 0)
addTopBottomStretch = false;
@@ -758,7 +758,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
if (label->expandingDirections() & Qt::Vertical)
expanding = true;
- label->sideBySide = (field != 0);
+ label->sideBySide = (field != nullptr);
label->vLayoutIndex = vidx;
stretch1 = label->vStretch();
}
@@ -790,7 +790,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
prevItem2 = field;
} else {
prevItem1 = field;
- prevItem2 = 0;
+ prevItem2 = nullptr;
}
prevRowSplit = false;
@@ -991,12 +991,12 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
{
Q_Q(QFormLayout);
if (!newitem)
- return 0;
+ return nullptr;
const int storageIndex = storageIndexFromLayoutItem(m_matrix, m_things.value(index));
if (Q_UNLIKELY(storageIndex == -1)) {
// ### Qt6 - fix warning too when this class becomes public
qWarning("QFormLayoutPrivate::replaceAt: Invalid index %d", index);
- return 0;
+ return nullptr;
}
int row, col;
@@ -1192,7 +1192,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
\sa QWidget::setLayout()
*/
QFormLayout::QFormLayout(QWidget *parent)
- : QLayout(*new QFormLayoutPrivate, 0, parent)
+ : QLayout(*new QFormLayoutPrivate, nullptr, parent)
{
}
@@ -1328,7 +1328,7 @@ void QFormLayout::insertRow(int row, const QString &labelText, QWidget *field)
if (field && !d->checkWidget(field))
return;
- QLabel *label = 0;
+ QLabel *label = nullptr;
if (!labelText.isEmpty()) {
label = new QLabel(labelText);
#ifndef QT_NO_SHORTCUT
@@ -1350,7 +1350,7 @@ void QFormLayout::insertRow(int row, const QString &labelText, QLayout *field)
if (field && !d->checkLayout(field))
return;
- insertRow(row, labelText.isEmpty() ? 0 : new QLabel(labelText), field);
+ insertRow(row, labelText.isEmpty() ? nullptr : new QLabel(labelText), field);
}
/*!
@@ -1653,7 +1653,7 @@ QLayoutItem *QFormLayout::itemAt(int index) const
Q_D(const QFormLayout);
if (QFormLayoutItem *formItem = d->m_things.value(index))
return formItem->item;
- return 0;
+ return nullptr;
}
/*!
@@ -1666,7 +1666,7 @@ QLayoutItem *QFormLayout::takeAt(int index)
const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(index));
if (Q_UNLIKELY(storageIndex == -1)) {
qWarning("QFormLayout::takeAt: Invalid index %d", index);
- return 0;
+ return nullptr;
}
int row, col;
@@ -1831,7 +1831,7 @@ QLayoutItem *QFormLayout::itemAt(int row, ItemRole role) const
{
Q_D(const QFormLayout);
if (uint(row) >= uint(d->m_matrix.rowCount()))
- return 0;
+ return nullptr;
switch (role) {
case SpanningRole:
if (QFormLayoutItem *item = d->m_matrix(row, 1))
@@ -1844,7 +1844,7 @@ QLayoutItem *QFormLayout::itemAt(int row, ItemRole role) const
return item->item;
break;
}
- return 0;
+ return nullptr;
}
/*!
@@ -1928,7 +1928,7 @@ QWidget *QFormLayout::labelForField(QWidget *field) const
if (QFormLayoutItem *label = d->m_matrix(row, LabelRole))
return label->widget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -1947,7 +1947,7 @@ QWidget *QFormLayout::labelForField(QLayout *field) const
if (QFormLayoutItem *label = d->m_matrix(row, LabelRole))
return label->widget();
}
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index fc715687c6..84dbed7043 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -879,7 +879,7 @@ int QTapAndHoldGesturePrivate::Timeout = 700; // in ms
Creates new QGestureEvent containing a list of \a gestures.
*/
QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)
- : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(0)
+ : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(nullptr)
{
}
@@ -907,7 +907,7 @@ QGesture *QGestureEvent::gesture(Qt::GestureType type) const
for (int i = 0; i < m_gestures.size(); ++i)
if (m_gestures.at(i)->gestureType() == type)
return m_gestures.at(i);
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index d0c6b882b5..5604391059 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -188,7 +188,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
// from the destructor.
if (object->isWidgetType()) {
if (static_cast<QWidget *>(object)->d_func()->data.in_destructor)
- return 0;
+ return nullptr;
} else if (QGesture *g = qobject_cast<QGesture *>(object)) {
return g;
#if QT_CONFIG(graphicsview)
@@ -196,7 +196,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);
if (graphicsObject->QGraphicsItem::d_func()->inDestructor)
- return 0;
+ return nullptr;
#endif
}
@@ -210,7 +210,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
Q_ASSERT(recognizer);
QGesture *state = recognizer->create(object);
if (!state)
- return 0;
+ return nullptr;
state->setParent(this);
if (state->gestureType() == Qt::CustomGesture) {
// if the recognizer didn't fill in the gesture type, then this
@@ -454,13 +454,13 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original)
// sort them per target widget by cherry picking from almostCanceledGestures and delivering
QSet<QGesture *> almostCanceledGestures = cancelledGestures;
while (!almostCanceledGestures.isEmpty()) {
- QWidget *target = 0;
+ QWidget *target = nullptr;
QSet<QGesture*> gestures;
iter = almostCanceledGestures.begin();
// sort per target widget
while (iter != almostCanceledGestures.end()) {
QWidget *widget = m_gestureTargets.value(*iter);
- if (target == 0)
+ if (target == nullptr)
target = widget;
if (target == widget) {
gestures << *iter;
@@ -508,7 +508,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
}
}
// find all gesture contexts for the widget tree
- w = w->isWindow() ? 0 : w->parentWidget();
+ w = w->isWindow() ? nullptr : w->parentWidget();
while (w)
{
for (ContextIterator it = w->d_func()->gestureContext.constBegin(),
@@ -587,7 +587,7 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
// sort gestures by types
foreach (QGesture *gesture, gestures) {
- QWidget *receiver = m_gestureTargets.value(gesture, 0);
+ QWidget *receiver = m_gestureTargets.value(gesture, nullptr);
Q_ASSERT(receiver);
if (receiver)
gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
@@ -611,7 +611,7 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
}
}
if (w->isWindow()) {
- w = 0;
+ w = nullptr;
break;
}
w = w->parentWidget();
@@ -637,7 +637,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
for (QSet<QGesture *>::const_iterator it = gestures.begin(),
e = gestures.end(); it != e; ++it) {
QGesture *gesture = *it;
- QWidget *target = m_gestureTargets.value(gesture, 0);
+ QWidget *target = m_gestureTargets.value(gesture, nullptr);
if (!target) {
// the gesture has just started and doesn't have a target yet.
Q_ASSERT(gesture->state() == Qt::GestureStarted);
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index 4f2b505e32..b4ac263c2b 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -84,7 +84,7 @@ public:
Qt::Alignment alignment() const { return item_->alignment(); }
QLayoutItem *item() { return item_; }
void setItem(QLayoutItem *newitem) { item_ = newitem; }
- QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = 0; return i; }
+ QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = nullptr; return i; }
int hStretch() { return item_->widget() ?
item_->widget()->sizePolicy().horizontalStretch() : 0; }
@@ -152,7 +152,7 @@ public:
if (index < things.count())
return things.at(index)->item();
else
- return 0;
+ return nullptr;
}
inline QLayoutItem *takeAt(int index) {
Q_Q(QGridLayout);
@@ -162,19 +162,19 @@ public:
if (QLayout *l = item->layout()) {
// sanity check in case the user passed something weird to QObject::setParent()
if (l->parent() == q)
- l->setParent(0);
+ l->setParent(nullptr);
}
delete b;
return item;
}
}
- return 0;
+ return nullptr;
}
QLayoutItem* replaceAt(int index, QLayoutItem *newitem) override
{
if (!newitem)
- return 0;
- QLayoutItem *item = 0;
+ return nullptr;
+ QLayoutItem *item = nullptr;
QGridBox *b = things.value(index);
if (b) {
item = b->takeItem();
@@ -342,7 +342,7 @@ QGridLayoutPrivate::QGridLayoutPrivate()
setDirty();
rr = cc = 0;
nextR = nextC = 0;
- hfwData = 0;
+ hfwData = nullptr;
hReversed = false;
vReversed = false;
horizontalSpacing = -1;
@@ -429,7 +429,7 @@ int QGridLayoutPrivate::minimumHeightForWidth(int w, int hSpacing, int vSpacing)
if (!has_hfw)
return -1;
int top, bottom;
- effectiveMargins(0, &top, 0, &bottom);
+ effectiveMargins(nullptr, &top, nullptr, &bottom);
return hfw_minheight + top + bottom;
}
@@ -521,7 +521,7 @@ void QGridLayoutPrivate::setSize(int r, int c)
if (hfwData && (int)hfwData->size() < r) {
delete hfwData;
- hfwData = 0;
+ hfwData = nullptr;
hfw_width = -1;
}
rr = r;
@@ -710,14 +710,14 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain,
qSwap(numRows, numColumns);
}
- QStyle *style = 0;
+ QStyle *style = nullptr;
if (fixedSpacing < 0) {
if (QWidget *parentWidget = q->parentWidget())
style = parentWidget->style();
}
for (int c = 0; c < numColumns; ++c) {
- QGridBox *previousBox = 0;
+ QGridBox *previousBox = nullptr;
int previousRow = -1; // previous *non-empty* row
for (int r = 0; r < numRows; ++r) {
@@ -741,7 +741,7 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain,
if (style)
spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2,
- orientation, 0, q->parentWidget());
+ orientation, nullptr, q->parentWidget());
} else {
if (orientation == Qt::Vertical) {
QGridBox *sibling = vReversed ? previousBox : box;
@@ -1075,7 +1075,7 @@ QRect QGridLayoutPrivate::cellRect(int row, int col) const
new items are inserted.
*/
QGridLayout::QGridLayout(QWidget *parent)
- : QLayout(*new QGridLayoutPrivate, 0, parent)
+ : QLayout(*new QGridLayoutPrivate, nullptr, parent)
{
Q_D(QGridLayout);
d->expand(1, 1);
@@ -1089,7 +1089,7 @@ QGridLayout::QGridLayout(QWidget *parent)
will not be performed before this is inserted into another layout.
*/
QGridLayout::QGridLayout()
- : QLayout(*new QGridLayoutPrivate, 0, 0)
+ : QLayout(*new QGridLayoutPrivate, nullptr, nullptr)
{
Q_D(QGridLayout);
d->expand(1, 1);
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index f0f4fc5505..d4ff9083f1 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -130,7 +130,7 @@ QLayout::QLayout(QWidget *parent)
management will work.
*/
QLayout::QLayout()
- : QObject(*new QLayoutPrivate, 0)
+ : QObject(*new QLayoutPrivate, nullptr)
{
}
@@ -149,14 +149,14 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w)
" already has a layout",
qUtf16Printable(QObject::objectName()), w->metaObject()->className(),
qUtf16Printable(w->objectName()));
- setParent(0);
+ setParent(nullptr);
} else {
d->topLevel = true;
w->d_func()->layout = this;
QT_TRY {
invalidate();
} QT_CATCH(...) {
- w->d_func()->layout = 0;
+ w->d_func()->layout = nullptr;
QT_RETHROW;
}
}
@@ -166,7 +166,7 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w)
QLayoutPrivate::QLayoutPrivate()
: QObjectPrivate(), insideSpacing(-1), userLeftMargin(-1), userTopMargin(-1), userRightMargin(-1),
userBottomMargin(-1), topLevel(false), enabled(true), activated(true), autoNewChild(false),
- constraint(QLayout::SetDefaultConstraint), menubar(0)
+ constraint(QLayout::SetDefaultConstraint), menubar(nullptr)
{
}
@@ -181,7 +181,7 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric
} else if (!topLevel) {
*result = 0;
} else if (QWidget *pw = q->parentWidget()) {
- *result = pw->style()->pixelMetric(pm, 0, pw);
+ *result = pw->style()->pixelMetric(pm, nullptr, pw);
} else {
*result = 0;
}
@@ -189,8 +189,8 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric
// Static item factory functions that allow for hooking things in Designer
-QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = 0;
-QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = 0;
+QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = nullptr;
+QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = nullptr;
QWidgetItem *QLayoutPrivate::createWidgetItem(const QLayout *layout, QWidget *widget)
{
@@ -624,7 +624,7 @@ void QLayout::widgetEvent(QEvent *e)
if (c->child()->isWidgetType()) {
#if QT_CONFIG(menubar)
if (c->child() == d->menubar)
- d->menubar = 0;
+ d->menubar = nullptr;
#endif
removeWidgetRecursively(this, c->child());
}
@@ -764,7 +764,7 @@ QLayout::~QLayout()
{
Q_D(QLayout);
if (d->topLevel && parent() && parent()->isWidgetType() && parentWidget()->layout() == this)
- parentWidget()->d_func()->layout = 0;
+ parentWidget()->d_func()->layout = nullptr;
else if (QLayout *parentLayout = qobject_cast<QLayout *>(parent()))
parentLayout->removeItem(this);
}
@@ -919,7 +919,7 @@ void QLayout::addChildWidget(QWidget *w)
qWarning("QLayout::addChildWidget: %s \"%ls\" in wrong parent; moved to correct parent",
w->metaObject()->className(), qUtf16Printable(w->objectName()));
#endif
- pw = 0;
+ pw = nullptr;
}
bool needShow = mw && mw->isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide));
if (!pw && mw)
@@ -1153,12 +1153,12 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
{
Q_D(QLayout);
if (!from || !to)
- return 0;
+ return nullptr;
if (from == to) // Do not return a QLayoutItem for \a from, since ownership still
return nullptr; // belongs to the layout (since nothing was changed)
int index = -1;
- QLayoutItem *item = 0;
+ QLayoutItem *item = nullptr;
for (int u = 0; u < count(); ++u) {
item = itemAt(u);
if (!item)
@@ -1176,7 +1176,7 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
}
}
if (index == -1)
- return 0;
+ return nullptr;
addChildWidget(to);
QLayoutItem *newitem = new QWidgetItem(to);
diff --git a/src/widgets/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp
index 92b362e89d..83bbd69b55 100644
--- a/src/widgets/kernel/qlayoutengine.cpp
+++ b/src/widgets/kernel/qlayoutengine.cpp
@@ -440,7 +440,7 @@ Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm
return -1;
} else if (parent->isWidgetType()) {
QWidget *pw = static_cast<QWidget *>(parent);
- return pw->style()->pixelMetric(pm, 0, pw);
+ return pw->style()->pixelMetric(pm, nullptr, pw);
} else {
return static_cast<QLayout *>(parent)->spacing();
}
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index fc02afb014..af5750771d 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -778,7 +778,7 @@ QWidgetItemV2::QWidgetItemV2(QWidget *widget)
q_cachedMaximumSize(Dirty, Dirty),
q_firstCachedHfw(0),
q_hfwCacheSize(0),
- d(0)
+ d(nullptr)
{
QWidgetPrivate *wd = wid->d_func();
if (!wd->widgetItem)
@@ -790,7 +790,7 @@ QWidgetItemV2::~QWidgetItemV2()
if (wid) {
auto *wd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(wid));
if (wd->widgetItem == this)
- wd->widgetItem = 0;
+ wd->widgetItem = nullptr;
}
}
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index bc5ca21b97..90622fd21e 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -555,16 +555,16 @@ class QOpenGLWidgetPrivate : public QWidgetPrivate
Q_DECLARE_PUBLIC(QOpenGLWidget)
public:
QOpenGLWidgetPrivate()
- : context(0),
- fbo(0),
- resolvedFbo(0),
- surface(0),
+ : context(nullptr),
+ fbo(nullptr),
+ resolvedFbo(nullptr),
+ surface(nullptr),
initialized(false),
fakeHidden(false),
inBackingStorePaint(false),
hasBeenComposed(false),
flushPending(false),
- paintDevice(0),
+ paintDevice(nullptr),
updateBehavior(QOpenGLWidget::NoPartialUpdate),
requestedSamples(0),
inPaintGL(false),
@@ -704,11 +704,11 @@ void QOpenGLWidgetPrivate::reset()
q->makeCurrent();
delete paintDevice;
- paintDevice = 0;
+ paintDevice = nullptr;
delete fbo;
- fbo = 0;
+ fbo = nullptr;
delete resolvedFbo;
- resolvedFbo = 0;
+ resolvedFbo = nullptr;
if (initialized)
q->doneCurrent();
@@ -717,9 +717,9 @@ void QOpenGLWidgetPrivate::reset()
// the context's aboutToBeDestroyed() may still call makeCurrent()
// to perform some cleanup.
delete context;
- context = 0;
+ context = nullptr;
delete surface;
- surface = 0;
+ surface = nullptr;
initialized = fakeHidden = inBackingStorePaint = false;
}
@@ -732,9 +732,9 @@ void QOpenGLWidgetPrivate::recreateFbo()
context->makeCurrent(surface);
delete fbo;
- fbo = 0;
+ fbo = nullptr;
delete resolvedFbo;
- resolvedFbo = 0;
+ resolvedFbo = nullptr;
int samples = requestedSamples;
QOpenGLExtensions *extfuncs = static_cast<QOpenGLExtensions *>(context->functions());
@@ -1421,7 +1421,7 @@ QPaintEngine *QOpenGLWidget::paintEngine() const
return QWidget::paintEngine();
if (!d->initialized)
- return 0;
+ return nullptr;
return d->paintDevice->paintEngine();
}
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 0412dc188d..f87fe96cc0 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -61,11 +61,11 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem)
{
Q_Q(QStackedLayout);
if (idx < 0 || idx >= list.size() || !newitem)
- return 0;
+ return nullptr;
QWidget *wdg = newitem->widget();
if (Q_UNLIKELY(!wdg)) {
qWarning("QStackedLayout::replaceAt: Only widgets can be added");
- return 0;
+ return nullptr;
}
QLayoutItem *orgitem = list.at(idx);
list.replace(idx, newitem);
@@ -154,7 +154,7 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem)
\sa addWidget(), insertWidget()
*/
QStackedLayout::QStackedLayout()
- : QLayout(*new QStackedLayoutPrivate, 0, 0)
+ : QLayout(*new QStackedLayoutPrivate, nullptr, nullptr)
{
}
@@ -165,7 +165,7 @@ QStackedLayout::QStackedLayout()
manage the geometry of its children.
*/
QStackedLayout::QStackedLayout(QWidget *parent)
- : QLayout(*new QStackedLayoutPrivate, 0, parent)
+ : QLayout(*new QStackedLayoutPrivate, nullptr, parent)
{
}
@@ -174,7 +174,7 @@ QStackedLayout::QStackedLayout(QWidget *parent)
the given \a parentLayout.
*/
QStackedLayout::QStackedLayout(QLayout *parentLayout)
- : QLayout(*new QStackedLayoutPrivate, parentLayout, 0)
+ : QLayout(*new QStackedLayoutPrivate, parentLayout, nullptr)
{
}
@@ -264,7 +264,7 @@ QLayoutItem *QStackedLayout::takeAt(int index)
{
Q_D(QStackedLayout);
if (index <0 || index >= d->list.size())
- return 0;
+ return nullptr;
QLayoutItem *item = d->list.takeAt(index);
if (index == d->index) {
d->index = -1;
@@ -307,7 +307,7 @@ void QStackedLayout::setCurrentIndex(int index)
parent->setUpdatesEnabled(false);
}
- QPointer<QWidget> fw = parent ? parent->window()->focusWidget() : 0;
+ QPointer<QWidget> fw = parent ? parent->window()->focusWidget() : nullptr;
const bool focusWasOnOldPage = fw && (prev && prev->isAncestorOf(fw));
if (prev) {
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 97a279d65d..b290713440 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -151,7 +151,7 @@ public slots:
*/
void styleSheetParentDestroyed() {
setProperty("_q_stylesheet_parent", QVariant());
- styleSheetParent = 0;
+ styleSheetParent = nullptr;
}
private:
@@ -163,11 +163,11 @@ private:
QRect rect;
};
-QTipLabel *QTipLabel::instance = 0;
+QTipLabel *QTipLabel::instance = nullptr;
QTipLabel::QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int msecDisplayTime)
#ifndef QT_NO_STYLE_STYLESHEET
- : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(0), widget(0)
+ : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(nullptr), widget(nullptr)
#else
: QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0)
#endif
@@ -178,12 +178,12 @@ QTipLabel::QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int mse
setBackgroundRole(QPalette::ToolTipBase);
setPalette(QToolTip::palette());
ensurePolished();
- setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
+ setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, this));
setFrameStyle(QFrame::NoFrame);
setAlignment(Qt::AlignLeft);
setIndent(1);
qApp->installEventFilter(this);
- setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
+ setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, nullptr, this) / 255.0);
setMouseTracking(true);
fadingOut = false;
reuseTip(text, msecDisplayTime, pos);
@@ -204,7 +204,7 @@ void QTipLabel::reuseTip(const QString &text, int msecDisplayTime, const QPoint
if (styleSheetParent){
disconnect(styleSheetParent, SIGNAL(destroyed()),
QTipLabel::instance, SLOT(styleSheetParentDestroyed()));
- styleSheetParent = 0;
+ styleSheetParent = nullptr;
}
#endif
@@ -278,7 +278,7 @@ void QTipLabel::mouseMoveEvent(QMouseEvent *e)
QTipLabel::~QTipLabel()
{
- instance = 0;
+ instance = nullptr;
}
void QTipLabel::hideTip()
@@ -547,7 +547,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w)
*/
bool QToolTip::isVisible()
{
- return (QTipLabel::instance != 0 && QTipLabel::instance->isVisible());
+ return (QTipLabel::instance != nullptr && QTipLabel::instance->isVisible());
}
/*!
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 228ca4d38a..8a632a395a 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -163,7 +163,7 @@ private:
QPixmap background;
};
-QWhatsThat *QWhatsThat::instance = 0;
+QWhatsThat *QWhatsThat::instance = nullptr;
// shadowWidth not const, for XP drop-shadow-fu turns it to 0
static int shadowWidth = 6; // also used as '5' and '6' and even '8' below
@@ -193,7 +193,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
setCursor(Qt::ArrowCursor);
#endif
QRect r;
- doc = 0;
+ doc = nullptr;
ensurePolished(); // Ensures style sheet font before size calc
if (Qt::mightBeRichText(text)) {
doc = new QTextDocument();
@@ -229,7 +229,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
QWhatsThat::~QWhatsThat()
{
- instance = 0;
+ instance = nullptr;
if (doc)
delete doc;
}
@@ -383,7 +383,7 @@ void QWhatsThisPrivate::notifyToplevels(QEvent *e)
QCoreApplication::sendEvent(w, e);
}
-QWhatsThisPrivate *QWhatsThisPrivate::instance = 0;
+QWhatsThisPrivate *QWhatsThisPrivate::instance = nullptr;
QWhatsThisPrivate::QWhatsThisPrivate()
: leaveOnMouseRelease(false)
@@ -423,7 +423,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate()
QAccessibleEvent event(this, QAccessible::ContextHelpEnd);
QAccessible::updateAccessibility(&event);
#endif
- instance = 0;
+ instance = nullptr;
}
bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
@@ -497,7 +497,7 @@ class QWhatsThisAction: public QAction
Q_OBJECT
public:
- explicit QWhatsThisAction(QObject* parent = 0);
+ explicit QWhatsThisAction(QObject* parent = nullptr);
private slots:
void actionTriggered();
@@ -553,7 +553,7 @@ void QWhatsThis::enterWhatsThisMode()
*/
bool QWhatsThis::inWhatsThisMode()
{
- return (QWhatsThisPrivate::instance != 0);
+ return (QWhatsThisPrivate::instance != nullptr);
}
/*!
@@ -577,7 +577,7 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y)
if (text.size() == 0)
return;
// make a fresh widget, and set it up
- QWhatsThat *whatsThat = new QWhatsThat(text, 0, widget);
+ QWhatsThat *whatsThat = new QWhatsThat(text, nullptr, widget);
// okay, now to find a suitable location
int scr = (widget ?
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 9099805cf8..9080c530c7 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -132,16 +132,16 @@ extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
QWidgetPrivate::QWidgetPrivate(int version)
: QObjectPrivate(version)
- , focus_next(0)
- , focus_prev(0)
- , focus_child(0)
- , layout(0)
- , needsFlush(0)
- , redirectDev(0)
- , widgetItem(0)
- , extraPaintEngine(0)
- , polished(0)
- , graphicsEffect(0)
+ , focus_next(nullptr)
+ , focus_prev(nullptr)
+ , focus_child(nullptr)
+ , layout(nullptr)
+ , needsFlush(nullptr)
+ , redirectDev(nullptr)
+ , widgetItem(nullptr)
+ , extraPaintEngine(nullptr)
+ , polished(nullptr)
+ , graphicsEffect(nullptr)
#if !defined(QT_NO_IM)
, imHints(Qt::ImhNone)
#endif
@@ -159,7 +159,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
, topLayoutItemMargin(0)
, rightLayoutItemMargin(0)
, bottomLayoutItemMargin(0)
- , hd(0)
+ , hd(nullptr)
, size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred)
, fg_role(QPalette::NoRole)
, bg_role(QPalette::NoRole)
@@ -214,7 +214,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
QWidgetPrivate::~QWidgetPrivate()
{
if (widgetItem)
- widgetItem->wid = 0;
+ widgetItem->wid = nullptr;
if (extra)
deleteExtra();
@@ -819,8 +819,8 @@ void QWidget::setAutoFillBackground(bool enabled)
*/
-QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
-QWidgetSet *QWidgetPrivate::allWidgets = 0; // widgets with no wid
+QWidgetMapper *QWidgetPrivate::mapper = nullptr; // widget with wid
+QWidgetSet *QWidgetPrivate::allWidgets = nullptr; // widgets with no wid
/*****************************************************************************
@@ -890,7 +890,7 @@ struct QWidgetExceptionCleaner
\sa windowFlags
*/
QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
- : QObject(*new QWidgetPrivate, 0), QPaintDevice()
+ : QObject(*new QWidgetPrivate, nullptr), QPaintDevice()
{
QT_TRY {
d_func()->init(parent, f);
@@ -904,7 +904,7 @@ QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
/*! \internal
*/
QWidget::QWidget(QWidgetPrivate &dd, QWidget* parent, Qt::WindowFlags f)
- : QObject(dd, 0), QPaintDevice()
+ : QObject(dd, nullptr), QPaintDevice()
{
Q_D(QWidget);
QT_TRY {
@@ -996,7 +996,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
if (parentWidget && parentWidget->windowType() == Qt::Desktop) {
const QDesktopScreenWidget *sw = qobject_cast<const QDesktopScreenWidget *>(parentWidget);
targetScreen = sw ? sw->screenNumber() : 0;
- parentWidget = 0;
+ parentWidget = nullptr;
}
q->data = &data;
@@ -1072,7 +1072,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
QCoreApplication::sendEvent(q, &e);
QCoreApplication::postEvent(q, new QEvent(QEvent::PolishRequest));
- extraPaintEngine = 0;
+ extraPaintEngine = nullptr;
}
void QWidgetPrivate::createRecursively()
@@ -1307,9 +1307,9 @@ void QWidgetPrivate::create()
if (nativeParent->windowHandle()) {
if (flags & Qt::Window) {
win->setTransientParent(nativeParent->window()->windowHandle());
- win->setParent(0);
+ win->setParent(nullptr);
} else {
- win->setTransientParent(0);
+ win->setTransientParent(nullptr);
win->setParent(nativeParent->windowHandle());
}
}
@@ -1442,7 +1442,7 @@ QWidget::~QWidget()
// delete layout while we still are a valid widget
delete d->layout;
- d->layout = 0;
+ d->layout = nullptr;
// Remove myself from focus list
Q_ASSERT(d->focus_next->d_func()->focus_prev == this);
@@ -1451,7 +1451,7 @@ QWidget::~QWidget()
if (d->focus_next != this) {
d->focus_next->d_func()->focus_prev = d->focus_prev;
d->focus_prev->d_func()->focus_next = d->focus_next;
- d->focus_next = d->focus_prev = 0;
+ d->focus_next = d->focus_prev = nullptr;
}
@@ -1493,7 +1493,7 @@ QWidget::~QWidget()
}
delete d->needsFlush;
- d->needsFlush = 0;
+ d->needsFlush = nullptr;
// The next 20 lines are duplicated from QObject, but required here
// since QWidget deletes is children itself
@@ -1520,7 +1520,7 @@ QWidget::~QWidget()
if (QAbstractDeclarativeData::destroyed)
QAbstractDeclarativeData::destroyed(d->declarativeData, this);
}
- d->declarativeData = 0; // don't activate again in ~QObject
+ d->declarativeData = nullptr; // don't activate again in ~QObject
d->wasDeleted = false;
}
@@ -1564,7 +1564,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier
// will have the same windowid (the root window id) as the
// qt_desktopWidget. We should not add the second desktop widget
// to the mapper.
- bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
+ bool userDesktopWidget = qt_desktopWidget != nullptr && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
if (mapper && data.winid && !userDesktopWidget) {
mapper->remove(data.winid);
}
@@ -1589,8 +1589,8 @@ void QWidgetPrivate::createTLExtra()
if (!extra->topextra) {
extra->topextra = qt_make_unique<QTLWExtra>();
QTLWExtra* x = extra->topextra.get();
- x->backingStore = 0;
- x->sharedPainter = 0;
+ x->backingStore = nullptr;
+ x->sharedPainter = nullptr;
x->incw = x->inch = 0;
x->basew = x->baseh = 0;
x->frameStrut.setCoords(0, 0, 0, 0);
@@ -1601,7 +1601,7 @@ void QWidgetPrivate::createTLExtra()
x->sizeAdjusted = false;
x->inTopLevelResize = false;
x->embedded = 0;
- x->window = 0;
+ x->window = nullptr;
x->initialScreenIndex = -1;
#ifdef QWIDGET_EXTRA_DEBUG
@@ -1620,9 +1620,9 @@ void QWidgetPrivate::createExtra()
{
if (!extra) { // if not exists
extra = qt_make_unique<QWExtra>();
- extra->glContext = 0;
+ extra->glContext = nullptr;
#if QT_CONFIG(graphicsview)
- extra->proxyWidget = 0;
+ extra->proxyWidget = nullptr;
#endif
extra->minw = 0;
extra->minh = 0;
@@ -1681,7 +1681,7 @@ static void deleteBackingStore(QWidgetPrivate *d)
QTLWExtra *topData = d->topData();
delete topData->backingStore;
- topData->backingStore = 0;
+ topData->backingStore = nullptr;
}
void QWidgetPrivate::deleteTLSysExtra()
@@ -1705,7 +1705,7 @@ void QWidgetPrivate::deleteTLSysExtra()
extra->topextra->window->destroy();
}
delete extra->topextra->window;
- extra->topextra->window = 0;
+ extra->topextra->window = nullptr;
}
}
@@ -1805,7 +1805,7 @@ void QWidgetPrivate::paintOnScreen(const QRegion &rgn)
if (toBePainted.isEmpty())
return; // Nothing to repaint.
- drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0);
+ drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, nullptr);
if (Q_UNLIKELY(q->paintingActive()))
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
@@ -2302,10 +2302,10 @@ void QWidgetPrivate::deactivateWidgetCleanup()
Q_Q(QWidget);
// If this was the active application window, reset it
if (QApplication::activeWindow() == q)
- QApplication::setActiveWindow(0);
+ QApplication::setActiveWindow(nullptr);
// If the is the active mouse press widget, reset it
if (q == qt_button_down)
- qt_button_down = 0;
+ qt_button_down = nullptr;
}
@@ -2563,7 +2563,7 @@ void QWidget::setStyleSheet(const QString& styleSheet)
if (testAttribute(Qt::WA_SetStyle)) {
d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true);
} else {
- d->setStyle_helper(new QStyleSheetStyle(0), true);
+ d->setStyle_helper(new QStyleSheetStyle(nullptr), true);
}
}
@@ -2606,7 +2606,7 @@ QStyle *QWidget::style() const
void QWidget::setStyle(QStyle *style)
{
Q_D(QWidget);
- setAttribute(Qt::WA_SetStyle, style != 0);
+ setAttribute(Qt::WA_SetStyle, style != nullptr);
d->createExtra();
#ifndef QT_NO_STYLE_STYLESHEET
if (QStyleSheetStyle *styleSheetStyle = qt_styleSheet(style)) {
@@ -2686,7 +2686,7 @@ void QWidgetPrivate::inheritStyle()
QStyle *origStyle = proxy ? proxy->base : extraStyle;
QWidget *parent = q->parentWidget();
- QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : 0;
+ QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : nullptr;
// If we have stylesheet on app or parent has stylesheet style, we need
// to be running a proxy
if (!qApp->styleSheet().isEmpty() || qt_styleSheet(parentStyle)) {
@@ -2709,7 +2709,7 @@ void QWidgetPrivate::inheritStyle()
// In such a case we need to start following the application style (i.e revert
// the propagation behavior of QStyleSheetStyle)
if (!q->testAttribute(Qt::WA_SetStyle))
- origStyle = 0;
+ origStyle = nullptr;
setStyle_helper(origStyle, true);
#endif // QT_NO_STYLE_STYLESHEET
@@ -3085,7 +3085,7 @@ bool QWidget::isEnabledTo(const QWidget *ancestor) const
*/
void QWidget::addAction(QAction *action)
{
- insertAction(0, action);
+ insertAction(nullptr, action);
}
/*!
@@ -3100,7 +3100,7 @@ void QWidget::addActions(QList<QAction*> actions)
#endif
{
for(int i = 0; i < actions.count(); i++)
- insertAction(0, actions.at(i));
+ insertAction(nullptr, actions.at(i));
}
/*!
@@ -3125,7 +3125,7 @@ void QWidget::insertAction(QAction *before, QAction *action)
int pos = d->actions.indexOf(before);
if (pos < 0) {
- before = 0;
+ before = nullptr;
pos = d->actions.size();
}
d->actions.insert(pos, action);
@@ -4606,7 +4606,7 @@ void QWidgetPrivate::updateFont(const QFont &font)
Q_Q(QWidget);
#ifndef QT_NO_STYLE_STYLESHEET
const QStyleSheetStyle* cssStyle;
- cssStyle = extra ? qt_styleSheet(extra->style) : 0;
+ cssStyle = extra ? qt_styleSheet(extra->style) : nullptr;
const bool useStyleSheetPropagationInWidgetStyles =
QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);
#endif
@@ -4842,7 +4842,7 @@ void qt_qpa_set_cursor(QWidget *w, bool force)
if (!w->testAttribute(Qt::WA_WState_Created))
return;
- static QPointer<QWidget> lastUnderMouse = 0;
+ static QPointer<QWidget> lastUnderMouse = nullptr;
if (force) {
lastUnderMouse = w;
} else if (lastUnderMouse) {
@@ -5119,7 +5119,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
if (d->graphicsEffect) {
d->invalidateBackingStore(rect());
delete d->graphicsEffect;
- d->graphicsEffect = 0;
+ d->graphicsEffect = nullptr;
}
if (effect) {
@@ -5313,7 +5313,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
setSystemClip(sharedPainter->paintEngine(), 1, QRegion());
sharedPainter->restore();
}
- sourced->context = 0;
+ sourced->context = nullptr;
if (repaintManager)
repaintManager->markNeedsFlush(q, rgn, offset);
@@ -5431,7 +5431,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (!sharedPainter)
paintEngine->d_func()->systemRect = QRect();
else
- paintEngine->d_func()->currentClipDevice = 0;
+ paintEngine->d_func()->currentClipDevice = nullptr;
setSystemClip(pdev->paintEngine(), 1, QRegion());
}
@@ -5492,7 +5492,7 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,
if (paintRegion.isEmpty())
return;
- QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0;
+ QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : nullptr;
// Use the target's shared painter if set (typically set when doing
// "other->render(widget);" in the widget's paintEvent.
@@ -5553,7 +5553,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
const QPoint &offset, DrawWidgetFlags flags
, QPainter *sharedPainter, QWidgetRepaintManager *repaintManager)
{
- QWidget *w = 0;
+ QWidget *w = nullptr;
QRect boundingRect;
bool dirtyBoundingRect = true;
const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);
@@ -5847,7 +5847,7 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg
if (count%2) { // odd number of [*] -> replace last one
int lastIndex = cap.lastIndexOf(placeHolder, index - 1);
if (widget->isWindowModified()
- && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget))
+ && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, nullptr, widget))
cap.replace(lastIndex, 3, QWidget::tr("*"));
else
cap.remove(lastIndex, 3);
@@ -6299,7 +6299,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
return;
#if QT_CONFIG(graphicsview)
- QWidget *previousProxyFocus = 0;
+ QWidget *previousProxyFocus = nullptr;
if (const auto &topData = window()->d_func()->extra) {
if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {
previousProxyFocus = topData->proxyWidget->widget()->focusWidget();
@@ -6439,12 +6439,12 @@ void QWidgetPrivate::updateFocusChild()
if (q->isHidden()) {
while (w && w->isHidden()) {
w->d_func()->focus_child = q;
- w = w->isWindow() ? 0 : w->parentWidget();
+ w = w->isWindow() ? nullptr : w->parentWidget();
}
} else {
while (w) {
w->d_func()->focus_child = q;
- w = w->isWindow() ? 0 : w->parentWidget();
+ w = w->isWindow() ? nullptr : w->parentWidget();
}
}
@@ -6490,7 +6490,7 @@ void QWidget::clearFocus()
while (w) {
// Just like setFocus(), we update (clear) the focus_child of our parents
if (w->d_func()->focus_child == this)
- w->d_func()->focus_child = 0;
+ w->d_func()->focus_child = nullptr;
w = w->parentWidget();
}
@@ -6511,7 +6511,7 @@ void QWidget::clearFocus()
if (hasFocus()) {
// Update proxy state
- QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
+ QApplicationPrivate::setFocusWidget(nullptr, Qt::OtherFocusReason);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(this, QAccessible::Focus);
QAccessible::updateAccessibility(&event);
@@ -6588,10 +6588,10 @@ bool QWidget::focusNextPrevChild(bool next)
*/
if (wrappingOccurred) {
QWindow *window = windowHandle();
- if (window != 0) {
+ if (window != nullptr) {
QWindowPrivate *winp = qt_window_private(window);
- if (winp->platformWindow != 0) {
+ if (winp->platformWindow != nullptr) {
QFocusEvent event(QEvent::FocusIn, reason);
event.ignore();
winp->platformWindow->windowEvent(&event);
@@ -6669,7 +6669,7 @@ bool QWidget::isActiveWindow() const
}
#endif
- if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) {
+ if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, this)) {
if(tlw->windowType() == Qt::Tool &&
!tlw->isModal() &&
(!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow()))
@@ -6825,9 +6825,9 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw)
focus_child->clearFocus();
// separate the focus chain into new (children of myself) and old (the rest)
- QWidget *firstOld = 0;
+ QWidget *firstOld = nullptr;
//QWidget *firstNew = q; //invariant
- QWidget *o = 0; // last in the old list
+ QWidget *o = nullptr; // last in the old list
QWidget *n = q; // last in the new list
bool prevWasNew = true;
@@ -7835,7 +7835,7 @@ void QWidgetPrivate::show_helper()
#endif
if (QApplicationPrivate::hidden_focus_widget == q) {
- QApplicationPrivate::hidden_focus_widget = 0;
+ QApplicationPrivate::hidden_focus_widget = nullptr;
q->setFocus(Qt::OtherFocusReason);
}
@@ -7934,7 +7934,7 @@ void QWidgetPrivate::hide_helper()
bool isEmbedded = false;
#if QT_CONFIG(graphicsview)
- isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0;
+ isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != nullptr;
#else
Q_UNUSED(isEmbedded);
#endif
@@ -8127,7 +8127,7 @@ void QWidgetPrivate::setVisible(bool visible)
QCoreApplication::sendEvent(q, &showToParentEvent);
} else { // hide
if (QApplicationPrivate::hidden_focus_widget == q)
- QApplicationPrivate::hidden_focus_widget = 0;
+ QApplicationPrivate::hidden_focus_widget = nullptr;
// hw: The test on getOpaqueRegion() needs to be more intelligent
// currently it doesn't work if the widget is hidden (the region will
@@ -8820,7 +8820,7 @@ bool QWidget::event(QEvent *event)
case Qt::ActionsContextMenu:
if (d->actions.count()) {
QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
- 0, this);
+ nullptr, this);
break;
}
Q_FALLTHROUGH();
@@ -10012,9 +10012,9 @@ QLayout *QWidget::takeLayout()
Q_D(QWidget);
QLayout *l = layout();
if (!l)
- return 0;
- d->layout = 0;
- l->setParent(0);
+ return nullptr;
+ d->layout = nullptr;
+ l->setParent(nullptr);
return l;
}
@@ -10136,10 +10136,10 @@ QWidget *QWidget::childAt(const QPoint &p) const
QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const
{
if (children.isEmpty())
- return 0;
+ return nullptr;
if (!pointInsideRectAndMask(p))
- return 0;
+ return nullptr;
return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
}
@@ -10167,7 +10167,7 @@ QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChil
// We have found our target; namely the child at position 'p'.
return child;
}
- return 0;
+ return nullptr;
}
void QWidgetPrivate::updateGeometry_helper(bool forceUpdate)
@@ -10380,7 +10380,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
if (f & Qt::Window) // Frame geometry likely changes, refresh.
d->data.fstrut_dirty = true;
- QWidget *desktopWidget = 0;
+ QWidget *desktopWidget = nullptr;
if (parent && parent->windowType() == Qt::Desktop)
desktopWidget = parent;
bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
@@ -10408,7 +10408,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
d->setParent_sys(parent, f);
if (desktopWidget)
- parent = 0;
+ parent = nullptr;
#ifndef QT_NO_OPENGL
if (d->textureChildSeen && parent) {
@@ -10522,7 +10522,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
// programmer specified desktop widget
const QDesktopScreenWidget *sw = qobject_cast<const QDesktopScreenWidget *>(newparent);
targetScreen = sw ? sw->screenNumber() : 0;
- newparent = 0;
+ newparent = nullptr;
}
setWinId(0);
@@ -10532,19 +10532,19 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
if (q->windowHandle()) {
q->windowHandle()->setFlags(f);
QWidget *parentWithWindow =
- newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0;
+ newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : nullptr;
if (parentWithWindow) {
QWidget *topLevel = parentWithWindow->window();
if ((f & Qt::Window) && topLevel && topLevel->windowHandle()) {
q->windowHandle()->setTransientParent(topLevel->windowHandle());
- q->windowHandle()->setParent(0);
+ q->windowHandle()->setParent(nullptr);
} else {
- q->windowHandle()->setTransientParent(0);
+ q->windowHandle()->setTransientParent(nullptr);
q->windowHandle()->setParent(parentWithWindow->windowHandle());
}
} else {
- q->windowHandle()->setTransientParent(0);
- q->windowHandle()->setParent(0);
+ q->windowHandle()->setTransientParent(nullptr);
+ q->windowHandle()->setParent(nullptr);
}
}
}
@@ -10575,7 +10575,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
continue;
QWidgetWindow *childWW = qobject_cast<QWidgetWindow *>(childWindow);
- QWidget *childWidget = childWW ? childWW->widget() : 0;
+ QWidget *childWidget = childWW ? childWW->widget() : nullptr;
if (!childWW || (childWidget && childWidget->testAttribute(Qt::WA_NativeWindow)))
childWindow->setParent(newParentWindow);
}
@@ -11981,7 +11981,7 @@ QOpenGLContext *QWidgetPrivate::shareContext() const
return 0;
#else
if (!extra || !extra->topextra || !extra->topextra->window)
- return 0;
+ return nullptr;
if (!extra->topextra->shareContext) {
auto ctx = qt_make_unique<QOpenGLContext>();
@@ -12040,7 +12040,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const
if (d->extra) {
return d->extra->proxyWidget;
}
- return 0;
+ return nullptr;
}
#endif
@@ -12101,7 +12101,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
qApp->d_func()->closePopup(this);
if (this == QApplicationPrivate::active_window)
- QApplication::setActiveWindow(0);
+ QApplication::setActiveWindow(nullptr);
if (QWidget::mouseGrabber() == this)
releaseMouse();
if (QWidget::keyboardGrabber() == this)
@@ -12165,7 +12165,7 @@ QPaintEngine *QWidget::paintEngine() const
const_cast<QWidgetPrivate *>(d_func())->noPaintOnScreen = 1;
#endif
- return 0; //##### @@@
+ return nullptr; //##### @@@
}
// Do not call QWindow::mapToGlobal() until QPlatformWindow is properly showing.
@@ -12252,10 +12252,10 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
return t.transform.inverted().map(windowLocal);
}
-QWidget *qt_pressGrab = 0;
-QWidget *qt_mouseGrb = 0;
+QWidget *qt_pressGrab = nullptr;
+QWidget *qt_mouseGrb = nullptr;
static bool mouseGrabWithCursor = false;
-static QWidget *keyboardGrb = 0;
+static QWidget *keyboardGrb = nullptr;
static inline QWindow *grabberWindow(const QWidget *w)
{
@@ -12267,7 +12267,7 @@ static inline QWindow *grabberWindow(const QWidget *w)
}
#ifndef QT_NO_CURSOR
-static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = 0)
+static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = nullptr)
#else
static void grabMouseForWidget(QWidget *widget)
#endif
@@ -12287,7 +12287,7 @@ static void grabMouseForWidget(QWidget *widget)
}
qt_mouseGrb = widget;
- qt_pressGrab = 0;
+ qt_pressGrab = nullptr;
}
static void releaseMouseGrabOfWidget(QWidget *widget)
@@ -12303,7 +12303,7 @@ static void releaseMouseGrabOfWidget(QWidget *widget)
window->setMouseGrabEnabled(false);
}
}
- qt_mouseGrb = 0;
+ qt_mouseGrb = nullptr;
}
/*!
@@ -12432,7 +12432,7 @@ void QWidget::releaseKeyboard()
if (keyboardGrb == this) {
if (QWindow *window = grabberWindow(this))
window->setKeyboardGrabEnabled(false);
- keyboardGrb = 0;
+ keyboardGrb = nullptr;
}
}
@@ -12509,8 +12509,8 @@ void QWidget::activateWindow()
*/
int QWidget::metric(PaintDeviceMetric m) const
{
- QWindow *topLevelWindow = 0;
- QScreen *screen = 0;
+ QWindow *topLevelWindow = nullptr;
+ QScreen *screen = nullptr;
if (QWidget *topLevel = window()) {
topLevelWindow = topLevel->windowHandle();
if (topLevelWindow)
@@ -12596,14 +12596,14 @@ QPainter *QWidget::sharedPainter() const
{
// Someone sent a paint event directly to the widget
if (!d_func()->redirectDev)
- return 0;
+ return nullptr;
QPainter *sp = d_func()->sharedPainter();
if (!sp || !sp->isActive())
- return 0;
+ return nullptr;
if (sp->paintEngine()->paintDevice() != d_func()->redirectDev)
- return 0;
+ return nullptr;
return sp;
}
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 62da3fabf4..6915782cb3 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -420,7 +420,7 @@ public:
void setVisible(bool);
void setEnabled_helper(bool);
- static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0);
+ static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = nullptr);
void updateFrameStrut();
QRect frameStrut() const;
diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp
index 6eebaca42c..9649e51b92 100644
--- a/src/widgets/kernel/qwidgetaction.cpp
+++ b/src/widgets/kernel/qwidgetaction.cpp
@@ -146,7 +146,7 @@ void QWidgetAction::setDefaultWidget(QWidget *widget)
setVisible(!(widget->isHidden() && widget->testAttribute(Qt::WA_WState_ExplicitShowHide)));
d->defaultWidget->hide();
- d->defaultWidget->setParent(0);
+ d->defaultWidget->setParent(nullptr);
d->defaultWidgetInUse = false;
if (!isEnabled())
d->defaultWidget->setEnabled(false);
@@ -177,7 +177,7 @@ QWidget *QWidgetAction::requestWidget(QWidget *parent)
QWidget *w = createWidget(parent);
if (!w) {
if (d->defaultWidgetInUse || !d->defaultWidget)
- return 0;
+ return nullptr;
d->defaultWidget->setParent(parent);
d->defaultWidgetInUse = true;
return d->defaultWidget;
@@ -203,7 +203,7 @@ void QWidgetAction::releaseWidget(QWidget *widget)
if (widget == d->defaultWidget) {
d->defaultWidget->hide();
- d->defaultWidget->setParent(0);
+ d->defaultWidget->setParent(nullptr);
d->defaultWidgetInUse = false;
return;
}
@@ -251,7 +251,7 @@ bool QWidgetAction::eventFilter(QObject *obj, QEvent *event)
QWidget *QWidgetAction::createWidget(QWidget *parent)
{
Q_UNUSED(parent)
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp
index c3211e275f..135a1527ac 100644
--- a/src/widgets/kernel/qwidgetrepaintmanager.cpp
+++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp
@@ -695,7 +695,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
return qt_dummy_platformTextureList();
}
- return 0;
+ return nullptr;
}
#else
@@ -788,7 +788,7 @@ bool QWidgetRepaintManager::syncAllowed()
QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
if (textureListWatcher && !textureListWatcher->isLocked()) {
textureListWatcher->deleteLater();
- textureListWatcher = 0;
+ textureListWatcher = nullptr;
} else if (!tlwExtra->widgetTextures.empty()) {
bool skipSync = false;
for (const auto &tl : tlwExtra->widgetTextures) {
@@ -822,7 +822,7 @@ void QWidgetRepaintManager::paintAndFlush()
if (hasStaticContents() && !store->size().isEmpty() ) {
// Repaint existing dirty area and newly visible area.
const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
- const QRegion staticRegion(staticContents(0, clipRect));
+ const QRegion staticRegion(staticContents(nullptr, clipRect));
QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
newVisible -= staticRegion;
dirty += newVisible;
@@ -1008,13 +1008,13 @@ void QWidgetRepaintManager::paintAndFlush()
QPoint offset;
if (w != tlw)
offset += w->mapTo(tlw, QPoint());
- wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, 0, this);
+ wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, nullptr, this);
}
// Paint the rest with composition.
if (repaintAllWidgets || !dirtyCopy.isEmpty()) {
QWidgetPrivate::DrawWidgetFlags flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive;
- tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, 0, this);
+ tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, nullptr, this);
}
store->endPaint();
@@ -1108,7 +1108,7 @@ void QWidgetRepaintManager::flush()
for (QWidget *w : qExchange(needsFlushWidgets, {})) {
QWidgetPrivate *wd = w->d_func();
Q_ASSERT(wd->needsFlush);
- QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : 0;
+ QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : nullptr;
flush(w, *wd->needsFlush, widgetTexturesForNative);
*wd->needsFlush = QRegion();
}
@@ -1284,7 +1284,7 @@ QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &with
wd->clipToEffectiveMask(visible);
if (visible.isEmpty())
continue;
- wd->subtractOpaqueSiblings(visible, 0, /*alsoNonOpaque=*/true);
+ wd->subtractOpaqueSiblings(visible, nullptr, /*alsoNonOpaque=*/true);
visible.translate(offset);
region += visible;
@@ -1331,7 +1331,7 @@ void QWidgetPrivate::invalidateBackingStore_resizeHelper(const QPoint &oldPos, c
if (!staticContents || graphicsEffect) {
QRegion staticChildren;
- QWidgetRepaintManager *bs = 0;
+ QWidgetRepaintManager *bs = nullptr;
if (offset.isNull() && (bs = maybeRepaintManager()))
staticChildren = bs->staticContents(q, oldWidgetRect);
const bool hasStaticChildren = !staticChildren.isEmpty();
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index 02b4ea20a7..41600d2143 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -125,12 +125,12 @@ static const QVariant::Handler widgets_handler = {
clear,
isNull,
#ifndef QT_NO_DATASTREAM
- 0,
- 0,
+ nullptr,
+ nullptr,
#endif
compare,
convert,
- 0,
+ nullptr,
#if !defined(QT_NO_DEBUG_STREAM)
streamDebug
#else
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 596343c52f..904067afda 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -57,10 +57,10 @@ QT_BEGIN_NAMESPACE
Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets();
-Q_WIDGETS_EXPORT QWidget *qt_button_down = 0; // widget got last button-down
+Q_WIDGETS_EXPORT QWidget *qt_button_down = nullptr; // widget got last button-down
// popup control
-QWidget *qt_popup_down = 0; // popup that contains the pressed widget
+QWidget *qt_popup_down = nullptr; // popup that contains the pressed widget
extern int openPopupCount;
bool qt_replay_popup_mouse_event = false;
extern bool qt_try_modal(QWidget *widget, QEvent::Type type);
@@ -156,7 +156,7 @@ QOpenGLContext *QWidgetWindowPrivate::shareContext() const
#endif // opengl
QWidgetWindow::QWidgetWindow(QWidget *widget)
- : QWindow(*new QWidgetWindowPrivate(), 0)
+ : QWindow(*new QWidgetWindowPrivate(), nullptr)
, m_widget(widget)
{
updateObjectName();
@@ -179,7 +179,7 @@ QAccessibleInterface *QWidgetWindow::accessibleRoot() const
{
if (m_widget)
return QAccessible::queryAccessibleInterface(m_widget);
- return 0;
+ return nullptr;
}
#endif
@@ -374,7 +374,7 @@ bool QWidgetWindow::event(QEvent *event)
#endif // QT_NO_CONTEXTMENU
case QEvent::WindowBlocked:
- qt_button_down = 0;
+ qt_button_down = nullptr;
break;
case QEvent::UpdateRequest:
@@ -393,7 +393,7 @@ bool QWidgetWindow::event(QEvent *event)
return QWindow::event(event);
}
-QPointer<QWidget> qt_last_mouse_receiver = 0;
+QPointer<QWidget> qt_last_mouse_receiver = nullptr;
void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
{
@@ -406,7 +406,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
return;
#endif
if (event->type() == QEvent::Leave) {
- QWidget *enter = 0;
+ QWidget *enter = nullptr;
// Check from window system event queue if the next queued enter targets a window
// in the same window hierarchy (e.g. enter a child of this window). If so,
// remove the enter event from queue and handle both in single dispatch.
@@ -484,13 +484,13 @@ QWidget *QWidgetWindow::getFocusWidget(FocusWidgets fw)
void QWidgetWindow::handleFocusInEvent(QFocusEvent *e)
{
- QWidget *focusWidget = 0;
+ QWidget *focusWidget = nullptr;
if (e->reason() == Qt::BacktabFocusReason)
focusWidget = getFocusWidget(LastFocusWidget);
else if (e->reason() == Qt::TabFocusReason)
focusWidget = getFocusWidget(FirstFocusWidget);
- if (focusWidget != 0)
+ if (focusWidget != nullptr)
focusWidget->setFocus();
}
@@ -513,8 +513,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QWidget *popupChild = activePopupWidget->childAt(mapped);
if (activePopupWidget != qt_popup_down) {
- qt_button_down = 0;
- qt_popup_down = 0;
+ qt_button_down = nullptr;
+ qt_popup_down = nullptr;
}
switch (event->type()) {
@@ -589,7 +589,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
&& qt_replay_popup_mouse_event
&& QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ReplayMousePressOutsidePopup).toBool()) {
if (m_widget->windowType() != Qt::Popup)
- qt_button_down = 0;
+ qt_button_down = nullptr;
if (event->type() == QEvent::MouseButtonPress) {
// the popup disappeared, replay the mouse press event
QWidget *w = QApplication::widgetAt(event->globalPos());
@@ -636,8 +636,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
#endif
if (releaseAfter) {
- qt_button_down = 0;
- qt_popup_down = 0;
+ qt_button_down = nullptr;
+ qt_popup_down = nullptr;
}
return;
}
@@ -1050,7 +1050,7 @@ bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long
#if QT_CONFIG(tabletevent)
void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
{
- static QPointer<QWidget> qt_tablet_target = 0;
+ static QPointer<QWidget> qt_tablet_target = nullptr;
QWidget *widget = qt_tablet_target;
@@ -1076,7 +1076,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
}
if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton)
- qt_tablet_target = 0;
+ qt_tablet_target = nullptr;
}
#endif // QT_CONFIG(tabletevent)
@@ -1084,7 +1084,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
void QWidgetWindow::handleGestureEvent(QNativeGestureEvent *e)
{
// copy-pasted code to find correct widget follows:
- QObject *receiver = 0;
+ QObject *receiver = nullptr;
if (QApplicationPrivate::inPopupMode()) {
QWidget *popup = QApplication::activePopupWidget();
QWidget *popupFocusWidget = popup->focusWidget();
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index fd8581edbb..b4d889fdfa 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -58,8 +58,8 @@ public:
Q_DECLARE_PUBLIC(QWindowContainer)
QWindowContainerPrivate()
- : window(0)
- , oldFocusWindow(0)
+ : window(nullptr)
+ , oldFocusWindow(nullptr)
, usesNativeWidgets(false)
{
}
@@ -70,7 +70,7 @@ public:
QWindowContainer *wc = qobject_cast<QWindowContainer *>(w);
if (wc)
return wc->d_func();
- return 0;
+ return nullptr;
}
void updateGeometry() {
@@ -90,7 +90,7 @@ public:
void updateUsesNativeWidgets()
{
- if (window->parent() == 0)
+ if (window->parent() == nullptr)
return;
Q_Q(QWindowContainer);
if (q->internalWinId()) {
@@ -295,7 +295,7 @@ bool QWindowContainer::event(QEvent *e)
case QEvent::ChildRemoved: {
QChildEvent *ce = static_cast<QChildEvent *>(e);
if (ce->child() == d->window)
- d->window = 0;
+ d->window = nullptr;
break;
}
// The only thing we are interested in is making sure our sizes stay
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index 42691d6b77..b310da5781 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -456,7 +456,7 @@ const QStateMachinePrivate::Handler qt_gui_statemachine_handler = {
cloneEvent
};
-static const QStateMachinePrivate::Handler *qt_guistatemachine_last_handler = 0;
+static const QStateMachinePrivate::Handler *qt_guistatemachine_last_handler = nullptr;
void qRegisterGuiStateMachine()
{
qt_guistatemachine_last_handler = QStateMachinePrivate::handler;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 861dd7a54c..6b3e3679ae 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE
static QWindow *qt_getWindow(const QWidget *widget)
{
- return widget ? widget->window()->windowHandle() : 0;
+ return widget ? widget->window()->windowHandle() : nullptr;
}
/*!
@@ -353,7 +353,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->fillRect(mid_h, opt->rect.y(), 1, bef_v - opt->rect.y(), brush);
break; }
case PE_FrameStatusBarItem:
- qDrawShadeRect(p, opt->rect, opt->palette, true, 1, 0, 0);
+ qDrawShadeRect(p, opt->rect, opt->palette, true, 1, 0, nullptr);
break;
case PE_IndicatorHeaderArrow:
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
@@ -450,7 +450,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
#endif // QT_CONFIG(tabbar)
case PE_FrameTabWidget:
case PE_FrameWindow:
- qDrawWinPanel(p, opt->rect, opt->palette, false, 0);
+ qDrawWinPanel(p, opt->rect, opt->palette, false, nullptr);
break;
case PE_FrameLineEdit:
proxy()->drawPrimitive(PE_Frame, opt, p, widget);
@@ -493,17 +493,17 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
x -= 2;
if (opt->rect.height() > 4) {
qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4,
- opt->palette, false, 1, 0);
+ opt->palette, false, 1, nullptr);
qDrawShadePanel(p, x+3, 2, 3, opt->rect.height() - 4,
- opt->palette, false, 1, 0);
+ opt->palette, false, 1, nullptr);
}
} else {
if (opt->rect.width() > 4) {
int y = opt->rect.height() / 3;
qDrawShadePanel(p, 2, y, opt->rect.width() - 4, 3,
- opt->palette, false, 1, 0);
+ opt->palette, false, 1, nullptr);
qDrawShadePanel(p, 2, y+3, opt->rect.width() - 4, 3,
- opt->palette, false, 1, 0);
+ opt->palette, false, 1, nullptr);
}
}
p->restore();
@@ -818,7 +818,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
#if QT_CONFIG(toolbutton)
static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbutton,
- const QRect &rect, QPainter *painter, const QWidget *widget = 0)
+ const QRect &rect, QPainter *painter, const QWidget *widget = nullptr)
{
QStyle::PrimitiveElement pe;
switch (toolbutton->arrowType) {
@@ -1016,7 +1016,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const
{
const QWidget *widget = option->widget;
- const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1;
+ const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1;
QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding
const bool wrapText = option->features & QStyleOptionViewItem::WrapText;
@@ -2931,8 +2931,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_TabBarScrollLeftButton: {
const bool vertical = opt->rect.width() < opt->rect.height();
const Qt::LayoutDirection ld = widget->layoutDirection();
- const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, widget), QApplication::globalStrut().width());
- const int buttonOverlap = proxy()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, 0, widget);
+ const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget), QApplication::globalStrut().width());
+ const int buttonOverlap = proxy()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, nullptr, widget);
r = vertical ? QRect(0, opt->rect.height() - (buttonWidth * 2) + buttonOverlap, opt->rect.width(), buttonWidth)
: QStyle::visualRect(ld, opt->rect, QRect(opt->rect.width() - (buttonWidth * 2) + buttonOverlap, 0, buttonWidth, opt->rect.height()));
@@ -2940,7 +2940,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_TabBarScrollRightButton: {
const bool vertical = opt->rect.width() < opt->rect.height();
const Qt::LayoutDirection ld = widget->layoutDirection();
- const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, widget), QApplication::globalStrut().width());
+ const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget), QApplication::globalStrut().width());
r = vertical ? QRect(0, opt->rect.height() - buttonWidth, opt->rect.width(), buttonWidth)
: QStyle::visualRect(ld, opt->rect, QRect(opt->rect.width() - buttonWidth, 0, buttonWidth, opt->rect.height()));
@@ -3030,8 +3030,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
const QStyleOptionDockWidget *dwOpt
= qstyleoption_cast<const QStyleOptionDockWidget*>(opt);
- bool canClose = dwOpt == 0 ? true : dwOpt->closable;
- bool canFloat = dwOpt == 0 ? false : dwOpt->floatable;
+ bool canClose = dwOpt == nullptr ? true : dwOpt->closable;
+ bool canFloat = dwOpt == nullptr ? false : dwOpt->floatable;
const bool verticalTitleBar = dwOpt && dwOpt->verticalTitleBar;
@@ -3134,7 +3134,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false);
if (d->cachedOption) {
delete d->cachedOption;
- d->cachedOption = 0;
+ d->cachedOption = nullptr;
}
d->cachedOption = new QStyleOptionViewItem(*vopt);
}
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index 5739678932..cfaa5a2011 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -90,7 +90,7 @@ void QProxyStylePrivate::ensureBaseStyle() const
if (qstrcmp(baseStyle->metaObject()->className(),
q->metaObject()->className()) == 0) {
delete baseStyle;
- baseStyle = 0;
+ baseStyle = nullptr;
}
}
}
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index b0ce5e52cf..2c4f6f83a1 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -88,7 +88,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
*/
QStyle *QStyleFactory::create(const QString& key)
{
- QStyle *ret = 0;
+ QStyle *ret = nullptr;
QString style = key.toLower();
#if QT_CONFIG(style_windows)
if (style == QLatin1String("windows"))
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 9477ca86da..61a59b03c1 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -132,7 +132,7 @@ bool isInstanceOf(QObject *obj, QAccessible::Role role)
bool hasAncestor(QObject *obj, QAccessible::Role role)
{
bool found = false;
- QObject *parent = obj ? obj->parent() : 0;
+ QObject *parent = obj ? obj->parent() : nullptr;
while (parent && !found) {
if (isInstanceOf(parent, role))
found = true;
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index e5e93ecc66..1af839c841 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -151,7 +151,7 @@ QT_BEGIN_NAMESPACE
QStyleOption::QStyleOption(int version, int type)
: version(version), type(type), state(QStyle::State_None),
- direction(QGuiApplication::layoutDirection()), fontMetrics(QFont()), styleObject(0)
+ direction(QGuiApplication::layoutDirection()), fontMetrics(QFont()), styleObject(nullptr)
{
}
@@ -3085,7 +3085,7 @@ QStyleOptionViewItem::QStyleOptionViewItem()
: QStyleOption(Version, SO_ViewItem),
displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
textElideMode(Qt::ElideMiddle), decorationPosition(Left),
- showDecorationSelected(false), features(None), widget(0),
+ showDecorationSelected(false), features(None), widget(nullptr),
checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
{
}
@@ -3097,7 +3097,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
: QStyleOption(version, SO_ViewItem),
displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
textElideMode(Qt::ElideMiddle), decorationPosition(Left),
- showDecorationSelected(false), features(None), widget(0),
+ showDecorationSelected(false), features(None), widget(nullptr),
checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
{
}
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 24a397a274..c40bbbc96c 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -133,7 +133,7 @@ public:
};
-static QStyleSheetStyleCaches *styleSheetCaches = 0;
+static QStyleSheetStyleCaches *styleSheetCaches = nullptr;
/* RECURSION_GUARD:
* the QStyleSheetStyle is a proxy. If used with others proxy style, we may end up with something like:
@@ -144,16 +144,16 @@ static QStyleSheetStyleCaches *styleSheetCaches = 0;
* The first instance of QStyleSheetStyle will set globalStyleSheetStyle to itself. The second one
* will notice the globalStyleSheetStyle is not istelf and call its base style directly.
*/
-static const QStyleSheetStyle *globalStyleSheetStyle = 0;
+static const QStyleSheetStyle *globalStyleSheetStyle = nullptr;
class QStyleSheetStyleRecursionGuard
{
public:
QStyleSheetStyleRecursionGuard(const QStyleSheetStyle *that)
- : guarded(globalStyleSheetStyle == 0)
+ : guarded(globalStyleSheetStyle == nullptr)
{
if (guarded) globalStyleSheetStyle = that;
}
- ~QStyleSheetStyleRecursionGuard() { if (guarded) globalStyleSheetStyle = 0; }
+ ~QStyleSheetStyleRecursionGuard() { if (guarded) globalStyleSheetStyle = nullptr; }
bool guarded;
};
#define RECURSION_GUARD(RETURN) \
@@ -371,7 +371,7 @@ struct QStyleSheetBackgroundData : public QSharedData
struct QStyleSheetBorderData : public QSharedData
{
- QStyleSheetBorderData() : bi(0)
+ QStyleSheetBorderData() : bi(nullptr)
{
for (int i = 0; i < 4; i++) {
borders[i] = 0;
@@ -379,7 +379,7 @@ struct QStyleSheetBorderData : public QSharedData
}
}
- QStyleSheetBorderData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r) : bi(0)
+ QStyleSheetBorderData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r) : bi(nullptr)
{
for (int i = 0; i < 4; i++) {
borders[i] = b[i];
@@ -396,7 +396,7 @@ struct QStyleSheetBorderData : public QSharedData
const QStyleSheetBorderImageData *borderImage() const
{ return bi; }
- bool hasBorderImage() const { return bi!=0; }
+ bool hasBorderImage() const { return bi!=nullptr; }
QSharedDataPointer<QStyleSheetBorderImageData> bi;
@@ -413,7 +413,7 @@ struct QStyleSheetBorderData : public QSharedData
if (!radii[i].isEmpty())
return false;
}
- if (bi != 0 && bi->pixmap.hasAlpha())
+ if (bi != nullptr && bi->pixmap.hasAlpha())
return false;
return true;
}
@@ -502,7 +502,7 @@ struct QStyleSheetImageData : public QSharedData
class QRenderRule
{
public:
- QRenderRule() : features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0) { }
+ QRenderRule() : features(0), hasFont(false), pal(nullptr), b(nullptr), bg(nullptr), bd(nullptr), ou(nullptr), geo(nullptr), p(nullptr), img(nullptr), clipset(0) { }
QRenderRule(const QVector<QCss::Declaration> &, const QObject *);
QRect borderRect(const QRect &r) const;
@@ -538,18 +538,18 @@ public:
bool hasModification() const;
- bool hasPalette() const { return pal != 0; }
- bool hasBackground() const { return bg != 0 && (!bg->pixmap.isNull() || bg->brush.style() != Qt::NoBrush); }
+ bool hasPalette() const { return pal != nullptr; }
+ bool hasBackground() const { return bg != nullptr && (!bg->pixmap.isNull() || bg->brush.style() != Qt::NoBrush); }
bool hasGradientBackground() const { return bg && bg->brush.style() >= Qt::LinearGradientPattern
&& bg->brush.style() <= Qt::ConicalGradientPattern; }
bool hasNativeBorder() const {
- return bd == 0
+ return bd == nullptr
|| (!bd->hasBorderImage() && bd->styles[0] == BorderStyle_Native);
}
bool hasNativeOutline() const {
- return (ou == 0
+ return (ou == nullptr
|| (!ou->hasBorderImage() && ou->styles[0] == BorderStyle_Native));
}
@@ -563,14 +563,14 @@ public:
return features & StyleFeature_BackgroundColor;
}
- bool hasBox() const { return b != 0; }
- bool hasBorder() const { return bd != 0; }
- bool hasOutline() const { return ou != 0; }
- bool hasPosition() const { return p != 0; }
- bool hasGeometry() const { return geo != 0; }
+ bool hasBox() const { return b != nullptr; }
+ bool hasBorder() const { return bd != nullptr; }
+ bool hasOutline() const { return ou != nullptr; }
+ bool hasPosition() const { return p != nullptr; }
+ bool hasGeometry() const { return geo != nullptr; }
bool hasDrawable() const { return !hasNativeBorder() || hasBackground() || hasImage(); }
- bool hasImage() const { return img != 0; }
- bool hasIcon() const { return iconPtr != 0; }
+ bool hasImage() const { return img != nullptr; }
+ bool hasIcon() const { return iconPtr != nullptr; }
QSize minimumContentsSize() const
{ return geo ? QSize(geo->minWidth, geo->minHeight) : QSize(0, 0); }
@@ -910,7 +910,7 @@ static QStyle::StandardPixmap subControlIcon(int pe)
}
QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject *object)
-: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0)
+: features(0), hasFont(false), pal(nullptr), b(nullptr), bg(nullptr), bd(nullptr), ou(nullptr), geo(nullptr), p(nullptr), img(nullptr), clipset(0)
{
QPalette palette = QGuiApplication::palette(); // ###: ideally widget's palette
ValueExtractor v(declarations, palette);
@@ -1134,11 +1134,11 @@ QSize QRenderRule::boxSize(const QSize &cs, int flags) const
void QRenderRule::fixupBorder(int nativeWidth)
{
- if (bd == 0)
+ if (bd == nullptr)
return;
if (!bd->hasBorderImage() || bd->bi->pixmap.isNull()) {
- bd->bi = 0;
+ bd->bi = nullptr;
// ignore the color, border of edges that have none border-style
QBrush color = pal ? pal->foreground : QBrush();
const bool hasRadius = bd->radii[0].isValid() || bd->radii[1].isValid()
@@ -1515,7 +1515,7 @@ public:
do {
result += QString::fromLatin1(metaObject->className()).replace(QLatin1Char(':'), QLatin1Char('-'));
metaObject = metaObject->superClass();
- } while (metaObject != 0);
+ } while (metaObject != nullptr);
return result;
}
QString attribute(NodePtr node, const QString& name) const override
@@ -1539,7 +1539,7 @@ public:
return className;
} else if (name == QLatin1String("style")) {
QWidget *w = qobject_cast<QWidget *>(obj);
- QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : 0;
+ QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : nullptr;
if (proxy) {
QString styleName = QString::fromLatin1(proxy->baseStyle()->metaObject()->className());
cache[name] = styleName;
@@ -1575,7 +1575,7 @@ public:
if (uc == e && !*c)
return true;
metaObject = metaObject->superClass();
- } while (metaObject != 0);
+ } while (metaObject != nullptr);
return false;
}
bool hasAttributes(NodePtr) const override
@@ -1583,11 +1583,11 @@ public:
QStringList nodeIds(NodePtr node) const override
{ return isNullNode(node) ? QStringList() : QStringList(OBJECT_PTR(node)->objectName()); }
bool isNullNode(NodePtr node) const override
- { return node.ptr == 0; }
+ { return node.ptr == nullptr; }
NodePtr parentNode(NodePtr node) const override
- { NodePtr n; n.ptr = isNullNode(node) ? 0 : parentObject(OBJECT_PTR(node)); return n; }
+ { NodePtr n; n.ptr = isNullNode(node) ? nullptr : parentObject(OBJECT_PTR(node)); return n; }
NodePtr previousSiblingNode(NodePtr) const override
- { NodePtr n; n.ptr = 0; return n; }
+ { NodePtr n; n.ptr = nullptr; return n; }
NodePtr duplicateNode(NodePtr node) const override
{ return node; }
void freeNode(NodePtr) const override
@@ -1700,22 +1700,22 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
#if QT_CONFIG(spinbox)
if (qobject_cast<const QAbstractSpinBox *>(w))
- return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w);
+ return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, nullptr, w);
#endif
#if QT_CONFIG(combobox)
if (qobject_cast<const QComboBox *>(w))
- return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w);
+ return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, nullptr, w);
#endif
#if QT_CONFIG(menu)
if (qobject_cast<const QMenu *>(w))
- return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w);
+ return base->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, w);
#endif
#if QT_CONFIG(menubar)
if (qobject_cast<const QMenuBar *>(w))
- return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w);
+ return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, w);
#endif
#ifndef QT_NO_FRAME
if (const QFrame *frame = qobject_cast<const QFrame *>(w)) {
@@ -1725,9 +1725,9 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
#endif
if (qstrcmp(w->metaObject()->className(), "QTipLabel") == 0)
- return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, w);
+ return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, w);
- return base->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, w);
+ return base->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, w);
}
static quint64 pseudoClass(QStyle::State state)
@@ -2243,21 +2243,21 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec
case PseudoElement_Indicator:
case PseudoElement_MenuCheckMark:
if (sz.width() == -1)
- sz.setWidth(base->pixelMetric(PM_IndicatorWidth, 0, w));
+ sz.setWidth(base->pixelMetric(PM_IndicatorWidth, nullptr, w));
if (sz.height() == -1)
- sz.setHeight(base->pixelMetric(PM_IndicatorHeight, 0, w));
+ sz.setHeight(base->pixelMetric(PM_IndicatorHeight, nullptr, w));
break;
case PseudoElement_ExclusiveIndicator:
case PseudoElement_GroupBoxIndicator:
if (sz.width() == -1)
- sz.setWidth(base->pixelMetric(PM_ExclusiveIndicatorWidth, 0, w));
+ sz.setWidth(base->pixelMetric(PM_ExclusiveIndicatorWidth, nullptr, w));
if (sz.height() == -1)
- sz.setHeight(base->pixelMetric(PM_ExclusiveIndicatorHeight, 0, w));
+ sz.setHeight(base->pixelMetric(PM_ExclusiveIndicatorHeight, nullptr, w));
break;
case PseudoElement_PushButtonMenuIndicator: {
- int pm = base->pixelMetric(PM_MenuButtonIndicator, 0, w);
+ int pm = base->pixelMetric(PM_MenuButtonIndicator, nullptr, w);
if (sz.width() == -1)
sz.setWidth(pm);
if (sz.height() == -1)
@@ -2291,12 +2291,12 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec
case PseudoElement_ToolButtonMenu:
if (sz.width() == -1)
- sz.setWidth(base->pixelMetric(PM_MenuButtonIndicator, 0, w));
+ sz.setWidth(base->pixelMetric(PM_MenuButtonIndicator, nullptr, w));
break;
case PseudoElement_HeaderViewUpArrow:
case PseudoElement_HeaderViewDownArrow: {
- int pm = base->pixelMetric(PM_HeaderMargin, 0, w);
+ int pm = base->pixelMetric(PM_HeaderMargin, nullptr, w);
if (sz.width() == -1)
sz.setWidth(pm);
if (sz.height() == 1)
@@ -2309,7 +2309,7 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec
case PseudoElement_ScrollBarAddLine:
case PseudoElement_ScrollBarSubLine:
case PseudoElement_ScrollBarSlider: {
- int pm = pixelMetric(QStyle::PM_ScrollBarExtent, 0, w);
+ int pm = pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, w);
if (sz.width() == -1)
sz.setWidth(pm);
if (sz.height() == -1)
@@ -2319,7 +2319,7 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec
case PseudoElement_DockWidgetCloseButton:
case PseudoElement_DockWidgetFloatButton: {
- int iconSize = pixelMetric(PM_SmallIconSize, 0, w);
+ int iconSize = pixelMetric(PM_SmallIconSize, nullptr, w);
return QSize(iconSize, iconSize);
}
@@ -2956,7 +2956,7 @@ void QStyleSheetStyle::unpolish(QWidget *w)
setGeometry(w);
w->setAttribute(Qt::WA_StyleSheetTarget, false);
w->setAttribute(Qt::WA_StyleSheet, false);
- QObject::disconnect(w, 0, this, 0);
+ QObject::disconnect(w, nullptr, this, nullptr);
#if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
@@ -3395,7 +3395,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
tb->icon.paint(p, ir);
} else {
int iconSize = pixelMetric(PM_SmallIconSize, tb, w);
- pm = standardIcon(SP_TitleBarMenuButton, 0, w).pixmap(iconSize, iconSize);
+ pm = standardIcon(SP_TitleBarMenuButton, nullptr, w).pixmap(iconSize, iconSize);
drawItemPixmap(p, ir, Qt::AlignCenter, pm);
}
}
@@ -3407,9 +3407,9 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
QSize sz = subSubRule.contentsRect(ir).size();
if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool)
- pm = standardIcon(SP_DockWidgetCloseButton, 0, w).pixmap(sz);
+ pm = standardIcon(SP_DockWidgetCloseButton, nullptr, w).pixmap(sz);
else
- pm = standardIcon(SP_TitleBarCloseButton, 0, w).pixmap(sz);
+ pm = standardIcon(SP_TitleBarCloseButton, nullptr, w).pixmap(sz);
drawItemPixmap(p, ir, Qt::AlignCenter, pm);
}
@@ -3430,7 +3430,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
continue;
QRenderRule subSubRule = renderRule(w, opt, pe);
subSubRule.drawRule(p, ir);
- pm = standardIcon(subControlIcon(pe), 0, w).pixmap(subSubRule.contentsRect(ir).size());
+ pm = standardIcon(subControlIcon(pe), nullptr, w).pixmap(subSubRule.contentsRect(ir).size());
drawItemPixmap(p, ir, Qt::AlignCenter, pm);
}
@@ -4280,7 +4280,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (pe1 != PseudoElement_None) {
QRenderRule subRule = renderRule(w, opt, pe1);
- if (subRule.bg != 0 || subRule.hasDrawable()) {
+ if (subRule.bg != nullptr || subRule.hasDrawable()) {
//We test subRule.bg directly because hasBackground() would return false for background:none.
//But we still don't want the default drawning in that case (example for QScrollBar::add-page) (task 198926)
subRule.drawRule(p, opt->rect);
@@ -5088,7 +5088,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
case CT_GroupBox:
case CT_LineEdit:
#if QT_CONFIG(spinbox)
- if (qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0))
+ if (qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : nullptr))
return csz; // we only care about the size hint of the line edit
#endif
if (rule.hasBox() || !rule.hasNativeBorder()) {
@@ -5729,7 +5729,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
if (!subRule.hasDrawable())
break;
- subRule.img = 0;
+ subRule.img = nullptr;
QRect gr = positionRect(w, rule, subRule, PseudoElement_SliderGroove, opt->rect, opt->direction);
switch (sc) {
case SC_SliderGroove:
@@ -5739,8 +5739,8 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
QRect cr = subRule.contentsRect(gr);
QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SliderHandle);
int len = horizontal ? subRule2.size().width() : subRule2.size().height();
- subRule2.img = 0;
- subRule2.geo = 0;
+ subRule2.img = nullptr;
+ subRule2.geo = nullptr;
cr = positionRect(w, subRule2, PseudoElement_SliderHandle, cr, opt->direction);
int thickness = horizontal ? cr.height() : cr.width();
int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition,
@@ -5848,7 +5848,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
QRect ir = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator,
opt, w);
ir = visualRect(opt->direction, opt->rect, ir);
- int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, 0, w);
+ int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, nullptr, w);
QRect cr = rule.contentsRect(opt->rect);
ir.setRect(ir.left() + ir.width() + spacing, cr.y(),
cr.width() - ir.width() - spacing, cr.height());
diff --git a/src/widgets/util/qcolormap.cpp b/src/widgets/util/qcolormap.cpp
index 6dacc97261..57e61690e9 100644
--- a/src/widgets/util/qcolormap.cpp
+++ b/src/widgets/util/qcolormap.cpp
@@ -59,7 +59,7 @@ public:
int numcolors;
};
-static QColormapPrivate *screenMap = 0;
+static QColormapPrivate *screenMap = nullptr;
void QColormap::initialize()
{
@@ -83,7 +83,7 @@ void QColormap::initialize()
void QColormap::cleanup()
{
delete screenMap;
- screenMap = 0;
+ screenMap = nullptr;
}
QColormap QColormap::instance(int /*screen*/)
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 3c0271e7c2..72fa557790 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1262,7 +1262,7 @@ Qt::MatchFlags QCompleter::filterMode() const
void QCompleter::setPopup(QAbstractItemView *popup)
{
Q_D(QCompleter);
- Q_ASSERT(popup != 0);
+ Q_ASSERT(popup != nullptr);
if (d->popup) {
QObject::disconnect(d->popup->selectionModel(), nullptr, this, nullptr);
QObject::disconnect(d->popup, nullptr, this, nullptr);
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 03df937938..064be873b9 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -114,19 +114,19 @@ static QMouseEvent *copyMouseEvent(QEvent *e)
}
#endif // QT_CONFIG(graphicsview)
default:
- return 0;
+ return nullptr;
}
}
class PressDelayHandler : public QObject
{
private:
- PressDelayHandler(QObject *parent = 0)
+ PressDelayHandler(QObject *parent = nullptr)
: QObject(parent)
, pressDelayTimer(0)
, sendingEvent(false)
, mouseButton(Qt::NoButton)
- , mouseTarget(0)
+ , mouseTarget(nullptr)
, mouseEventSource(Qt::MouseEventNotSynthesized)
{ }
@@ -138,7 +138,7 @@ public:
static PressDelayHandler *instance()
{
- static PressDelayHandler *inst = 0;
+ static PressDelayHandler *inst = nullptr;
if (!inst)
inst = new PressDelayHandler(QCoreApplication::instance());
return inst;
@@ -192,10 +192,10 @@ public:
result = true; // consume this event
} else if (mouseTarget && scrollerIsActive) {
// we grabbed the mouse expicitly when the scroller became active, so undo that now
- sendMouseEvent(0, UngrabMouseBefore);
+ sendMouseEvent(nullptr, UngrabMouseBefore);
}
- pressDelayEvent.reset(0);
- mouseTarget = 0;
+ pressDelayEvent.reset(nullptr);
+ mouseTarget = nullptr;
return result;
}
@@ -208,9 +208,9 @@ public:
killTimer(pressDelayTimer);
pressDelayTimer = 0;
}
- pressDelayEvent.reset(0);
+ pressDelayEvent.reset(nullptr);
}
- mouseTarget = 0;
+ mouseTarget = nullptr;
}
void scrollerBecameActive()
@@ -222,8 +222,8 @@ public:
killTimer(pressDelayTimer);
pressDelayTimer = 0;
}
- pressDelayEvent.reset(0);
- mouseTarget = 0;
+ pressDelayEvent.reset(nullptr);
+ mouseTarget = nullptr;
} else if (mouseTarget) {
// we did send a press, so we need to fake a release now
@@ -261,7 +261,7 @@ protected:
qFGDebug() << "QFG: timer event: re-sending mouse press to " << mouseTarget;
sendMouseEvent(pressDelayEvent.data(), UngrabMouseBefore);
}
- pressDelayEvent.reset(0);
+ pressDelayEvent.reset(nullptr);
if (pressDelayTimer) {
killTimer(pressDelayTimer);
@@ -276,7 +276,7 @@ protected:
sendingEvent = true;
#if QT_CONFIG(graphicsview)
- QGraphicsItem *grabber = 0;
+ QGraphicsItem *grabber = nullptr;
if (mouseTarget->parentWidget()) {
if (QGraphicsView *gv = qobject_cast<QGraphicsView *>(mouseTarget->parentWidget())) {
if (gv->scene())
@@ -350,7 +350,7 @@ QFlickGesture::QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject
{
d_func()->q_ptr = this;
d_func()->receiver = receiver;
- d_func()->receiverScroller = (receiver && QScroller::hasScroller(receiver)) ? QScroller::scroller(receiver) : 0;
+ d_func()->receiverScroller = (receiver && QScroller::hasScroller(receiver)) ? QScroller::scroller(receiver) : nullptr;
d_func()->button = button;
}
@@ -358,7 +358,7 @@ QFlickGesture::~QFlickGesture()
{ }
QFlickGesturePrivate::QFlickGesturePrivate()
- : receiverScroller(0), button(Qt::NoButton), macIgnoreWheel(false)
+ : receiverScroller(nullptr), button(Qt::NoButton), macIgnoreWheel(false)
{ }
@@ -420,11 +420,11 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
return Ignore;
}
- const QMouseEvent *me = 0;
+ const QMouseEvent *me = nullptr;
#if QT_CONFIG(graphicsview)
- const QGraphicsSceneMouseEvent *gsme = 0;
+ const QGraphicsSceneMouseEvent *gsme = nullptr;
#endif
- const QTouchEvent *te = 0;
+ const QTouchEvent *te = nullptr;
QPoint globalPos;
// qFGDebug() << "FlickGesture "<<state<<"watched:"<<watched<<"receiver"<<d->receiver<<"event"<<event->type()<<"button"<<button;
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index df05bbf71c..fec373d45c 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -300,7 +300,7 @@ QScroller *QScroller::scroller(QObject *target)
{
if (!target) {
qWarning("QScroller::scroller() was called with a null target.");
- return 0;
+ return nullptr;
}
if (qt_allScrollers()->contains(target))
@@ -476,7 +476,7 @@ void QScroller::ungrabGesture(QObject *target)
QGestureRecognizer::unregisterRecognizer(sp->recognizerType);
// do not delete the recognizer. The QGestureManager is doing this.
- sp->recognizer = 0;
+ sp->recognizer = nullptr;
}
#endif // QT_NO_GESTURES
@@ -502,7 +502,7 @@ QScroller::~QScroller()
#ifndef QT_NO_GESTURES
QGestureRecognizer::unregisterRecognizer(d->recognizerType);
// do not delete the recognizer. The QGestureManager is doing this.
- d->recognizer = 0;
+ d->recognizer = nullptr;
#endif
qt_allScrollers()->remove(d->target);
qt_activeScrollers()->removeOne(this);
@@ -879,7 +879,7 @@ void QScroller::setSnapPositionsY(qreal first, qreal interval)
QScrollerPrivate::QScrollerPrivate(QScroller *q, QObject *_target)
: target(_target)
#ifndef QT_NO_GESTURES
- , recognizer(0)
+ , recognizer(nullptr)
, recognizerType(Qt::CustomGesture)
#endif
, state(QScroller::Inactive)
@@ -900,7 +900,7 @@ QScrollerPrivate::QScrollerPrivate(QScroller *q, QObject *_target)
void QScrollerPrivate::init()
{
- setDpiFromWidget(0);
+ setDpiFromWidget(nullptr);
monotonicTimer.start();
}
diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp
index df6b899fe4..0306f54faa 100644
--- a/src/widgets/util/qscrollerproperties.cpp
+++ b/src/widgets/util/qscrollerproperties.cpp
@@ -46,8 +46,8 @@
QT_BEGIN_NAMESPACE
-static QScrollerPropertiesPrivate *userDefaults = 0;
-static QScrollerPropertiesPrivate *systemDefaults = 0;
+static QScrollerPropertiesPrivate *userDefaults = nullptr;
+static QScrollerPropertiesPrivate *systemDefaults = nullptr;
QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults()
{
@@ -200,7 +200,7 @@ void QScrollerProperties::setDefaultScrollerProperties(const QScrollerProperties
void QScrollerProperties::unsetDefaultScrollerProperties()
{
delete userDefaults;
- userDefaults = 0;
+ userDefaults = nullptr;
}
/*!
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index ae81cc5661..ee52139913 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -453,7 +453,7 @@ void QSystemTrayIconPrivate::_q_emitActivated(QPlatformSystemTrayIcon::Activatio
}
//////////////////////////////////////////////////////////////////////
-static QBalloonTip *theSolitaryBalloonTip = 0;
+static QBalloonTip *theSolitaryBalloonTip = nullptr;
void QBalloonTip::showBalloon(const QIcon &icon, const QString &title,
const QString &message, QSystemTrayIcon *trayIcon,
@@ -475,7 +475,7 @@ void QBalloonTip::hideBalloon()
return;
theSolitaryBalloonTip->hide();
delete theSolitaryBalloonTip;
- theSolitaryBalloonTip = 0;
+ theSolitaryBalloonTip = nullptr;
}
void QBalloonTip::updateBalloonPosition(const QPoint& pos)
@@ -493,7 +493,7 @@ bool QBalloonTip::isBalloonVisible()
QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
const QString &message, QSystemTrayIcon *ti)
- : QWidget(0, Qt::ToolTip),
+ : QWidget(nullptr, Qt::ToolTip),
trayIcon(ti),
timerId(-1),
showArrow(true)
@@ -583,7 +583,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
QBalloonTip::~QBalloonTip()
{
- theSolitaryBalloonTip = 0;
+ theSolitaryBalloonTip = nullptr;
}
void QBalloonTip::paintEvent(QPaintEvent *)
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 0c7bb94a91..86c11f98ed 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -97,7 +97,7 @@ private:
};
QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn)
- : QWidget(0, Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint)
+ : QWidget(nullptr, Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint)
, q(qIn)
{
setObjectName(QStringLiteral("QSystemTrayIconSys"));
@@ -218,7 +218,7 @@ private:
////////////////////////////////////////////////////////////////////////////
QSystemTrayIconPrivate::QSystemTrayIconPrivate()
- : sys(0),
+ : sys(nullptr),
qpa_sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon()),
visible(false),
trayWatcher(nullptr)
diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp
index 9bd63d4232..ae439743bc 100644
--- a/src/widgets/util/qundogroup.cpp
+++ b/src/widgets/util/qundogroup.cpp
@@ -47,7 +47,7 @@ class QUndoGroupPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QUndoGroup)
public:
- QUndoGroupPrivate() : active(0) {}
+ QUndoGroupPrivate() : active(nullptr) {}
QUndoStack *active;
QList<QUndoStack*> stack_list;
@@ -113,7 +113,7 @@ QUndoGroup::~QUndoGroup()
QList<QUndoStack *>::iterator it = d->stack_list.begin();
QList<QUndoStack *>::iterator end = d->stack_list.end();
while (it != end) {
- (*it)->d_func()->group = 0;
+ (*it)->d_func()->group = nullptr;
++it;
}
}
@@ -154,8 +154,8 @@ void QUndoGroup::removeStack(QUndoStack *stack)
if (d->stack_list.removeAll(stack) == 0)
return;
if (stack == d->active)
- setActiveStack(0);
- stack->d_func()->group = 0;
+ setActiveStack(nullptr);
+ stack->d_func()->group = nullptr;
}
/*!
@@ -190,7 +190,7 @@ void QUndoGroup::setActiveStack(QUndoStack *stack)
if (d->active == stack)
return;
- if (d->active != 0) {
+ if (d->active != nullptr) {
disconnect(d->active, SIGNAL(canUndoChanged(bool)),
this, SIGNAL(canUndoChanged(bool)));
disconnect(d->active, SIGNAL(undoTextChanged(QString)),
@@ -207,7 +207,7 @@ void QUndoGroup::setActiveStack(QUndoStack *stack)
d->active = stack;
- if (d->active == 0) {
+ if (d->active == nullptr) {
emit canUndoChanged(false);
emit undoTextChanged(QString());
emit canRedoChanged(false);
@@ -265,7 +265,7 @@ QUndoStack *QUndoGroup::activeStack() const
void QUndoGroup::undo()
{
Q_D(QUndoGroup);
- if (d->active != 0)
+ if (d->active != nullptr)
d->active->undo();
}
@@ -282,7 +282,7 @@ void QUndoGroup::undo()
void QUndoGroup::redo()
{
Q_D(QUndoGroup);
- if (d->active != 0)
+ if (d->active != nullptr)
d->active->redo();
}
@@ -298,7 +298,7 @@ void QUndoGroup::redo()
bool QUndoGroup::canUndo() const
{
Q_D(const QUndoGroup);
- return d->active != 0 && d->active->canUndo();
+ return d->active != nullptr && d->active->canUndo();
}
/*!
@@ -313,7 +313,7 @@ bool QUndoGroup::canUndo() const
bool QUndoGroup::canRedo() const
{
Q_D(const QUndoGroup);
- return d->active != 0 && d->active->canRedo();
+ return d->active != nullptr && d->active->canRedo();
}
/*!
@@ -328,7 +328,7 @@ bool QUndoGroup::canRedo() const
QString QUndoGroup::undoText() const
{
Q_D(const QUndoGroup);
- return d->active == 0 ? QString() : d->active->undoText();
+ return d->active == nullptr ? QString() : d->active->undoText();
}
/*!
@@ -343,7 +343,7 @@ QString QUndoGroup::undoText() const
QString QUndoGroup::redoText() const
{
Q_D(const QUndoGroup);
- return d->active == 0 ? QString() : d->active->redoText();
+ return d->active == nullptr ? QString() : d->active->redoText();
}
/*!
@@ -358,7 +358,7 @@ QString QUndoGroup::redoText() const
bool QUndoGroup::isClean() const
{
Q_D(const QUndoGroup);
- return d->active == 0 || d->active->isClean();
+ return d->active == nullptr || d->active->isClean();
}
#ifndef QT_NO_ACTION
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 8788c42252..f188b8298a 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -128,7 +128,7 @@ QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent)
QUndoCommand::QUndoCommand(QUndoCommand *parent)
{
d = new QUndoCommandPrivate;
- if (parent != 0)
+ if (parent != nullptr)
parent->d->child_list.append(this);
}
@@ -336,7 +336,7 @@ int QUndoCommand::childCount() const
const QUndoCommand *QUndoCommand::child(int index) const
{
if (index < 0 || index >= d->child_list.count())
- return 0;
+ return nullptr;
return d->child_list.at(index);
}
@@ -559,7 +559,7 @@ QUndoStack::~QUndoStack()
{
#if QT_CONFIG(undogroup)
Q_D(QUndoStack);
- if (d->group != 0)
+ if (d->group != nullptr)
d->group->removeStack(this);
#endif
clear();
@@ -640,7 +640,7 @@ void QUndoStack::push(QUndoCommand *cmd)
bool macro = !d->macro_stack.isEmpty();
- QUndoCommand *cur = 0;
+ QUndoCommand *cur = nullptr;
if (macro) {
QUndoCommand *macro_cmd = d->macro_stack.constLast();
if (!macro_cmd->d->child_list.isEmpty())
@@ -654,7 +654,7 @@ void QUndoStack::push(QUndoCommand *cmd)
d->clean_index = -1; // we've deleted the clean state
}
- bool try_merge = cur != 0
+ bool try_merge = cur != nullptr
&& cur->id() != -1
&& cur->id() == cmd->id()
&& (macro || d->index != d->clean_index);
@@ -1225,7 +1225,7 @@ const QUndoCommand *QUndoStack::command(int index) const
Q_D(const QUndoStack);
if (index < 0 || index >= d->command_list.count())
- return 0;
+ return nullptr;
return d->command_list.at(index);
}
@@ -1305,11 +1305,11 @@ void QUndoStack::setActive(bool active)
#else
Q_D(QUndoStack);
- if (d->group != 0) {
+ if (d->group != nullptr) {
if (active)
d->group->setActiveStack(this);
else if (d->group->activeStack() == this)
- d->group->setActiveStack(0);
+ d->group->setActiveStack(nullptr);
}
#endif
}
@@ -1320,7 +1320,7 @@ bool QUndoStack::isActive() const
return true;
#else
Q_D(const QUndoStack);
- return d->group == 0 || d->group->activeStack() == this;
+ return d->group == nullptr || d->group->activeStack() == this;
#endif
}
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index f59d87fb9d..9ca83a1da2 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -54,7 +54,7 @@ class QUndoModel : public QAbstractItemModel
{
Q_OBJECT
public:
- QUndoModel(QObject *parent = 0);
+ QUndoModel(QObject *parent = nullptr);
QUndoStack *stack() const;
@@ -92,7 +92,7 @@ private:
QUndoModel::QUndoModel(QObject *parent)
: QAbstractItemModel(parent)
{
- m_stack = 0;
+ m_stack = nullptr;
m_sel_model = new QItemSelectionModel(this, this);
connect(m_sel_model, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this, SLOT(setStackCurrentIndex(QModelIndex)));
@@ -114,13 +114,13 @@ void QUndoModel::setStack(QUndoStack *stack)
if (m_stack == stack)
return;
- if (m_stack != 0) {
+ if (m_stack != nullptr) {
disconnect(m_stack, SIGNAL(cleanChanged(bool)), this, SLOT(stackChanged()));
disconnect(m_stack, SIGNAL(indexChanged(int)), this, SLOT(stackChanged()));
disconnect(m_stack, SIGNAL(destroyed(QObject*)), this, SLOT(stackDestroyed(QObject*)));
}
m_stack = stack;
- if (m_stack != 0) {
+ if (m_stack != nullptr) {
connect(m_stack, SIGNAL(cleanChanged(bool)), this, SLOT(stackChanged()));
connect(m_stack, SIGNAL(indexChanged(int)), this, SLOT(stackChanged()));
connect(m_stack, SIGNAL(destroyed(QObject*)), this, SLOT(stackDestroyed(QObject*)));
@@ -133,7 +133,7 @@ void QUndoModel::stackDestroyed(QObject *obj)
{
if (obj != m_stack)
return;
- m_stack = 0;
+ m_stack = nullptr;
stackChanged();
}
@@ -147,7 +147,7 @@ void QUndoModel::stackChanged()
void QUndoModel::setStackCurrentIndex(const QModelIndex &index)
{
- if (m_stack == 0)
+ if (m_stack == nullptr)
return;
if (index == selectedIndex())
@@ -161,12 +161,12 @@ void QUndoModel::setStackCurrentIndex(const QModelIndex &index)
QModelIndex QUndoModel::selectedIndex() const
{
- return m_stack == 0 ? QModelIndex() : createIndex(m_stack->index(), 0);
+ return m_stack == nullptr ? QModelIndex() : createIndex(m_stack->index(), 0);
}
QModelIndex QUndoModel::index(int row, int column, const QModelIndex &parent) const
{
- if (m_stack == 0)
+ if (m_stack == nullptr)
return QModelIndex();
if (parent.isValid())
@@ -188,7 +188,7 @@ QModelIndex QUndoModel::parent(const QModelIndex&) const
int QUndoModel::rowCount(const QModelIndex &parent) const
{
- if (m_stack == 0)
+ if (m_stack == nullptr)
return 0;
if (parent.isValid())
@@ -204,7 +204,7 @@ int QUndoModel::columnCount(const QModelIndex&) const
QVariant QUndoModel::data(const QModelIndex &index, int role) const
{
- if (m_stack == 0)
+ if (m_stack == nullptr)
return QVariant();
if (index.column() != 0)
@@ -274,9 +274,9 @@ class QUndoViewPrivate : public QListViewPrivate
public:
QUndoViewPrivate() :
#if QT_CONFIG(undogroup)
- group(0),
+ group(nullptr),
#endif
- model(0) {}
+ model(nullptr) {}
#if QT_CONFIG(undogroup)
QPointer<QUndoGroup> group;
@@ -370,7 +370,7 @@ void QUndoView::setStack(QUndoStack *stack)
{
Q_D(QUndoView);
#if QT_CONFIG(undogroup)
- setGroup(0);
+ setGroup(nullptr);
#endif
d->model->setStack(stack);
}
@@ -393,19 +393,19 @@ void QUndoView::setGroup(QUndoGroup *group)
if (d->group == group)
return;
- if (d->group != 0) {
+ if (d->group != nullptr) {
disconnect(d->group, SIGNAL(activeStackChanged(QUndoStack*)),
d->model, SLOT(setStack(QUndoStack*)));
}
d->group = group;
- if (d->group != 0) {
+ if (d->group != nullptr) {
connect(d->group, SIGNAL(activeStackChanged(QUndoStack*)),
d->model, SLOT(setStack(QUndoStack*)));
d->model->setStack(d->group->activeStack());
} else {
- d->model->setStack(0);
+ d->model->setStack(nullptr);
}
}
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 19528d61d2..022f41738c 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -177,7 +177,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
checkable(false), checked(false), autoRepeat(false), autoExclusive(false),
down(false), blockRefresh(false), pressed(false),
#if QT_CONFIG(buttongroup)
- group(0),
+ group(nullptr),
#endif
autoRepeatDelay(AUTO_REPEAT_DELAY),
autoRepeatInterval(AUTO_REPEAT_INTERVAL),
@@ -217,14 +217,14 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const
Q_Q(const QAbstractButton);
QList<QAbstractButton *> buttonList = queryButtonList();
if (!autoExclusive || buttonList.count() == 1) // no group
- return 0;
+ return nullptr;
for (int i = 0; i < buttonList.count(); ++i) {
QAbstractButton *b = buttonList.at(i);
if (b->d_func()->checked && b != q)
return b;
}
- return checked ? const_cast<QAbstractButton *>(q) : 0;
+ return checked ? const_cast<QAbstractButton *>(q) : nullptr;
}
void QAbstractButtonPrivate::notifyChecked()
@@ -257,7 +257,7 @@ void QAbstractButtonPrivate::moveFocus(int key)
if (!fb || !buttonList.contains(fb))
return;
- QAbstractButton *candidate = 0;
+ QAbstractButton *candidate = nullptr;
int bestScore = -1;
QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0)));
QPoint goal = target.center();
@@ -1272,7 +1272,7 @@ QSize QAbstractButton::iconSize() const
Q_D(const QAbstractButton);
if (d->iconSize.isValid())
return d->iconSize;
- int e = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this);
+ int e = style()->pixelMetric(QStyle::PM_ButtonIconSize, nullptr, this);
return QSize(e, e);
}
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index d2372a7be9..320b3bf7ef 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -161,10 +161,10 @@ QT_BEGIN_NAMESPACE
*/
QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate()
- :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded),
+ :hbar(nullptr), vbar(nullptr), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded),
shownOnce(false), inResize(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored),
- viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0),
- xoffset(0), yoffset(0), viewportFilter(0)
+ viewport(nullptr), cornerWidget(nullptr), left(0), top(0), right(0), bottom(0),
+ xoffset(0), yoffset(0), viewportFilter(nullptr)
{
}
@@ -329,12 +329,12 @@ void QAbstractScrollAreaPrivate::layoutChildren()
void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrollbar, bool *needVerticalScrollbar)
{
Q_Q(QAbstractScrollArea);
- bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, hbar);
+ bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, hbar);
bool needh = *needHorizontalScrollbar || ((hbarpolicy != Qt::ScrollBarAlwaysOff) && ((hbarpolicy == Qt::ScrollBarAlwaysOn && !htransient)
|| ((hbarpolicy == Qt::ScrollBarAsNeeded || htransient)
&& hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty())));
- bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar);
+ bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, vbar);
bool needv = *needVerticalScrollbar || ((vbarpolicy != Qt::ScrollBarAlwaysOff) && ((vbarpolicy == Qt::ScrollBarAlwaysOn && !vtransient)
|| ((vbarpolicy == Qt::ScrollBarAsNeeded || vtransient)
&& vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty())));
@@ -352,7 +352,7 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol
const QRect widgetRect = q->rect();
- const bool hasCornerWidget = (cornerWidget != 0);
+ const bool hasCornerWidget = (cornerWidget != nullptr);
QPoint cornerOffset((needv && vscrollOverlap == 0) ? vsbExt : 0, (needh && hscrollOverlap == 0) ? hsbExt : 0);
QRect controlsRect;
@@ -794,7 +794,7 @@ void QAbstractScrollArea::addScrollBarWidget(QWidget *widget, Qt::Alignment alig
{
Q_D(QAbstractScrollArea);
- if (widget == 0)
+ if (widget == nullptr)
return;
const Qt::Orientation scrollBarOrientation
@@ -894,8 +894,8 @@ bool QAbstractScrollArea::eventFilter(QObject *o, QEvent *e)
if (d->hbarpolicy == Qt::ScrollBarAsNeeded && d->vbarpolicy == Qt::ScrollBarAsNeeded) {
QScrollBar *sbar = static_cast<QScrollBar*>(o);
QScrollBar *sibling = sbar == d->hbar ? d->vbar : d->hbar;
- if (sbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, sbar) &&
- sibling->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, sibling))
+ if (sbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, sbar) &&
+ sibling->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, sibling))
d->setScrollBarTransient(sibling, e->type() == QEvent::HoverLeave);
}
}
@@ -1389,10 +1389,10 @@ bool QAbstractScrollAreaPrivate::canStartScrollingAt( const QPoint &startPos )
void QAbstractScrollAreaPrivate::flashScrollBars()
{
- bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, hbar);
+ bool htransient = hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, hbar);
if ((hbarpolicy != Qt::ScrollBarAlwaysOff) && (hbarpolicy == Qt::ScrollBarAsNeeded || htransient))
hbar->d_func()->flash();
- bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar);
+ bool vtransient = vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, vbar);
if ((vbarpolicy != Qt::ScrollBarAlwaysOff) && (vbarpolicy == Qt::ScrollBarAsNeeded || vtransient))
vbar->d_func()->flash();
}
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index b1e1c9bc1b..6a0d2f5019 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -848,9 +848,9 @@ void QAbstractSpinBox::changeEvent(QEvent *event)
switch (event->type()) {
case QEvent::StyleChange:
- d->spinClickTimerInterval = style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, 0, this);
+ d->spinClickTimerInterval = style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, nullptr, this);
d->spinClickThresholdTimerInterval =
- style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, 0, this);
+ style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, nullptr, this);
if (d->edit)
d->edit->setFrame(!style()->styleHint(QStyle::SH_SpinBox_ButtonsInsideFrame, nullptr, this));
d->stepModifier = static_cast<Qt::KeyboardModifier>(style()->styleHint(QStyle::SH_SpinBox_StepModifier, nullptr, this));
@@ -1043,7 +1043,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
steps *= 10;
if (!up)
steps *= -1;
- if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) {
+ if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, nullptr, this)) {
d->buttonState = (Keyboard | (up ? Up : Down));
}
if (d->spinClickTimerId == -1)
@@ -1421,14 +1421,14 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event)
*/
QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate()
- : edit(0), type(QVariant::Invalid), spinClickTimerId(-1),
+ : edit(nullptr), type(QVariant::Invalid), spinClickTimerId(-1),
spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1),
effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")),
cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false),
ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true),
cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue),
stepModifier(Qt::ControlModifier), acceleration(0), hoverControl(QStyle::SC_None),
- buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0), showGroupSeparator(0),
+ buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(nullptr), showGroupSeparator(0),
wheelDeltaRemainder(0)
{
}
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index 669faa92c7..c3fd37d8e9 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
void QButtonGroupPrivate::detectCheckedButton()
{
QAbstractButton *previous = checkedButton;
- checkedButton = 0;
+ checkedButton = nullptr;
if (exclusive)
return;
for (int i = 0; i < buttonList.count(); i++) {
@@ -119,7 +119,7 @@ QButtonGroup::~QButtonGroup()
{
Q_D(QButtonGroup);
for (int i = 0; i < d->buttonList.count(); ++i)
- d->buttonList.at(i)->d_func()->group = 0;
+ d->buttonList.at(i)->d_func()->group = nullptr;
}
/*!
@@ -273,7 +273,7 @@ void QButtonGroup::removeButton(QAbstractButton *button)
d->detectCheckedButton();
}
if (button->d_func()->group == this) {
- button->d_func()->group = 0;
+ button->d_func()->group = nullptr;
d->buttonList.removeAll(button);
d->mapping.remove(button);
}
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 749ae96df2..fe1133c6c7 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -559,7 +559,7 @@ void QCalendarDateValidator::setFormat(const QString &format)
separator += nextChar;
quoting = false;
} else {
- QCalendarDateSectionValidator *validator = 0;
+ QCalendarDateSectionValidator *validator = nullptr;
if (nextChar == QLatin1Char('d')) {
offset = qMin(4, countRepeat(format, pos));
validator = &m_dayValidator;
@@ -640,9 +640,9 @@ class QCalendarTextNavigator: public QObject
{
Q_OBJECT
public:
- QCalendarTextNavigator(QObject *parent = 0)
- : QObject(parent), m_dateText(0), m_dateFrame(0), m_dateValidator(0),
- m_widget(0), m_editDelay(1500), m_date(QDate::currentDate()) {}
+ QCalendarTextNavigator(QObject *parent = nullptr)
+ : QObject(parent), m_dateText(nullptr), m_dateFrame(nullptr), m_dateValidator(nullptr),
+ m_widget(nullptr), m_editDelay(1500), m_date(QDate::currentDate()) {}
QWidget *widget() const;
void setWidget(QWidget *widget);
@@ -752,9 +752,9 @@ void QCalendarTextNavigator::removeDateLabel()
m_dateFrame->hide();
m_dateFrame->deleteLater();
delete m_dateValidator;
- m_dateFrame = 0;
- m_dateText = 0;
- m_dateValidator = 0;
+ m_dateFrame = nullptr;
+ m_dateText = nullptr;
+ m_dateValidator = nullptr;
}
bool QCalendarTextNavigator::eventFilter(QObject *o, QEvent *e)
@@ -858,7 +858,7 @@ class QCalendarModel : public QAbstractTableModel
{
Q_OBJECT
public:
- QCalendarModel(QObject *parent = 0);
+ QCalendarModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &) const override
{ return RowCount + m_firstRow; }
@@ -951,7 +951,7 @@ class QCalendarView : public QTableView
{
Q_OBJECT
public:
- QCalendarView(QWidget *parent = 0);
+ QCalendarView(QWidget *parent = nullptr);
void internalUpdate() { updateGeometries(); }
void setReadOnly(bool enable);
@@ -1599,7 +1599,7 @@ class QCalendarDelegate : public QItemDelegate
{
Q_OBJECT
public:
- QCalendarDelegate(QCalendarWidgetPrivate *w, QObject *parent = 0)
+ QCalendarDelegate(QCalendarWidgetPrivate *w, QObject *parent = nullptr)
: QItemDelegate(parent), calendarWidgetPrivate(w)
{ }
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
@@ -1734,11 +1734,11 @@ void QCalendarDelegate::paintCell(QPainter *painter, const QRect &rect, QDate da
QCalendarWidgetPrivate::QCalendarWidgetPrivate()
: QWidgetPrivate()
{
- m_model = 0;
- m_view = 0;
- m_delegate = 0;
- m_selection = 0;
- m_navigator = 0;
+ m_model = nullptr;
+ m_view = nullptr;
+ m_delegate = nullptr;
+ m_selection = nullptr;
+ m_navigator = nullptr;
m_dateEditEnabled = false;
navBarVisible = true;
oldFocusPolicy = Qt::StrongFocus;
@@ -1748,7 +1748,7 @@ void QCalendarWidgetPrivate::setNavigatorEnabled(bool enable)
{
Q_Q(QCalendarWidget);
- bool navigatorEnabled = (m_navigator->widget() != 0);
+ bool navigatorEnabled = (m_navigator->widget() != nullptr);
if (enable == navigatorEnabled)
return;
@@ -1760,7 +1760,7 @@ void QCalendarWidgetPrivate::setNavigatorEnabled(bool enable)
q, SLOT(_q_editingFinished()));
m_view->installEventFilter(m_navigator);
} else {
- m_navigator->setWidget(0);
+ m_navigator->setWidget(nullptr);
q->disconnect(m_navigator, SIGNAL(dateChanged(QDate)),
q, SLOT(_q_slotChangeDate(QDate)));
q->disconnect(m_navigator, SIGNAL(editingFinished()),
@@ -1847,8 +1847,8 @@ void QCalendarWidgetPrivate::createNavigationBar(QWidget *widget)
void QCalendarWidgetPrivate::updateButtonIcons()
{
Q_Q(QCalendarWidget);
- prevMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowRight : QStyle::SP_ArrowLeft, 0, q));
- nextMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowLeft : QStyle::SP_ArrowRight, 0, q));
+ prevMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowRight : QStyle::SP_ArrowLeft, nullptr, q));
+ nextMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowLeft : QStyle::SP_ArrowRight, nullptr, q));
}
void QCalendarWidgetPrivate::updateMonthMenu()
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 3be163ff75..8c8aaf8ae3 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -764,7 +764,7 @@ QCalendarWidget *QDateTimeEdit::calendarWidget() const
{
Q_D(const QDateTimeEdit);
if (!d->calendarPopup || !(d->sections & QDateTimeParser::DateSectionMask))
- return 0;
+ return nullptr;
if (!d->monthCalendar) {
const_cast<QDateTimeEditPrivate*>(d)->initCalendarPopup();
}
@@ -1221,7 +1221,7 @@ void QDateTimeEdit::focusInEvent(QFocusEvent *event)
{
Q_D(QDateTimeEdit);
QAbstractSpinBox::focusInEvent(event);
- QString *frm = 0;
+ QString *frm = nullptr;
const int oldPos = d->edit->cursorPosition();
if (!d->formatExplicitlySet) {
if (d->displayFormat == d->defaultTimeFormat) {
@@ -1668,7 +1668,7 @@ QDateTimeEditPrivate::QDateTimeEditPrivate()
minimum = QDATETIMEEDIT_COMPAT_DATE_MIN.startOfDay();
maximum = QDATETIMEEDIT_DATE_MAX.endOfDay();
arrowState = QStyle::State_None;
- monthCalendar = 0;
+ monthCalendar = nullptr;
readLocaleSettings();
#ifdef QT_KEYPAD_NAVIGATION
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 9096ee82f6..9867cb5540 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -178,15 +178,15 @@ public:
};
QDialogButtonBoxPrivate::QDialogButtonBoxPrivate(Qt::Orientation orient)
- : orientation(orient), buttonLayout(0), internalRemove(false), center(false)
+ : orientation(orient), buttonLayout(nullptr), internalRemove(false), center(false)
{
}
void QDialogButtonBoxPrivate::initLayout()
{
Q_Q(QDialogButtonBox);
- layoutPolicy = QDialogButtonBox::ButtonLayout(q->style()->styleHint(QStyle::SH_DialogButtonLayout, 0, q));
- bool createNewLayout = buttonLayout == 0
+ layoutPolicy = QDialogButtonBox::ButtonLayout(q->style()->styleHint(QStyle::SH_DialogButtonLayout, nullptr, q));
+ bool createNewLayout = buttonLayout == nullptr
|| (orientation == Qt::Horizontal && qobject_cast<QVBoxLayout *>(buttonLayout) != 0)
|| (orientation == Qt::Vertical && qobject_cast<QHBoxLayout *>(buttonLayout) != 0);
if (createNewLayout) {
@@ -329,8 +329,8 @@ void QDialogButtonBoxPrivate::layoutButtons()
++currentLayout;
}
- QWidget *lastWidget = 0;
- q->setFocusProxy(0);
+ QWidget *lastWidget = nullptr;
+ q->setFocusProxy(nullptr);
for (int i = 0; i < buttonLayout->count(); ++i) {
QLayoutItem *item = buttonLayout->itemAt(i);
if (QWidget *widget = item->widget()) {
@@ -408,13 +408,13 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut
icon = QStyle::SP_RestoreDefaultsButton;
break;
case QDialogButtonBox::NoButton:
- return 0;
+ return nullptr;
;
}
QPushButton *button = new QPushButton(QGuiApplicationPrivate::platformTheme()->standardButtonText(sbutton), q);
QStyle *style = q->style();
- if (style->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, 0, q) && icon != 0)
- button->setIcon(style->standardIcon(QStyle::StandardPixmap(icon), 0, q));
+ if (style->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, nullptr, q) && icon != 0)
+ button->setIcon(style->standardIcon(QStyle::StandardPixmap(icon), nullptr, q));
if (style != QApplication::style()) // Propagate style
button->setStyle(style);
standardButtonHash.insert(button, sbutton);
@@ -743,7 +743,7 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
}
}
if (!d->internalRemove)
- button->setParent(0);
+ button->setParent(nullptr);
}
/*!
@@ -781,7 +781,7 @@ QPushButton *QDialogButtonBox::addButton(const QString &text, ButtonRole role)
Q_D(QDialogButtonBox);
if (Q_UNLIKELY(role <= InvalidRole || role >= NRoles)) {
qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
- return 0;
+ return nullptr;
}
QPushButton *button = new QPushButton(text, this);
d->addButton(button, role);
@@ -963,7 +963,7 @@ bool QDialogButtonBox::event(QEvent *event)
QList<QAbstractButton *> acceptRoleList = d->buttonLists[AcceptRole];
QPushButton *firstAcceptButton = acceptRoleList.isEmpty() ? 0 : qobject_cast<QPushButton *>(acceptRoleList.at(0));
bool hasDefault = false;
- QWidget *dialog = 0;
+ QWidget *dialog = nullptr;
QWidget *p = this;
while (p && !p->isWindow()) {
p = p->parentWidget();
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 5900326087..87f4519dd6 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -85,27 +85,27 @@ QPlaceHolderItem::QPlaceHolderItem(QWidget *w)
*/
QDockAreaLayoutItem::QDockAreaLayoutItem(QLayoutItem *_widgetItem)
- : widgetItem(_widgetItem), subinfo(0), placeHolderItem(0), pos(0), size(-1), flags(NoFlags)
+ : widgetItem(_widgetItem), subinfo(nullptr), placeHolderItem(nullptr), pos(0), size(-1), flags(NoFlags)
{
}
QDockAreaLayoutItem::QDockAreaLayoutItem(QDockAreaLayoutInfo *_subinfo)
- : widgetItem(0), subinfo(_subinfo), placeHolderItem(0), pos(0), size(-1), flags(NoFlags)
+ : widgetItem(nullptr), subinfo(_subinfo), placeHolderItem(nullptr), pos(0), size(-1), flags(NoFlags)
{
}
QDockAreaLayoutItem::QDockAreaLayoutItem(QPlaceHolderItem *_placeHolderItem)
- : widgetItem(0), subinfo(0), placeHolderItem(_placeHolderItem), pos(0), size(-1), flags(NoFlags)
+ : widgetItem(nullptr), subinfo(nullptr), placeHolderItem(_placeHolderItem), pos(0), size(-1), flags(NoFlags)
{
}
QDockAreaLayoutItem::QDockAreaLayoutItem(const QDockAreaLayoutItem &other)
- : widgetItem(other.widgetItem), subinfo(0), placeHolderItem(0), pos(other.pos),
+ : widgetItem(other.widgetItem), subinfo(nullptr), placeHolderItem(nullptr), pos(other.pos),
size(other.size), flags(other.flags)
{
- if (other.subinfo != 0)
+ if (other.subinfo != nullptr)
subinfo = new QDockAreaLayoutInfo(*other.subinfo);
- else if (other.placeHolderItem != 0)
+ else if (other.placeHolderItem != nullptr)
placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem);
}
@@ -117,16 +117,16 @@ QDockAreaLayoutItem::~QDockAreaLayoutItem()
bool QDockAreaLayoutItem::skip() const
{
- if (placeHolderItem != 0)
+ if (placeHolderItem != nullptr)
return true;
if (flags & GapItem)
return false;
- if (widgetItem != 0)
+ if (widgetItem != nullptr)
return widgetItem->isEmpty();
- if (subinfo != 0) {
+ if (subinfo != nullptr) {
for (int i = 0; i < subinfo->item_list.count(); ++i) {
if (!subinfo->item_list.at(i).skip())
return false;
@@ -140,7 +140,7 @@ QSize QDockAreaLayoutItem::minimumSize() const
{
if (widgetItem)
return widgetItem->minimumSize().grownBy(widgetItem->widget()->contentsMargins());
- if (subinfo != 0)
+ if (subinfo != nullptr)
return subinfo->minimumSize();
return QSize(0, 0);
}
@@ -149,7 +149,7 @@ QSize QDockAreaLayoutItem::maximumSize() const
{
if (widgetItem)
return widgetItem->maximumSize().grownBy(widgetItem->widget()->contentsMargins());
- if (subinfo != 0)
+ if (subinfo != nullptr)
return subinfo->maximumSize();
return QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
}
@@ -161,22 +161,22 @@ bool QDockAreaLayoutItem::hasFixedSize(Qt::Orientation o) const
bool QDockAreaLayoutItem::expansive(Qt::Orientation o) const
{
- if ((flags & GapItem) || placeHolderItem != 0)
+ if ((flags & GapItem) || placeHolderItem != nullptr)
return false;
- if (widgetItem != 0)
+ if (widgetItem != nullptr)
return ((widgetItem->expandingDirections() & o) == o);
- if (subinfo != 0)
+ if (subinfo != nullptr)
return subinfo->expansive(o);
return false;
}
QSize QDockAreaLayoutItem::sizeHint() const
{
- if (placeHolderItem != 0)
+ if (placeHolderItem != nullptr)
return QSize(0, 0);
if (widgetItem)
return widgetItem->sizeHint().grownBy(widgetItem->widget()->contentsMargins());
- if (subinfo != 0)
+ if (subinfo != nullptr)
return subinfo->sizeHint();
return QSize(-1, -1);
}
@@ -185,14 +185,14 @@ QDockAreaLayoutItem
&QDockAreaLayoutItem::operator = (const QDockAreaLayoutItem &other)
{
widgetItem = other.widgetItem;
- if (other.subinfo == 0)
- subinfo = 0;
+ if (other.subinfo == nullptr)
+ subinfo = nullptr;
else
subinfo = new QDockAreaLayoutInfo(*other.subinfo);
delete placeHolderItem;
- if (other.placeHolderItem == 0)
- placeHolderItem = 0;
+ if (other.placeHolderItem == nullptr)
+ placeHolderItem = nullptr;
else
placeHolderItem = new QPlaceHolderItem(*other.placeHolderItem);
@@ -210,7 +210,7 @@ QDockAreaLayoutItem
#if QT_CONFIG(tabbar)
static quintptr tabId(const QDockAreaLayoutItem &item)
{
- if (item.widgetItem == 0)
+ if (item.widgetItem == nullptr)
return 0;
return reinterpret_cast<quintptr>(item.widgetItem->widget());
}
@@ -219,9 +219,9 @@ static quintptr tabId(const QDockAreaLayoutItem &item)
static const int zero = 0;
QDockAreaLayoutInfo::QDockAreaLayoutInfo()
- : sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(0)
+ : sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(nullptr)
#if QT_CONFIG(tabbar)
- , tabbed(false), tabBar(0), tabBarShape(QTabBar::RoundedSouth)
+ , tabbed(false), tabBar(nullptr), tabBarShape(QTabBar::RoundedSouth)
#endif
{
}
@@ -231,7 +231,7 @@ QDockAreaLayoutInfo::QDockAreaLayoutInfo(const int *_sep, QInternal::DockPositio
QMainWindow *window)
: sep(_sep), dockPos(_dockPos), o(_o), mainWindow(window)
#if QT_CONFIG(tabbar)
- , tabbed(false), tabBar(0), tabBarShape(static_cast<QTabBar::Shape>(tbshape))
+ , tabbed(false), tabBar(nullptr), tabBarShape(static_cast<QTabBar::Shape>(tbshape))
#endif
{
#if !QT_CONFIG(tabbar)
@@ -250,7 +250,7 @@ void QDockAreaLayoutInfo::clear()
rect = QRect();
#if QT_CONFIG(tabbar)
tabbed = false;
- tabBar = 0;
+ tabBar = nullptr;
#endif
}
@@ -403,7 +403,7 @@ QSize QDockAreaLayoutInfo::sizeHint() const
int a = 0, b = 0;
int min_perp = 0;
int max_perp = QWIDGETSIZE_MAX;
- const QDockAreaLayoutItem *previous = 0;
+ const QDockAreaLayoutItem *previous = nullptr;
for (int i = 0; i < item_list.size(); ++i) {
const QDockAreaLayoutItem &item = item_list.at(i);
if (item.skip())
@@ -552,7 +552,7 @@ void QDockAreaLayoutInfo::fitItems()
int max_size = realMaxSize(*this);
int last_index = -1;
- const QDockAreaLayoutItem *previous = 0;
+ const QDockAreaLayoutItem *previous = nullptr;
for (int i = 0; i < item_list.size(); ++i) {
QDockAreaLayoutItem &item = item_list[i];
if (item.skip())
@@ -633,7 +633,7 @@ void QDockAreaLayoutInfo::fitItems()
item.size = ls.size;
item.pos = ls.pos;
- if (item.subinfo != 0) {
+ if (item.subinfo != nullptr) {
item.subinfo->rect = itemRect(i);
item.subinfo->fitItems();
}
@@ -771,7 +771,7 @@ QList<int> QDockAreaLayoutInfo::gapIndex(const QPoint& _pos,
if (item.pos + item.size < pos)
continue;
- if (item.subinfo != 0
+ if (item.subinfo != nullptr
#if QT_CONFIG(tabbar)
&& !item.subinfo->tabbed
#endif
@@ -967,7 +967,7 @@ int QDockAreaLayoutInfo::separatorMove(int index, int delta)
const int separatorSpace = item.hasFixedSize(o) ? 0 : *sep;
item.size = ls.size - separatorSpace;
item.pos = ls.pos;
- if (item.subinfo != 0) {
+ if (item.subinfo != nullptr) {
item.subinfo->rect = itemRect(i);
item.subinfo->fitItems();
}
@@ -979,7 +979,7 @@ int QDockAreaLayoutInfo::separatorMove(int index, int delta)
void QDockAreaLayoutInfo::unnest(int index)
{
QDockAreaLayoutItem &item = item_list[index];
- if (item.subinfo == 0)
+ if (item.subinfo == nullptr)
return;
if (item.subinfo->item_list.count() > 1)
return;
@@ -988,14 +988,14 @@ void QDockAreaLayoutInfo::unnest(int index)
item_list.removeAt(index);
} else if (item.subinfo->item_list.count() == 1) {
QDockAreaLayoutItem &child = item.subinfo->item_list.first();
- if (child.widgetItem != 0) {
+ if (child.widgetItem != nullptr) {
item.widgetItem = child.widgetItem;
delete item.subinfo;
- item.subinfo = 0;
- } else if (child.subinfo != 0) {
+ item.subinfo = nullptr;
+ } else if (child.subinfo != nullptr) {
QDockAreaLayoutInfo *tmp = item.subinfo;
item.subinfo = child.subinfo;
- child.subinfo = 0;
+ child.subinfo = nullptr;
tmp->item_list.clear();
delete tmp;
}
@@ -1009,7 +1009,7 @@ void QDockAreaLayoutInfo::remove(const QList<int> &path)
if (path.count() > 1) {
const int index = path.first();
QDockAreaLayoutItem &item = item_list[index];
- Q_ASSERT(item.subinfo != 0);
+ Q_ASSERT(item.subinfo != nullptr);
item.subinfo->remove(path.mid(1));
unnest(index);
} else {
@@ -1028,13 +1028,13 @@ QLayoutItem *QDockAreaLayoutInfo::plug(const QList<int> &path)
if (path.count() > 1) {
QDockAreaLayoutItem &item = item_list[index];
- Q_ASSERT(item.subinfo != 0);
+ Q_ASSERT(item.subinfo != nullptr);
return item.subinfo->plug(path.mid(1));
}
QDockAreaLayoutItem &item = item_list[index];
- Q_ASSERT(item.widgetItem != 0);
+ Q_ASSERT(item.widgetItem != nullptr);
Q_ASSERT(item.flags & QDockAreaLayoutItem::GapItem);
item.flags &= ~QDockAreaLayoutItem::GapItem;
return item.widgetItem;
@@ -1047,7 +1047,7 @@ QLayoutItem *QDockAreaLayoutInfo::unplug(const QList<int> &path)
const int index = path.first();
if (path.count() > 1) {
QDockAreaLayoutItem &item = item_list[index];
- Q_ASSERT(item.subinfo != 0);
+ Q_ASSERT(item.subinfo != nullptr);
return item.subinfo->unplug(path.mid(1));
}
@@ -1078,7 +1078,7 @@ QLayoutItem *QDockAreaLayoutInfo::unplug(const QList<int> &path)
quintptr QDockAreaLayoutInfo::currentTabId() const
{
- if (!tabbed || tabBar == 0)
+ if (!tabbed || tabBar == nullptr)
return 0;
int index = tabBar->currentIndex();
@@ -1095,7 +1095,7 @@ void QDockAreaLayoutInfo::setCurrentTab(QWidget *widget)
void QDockAreaLayoutInfo::setCurrentTabId(quintptr id)
{
- if (!tabbed || tabBar == 0)
+ if (!tabbed || tabBar == nullptr)
return;
for (int i = 0; i < tabBar->count(); ++i) {
@@ -1114,7 +1114,7 @@ static QRect dockedGeometry(QWidget *widget)
QDockWidgetLayout *layout
= qobject_cast<QDockWidgetLayout*>(widget->layout());
- if(layout != 0 && layout->nativeWindowDeco())
+ if (layout && layout->nativeWindowDeco())
titleHeight = layout->titleHeight();
QRect result = widget->geometry();
@@ -1138,7 +1138,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
if (path.count() > 1) {
QDockAreaLayoutItem &item = item_list[index];
- if (item.subinfo == 0
+ if (item.subinfo == nullptr
#if QT_CONFIG(tabbar)
|| (item.subinfo->tabbed && !insert_tabbed)
#endif
@@ -1149,7 +1149,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
QDockAreaLayoutInfo *subinfo = item.subinfo;
QLayoutItem *widgetItem = item.widgetItem;
QPlaceHolderItem *placeHolderItem = item.placeHolderItem;
- QRect r = subinfo == 0 ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect;
+ QRect r = subinfo == nullptr ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect;
Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal;
#if !QT_CONFIG(tabbar)
@@ -1160,11 +1160,11 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
//item become a new top-level
item.subinfo = new_info;
- item.widgetItem = 0;
- item.placeHolderItem = 0;
+ item.widgetItem = nullptr;
+ item.placeHolderItem = nullptr;
QDockAreaLayoutItem new_item
- = widgetItem == 0
+ = widgetItem == nullptr
? QDockAreaLayoutItem(subinfo)
: widgetItem ? QDockAreaLayoutItem(widgetItem) : QDockAreaLayoutItem(placeHolderItem);
new_item.size = pick(opposite, r.size());
@@ -1265,16 +1265,16 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(QWidget *widget)
return this;
#endif
- if (item.widgetItem != 0 && item.widgetItem->widget() == widget)
+ if (item.widgetItem != nullptr && item.widgetItem->widget() == widget)
return this;
- if (item.subinfo != 0) {
+ if (item.subinfo != nullptr) {
if (QDockAreaLayoutInfo *result = item.subinfo->info(widget))
return result;
}
}
- return 0;
+ return nullptr;
}
QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList<int> &path)
@@ -1284,7 +1284,7 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList<int> &path)
index = -index - 1;
if (index >= item_list.count())
return this;
- if (path.count() == 1 || item_list[index].subinfo == 0)
+ if (path.count() == 1 || item_list[index].subinfo == nullptr)
return this;
return item_list[index].subinfo->info(path.mid(1));
}
@@ -1341,7 +1341,7 @@ QRect QDockAreaLayoutInfo::itemRect(const QList<int> &path) const
const int index = path.first();
if (path.count() > 1) {
const QDockAreaLayoutItem &item = item_list.at(index);
- Q_ASSERT(item.subinfo != 0);
+ Q_ASSERT(item.subinfo != nullptr);
return item.subinfo->itemRect(path.mid(1));
}
@@ -1374,7 +1374,7 @@ QRect QDockAreaLayoutInfo::separatorRect(const QList<int> &path) const
const int index = path.first();
if (path.count() > 1) {
const QDockAreaLayoutItem &item = item_list.at(index);
- Q_ASSERT(item.subinfo != 0);
+ Q_ASSERT(item.subinfo != nullptr);
return item.subinfo->separatorRect(path.mid(1));
}
return separatorRect(index);
@@ -1395,7 +1395,7 @@ QList<int> QDockAreaLayoutInfo::findSeparator(const QPoint &_pos) const
continue;
if (item.pos + item.size > pos) {
- if (item.subinfo != 0) {
+ if (item.subinfo != nullptr) {
QList<int> result = item.subinfo->findSeparator(_pos);
if (!result.isEmpty()) {
result.prepend(i);
@@ -1428,7 +1428,7 @@ QList<int> QDockAreaLayoutInfo::indexOfPlaceHolder(const QString &objectName) co
for (int i = 0; i < item_list.size(); ++i) {
const QDockAreaLayoutItem &item = item_list.at(i);
- if (item.subinfo != 0) {
+ if (item.subinfo != nullptr) {
QList<int> result = item.subinfo->indexOfPlaceHolder(objectName);
if (!result.isEmpty()) {
result.prepend(i);
@@ -1437,7 +1437,7 @@ QList<int> QDockAreaLayoutInfo::indexOfPlaceHolder(const QString &objectName) co
continue;
}
- if (item.placeHolderItem != 0 && item.placeHolderItem->objectName == objectName) {
+ if (item.placeHolderItem != nullptr && item.placeHolderItem->objectName == objectName) {
QList<int> result;
result << i;
return result;
@@ -1452,10 +1452,10 @@ QList<int> QDockAreaLayoutInfo::indexOf(QWidget *widget) const
for (int i = 0; i < item_list.size(); ++i) {
const QDockAreaLayoutItem &item = item_list.at(i);
- if (item.placeHolderItem != 0)
+ if (item.placeHolderItem != nullptr)
continue;
- if (item.subinfo != 0) {
+ if (item.subinfo != nullptr) {
QList<int> result = item.subinfo->indexOf(widget);
if (!result.isEmpty()) {
result.prepend(i);
@@ -1477,7 +1477,7 @@ QList<int> QDockAreaLayoutInfo::indexOf(QWidget *widget) const
QMainWindowLayout *QDockAreaLayoutInfo::mainWindowLayout() const
{
QMainWindowLayout *result = qt_mainwindow_layout(mainWindow);
- Q_ASSERT(result != 0);
+ Q_ASSERT(result != nullptr);
return result;
}
@@ -1536,7 +1536,7 @@ QDockWidget *QDockAreaLayoutInfo::apply(bool animate)
if (item.flags & QDockAreaLayoutItem::GapItem)
continue;
- if (item.subinfo != 0) {
+ if (item.subinfo != nullptr) {
item.subinfo->apply(animate);
continue;
}
@@ -1681,7 +1681,7 @@ void QDockAreaLayoutInfo::tab(int index, QLayoutItem *dockWidgetItem)
= new QDockAreaLayoutInfo(sep, dockPos, o, tabBarShape, mainWindow);
item_list[index].subinfo = new_info;
new_info->item_list.append(QDockAreaLayoutItem(item_list.at(index).widgetItem));
- item_list[index].widgetItem = 0;
+ item_list[index].widgetItem = nullptr;
new_info->item_list.append(QDockAreaLayoutItem(dockWidgetItem));
new_info->tabbed = true;
new_info->updateTabBar();
@@ -1703,7 +1703,7 @@ void QDockAreaLayoutInfo::split(int index, Qt::Orientation orientation,
= new QDockAreaLayoutInfo(sep, dockPos, orientation, tabBarShape, mainWindow);
item_list[index].subinfo = new_info;
new_info->item_list.append(QDockAreaLayoutItem(item_list.at(index).widgetItem));
- item_list[index].widgetItem = 0;
+ item_list[index].widgetItem = nullptr;
new_info->item_list.append(QDockAreaLayoutItem(dockWidgetItem));
}
}
@@ -1714,7 +1714,7 @@ QDockAreaLayoutItem &QDockAreaLayoutInfo::item(const QList<int> &path)
const int index = path.first();
if (path.count() > 1) {
const QDockAreaLayoutItem &item = item_list[index];
- Q_ASSERT(item.subinfo != 0);
+ Q_ASSERT(item.subinfo != nullptr);
return item.subinfo->item(path.mid(1));
}
return item_list[index];
@@ -1724,7 +1724,7 @@ QLayoutItem *QDockAreaLayoutInfo::itemAt(int *x, int index) const
{
for (int i = 0; i < item_list.count(); ++i) {
const QDockAreaLayoutItem &item = item_list.at(i);
- if (item.placeHolderItem != 0)
+ if (item.placeHolderItem != nullptr)
continue;
if (item.subinfo) {
if (QLayoutItem *ret = item.subinfo->itemAt(x, index))
@@ -1734,14 +1734,14 @@ QLayoutItem *QDockAreaLayoutInfo::itemAt(int *x, int index) const
return item.widgetItem;
}
}
- return 0;
+ return nullptr;
}
QLayoutItem *QDockAreaLayoutInfo::takeAt(int *x, int index)
{
for (int i = 0; i < item_list.count(); ++i) {
QDockAreaLayoutItem &item = item_list[i];
- if (item.placeHolderItem != 0)
+ if (item.placeHolderItem != nullptr)
continue;
else if (item.subinfo) {
if (QLayoutItem *ret = item.subinfo->takeAt(x, index)) {
@@ -1752,14 +1752,14 @@ QLayoutItem *QDockAreaLayoutInfo::takeAt(int *x, int index)
if ((*x)++ == index) {
item.placeHolderItem = new QPlaceHolderItem(item.widgetItem->widget());
QLayoutItem *ret = item.widgetItem;
- item.widgetItem = 0;
+ item.widgetItem = nullptr;
if (item.size != -1)
item.flags |= QDockAreaLayoutItem::KeepSize;
return ret;
}
}
}
- return 0;
+ return nullptr;
}
void QDockAreaLayoutInfo::deleteAllLayoutItems()
@@ -1770,7 +1770,7 @@ void QDockAreaLayoutInfo::deleteAllLayoutItems()
item.subinfo->deleteAllLayoutItems();
} else {
delete item.widgetItem;
- item.widgetItem = 0;
+ item.widgetItem = nullptr;
}
}
}
@@ -1801,7 +1801,7 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const
for (int i = 0; i < item_list.count(); ++i) {
const QDockAreaLayoutItem &item = item_list.at(i);
- if (item.widgetItem != 0) {
+ if (item.widgetItem != nullptr) {
stream << (uchar) WidgetMarker;
QWidget *w = item.widgetItem->widget();
QString name = w->objectName();
@@ -1825,7 +1825,7 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const
stream << item.pos << item.size << pick(o, item.minimumSize())
<< pick(o, item.maximumSize());
}
- } else if (item.placeHolderItem != 0) {
+ } else if (item.placeHolderItem != nullptr) {
stream << (uchar) WidgetMarker;
stream << item.placeHolderItem->objectName;
uchar flags = 0;
@@ -1840,7 +1840,7 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const
} else {
stream << item.pos << item.size << (int)0 << (int)0;
}
- } else if (item.subinfo != 0) {
+ } else if (item.subinfo != nullptr) {
stream << (uchar) SequenceMarker << item.pos << item.size << pick(o, item.minimumSize()) << pick(o, item.maximumSize());
item.subinfo->saveState(stream);
}
@@ -1894,7 +1894,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
continue;
}
- QDockWidget *widget = 0;
+ QDockWidget *widget = nullptr;
for (int j = 0; j < widgets.count(); ++j) {
if (widgets.at(j)->objectName() == name) {
widget = widgets.takeAt(j);
@@ -1902,7 +1902,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
}
}
- if (widget == 0) {
+ if (widget == nullptr) {
QPlaceHolderItem *placeHolder = new QPlaceHolderItem;
QDockAreaLayoutItem item(placeHolder);
@@ -2081,7 +2081,7 @@ bool QDockAreaLayoutInfo::updateTabBar() const
QDockAreaLayoutInfo *that = const_cast<QDockAreaLayoutInfo*>(this);
- if (that->tabBar == 0) {
+ if (that->tabBar == nullptr) {
that->tabBar = mainWindowLayout()->getTabBar();
that->tabBar->setShape(static_cast<QTabBar::Shape>(tabBarShape));
that->tabBar->setDrawBase(true);
@@ -2101,7 +2101,7 @@ bool QDockAreaLayoutInfo::updateTabBar() const
gap = true;
continue;
}
- if (item.widgetItem == 0)
+ if (item.widgetItem == nullptr)
continue;
QDockWidget *dw = qobject_cast<QDockWidget*>(item.widgetItem->widget());
@@ -2155,12 +2155,12 @@ void QDockAreaLayoutInfo::setTabBarShape(int shape)
if (shape == tabBarShape)
return;
tabBarShape = shape;
- if (tabBar != 0)
+ if (tabBar != nullptr)
tabBar->setShape(static_cast<QTabBar::Shape>(shape));
for (int i = 0; i < item_list.count(); ++i) {
QDockAreaLayoutItem &item = item_list[i];
- if (item.subinfo != 0)
+ if (item.subinfo != nullptr)
item.subinfo->setTabBarShape(shape);
}
}
@@ -2192,7 +2192,7 @@ QSet<QTabBar*> QDockAreaLayoutInfo::usedTabBars() const
for (int i = 0; i < item_list.count(); ++i) {
const QDockAreaLayoutItem &item = item_list.at(i);
- if (item.subinfo != 0)
+ if (item.subinfo != nullptr)
result += item.subinfo->usedTabBars();
}
@@ -2212,7 +2212,7 @@ QSet<QWidget*> QDockAreaLayoutInfo::usedSeparatorWidgets() const
for (int i = 0; i < item_list.count(); ++i) {
const QDockAreaLayoutItem &item = item_list.at(i);
- if (item.subinfo != 0)
+ if (item.subinfo != nullptr)
result += item.subinfo->usedSeparatorWidgets();
}
@@ -2277,7 +2277,7 @@ void QDockAreaLayoutInfo::moveTab(int from, int to)
QDockAreaLayout::QDockAreaLayout(QMainWindow *win) : fallbackToSizeHints(true)
{
mainWindow = win;
- sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, win);
+ sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, nullptr, win);
#if QT_CONFIG(tabbar)
const int tabShape = QTabBar::RoundedSouth;
#else
@@ -2291,7 +2291,7 @@ QDockAreaLayout::QDockAreaLayout(QMainWindow *win) : fallbackToSizeHints(true)
= QDockAreaLayoutInfo(&sep, QInternal::TopDock, Qt::Horizontal, tabShape, win);
docks[QInternal::BottomDock]
= QDockAreaLayoutInfo(&sep, QInternal::BottomDock, Qt::Horizontal, tabShape, win);
- centralWidgetItem = 0;
+ centralWidgetItem = nullptr;
corners[Qt::TopLeftCorner] = Qt::TopDockWidgetArea;
@@ -2491,7 +2491,7 @@ QDockAreaLayoutInfo *QDockAreaLayout::info(QWidget *widget)
return result;
}
- return 0;
+ return nullptr;
}
QDockAreaLayoutInfo *QDockAreaLayout::info(const QList<int> &path)
@@ -2623,7 +2623,7 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
QSize center_hint(0, 0);
QSize center_min(0, 0);
QSize center_max(0, 0);
- const bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty();
+ const bool have_central = centralWidgetItem != nullptr && !centralWidgetItem->isEmpty();
if (have_central) {
center_hint = centralWidgetRect.size();
if (!center_hint.isValid())
@@ -2670,7 +2670,7 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
QSize bottom_max = docks[QInternal::BottomDock].maximumSize();
bottom_hint = bottom_hint.boundedTo(bottom_max).expandedTo(bottom_min);
- if (_ver_struct_list != 0) {
+ if (_ver_struct_list != nullptr) {
QVector<QLayoutStruct> &ver_struct_list = *_ver_struct_list;
ver_struct_list.resize(3);
@@ -2732,7 +2732,7 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
ver_struct_list[1].maximumSize = QWIDGETSIZE_MAX;
}
- if (_hor_struct_list != 0) {
+ if (_hor_struct_list != nullptr) {
QVector<QLayoutStruct> &hor_struct_list = *_hor_struct_list;
hor_struct_list.resize(3);
@@ -2803,7 +2803,7 @@ void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,
if (!docks[QInternal::TopDock].isEmpty()) {
QRect r = docks[QInternal::TopDock].rect;
- if (hor_struct_list != 0) {
+ if (hor_struct_list != nullptr) {
r.setLeft(corners[Qt::TopLeftCorner] == Qt::TopDockWidgetArea
|| docks[QInternal::LeftDock].isEmpty()
? rect.left() : hor_struct_list->at(1).pos);
@@ -2811,7 +2811,7 @@ void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,
|| docks[QInternal::RightDock].isEmpty()
? rect.right() : hor_struct_list->at(2).pos - sep - 1);
}
- if (ver_struct_list != 0) {
+ if (ver_struct_list != nullptr) {
r.setTop(rect.top());
r.setBottom(ver_struct_list->at(1).pos - sep - 1);
}
@@ -2823,7 +2823,7 @@ void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,
if (!docks[QInternal::BottomDock].isEmpty()) {
QRect r = docks[QInternal::BottomDock].rect;
- if (hor_struct_list != 0) {
+ if (hor_struct_list != nullptr) {
r.setLeft(corners[Qt::BottomLeftCorner] == Qt::BottomDockWidgetArea
|| docks[QInternal::LeftDock].isEmpty()
? rect.left() : hor_struct_list->at(1).pos);
@@ -2831,7 +2831,7 @@ void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,
|| docks[QInternal::RightDock].isEmpty()
? rect.right() : hor_struct_list->at(2).pos - sep - 1);
}
- if (ver_struct_list != 0) {
+ if (ver_struct_list != nullptr) {
r.setTop(ver_struct_list->at(2).pos);
r.setBottom(rect.bottom());
}
@@ -2843,11 +2843,11 @@ void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,
if (!docks[QInternal::LeftDock].isEmpty()) {
QRect r = docks[QInternal::LeftDock].rect;
- if (hor_struct_list != 0) {
+ if (hor_struct_list != nullptr) {
r.setLeft(rect.left());
r.setRight(hor_struct_list->at(1).pos - sep - 1);
}
- if (ver_struct_list != 0) {
+ if (ver_struct_list != nullptr) {
r.setTop(corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea
|| docks[QInternal::TopDock].isEmpty()
? rect.top() : ver_struct_list->at(1).pos);
@@ -2863,11 +2863,11 @@ void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,
if (!docks[QInternal::RightDock].isEmpty()) {
QRect r = docks[QInternal::RightDock].rect;
- if (hor_struct_list != 0) {
+ if (hor_struct_list != nullptr) {
r.setLeft(hor_struct_list->at(2).pos);
r.setRight(rect.right());
}
- if (ver_struct_list != 0) {
+ if (ver_struct_list != nullptr) {
r.setTop(corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea
|| docks[QInternal::TopDock].isEmpty()
? rect.top() : ver_struct_list->at(1).pos);
@@ -2881,11 +2881,11 @@ void QDockAreaLayout::setGrid(QVector<QLayoutStruct> *ver_struct_list,
// center ---------------------------------------------------
- if (hor_struct_list != 0) {
+ if (hor_struct_list != nullptr) {
centralWidgetRect.setLeft(hor_struct_list->at(1).pos);
centralWidgetRect.setWidth(hor_struct_list->at(1).size);
}
- if (ver_struct_list != 0) {
+ if (ver_struct_list != nullptr) {
centralWidgetRect.setTop(ver_struct_list->at(1).pos);
centralWidgetRect.setHeight(ver_struct_list->at(1).size);
}
@@ -2919,7 +2919,7 @@ QSize QDockAreaLayout::sizeHint() const
int top_sep = 0;
int bottom_sep = 0;
- if (centralWidgetItem != 0) {
+ if (centralWidgetItem != nullptr) {
left_sep = docks[QInternal::LeftDock].isEmpty() ? 0 : sep;
right_sep = docks[QInternal::RightDock].isEmpty() ? 0 : sep;
top_sep = docks[QInternal::TopDock].isEmpty() ? 0 : sep;
@@ -2930,7 +2930,7 @@ QSize QDockAreaLayout::sizeHint() const
QSize right = docks[QInternal::RightDock].sizeHint() + QSize(right_sep, 0);
QSize top = docks[QInternal::TopDock].sizeHint() + QSize(0, top_sep);
QSize bottom = docks[QInternal::BottomDock].sizeHint() + QSize(0, bottom_sep);
- QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->sizeHint();
+ QSize center = centralWidgetItem == nullptr ? QSize(0, 0) : centralWidgetItem->sizeHint();
int row1 = top.width();
int row2 = left.width() + center.width() + right.width();
@@ -2969,7 +2969,7 @@ QSize QDockAreaLayout::minimumSize() const
int top_sep = 0;
int bottom_sep = 0;
- if (centralWidgetItem != 0) {
+ if (centralWidgetItem != nullptr) {
left_sep = docks[QInternal::LeftDock].isEmpty() ? 0 : sep;
right_sep = docks[QInternal::RightDock].isEmpty() ? 0 : sep;
top_sep = docks[QInternal::TopDock].isEmpty() ? 0 : sep;
@@ -2980,7 +2980,7 @@ QSize QDockAreaLayout::minimumSize() const
QSize right = docks[QInternal::RightDock].minimumSize() + QSize(right_sep, 0);
QSize top = docks[QInternal::TopDock].minimumSize() + QSize(0, top_sep);
QSize bottom = docks[QInternal::BottomDock].minimumSize() + QSize(0, bottom_sep);
- QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->minimumSize();
+ QSize center = centralWidgetItem == nullptr ? QSize(0, 0) : centralWidgetItem->minimumSize();
int row1 = top.width();
int row2 = left.width() + center.width() + right.width();
@@ -3040,7 +3040,7 @@ QRect QDockAreaLayout::constrainedRect(QRect rect, QWidget* widget)
bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget)
{
- QDockAreaLayoutItem *item = 0;
+ QDockAreaLayoutItem *item = nullptr;
const auto groups =
mainWindow->findChildren<QDockWidgetGroupWindow *>(QString(), Qt::FindDirectChildrenOnly);
for (QDockWidgetGroupWindow *dwgw : groups) {
@@ -3059,7 +3059,7 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget)
}
QPlaceHolderItem *placeHolder = item->placeHolderItem;
- Q_ASSERT(placeHolder != 0);
+ Q_ASSERT(placeHolder != nullptr);
item->widgetItem = new QDockWidgetItem(dockWidget);
@@ -3069,7 +3069,7 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget)
}
dockWidget->setVisible(!placeHolder->hidden);
- item->placeHolderItem = 0;
+ item->placeHolderItem = nullptr;
delete placeHolder;
return true;
@@ -3116,7 +3116,7 @@ void QDockAreaLayout::tabifyDockWidget(QDockWidget *first, QDockWidget *second)
return;
QDockAreaLayoutInfo *info = this->info(path);
- Q_ASSERT(info != 0);
+ Q_ASSERT(info != nullptr);
info->tab(path.last(), new QDockWidgetItem(second));
removePlaceHolder(second->objectName());
@@ -3181,7 +3181,7 @@ void QDockAreaLayout::splitDockWidget(QDockWidget *after,
return;
QDockAreaLayoutInfo *info = this->info(path);
- Q_ASSERT(info != 0);
+ Q_ASSERT(info != nullptr);
info->split(path.last(), orientation, new QDockWidgetItem(dockWidget));
removePlaceHolder(dockWidget->objectName());
@@ -3193,7 +3193,7 @@ void QDockAreaLayout::apply(bool animate)
for (int i = 0; i < QInternal::DockCount; ++i)
docks[i].apply(animate);
- if (centralWidgetItem != 0 && !centralWidgetItem->isEmpty()) {
+ if (centralWidgetItem != nullptr && !centralWidgetItem->isEmpty()) {
widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect,
animate);
}
@@ -3255,9 +3255,9 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or
QVector<QLayoutStruct> list;
if (index == QInternal::LeftDock || index == QInternal::RightDock)
- getGrid(0, &list);
+ getGrid(nullptr, &list);
else
- getGrid(&list, 0);
+ getGrid(&list, nullptr);
int sep_index = index == QInternal::LeftDock || index == QInternal::TopDock
? 0 : 1;
@@ -3271,9 +3271,9 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or
fallbackToSizeHints = false;
if (index == QInternal::LeftDock || index == QInternal::RightDock)
- setGrid(0, &list);
+ setGrid(nullptr, &list);
else
- setGrid(&list, 0);
+ setGrid(&list, nullptr);
apply(false);
@@ -3330,7 +3330,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const
QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const
{
- Q_ASSERT(x != 0);
+ Q_ASSERT(x != nullptr);
for (int i = 0; i < QInternal::DockCount; ++i) {
const QDockAreaLayoutInfo &dock = docks[i];
@@ -3341,12 +3341,12 @@ QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const
if (centralWidgetItem && (*x)++ == index)
return centralWidgetItem;
- return 0;
+ return nullptr;
}
QLayoutItem *QDockAreaLayout::takeAt(int *x, int index)
{
- Q_ASSERT(x != 0);
+ Q_ASSERT(x != nullptr);
for (int i = 0; i < QInternal::DockCount; ++i) {
QDockAreaLayoutInfo &dock = docks[i];
@@ -3356,11 +3356,11 @@ QLayoutItem *QDockAreaLayout::takeAt(int *x, int index)
if (centralWidgetItem && (*x)++ == index) {
QLayoutItem *ret = centralWidgetItem;
- centralWidgetItem = 0;
+ centralWidgetItem = nullptr;
return ret;
}
- return 0;
+ return nullptr;
}
void QDockAreaLayout::deleteAllLayoutItems()
@@ -3399,7 +3399,7 @@ QSet<QWidget*> QDockAreaLayout::usedSeparatorWidgets() const
QRect QDockAreaLayout::gapRect(const QList<int> &path) const
{
const QDockAreaLayoutInfo *info = this->info(path);
- if (info == 0)
+ if (info == nullptr)
return QRect();
int index = path.last();
if (index < 0 || index >= info->item_list.count())
@@ -3419,7 +3419,7 @@ void QDockAreaLayout::keepSize(QDockWidget *w)
void QDockAreaLayout::styleChangedEvent()
{
- sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainWindow);
+ sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, nullptr, mainWindow);
if (isValid())
fitLayout();
}
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index bcbd3dd2d4..299e5da8d3 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -197,7 +197,7 @@ QSize QDockWidgetTitleButton::sizeHint() const
{
ensurePolished();
- int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this);
+ int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, nullptr, this);
if (!icon().isNull()) {
const QSize sz = icon().actualSize(dockButtonIconSize());
size += qMax(sz.width(), sz.height());
@@ -226,7 +226,7 @@ void QDockWidgetTitleButton::paintEvent(QPaintEvent *)
opt.init(this);
opt.state |= QStyle::State_AutoRaise;
- if (style()->styleHint(QStyle::SH_DockWidget_ButtonsHaveFrame, 0, this))
+ if (style()->styleHint(QStyle::SH_DockWidget_ButtonsHaveFrame, nullptr, this))
{
if (isEnabled() && underMouse() && !isChecked() && !isDown())
opt.state |= QStyle::State_Raised;
@@ -311,12 +311,12 @@ QLayoutItem *QDockWidgetLayout::itemAt(int index) const
int cnt = 0;
for (int i = 0; i < item_list.count(); ++i) {
QLayoutItem *item = item_list.at(i);
- if (item == 0)
+ if (item == nullptr)
continue;
if (index == cnt++)
return item;
}
- return 0;
+ return nullptr;
}
QLayoutItem *QDockWidgetLayout::takeAt(int index)
@@ -324,7 +324,7 @@ QLayoutItem *QDockWidgetLayout::takeAt(int index)
int j = 0;
for (int i = 0; i < item_list.count(); ++i) {
QLayoutItem *item = item_list.at(i);
- if (item == 0)
+ if (item == nullptr)
continue;
if (index == j) {
item_list[i] = 0;
@@ -333,7 +333,7 @@ QLayoutItem *QDockWidgetLayout::takeAt(int index)
}
++j;
}
- return 0;
+ return nullptr;
}
int QDockWidgetLayout::count() const
@@ -362,7 +362,7 @@ QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) co
const bool nativeDeco = nativeWindowDeco(floating);
int fw = floating && !nativeDeco
- ? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, w)
+ ? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, w)
: 0;
const int th = titleHeight();
@@ -394,7 +394,7 @@ QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) co
uint explicitMin = 0;
uint explicitMax = 0;
- if (w->d_func()->extra != 0) {
+ if (w->d_func()->extra != nullptr) {
explicitMin = w->d_func()->extra->explicitMinSize;
explicitMax = w->d_func()->extra->explicitMaxSize;
}
@@ -448,7 +448,7 @@ QSize QDockWidgetLayout::minimumSize() const
QWidget *QDockWidgetLayout::widgetForRole(Role r) const
{
QLayoutItem *item = item_list.at(r);
- return item == 0 ? 0 : item->widget();
+ return item == nullptr ? nullptr : item->widget();
}
QLayoutItem *QDockWidgetLayout::itemForRole(Role r) const
@@ -459,12 +459,12 @@ QLayoutItem *QDockWidgetLayout::itemForRole(Role r) const
void QDockWidgetLayout::setWidgetForRole(Role r, QWidget *w)
{
QWidget *old = widgetForRole(r);
- if (old != 0) {
+ if (old != nullptr) {
old->hide();
removeWidget(old);
}
- if (w != 0) {
+ if (w != nullptr) {
addChildWidget(w);
item_list[r] = new QWidgetItemV2(w);
w->show();
@@ -505,8 +505,8 @@ int QDockWidgetLayout::minimumTitleWidth() const
int titleHeight = this->titleHeight();
- int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
- int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q);
+ int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, nullptr, q);
+ int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q);
return pick(verticalTitleBar, closeSize)
+ pick(verticalTitleBar, floatSize)
@@ -531,7 +531,7 @@ int QDockWidgetLayout::titleHeight() const
perp(verticalTitleBar, floatSize));
QFontMetrics titleFontMetrics = q->fontMetrics();
- int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
+ int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, nullptr, q);
return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw);
}
@@ -543,7 +543,7 @@ void QDockWidgetLayout::setGeometry(const QRect &geometry)
bool nativeDeco = nativeWindowDeco();
int fw = q->isFloating() && !nativeDeco
- ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q)
+ ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q)
: 0;
if (nativeDeco) {
@@ -730,7 +730,7 @@ void QDockWidgetPrivate::updateButtons()
QStyleOptionDockWidget opt;
q->initStyleOption(&opt);
- bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0;
+ bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != nullptr;
bool nativeDeco = dwLayout->nativeWindowDeco();
bool hideButtons = nativeDeco || customTitleBar;
@@ -777,18 +777,18 @@ void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca)
{
Q_Q(QDockWidget);
- if (state != 0)
+ if (state != nullptr)
return;
QMainWindowLayout *layout = qt_mainwindow_layout_from_dock(q);
- Q_ASSERT(layout != 0);
- if (layout->pluggingWidget != 0) // the main window is animating a docking operation
+ Q_ASSERT(layout != nullptr);
+ if (layout->pluggingWidget != nullptr) // the main window is animating a docking operation
return;
state = new QDockWidgetPrivate::DragState;
state->pressPos = pos;
state->dragging = false;
- state->widgetItem = 0;
+ state->widgetItem = nullptr;
state->ownWidgetItem = false;
state->nca = nca;
state->ctrlDrag = false;
@@ -804,14 +804,14 @@ void QDockWidgetPrivate::startDrag(bool group)
{
Q_Q(QDockWidget);
- if (state == 0 || state->dragging)
+ if (state == nullptr || state->dragging)
return;
QMainWindowLayout *layout = qt_mainwindow_layout_from_dock(q);
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
state->widgetItem = layout->unplug(q, group);
- if (state->widgetItem == 0) {
+ if (state->widgetItem == nullptr) {
/* I have a QMainWindow parent, but I was never inserted with
QMainWindow::addDockWidget, so the QMainWindowLayout has no
widget item for me. :( I have to create it myself, and then
@@ -838,7 +838,7 @@ void QDockWidgetPrivate::startDrag(bool group)
void QDockWidgetPrivate::endDrag(bool abort)
{
Q_Q(QDockWidget);
- Q_ASSERT(state != 0);
+ Q_ASSERT(state != nullptr);
q->releaseMouse();
@@ -881,7 +881,7 @@ void QDockWidgetPrivate::endDrag(bool abort)
}
}
delete state;
- state = 0;
+ state = nullptr;
}
void QDockWidgetPrivate::setResizerActive(bool active)
@@ -900,7 +900,7 @@ bool QDockWidgetPrivate::isAnimating() const
Q_Q(const QDockWidget);
QMainWindowLayout *mainWinLayout = qt_mainwindow_layout_from_dock(q);
- if (mainWinLayout == 0)
+ if (mainWinLayout == nullptr)
return false;
return (const void*)mainWinLayout->pluggingWidget == (const void*)q;
@@ -925,7 +925,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
// is not (but allow moving if the window is floating)
(!hasFeature(this, QDockWidget::DockWidgetMovable) && !q->isFloating()) ||
(qobject_cast<QMainWindow*>(parent) == 0 && !floatingTab) ||
- isAnimating() || state != 0) {
+ isAnimating() || state != nullptr) {
return false;
}
@@ -972,7 +972,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
QMainWindowLayout *mwlayout = qt_mainwindow_layout_from_dock(q);
if (!dwlayout->nativeWindowDeco()) {
if (!state->dragging
- && mwlayout->pluggingWidget == 0
+ && mwlayout->pluggingWidget == nullptr
&& (event->pos() - state->pressPos).manhattanLength()
> QApplication::startDragDistance()) {
startDrag();
@@ -1019,7 +1019,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
{
Q_Q(QDockWidget);
- int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q);
+ int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q);
QWidget *tl = q->topLevelWidget();
QRect geo = tl->geometry();
@@ -1035,21 +1035,21 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
case QEvent::NonClientAreaMouseButtonPress:
if (!titleRect.contains(event->globalPos()))
break;
- if (state != 0)
+ if (state != nullptr)
break;
if (qobject_cast<QMainWindow*>(parent) == 0 && qobject_cast<QDockWidgetGroupWindow*>(parent) == 0)
break;
if (isAnimating())
break;
initDrag(event->pos(), true);
- if (state == 0)
+ if (state == nullptr)
break;
state->ctrlDrag = (event->modifiers() & Qt::ControlModifier) ||
(!hasFeature(this, QDockWidget::DockWidgetMovable) && q->isFloating());
startDrag();
break;
case QEvent::NonClientAreaMouseMove:
- if (state == 0 || !state->dragging)
+ if (state == nullptr || !state->dragging)
break;
#ifndef Q_OS_MAC
@@ -1085,7 +1085,7 @@ void QDockWidgetPrivate::moveEvent(QMoveEvent *event)
{
Q_Q(QDockWidget);
- if (state == 0 || !state->dragging || !state->nca)
+ if (state == nullptr || !state->dragging || !state->nca)
return;
if (!q->isWindow() && qobject_cast<QDockWidgetGroupWindow*>(parent) == 0)
@@ -1098,7 +1098,7 @@ void QDockWidgetPrivate::moveEvent(QMoveEvent *event)
return;
QMainWindowLayout *layout = qt_mainwindow_layout_from_dock(q);
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
QPoint globalMousePos = event->pos() + state->pressPos;
layout->hover(state->widgetItem, globalMousePos);
@@ -1384,7 +1384,7 @@ void QDockWidget::setFloating(bool floating)
Q_D(QDockWidget);
// the initial click of a double-click may have started a drag...
- if (d->state != 0)
+ if (d->state != nullptr)
d->endDrag(true);
QRect r = d->undockedGeometry;
@@ -1479,7 +1479,7 @@ void QDockWidget::paintEvent(QPaintEvent *event)
QDockWidgetLayout *layout
= qobject_cast<QDockWidgetLayout*>(this->layout());
- bool customTitleBar = layout->widgetForRole(QDockWidgetLayout::TitleBar) != 0;
+ bool customTitleBar = layout->widgetForRole(QDockWidgetLayout::TitleBar) != nullptr;
bool nativeDeco = layout->nativeWindowDeco();
if (!nativeDeco && !customTitleBar) {
@@ -1516,7 +1516,7 @@ bool QDockWidget::event(QEvent *event)
switch (event->type()) {
#ifndef QT_NO_ACTION
case QEvent::Hide:
- if (layout != 0)
+ if (layout != nullptr)
layout->keepSize(this);
d->toggleViewAction->setChecked(false);
emit visibilityChanged(false);
@@ -1542,12 +1542,12 @@ bool QDockWidget::event(QEvent *event)
break;
case QEvent::ZOrderChange: {
bool onTop = false;
- if (win != 0) {
+ if (win != nullptr) {
const QObjectList &siblings = win->children();
onTop = siblings.count() > 0 && siblings.last() == (QObject*)this;
}
#if QT_CONFIG(tabbar)
- if (!isFloating() && layout != 0 && onTop)
+ if (!isFloating() && layout != nullptr && onTop)
layout->raise(this);
#endif
break;
@@ -1591,7 +1591,7 @@ bool QDockWidget::event(QEvent *event)
break;
case QEvent::Resize:
// if the mainwindow is plugging us, we don't want to update undocked geometry
- if (isFloating() && layout != 0 && layout->pluggingWidget != this)
+ if (isFloating() && layout != nullptr && layout->pluggingWidget != this)
d->undockedGeometry = geometry();
// Usually the window won't get resized while it's being moved, but it can happen,
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index e69366d7c8..ee4095cb36 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -93,7 +93,7 @@ private:
QElapsedTimer checkTime;
};
-static QAlphaWidget* q_blend = 0;
+static QAlphaWidget* q_blend = nullptr;
/*
Constructs a QAlphaWidget.
@@ -285,7 +285,7 @@ void QAlphaWidget::render()
lower();
}
}
- q_blend = 0;
+ q_blend = nullptr;
deleteLater();
} else {
alphaBlend();
@@ -377,13 +377,13 @@ private:
QPixmap pm;
};
-static QRollEffect* q_roll = 0;
+static QRollEffect* q_roll = nullptr;
/*
Construct a QRollEffect widget.
*/
QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient)
- : QWidget(0, f), orientation(orient)
+ : QWidget(nullptr, f), orientation(orient)
{
#ifndef Q_OS_WIN
setEnabled(false);
@@ -550,7 +550,7 @@ void QRollEffect::scroll()
lower();
}
}
- q_roll = 0;
+ q_roll = nullptr;
deleteLater();
}
}
@@ -563,7 +563,7 @@ void qScrollEffect(QWidget* w, QEffects::DirFlags orient, int time)
{
if (q_roll) {
q_roll->deleteLater();
- q_roll = 0;
+ q_roll = nullptr;
}
if (!w)
@@ -585,7 +585,7 @@ void qFadeEffect(QWidget* w, int time)
{
if (q_blend) {
q_blend->deleteLater();
- q_blend = 0;
+ q_blend = nullptr;
}
if (!w)
diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp
index ee24e92c7e..4d64c24db3 100644
--- a/src/widgets/widgets/qfocusframe.cpp
+++ b/src/widgets/widgets/qfocusframe.cpp
@@ -55,8 +55,8 @@ class QFocusFramePrivate : public QWidgetPrivate
bool showFrameAboveWidget;
public:
QFocusFramePrivate() {
- widget = 0;
- frameParent = 0;
+ widget = nullptr;
+ frameParent = nullptr;
sendChildEvents = false;
showFrameAboveWidget = false;
}
@@ -159,7 +159,7 @@ QFocusFrame::QFocusFrame(QWidget *parent)
setAttribute(Qt::WA_TransparentForMouseEvents);
setFocusPolicy(Qt::NoFocus);
setAttribute(Qt::WA_NoChildEventsForParent, true);
- setAttribute(Qt::WA_AcceptDrops, style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, 0, this));
+ setAttribute(Qt::WA_AcceptDrops, style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, nullptr, this));
}
/*!
@@ -184,7 +184,7 @@ QFocusFrame::setWidget(QWidget *widget)
{
Q_D(QFocusFrame);
- if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, 0, this))
+ if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, nullptr, this))
d->showFrameAboveWidget = true;
else
d->showFrameAboveWidget = false;
@@ -205,7 +205,7 @@ QFocusFrame::setWidget(QWidget *widget)
d->widget = widget;
d->widget->installEventFilter(this);
QWidget *p = widget->parentWidget();
- QWidget *prev = 0;
+ QWidget *prev = nullptr;
if (d->showFrameAboveWidget) {
// Find the right parent for the focus frame.
while (p) {
@@ -231,7 +231,7 @@ QFocusFrame::setWidget(QWidget *widget)
}
d->update();
} else {
- d->widget = 0;
+ d->widget = nullptr;
hide();
}
}
@@ -290,7 +290,7 @@ QFocusFrame::eventFilter(QObject *o, QEvent *e)
case QEvent::ParentChange:
if (d->showFrameAboveWidget) {
QWidget *w = d->widget;
- setWidget(0);
+ setWidget(nullptr);
setWidget(w);
} else {
d->update();
@@ -304,13 +304,13 @@ QFocusFrame::eventFilter(QObject *o, QEvent *e)
setPalette(d->widget->palette());
break;
case QEvent::ZOrderChange:
- if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, 0, this))
+ if (style()->styleHint(QStyle::SH_FocusFrame_AboveWidget, nullptr, this))
raise();
else
stackUnder(d->widget);
break;
case QEvent::Destroy:
- setWidget(0);
+ setWidget(nullptr);
break;
default:
break;
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index f7fe072302..048fe42948 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -424,8 +424,8 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason)
Q_Q(QGroupBox);
QWidget *fw = q->focusWidget();
if (!fw || fw == q) {
- QWidget * best = 0;
- QWidget * candidate = 0;
+ QWidget * best = nullptr;
+ QWidget * candidate = nullptr;
QWidget * w = q;
while ((w = w->nextInFocusChain()) != q) {
if (q->isAncestorOf(w) && (w->focusPolicy() & Qt::TabFocus) == Qt::TabFocus && w->isVisibleTo(q)) {
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index 282714843c..3ddada4514 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -51,7 +51,7 @@ class QLCDNumberPrivate : public QFramePrivate
public:
void init();
void internalSetString(const QString& s);
- void drawString(const QString& s, QPainter &, QBitArray * = 0, bool = true);
+ void drawString(const QString& s, QPainter &, QBitArray * = nullptr, bool = true);
//void drawString(const QString &, QPainter &, QBitArray * = 0) const;
void drawDigit(const QPoint &, QPainter &, int, char, char = ' ');
void drawSegment(const QPoint &, char, QPainter &, int, bool = false);
@@ -212,7 +212,7 @@ static QString double2string(double num, int base, int ndigits, bool *oflow)
*oflow = true;
return s;
}
- s = int2string((int)num, base, ndigits, 0);
+ s = int2string((int)num, base, ndigits, nullptr);
} else { // decimal base
int nd = ndigits;
do {
@@ -706,7 +706,7 @@ void QLCDNumber::paintEvent(QPaintEvent *)
if (d->smallPoint)
d->drawString(d->digitStr, p, &d->points, false);
else
- d->drawString(d->digitStr, p, 0, false);
+ d->drawString(d->digitStr, p, nullptr, false);
}
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index dc767cdae6..bcd6614ee4 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -446,7 +446,7 @@ void QLineEdit::addAction(QAction *action, ActionPosition position)
{
Q_D(QLineEdit);
QWidget::addAction(action);
- d->addAction(action, 0, position);
+ d->addAction(action, nullptr, position);
}
/*!
@@ -640,15 +640,15 @@ void QLineEdit::setCompleter(QCompleter *c)
if (c == d->control->completer())
return;
if (d->control->completer()) {
- disconnect(d->control->completer(), 0, this, 0);
- d->control->completer()->setWidget(0);
+ disconnect(d->control->completer(), nullptr, this, nullptr);
+ d->control->completer()->setWidget(nullptr);
if (d->control->completer()->parent() == this)
delete d->control->completer();
}
d->control->setCompleter(c);
if (!c)
return;
- if (c->widget() == 0)
+ if (c->widget() == nullptr)
c->setWidget(this);
if (hasFocus()) {
QObject::connect(d->control->completer(), SIGNAL(activated(QString)),
@@ -683,7 +683,7 @@ QSize QLineEdit::sizeHint() const
Q_D(const QLineEdit);
ensurePolished();
QFontMetrics fm(font());
- const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+ const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
const QMargins tm = d->effectiveTextMargins();
int h = qMax(fm.height(), qMax(14, iconSize - 2)) + 2 * QLineEditPrivate::verticalMargin
+ tm.top() + tm.bottom()
@@ -1951,7 +1951,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e)
#endif
#if QT_CONFIG(completer)
if (d->control->completer()) {
- QObject::disconnect(d->control->completer(), 0, this, 0);
+ QObject::disconnect(d->control->completer(), nullptr, this, nullptr);
}
#endif
QWidget::focusOutEvent(e);
@@ -2190,7 +2190,7 @@ QMenu *QLineEdit::createStandardContextMenu()
Q_D(QLineEdit);
QMenu *popup = new QMenu(this);
popup->setObjectName(QLatin1String("qt_edit_menu"));
- QAction *action = 0;
+ QAction *action = nullptr;
if (!isReadOnly()) {
action = popup->addAction(QLineEdit::tr("&Undo") + ACCEL_KEY(QKeySequence::Undo));
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index d2b5f87906..feb34ef403 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -487,7 +487,7 @@ QLineEditPrivate::SideWidgetParameters QLineEditPrivate::sideWidgetParameters()
{
Q_Q(const QLineEdit);
SideWidgetParameters result;
- result.iconSize = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
+ result.iconSize = q->style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, q);
result.margin = result.iconSize / 4;
result.widgetWidth = result.iconSize + 6;
result.widgetHeight = result.iconSize + 2;
@@ -566,12 +566,12 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
{
Q_Q(QLineEdit);
if (!newAction)
- return 0;
+ return nullptr;
if (!hasSideWidgets()) { // initial setup.
QObject::connect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString)));
lastTextSize = q->text().size();
}
- QWidget *w = 0;
+ QWidget *w = nullptr;
// Store flags about QWidgetAction here since removeAction() may be called from ~QAction,
// in which a qobject_cast<> no longer works.
#if QT_CONFIG(action)
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index a11fea6bbe..5ae402b992 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -151,7 +151,7 @@ public:
};
QLineEditPrivate()
- : control(0), frame(1), contextMenuEnabled(1), cursorVisible(0),
+ : control(nullptr), frame(1), contextMenuEnabled(1), cursorVisible(0),
dragEnabled(0), clickCausedFocus(0), edited(0), hscroll(0), vscroll(0),
alignment(Qt::AlignLeading | Qt::AlignVCenter),
textMargins{0, 0, 0, 0},
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 16ed699137..7f0f3342b6 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -78,7 +78,7 @@ class QMainWindowPrivate : public QWidgetPrivate
Q_DECLARE_PUBLIC(QMainWindow)
public:
inline QMainWindowPrivate()
- : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly)
+ : layout(nullptr), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly)
#ifdef Q_OS_OSX
, useUnifiedToolBar(false)
#endif
@@ -94,7 +94,7 @@ public:
static inline QMainWindowLayout *mainWindowLayout(const QMainWindow *mainWindow)
{
- return mainWindow ? mainWindow->d_func()->layout : static_cast<QMainWindowLayout *>(0);
+ return mainWindow ? mainWindow->d_func()->layout : static_cast<QMainWindowLayout *>(nullptr);
}
};
@@ -152,10 +152,10 @@ void QMainWindowPrivate::init()
topLayout->addItem(layout, 1, 1);
#else
- layout = new QMainWindowLayout(q, 0);
+ layout = new QMainWindowLayout(q, nullptr);
#endif
- const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
+ const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, q);
iconSize = QSize(metric, metric);
q->setAttribute(Qt::WA_Hover);
}
@@ -452,7 +452,7 @@ void QMainWindow::setIconSize(const QSize &iconSize)
Q_D(QMainWindow);
QSize sz = iconSize;
if (!sz.isValid()) {
- const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, this);
+ const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, this);
sz = QSize(metric, metric);
}
if (d->iconSize != sz) {
@@ -652,8 +652,8 @@ QWidget *QMainWindow::takeCentralWidget()
Q_D(QMainWindow);
QWidget *oldcentralwidget = d->layout->centralWidget();
if (oldcentralwidget) {
- oldcentralwidget->setParent(0);
- d->layout->setCentralWidget(0);
+ oldcentralwidget->setParent(nullptr);
+ d->layout->setCentralWidget(nullptr);
}
return oldcentralwidget;
}
@@ -1478,7 +1478,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
QMenu *QMainWindow::createPopupMenu()
{
Q_D(QMainWindow);
- QMenu *menu = 0;
+ QMenu *menu = nullptr;
#if QT_CONFIG(dockwidget)
QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>();
if (dockwidgets.size()) {
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 0fb3a86cf8..30562d8270 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -101,14 +101,14 @@ static void dumpLayout(QTextStream &qout, const QDockAreaLayoutItem &item, QStri
<< " gap:" << (item.flags & QDockAreaLayoutItem::GapItem)
<< " keepSize:" << (item.flags & QDockAreaLayoutItem::KeepSize) << '\n';
indent += QLatin1String(" ");
- if (item.widgetItem != 0) {
+ if (item.widgetItem != nullptr) {
qout << indent << "widget: "
<< item.widgetItem->widget()->metaObject()->className()
<< " \"" << item.widgetItem->widget()->windowTitle() << "\"\n";
- } else if (item.subinfo != 0) {
+ } else if (item.subinfo != nullptr) {
qout << indent << "subinfo:\n";
dumpLayout(qout, *item.subinfo, indent + QLatin1String(" "));
- } else if (item.placeHolderItem != 0) {
+ } else if (item.placeHolderItem != nullptr) {
QRect r = item.placeHolderItem->topLevelRect;
qout << indent << "placeHolder: "
<< "pos: " << item.pos << " size:" << item.size
@@ -272,7 +272,7 @@ public:
int frameWidth() const
{
return nativeWindowDeco() ? 0 :
- parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, parentWidget());
+ parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, parentWidget());
}
QDockWidgetGroupWindow *groupWindow() const
@@ -727,7 +727,7 @@ void QMainWindowLayoutState::deleteCentralWidgetItem()
{
#if QT_CONFIG(dockwidget)
delete dockAreaLayout.centralWidgetItem;
- dockAreaLayout.centralWidgetItem = 0;
+ dockAreaLayout.centralWidgetItem = nullptr;
#else
delete centralWidgetItem;
centralWidgetItem = 0;
@@ -749,7 +749,7 @@ QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const
return centralWidgetItem;
#endif
- return 0;
+ return nullptr;
}
QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x)
@@ -770,7 +770,7 @@ QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x)
}
#endif
- return 0;
+ return nullptr;
}
QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const
@@ -803,7 +803,7 @@ QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const
bool QMainWindowLayoutState::contains(QWidget *widget) const
{
#if QT_CONFIG(dockwidget)
- if (dockAreaLayout.centralWidgetItem != 0 && dockAreaLayout.centralWidgetItem->widget() == widget)
+ if (dockAreaLayout.centralWidgetItem != nullptr && dockAreaLayout.centralWidgetItem->widget() == widget)
return true;
if (!dockAreaLayout.indexOf(widget).isEmpty())
return true;
@@ -821,11 +821,11 @@ bool QMainWindowLayoutState::contains(QWidget *widget) const
void QMainWindowLayoutState::setCentralWidget(QWidget *widget)
{
- QLayoutItem *item = 0;
+ QLayoutItem *item = nullptr;
//make sure we remove the widget
deleteCentralWidgetItem();
- if (widget != 0)
+ if (widget != nullptr)
item = new QWidgetItemV2(widget);
#if QT_CONFIG(dockwidget)
@@ -837,7 +837,7 @@ void QMainWindowLayoutState::setCentralWidget(QWidget *widget)
QWidget *QMainWindowLayoutState::centralWidget() const
{
- QLayoutItem *item = 0;
+ QLayoutItem *item = nullptr;
#if QT_CONFIG(dockwidget)
item = dockAreaLayout.centralWidgetItem;
@@ -845,9 +845,9 @@ QWidget *QMainWindowLayoutState::centralWidget() const
item = centralWidgetItem;
#endif
- if (item != 0)
+ if (item != nullptr)
return item->widget();
- return 0;
+ return nullptr;
}
QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget,
@@ -978,7 +978,7 @@ QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path)
return dockAreaLayout.item(path.mid(1)).widgetItem;
#endif // QT_CONFIG(dockwidget)
- return 0;
+ return nullptr;
}
QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const
@@ -1029,7 +1029,7 @@ QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path)
return dockAreaLayout.plug(path.mid(1));
#endif // QT_CONFIG(dockwidget)
- return 0;
+ return nullptr;
}
QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowLayoutState *other)
@@ -1040,7 +1040,7 @@ QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowL
Q_UNUSED(other);
#else
if (i == 0)
- return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
+ return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : nullptr);
#endif
#if QT_CONFIG(dockwidget)
@@ -1048,7 +1048,7 @@ QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowL
return dockAreaLayout.unplug(path.mid(1));
#endif // QT_CONFIG(dockwidget)
- return 0;
+ return nullptr;
}
void QMainWindowLayoutState::saveState(QDataStream &stream) const
@@ -1198,7 +1198,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
continue;
}
QDockAreaLayoutInfo *info = dockAreaLayout.info(oldPath);
- if (info == 0) {
+ if (info == nullptr) {
continue;
}
info->item_list.append(QDockAreaLayoutItem(new QDockWidgetItem(w)));
@@ -1249,7 +1249,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
if (oldPath.isEmpty()) {
continue;
}
- toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(0, w);
+ toolBarAreaLayout.docks[oldPath.at(0)].insertToolBar(nullptr, w);
}
}
}
@@ -1755,7 +1755,7 @@ void QMainWindowTabBar::mouseReleaseEvent(QMouseEvent *e)
if (dockPriv->state && dockPriv->state->dragging) {
dockPriv->endDrag();
}
- draggingDock = 0;
+ draggingDock = nullptr;
}
QTabBar::mouseReleaseEvent(e);
}
@@ -1780,7 +1780,7 @@ bool QMainWindowTabBar::event(QEvent *e)
QTabBar *QMainWindowLayout::getTabBar()
{
- QTabBar *result = 0;
+ QTabBar *result = nullptr;
if (!unusedTabBars.isEmpty()) {
result = unusedTabBars.takeLast();
} else {
@@ -1800,7 +1800,7 @@ QTabBar *QMainWindowLayout::getTabBar()
// Allocates a new separator widget if needed
QWidget *QMainWindowLayout::getSeparatorWidget()
{
- QWidget *result = 0;
+ QWidget *result = nullptr;
if (!unusedSeparatorWidgets.isEmpty()) {
result = unusedSeparatorWidgets.takeLast();
} else {
@@ -1829,16 +1829,16 @@ QDockAreaLayoutInfo *QMainWindowLayout::dockInfo(QWidget *widget)
if (info)
return info;
}
- return 0;
+ return nullptr;
}
void QMainWindowLayout::tabChanged()
{
QTabBar *tb = qobject_cast<QTabBar*>(sender());
- if (tb == 0)
+ if (tb == nullptr)
return;
QDockAreaLayoutInfo *info = dockInfo(tb);
- if (info == 0)
+ if (info == nullptr)
return;
QDockWidget *activated = info->apply(false);
@@ -1866,7 +1866,7 @@ void QMainWindowLayout::tabMoved(int from, int to)
void QMainWindowLayout::raise(QDockWidget *widget)
{
QDockAreaLayoutInfo *info = dockInfo(widget);
- if (info == 0)
+ if (info == nullptr)
return;
if (!info->tabbed)
return;
@@ -1897,7 +1897,7 @@ QLayoutItem *QMainWindowLayout::itemAt(int index) const
if (statusbar && x++ == index)
return statusbar;
- return 0;
+ return nullptr;
}
QLayoutItem *QMainWindowLayout::takeAt(int index)
@@ -1909,7 +1909,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index)
if (QWidget *w = ret->widget()) {
widgetAnimator.abort(w);
if (w == pluggingWidget)
- pluggingWidget = 0;
+ pluggingWidget = nullptr;
}
if (savedState.isValid() ) {
@@ -1934,11 +1934,11 @@ QLayoutItem *QMainWindowLayout::takeAt(int index)
if (statusbar && x++ == index) {
QLayoutItem *ret = statusbar;
- statusbar = 0;
+ statusbar = nullptr;
return ret;
}
- return 0;
+ return nullptr;
}
void QMainWindowLayout::setGeometry(const QRect &_r)
@@ -2033,7 +2033,7 @@ static void fixToolBarOrientation(QLayoutItem *item, int dockPos)
{
#if QT_CONFIG(toolbar)
QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());
- if (toolBar == 0)
+ if (toolBar == nullptr)
return;
QRect oldGeo = toolBar->geometry();
@@ -2146,7 +2146,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem)
if (layout->nativeWindowDeco()) {
globalRect.adjust(0, layout->titleHeight(), 0, 0);
} else {
- int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget);
+ int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, widget);
globalRect.adjust(-fw, -fw, fw, fw);
}
}
@@ -2214,7 +2214,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
QDockAreaLayoutItem &item = dstParentInfo->item_list[idx];
Q_ASSERT(item.widgetItem->widget() == dwgw);
delete item.widgetItem;
- item.widgetItem = 0;
+ item.widgetItem = nullptr;
item.subinfo = new QDockAreaLayoutInfo(std::move(*srcInfo));
*srcInfo = QDockAreaLayoutInfo();
item.subinfo->reparentWidgets(currentHoveredFloat ? currentHoveredFloat.data()
@@ -2238,7 +2238,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
savedState.clear();
currentGapPos.clear();
- pluggingWidget = 0;
+ pluggingWidget = nullptr;
#if QT_CONFIG(dockwidget)
setCurrentHoveredFloat(nullptr);
#endif
@@ -2283,16 +2283,16 @@ void QMainWindowLayout::restore(bool keepSavedState)
if (!keepSavedState)
savedState.clear();
currentGapPos.clear();
- pluggingWidget = 0;
+ pluggingWidget = nullptr;
updateGapIndicator();
}
QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLayout)
- : QLayout(parentLayout ? static_cast<QWidget *>(0) : mainwindow)
+ : QLayout(parentLayout ? static_cast<QWidget *>(nullptr) : mainwindow)
, layoutState(mainwindow)
, savedState(mainwindow)
, dockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks)
- , statusbar(0)
+ , statusbar(nullptr)
#if QT_CONFIG(dockwidget)
#if QT_CONFIG(tabbar)
, _documentMode(false)
@@ -2303,14 +2303,14 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay
#endif
#endif // QT_CONFIG(dockwidget)
, widgetAnimator(this)
- , pluggingWidget(0)
+ , pluggingWidget(nullptr)
{
if (parentLayout)
setParent(parentLayout);
#if QT_CONFIG(dockwidget)
#if QT_CONFIG(tabbar)
- sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow);
+ sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, nullptr, mainwindow);
#endif
#if QT_CONFIG(tabwidget)
@@ -2318,7 +2318,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay
tabPositions[i] = QTabWidget::South;
#endif
#endif // QT_CONFIG(dockwidget)
- pluggingWidget = 0;
+ pluggingWidget = nullptr;
setObjectName(mainwindow->objectName() + QLatin1String("_layout"));
}
@@ -2354,7 +2354,7 @@ void QMainWindowLayout::setStatusBar(QStatusBar *sb)
if (sb)
addChildWidget(sb);
delete statusbar;
- statusbar = sb ? new QWidgetItemV2(sb) : 0;
+ statusbar = sb ? new QWidgetItemV2(sb) : nullptr;
invalidate();
}
#endif // QT_CONFIG(statusbar)
@@ -2366,7 +2366,7 @@ QWidget *QMainWindowLayout::centralWidget() const
void QMainWindowLayout::setCentralWidget(QWidget *widget)
{
- if (widget != 0)
+ if (widget != nullptr)
addChildWidget(widget);
layoutState.setCentralWidget(widget);
if (savedState.isValid()) {
@@ -2453,7 +2453,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
#endif
QList<int> path = layoutState.indexOf(widget);
if (path.isEmpty())
- return 0;
+ return nullptr;
QLayoutItem *item = layoutState.item(path);
if (widget->isWindow())
@@ -2561,7 +2561,7 @@ static QTabBar::Shape tabwidgetPositionToTabBarShape(QWidget *w)
void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
{
if (!parentWidget()->isVisible() || parentWidget()->isMinimized()
- || pluggingWidget != 0 || widgetItem == 0)
+ || pluggingWidget != nullptr || widgetItem == nullptr)
return;
QWidget *widget = widgetItem->widget();
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 6e3de1b1ff..3272ac440b 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -245,7 +245,7 @@ static inline bool useScrollBar(const QRect &childrenRect, const QSize &maxViewp
static inline QMdiArea *mdiAreaParent(QWidget *widget)
{
if (!widget)
- return 0;
+ return nullptr;
QWidget *parent = widget->parentWidget();
while (parent) {
@@ -253,7 +253,7 @@ static inline QMdiArea *mdiAreaParent(QWidget *widget)
return area;
parent = parent->parentWidget();
}
- return 0;
+ return nullptr;
}
#if QT_CONFIG(tabwidget)
@@ -352,7 +352,7 @@ void SimpleCascader::rearrange(QList<QWidget *> &widgets, const QRect &domain) c
int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0));
const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar"));
const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1)
- + widgets.at(0)->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, 0, widgets.at(0));
+ + widgets.at(0)->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, nullptr, widgets.at(0));
const int n = widgets.size();
const int nrows = qMax((domain.height() - (topOffset + bottomOffset)) / dy, 1);
@@ -648,7 +648,7 @@ void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event)
QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const
{
if (index < 0 || index >= count())
- return 0;
+ return nullptr;
QMdiArea *mdiArea = qobject_cast<QMdiArea *>(parentWidget());
Q_ASSERT(mdiArea);
@@ -667,15 +667,15 @@ QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const
\internal
*/
QMdiAreaPrivate::QMdiAreaPrivate()
- : cascader(0),
- regularTiler(0),
- iconTiler(0),
- placer(0),
+ : cascader(nullptr),
+ regularTiler(nullptr),
+ iconTiler(nullptr),
+ placer(nullptr),
#if QT_CONFIG(rubberband)
- rubberBand(0),
+ rubberBand(nullptr),
#endif
#if QT_CONFIG(tabbar)
- tabBar(0),
+ tabBar(nullptr),
#endif
activationOrder(QMdiArea::CreationOrder),
viewMode(QMdiArea::SubWindowView),
@@ -1070,7 +1070,7 @@ void QMdiAreaPrivate::emitWindowActivated(QMdiSubWindow *activeWindow)
Q_ASSERT(aboutToBecomeActive == activeWindow);
active = activeWindow;
- aboutToBecomeActive = 0;
+ aboutToBecomeActive = nullptr;
Q_ASSERT(active->d_func()->isActive);
#if QT_CONFIG(tabbar)
@@ -1093,20 +1093,20 @@ void QMdiAreaPrivate::resetActiveWindow(QMdiSubWindow *deactivatedWindow)
if (deactivatedWindow) {
if (deactivatedWindow != active)
return;
- active = 0;
+ active = nullptr;
if ((aboutToBecomeActive || isActivated || lastWindowAboutToBeDestroyed())
&& !isExplicitlyDeactivated(deactivatedWindow) && !q->window()->isMinimized()) {
return;
}
- emit q->subWindowActivated(0);
+ emit q->subWindowActivated(nullptr);
return;
}
if (aboutToBecomeActive)
return;
- active = 0;
- emit q->subWindowActivated(0);
+ active = nullptr;
+ emit q->subWindowActivated(nullptr);
}
/*!
@@ -1171,7 +1171,7 @@ void QMdiAreaPrivate::updateScrollBars()
QSize hbarExtent = hbar->sizeHint();
QSize vbarExtent = vbar->sizeHint();
- if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) {
+ if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q)) {
const int doubleFrameWidth = frameWidth * 2;
if (hbarpolicy == Qt::ScrollBarAlwaysOn)
maxSize.rheight() -= doubleFrameWidth;
@@ -1232,7 +1232,7 @@ void QMdiAreaPrivate::internalRaise(QMdiSubWindow *mdiChild) const
if (!sanityCheck(mdiChild, "QMdiArea::internalRaise") || childWindows.size() < 2)
return;
- QMdiSubWindow *stackUnderChild = 0;
+ QMdiSubWindow *stackUnderChild = nullptr;
if (!windowStaysOnTop(mdiChild)) {
const auto children = viewport->children(); // take a copy, as raising/stacking under changes the order
for (QObject *object : children) {
@@ -1282,8 +1282,8 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in
minAreaHeight += hbar->height();
if (vbar->isVisible())
minAreaWidth += vbar->width();
- if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) {
- const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q);
+ if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q)) {
+ const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, q);
minAreaWidth += 2 * frame;
minAreaHeight += 2 * frame;
}
@@ -1427,7 +1427,7 @@ void QMdiAreaPrivate::disconnectSubWindow(QObject *subWindow)
return;
Q_Q(QMdiArea);
- QObject::disconnect(subWindow, 0, q, 0);
+ QObject::disconnect(subWindow, nullptr, q, nullptr);
subWindow->removeEventFilter(q);
}
@@ -1438,11 +1438,11 @@ QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiAre
int removedIndex, int fromIndex) const
{
if (childWindows.isEmpty())
- return 0;
+ return nullptr;
Q_Q(const QMdiArea);
const QList<QMdiSubWindow *> subWindows = q->subWindowList(order);
- QMdiSubWindow *current = 0;
+ QMdiSubWindow *current = nullptr;
if (removedIndex < 0) {
if (fromIndex >= 0 && fromIndex < subWindows.size())
@@ -1482,7 +1482,7 @@ QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiAre
if (!subWindows.at(index)->isHidden())
return subWindows.at(index);
- return 0;
+ return nullptr;
}
/*!
@@ -1603,7 +1603,7 @@ void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode)
{ // SubWindowView
#if QT_CONFIG(tabbar)
delete tabBar;
- tabBar = 0;
+ tabBar = nullptr;
#endif // QT_CONFIG(tabbar)
viewMode = mode;
@@ -1704,7 +1704,7 @@ QMdiArea::QMdiArea(QWidget *parent)
setFrameStyle(QFrame::NoFrame);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setViewport(0);
+ setViewport(nullptr);
setFocusPolicy(Qt::NoFocus);
QApplication::instance()->installEventFilter(this);
}
@@ -1716,16 +1716,16 @@ QMdiArea::~QMdiArea()
{
Q_D(QMdiArea);
delete d->cascader;
- d->cascader = 0;
+ d->cascader = nullptr;
delete d->regularTiler;
- d->regularTiler = 0;
+ d->regularTiler = nullptr;
delete d->iconTiler;
- d->iconTiler = 0;
+ d->iconTiler = nullptr;
delete d->placer;
- d->placer = 0;
+ d->placer = nullptr;
}
/*!
@@ -1760,8 +1760,8 @@ QSize QMdiArea::sizeHint() const
QSize QMdiArea::minimumSizeHint() const
{
Q_D(const QMdiArea);
- QSize size(style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, this),
- style()->pixelMetric(QStyle::PM_TitleBarHeight, 0, this));
+ QSize size(style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, nullptr, this),
+ style()->pixelMetric(QStyle::PM_TitleBarHeight, nullptr, this));
size = size.expandedTo(QAbstractScrollArea::minimumSizeHint());
if (!d->scrollBarsEnabled()) {
for (QMdiSubWindow *child : d->childWindows) {
@@ -1965,7 +1965,7 @@ QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFla
{
if (Q_UNLIKELY(!widget)) {
qWarning("QMdiArea::addSubWindow: null pointer to widget");
- return 0;
+ return nullptr;
}
Q_D(QMdiArea);
@@ -2027,7 +2027,7 @@ void QMdiArea::removeSubWindow(QWidget *widget)
d->childWindows.removeAll(child);
d->indicesToActivatedChildren.removeAll(index);
d->updateActiveWindow(index, d->active == child);
- child->setParent(0);
+ child->setParent(nullptr);
return;
}
@@ -2036,7 +2036,7 @@ void QMdiArea::removeSubWindow(QWidget *widget)
if (!sanityCheck(child, "QMdiArea::removeSubWindow"))
continue;
if (child->widget() == widget) {
- child->setWidget(0);
+ child->setWidget(nullptr);
Q_ASSERT(!child->widget());
found = true;
break;
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index a0286dfcb1..84568c35db 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -253,7 +253,7 @@ static inline ControlElement<T> *ptr(QWidget *widget)
&& strcmp(widget->metaObject()->className(), T::staticMetaObject.className()) == 0) {
return static_cast<ControlElement<T> *>(widget);
}
- return 0;
+ return nullptr;
}
QString QMdiSubWindowPrivate::originalWindowTitle()
@@ -364,7 +364,7 @@ class ControlLabel : public QWidget
{
Q_OBJECT
public:
- ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = 0);
+ ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = nullptr);
QSize sizeHint() const override;
@@ -481,8 +481,8 @@ void ControlLabel::updateWindowIcon()
{
QIcon menuIcon = windowIcon();
if (menuIcon.isNull())
- menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget());
- const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, 0, parentWidget());
+ menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, parentWidget());
+ const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, nullptr, parentWidget());
label = menuIcon.pixmap(iconSize);
update();
}
@@ -496,7 +496,7 @@ class ControllerWidget : public QWidget
{
Q_OBJECT
public:
- ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = 0);
+ ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = nullptr);
QSize sizeHint() const override;
void setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible);
inline bool hasVisibleControls() const
@@ -542,7 +542,7 @@ ControllerWidget::ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent)
activeControl(QStyle::SC_None),
hoverControl(QStyle::SC_None),
visibleControls(QStyle::SC_None),
- mdiArea(0)
+ mdiArea(nullptr)
{
if (subWindow->parentWidget())
mdiArea = qobject_cast<QMdiArea *>(subWindow->parentWidget()->parentWidget());
@@ -697,10 +697,10 @@ void ControllerWidget::initStyleOption(QStyleOptionComplex *option) const
*/
ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
: QObject(mdiChild),
- previousLeft(0),
- previousRight(0),
+ previousLeft(nullptr),
+ previousRight(nullptr),
#if QT_CONFIG(menubar)
- m_menuBar(0),
+ m_menuBar(nullptr),
#endif
mdiChild(mdiChild)
{
@@ -725,9 +725,9 @@ ControlContainer::~ControlContainer()
removeButtonsFromMenuBar();
#endif
delete m_menuLabel;
- m_menuLabel = 0;
+ m_menuLabel = nullptr;
delete m_controllerWidget;
- m_controllerWidget = 0;
+ m_controllerWidget = nullptr;
}
#if QT_CONFIG(menubar)
@@ -741,12 +741,12 @@ QMenuBar *QMdiSubWindowPrivate::menuBar() const
#else
Q_Q(const QMdiSubWindow);
if (!q->isMaximized() || drawTitleBarWhenMaximized() || isChildOfTabbedQMdiArea(q))
- return 0;
+ return nullptr;
if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window()))
return mainWindow->menuBar();
- return 0;
+ return nullptr;
#endif
}
@@ -790,50 +790,50 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar)
{
if (menuBar && menuBar != m_menuBar) {
// m_menubar was deleted while sub-window was maximized
- previousRight = 0;
- previousLeft = 0;
+ previousRight = nullptr;
+ previousLeft = nullptr;
m_menuBar = menuBar;
}
if (!m_menuBar || !mdiChild || qt_widget_private(mdiChild->window())->data.in_destructor)
return;
- QMdiSubWindow *child = 0;
+ QMdiSubWindow *child = nullptr;
if (m_controllerWidget) {
QWidget *currentRight = m_menuBar->cornerWidget(Qt::TopRightCorner);
if (currentRight == m_controllerWidget) {
if (ControlElement<ControllerWidget> *ce = ptr<ControllerWidget>(previousRight)) {
if (!ce->mdiChild || !ce->mdiChild->isMaximized())
- previousRight = 0;
+ previousRight = nullptr;
else
child = ce->mdiChild;
}
m_menuBar->setCornerWidget(previousRight, Qt::TopRightCorner);
if (previousRight) {
previousRight->show();
- previousRight = 0;
+ previousRight = nullptr;
}
}
m_controllerWidget->hide();
- m_controllerWidget->setParent(0);
+ m_controllerWidget->setParent(nullptr);
}
if (m_menuLabel) {
QWidget *currentLeft = m_menuBar->cornerWidget(Qt::TopLeftCorner);
if (currentLeft == m_menuLabel) {
if (ControlElement<ControlLabel> *ce = ptr<ControlLabel>(previousLeft)) {
if (!ce->mdiChild || !ce->mdiChild->isMaximized())
- previousLeft = 0;
+ previousLeft = nullptr;
else if (!child)
child = mdiChild;
}
m_menuBar->setCornerWidget(previousLeft, Qt::TopLeftCorner);
if (previousLeft) {
previousLeft->show();
- previousLeft = 0;
+ previousLeft = nullptr;
}
}
m_menuLabel->hide();
- m_menuLabel->setParent(0);
+ m_menuLabel->setParent(nullptr);
}
m_menuBar->update();
if (child)
@@ -854,14 +854,14 @@ void ControlContainer::updateWindowIcon(const QIcon &windowIcon)
\internal
*/
QMdiSubWindowPrivate::QMdiSubWindowPrivate()
- : baseWidget(0),
- restoreFocusWidget(0),
- controlContainer(0),
+ : baseWidget(nullptr),
+ restoreFocusWidget(nullptr),
+ controlContainer(nullptr),
#if QT_CONFIG(sizegrip)
- sizeGrip(0),
+ sizeGrip(nullptr),
#endif
#if QT_CONFIG(rubberband)
- rubberBand(0),
+ rubberBand(nullptr),
#endif
userMinimumSize(0,0),
resizeEnabled(true),
@@ -926,7 +926,7 @@ void QMdiSubWindowPrivate::_q_enterInteractiveMode()
pressPos = QPoint(q->width() / 2, titleBarHeight() - 1);
} else if (actions[ResizeAction] && actions[ResizeAction] == action) {
currentOperation = q->isLeftToRight() ? BottomRightResize : BottomLeftResize;
- int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q) / 2;
+ int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q) / 2;
int x = q->isLeftToRight() ? q->width() - offset : offset;
pressPos = QPoint(x, q->height() - offset);
} else {
@@ -1009,8 +1009,8 @@ void QMdiSubWindowPrivate::removeBaseWidget()
lastChildWindowTitle.clear();
// QTBUG-47993: parent widget can be reset before this call
if (baseWidget->parentWidget() == q)
- baseWidget->setParent(0);
- baseWidget = 0;
+ baseWidget->setParent(nullptr);
+ baseWidget = nullptr;
isWidgetHiddenByUs = false;
}
@@ -1047,19 +1047,19 @@ void QMdiSubWindowPrivate::createSystemMenu()
systemMenu->installEventFilter(q);
const QStyle *style = q->style();
addToSystemMenu(RestoreAction, QMdiSubWindow::tr("&Restore"), SLOT(showNormal()));
- actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q));
+ actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, nullptr, q));
actions[RestoreAction]->setEnabled(false);
addToSystemMenu(MoveAction, QMdiSubWindow::tr("&Move"), SLOT(_q_enterInteractiveMode()));
addToSystemMenu(ResizeAction, QMdiSubWindow::tr("&Size"), SLOT(_q_enterInteractiveMode()));
addToSystemMenu(MinimizeAction, QMdiSubWindow::tr("Mi&nimize"), SLOT(showMinimized()));
- actions[MinimizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMinButton, 0, q));
+ actions[MinimizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMinButton, nullptr, q));
addToSystemMenu(MaximizeAction, QMdiSubWindow::tr("Ma&ximize"), SLOT(showMaximized()));
- actions[MaximizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMaxButton, 0, q));
+ actions[MaximizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMaxButton, nullptr, q));
addToSystemMenu(StayOnTopAction, QMdiSubWindow::tr("Stay on &Top"), SLOT(_q_updateStaysOnTopHint()));
actions[StayOnTopAction]->setCheckable(true);
systemMenu->addSeparator();
addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), SLOT(close()));
- actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q));
+ actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, nullptr, q));
#if !defined(QT_NO_SHORTCUT)
actions[CloseAction]->setShortcuts(QKeySequence::Close);
#endif
@@ -1461,7 +1461,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus)
ensureWindowState(Qt::WindowActive);
}
- int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
+ int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q);
int titleBarHeight = this->titleBarHeight();
QRegion windowDecoration = QRegion(0, 0, q->width(), q->height());
windowDecoration -= QRegion(frameWidth, titleBarHeight, q->width() - 2 * frameWidth,
@@ -1543,7 +1543,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const
int width = q->width();
int height = q->height();
int titleBarHeight = this->titleBarHeight();
- int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
+ int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q);
int cornerConst = titleBarHeight - frameWidth;
int titleBarConst = 2 * titleBarHeight;
@@ -1738,7 +1738,7 @@ void QMdiSubWindowPrivate::sizeParameters(int *margin, int *minWidth) const
if (q->isMaximized() && !drawTitleBarWhenMaximized())
*margin = 0;
else
- *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
+ *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, q);
QStyleOptionTitleBar opt = this->titleBarOptions();
int tempWidth = 0;
@@ -1767,7 +1767,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
if (isChildOfTabbedQMdiArea(q))
return false;
- if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
+ if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, nullptr, q))
return true;
#if !QT_CONFIG(menubar) || !QT_CONFIG(mainwindow)
Q_UNUSED(isChildOfQMdiSubWindow);
@@ -1833,7 +1833,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
if (!controlContainer || isChildOfTabbedQMdiArea(q))
return;
- QMenuBar *currentMenuBar = 0;
+ QMenuBar *currentMenuBar = nullptr;
#if QT_CONFIG(mainwindow)
if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())) {
// NB! We can't use menuBar() here because that one will actually create
@@ -1863,7 +1863,7 @@ void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
return;
}
- QWidget *titleWidget = 0;
+ QWidget *titleWidget = nullptr;
if (isRequestFromChild)
titleWidget = baseWidget;
else
@@ -2131,7 +2131,7 @@ QSize QMdiSubWindowPrivate::iconSize() const
Q_Q(const QMdiSubWindow);
if (!parent || q->windowFlags() & Qt::FramelessWindowHint)
return QSize(-1, -1);
- return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());
+ return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, nullptr, q), titleBarHeight());
}
#if QT_CONFIG(sizegrip)
@@ -2233,7 +2233,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
// We don't want the menu icon by default on mac.
#ifndef Q_OS_MAC
if (windowIcon().isNull())
- d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
+ d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, this);
else
d->menuIcon = windowIcon();
#endif
@@ -2340,7 +2340,7 @@ QWidget *QMdiSubWindow::maximizedButtonsWidget() const
&& !isChildOfTabbedQMdiArea(this)) {
return d->controlContainer->controllerWidget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -2353,7 +2353,7 @@ QWidget *QMdiSubWindow::maximizedSystemMenuIconWidget() const
&& !isChildOfTabbedQMdiArea(this)) {
return d->controlContainer->systemMenuLabel();
}
- return 0;
+ return nullptr;
}
/*!
@@ -2476,7 +2476,7 @@ void QMdiSubWindow::setSystemMenu(QMenu *systemMenu)
if (d->systemMenu) {
delete d->systemMenu;
- d->systemMenu = 0;
+ d->systemMenu = nullptr;
}
if (!systemMenu)
@@ -2860,7 +2860,7 @@ bool QMdiSubWindow::event(QEvent *event)
case QEvent::WindowIconChange:
d->menuIcon = windowIcon();
if (d->menuIcon.isNull())
- d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
+ d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, this);
if (d->controlContainer)
d->controlContainer->updateWindowIcon(d->menuIcon);
if (!maximizedSystemMenuIconWidget())
@@ -3135,7 +3135,7 @@ void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent)
if (isMinimized() && !d->hasBorder(d->cachedStyleOptions))
return;
- frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this);
+ frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, nullptr, this);
// ### Ensure that we do not require setting the cliprect for 4.4
if (!isMinimized() && !d->hasBorder(d->cachedStyleOptions))
@@ -3510,7 +3510,7 @@ QSize QMdiSubWindow::minimumSizeHint() const
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
sizeGripHeight = d->sizeGrip->height();
else if (parent() && isMacStyle(style()) && !d->sizeGrip)
- sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
+ sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, nullptr, this);
minHeight = qMax(minHeight, decorationHeight + sizeGripHeight);
#endif
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 51b458f03a..e7f80263c8 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -83,7 +83,7 @@
QT_BEGIN_NAMESPACE
-QMenu *QMenuPrivate::mouseDown = 0;
+QMenu *QMenuPrivate::mouseDown = nullptr;
/* QMenu code */
// internal class used for the torn off popup
@@ -96,7 +96,7 @@ class QTornOffMenu : public QMenu
public:
QTornOffMenuPrivate(QMenu *p) : causedMenu(p), initialized(false) {
tornoff = 1;
- causedPopup.widget = 0;
+ causedPopup.widget = nullptr;
causedPopup.action = p->d_func()->causedPopup.action;
causedStack = p->d_func()->calcCausedStack();
}
@@ -106,11 +106,11 @@ class QTornOffMenu : public QMenu
QSize size = menuSize;
const QPoint p = (!initialized) ? causedMenu->pos() : q->pos();
QRect screen = popupGeometry(QDesktopWidgetPrivate::screenNumber(p));
- const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q);
- const int titleBarHeight = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, 0, q);
+ const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, q);
+ const int titleBarHeight = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, nullptr, q);
if (scroll && (size.height() > screen.height() - titleBarHeight || size.width() > screen.width())) {
- const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
- const int hmargin = q->style()->pixelMetric(QStyle::PM_MenuHMargin, 0, q);
+ const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, q);
+ const int hmargin = q->style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr, q);
scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown);
size.setWidth(qMin(actionRects.at(getLastVisibleAction()).right() + fw + hmargin + rightmargin + 1, screen.width()));
size.setHeight(screen.height() - desktopFrame * 2 - titleBarHeight);
@@ -202,15 +202,15 @@ void QMenuPrivate::init()
if (!tornPopup.isNull())
tornPopup->updateWindowTitle();
});
- q->setMouseTracking(q->style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, q));
- if (q->style()->styleHint(QStyle::SH_Menu_Scrollable, 0, q)) {
+ q->setMouseTracking(q->style()->styleHint(QStyle::SH_Menu_MouseTracking, nullptr, q));
+ if (q->style()->styleHint(QStyle::SH_Menu_Scrollable, nullptr, q)) {
scroll = new QMenuPrivate::QMenuScroller;
scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;
}
sloppyState.initialize(q);
delayState.initialize(q);
- mousePopupDelay = q->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, q);
+ mousePopupDelay = q->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, nullptr, q);
}
QPlatformMenu *QMenuPrivate::createPlatformMenu()
@@ -262,7 +262,7 @@ void QMenuPrivate::copyActionToPlatformItem(const QAction *action, QPlatformMenu
item->setIconSize(w->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, w));
} else {
QStyleOption opt;
- item->setIconSize(QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, 0));
+ item->setIconSize(QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, nullptr));
}
} else {
item->setIcon(QIcon());
@@ -283,7 +283,7 @@ void QMenuPrivate::copyActionToPlatformItem(const QAction *action, QPlatformMenu
action->menu()->setPlatformMenu(platformMenu->createSubMenu());
item->setMenu(action->menu()->platformMenu());
} else {
- item->setMenu(0);
+ item->setMenu(nullptr);
}
}
@@ -304,7 +304,7 @@ QPlatformMenuItem * QMenuPrivate::insertActionInPlatformMenu(const QAction *acti
int QMenuPrivate::scrollerHeight() const
{
Q_Q(const QMenu);
- return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q));
+ return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, q));
}
// Windows and KDE allow menus to cover the taskbar, while GNOME and macOS
@@ -541,9 +541,9 @@ void QMenuPrivate::hideUpToMenuBar()
while(caused) {
#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
- mb->d_func()->setCurrentAction(0);
+ mb->d_func()->setCurrentAction(nullptr);
mb->d_func()->setKeyboardMode(false);
- caused = 0;
+ caused = nullptr;
} else
#endif
if (QMenu *m = qobject_cast<QMenu*>(caused)) {
@@ -551,12 +551,12 @@ void QMenuPrivate::hideUpToMenuBar()
if (!m->d_func()->tornoff)
hideMenu(m);
if (!fadeMenus) // Mac doesn't clear the action until after hidden.
- m->d_func()->setCurrentAction(0);
- } else { caused = 0;
+ m->d_func()->setCurrentAction(nullptr);
+ } else { caused = nullptr;
}
}
}
- setCurrentAction(0);
+ setCurrentAction(nullptr);
}
void QMenuPrivate::hideMenu(QMenu *menu)
@@ -573,7 +573,7 @@ void QMenuPrivate::hideMenu(QMenu *menu)
QEventLoop eventLoop;
QAction *activeAction = currentAction;
- menu->setActiveAction(0);
+ menu->setActiveAction(nullptr);
QTimer::singleShot(60, &eventLoop, SLOT(quit()));
eventLoop.exec();
@@ -587,10 +587,10 @@ void QMenuPrivate::hideMenu(QMenu *menu)
blocker.unblock();
#endif // QT_CONFIG(effects)
if (activeMenu == menu)
- activeMenu = 0;
- menu->d_func()->causedPopup.action = 0;
+ activeMenu = nullptr;
+ menu->d_func()->causedPopup.action = nullptr;
menu->close();
- menu->d_func()->causedPopup.widget = 0;
+ menu->d_func()->causedPopup.widget = nullptr;
}
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
@@ -617,7 +617,7 @@ void QMenuPrivate::setSyncAction()
Q_Q(QMenu);
QAction *current = currentAction;
if(current && (!current->isEnabled() || current->menu() || current->isSeparator()))
- current = 0;
+ current = nullptr;
for(QWidget *caused = q; caused;) {
if (QMenu *m = qobject_cast<QMenu*>(caused)) {
caused = m->d_func()->causedPopup.widget;
@@ -645,7 +645,7 @@ void QMenuPrivate::setFirstActionActive()
}
QAction *act = actions.at(i);
if (!act->isSeparator() &&
- (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
+ (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q)
|| act->isEnabled())) {
setCurrentAction(act);
break;
@@ -661,7 +661,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
if (action
&& (action->isSeparator()
- || (!action->isEnabled() && !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q))))
+ || (!action->isEnabled() && !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q))))
action = nullptr;
// Reselect the currently active action in case mouse moved over other menu items when
@@ -718,8 +718,8 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
if (popup == -1) {
#if QT_CONFIG(effects)
// kill any running effect
- qFadeEffect(0);
- qScrollEffect(0);
+ qFadeEffect(nullptr);
+ qScrollEffect(nullptr);
#endif
hideMenu(hideActiveMenu);
} else if (!currentAction || !currentAction->menu()) {
@@ -867,13 +867,13 @@ QWidget *QMenuPrivate::topCausedWidget() const
QAction *QMenuPrivate::actionAt(QPoint p) const
{
if (!rect().contains(p)) //sanity check
- return 0;
+ return nullptr;
for(int i = 0; i < actionRects.count(); i++) {
if (actionRects.at(i).contains(p))
return actions.at(i);
}
- return 0;
+ return nullptr;
}
void QMenuPrivate::setOverrideMenuAction(QAction *a)
@@ -976,7 +976,7 @@ QMenuPrivate::ScrollerTearOffItem::ScrollerTearOffItem(QMenuPrivate::ScrollerTea
: QWidget(parent, f), menuPrivate(mPrivate), scrollType(type)
{
if (parent)
- setMouseTracking(parent->style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, parent));
+ setMouseTracking(parent->style()->styleHint(QStyle::SH_Menu_MouseTracking, nullptr, parent));
}
void QMenuPrivate::ScrollerTearOffItem::paintEvent(QPaintEvent *e)
@@ -991,7 +991,7 @@ void QMenuPrivate::ScrollerTearOffItem::paintEvent(QPaintEvent *e)
menuPrivate->drawScroller(&p, scrollType, QRect(0, 0, width(), menuPrivate->scrollerHeight()));
//paint the tear off
if (scrollType == QMenuPrivate::ScrollerTearOffItem::ScrollUp) {
- QRect rect(0, 0, width(), parent->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, parent));
+ QRect rect(0, 0, width(), parent->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, parent));
if (menuPrivate->scroll && menuPrivate->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
rect.translate(0, menuPrivate->scrollerHeight());
menuPrivate->drawTearOff(&p, rect);
@@ -1066,8 +1066,8 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
int newOffset = 0;
const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0;
const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0;
- const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q);
- const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
+ const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr, q);
+ const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, q);
if (location == QMenuScroller::ScrollTop) {
for(int i = 0, saccum = 0; i < actions.count(); i++) {
@@ -1108,7 +1108,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
if (!(newScrollFlags & QMenuScroller::ScrollDown) && (scroll->scrollFlags & QMenuScroller::ScrollDown)) {
newOffset = q->height() - (saccum - newOffset) - fw*2 - vmargin - topmargin - bottommargin; //last item at bottom
if (tearoff)
- newOffset -= q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q);
+ newOffset -= q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, q);
}
if (!(newScrollFlags & QMenuScroller::ScrollUp) && (scroll->scrollFlags & QMenuScroller::ScrollUp)) {
@@ -1119,7 +1119,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
newOffset -= vmargin;
QRect screen = popupGeometry();
- const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q);
+ const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, q);
if (q->height() < screen.height()-(desktopFrame*2)-1) {
QRect geom = q->geometry();
if (newOffset > scroll->scrollOffset && (scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollUp)) { //scroll up
@@ -1181,7 +1181,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ
if (actionRects.at(i).isNull())
continue;
if (!act->isSeparator() &&
- (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
+ (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q)
|| act->isEnabled())) {
if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)
scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollBottom, active);
@@ -1196,7 +1196,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ
if (actionRects.at(i).isNull())
continue;
if (!act->isSeparator() &&
- (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
+ (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q)
|| act->isEnabled())) {
if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollTop, active);
@@ -1217,8 +1217,8 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool pag
updateActionRects();
const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0;
const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0;
- const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q);
- const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
+ const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr, q);
+ const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, q);
const int offset = topScroll ? topScroll-vmargin : 0;
if (direction == QMenuScroller::ScrollUp) {
for(int i = 0, saccum = 0; i < actions.count(); i++) {
@@ -1299,7 +1299,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
tearRect.translate(0, scrollerHeight());
q->update(tearRect);
if (tearRect.contains(pos) && hasMouseMoved(e->globalPos())) {
- setCurrentAction(0);
+ setCurrentAction(nullptr);
tearoffHighlighted = 1;
if (e->type() == QEvent::MouseButtonRelease) {
if (!tornPopup)
@@ -1318,7 +1318,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
for(QWidget *caused = causedPopup.widget; caused;) {
bool passOnEvent = false;
- QWidget *next_widget = 0;
+ QWidget *next_widget = nullptr;
QPoint cpos = caused->mapFromGlobal(e->globalPos());
#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
@@ -1439,7 +1439,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e
#endif
action->showStatusText(topCausedWidget());
} else {
- actionAboutToTrigger = 0;
+ actionAboutToTrigger = nullptr;
}
}
@@ -2258,7 +2258,7 @@ QAction *QMenu::actionAt(const QPoint &pt) const
{
if (QAction *ret = d_func()->actionAt(pt))
return ret;
- return 0;
+ return nullptr;
}
/*!
@@ -2380,7 +2380,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
const QSize menuSizeHint(sizeHint());
QSize size = menuSizeHint;
- const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this);
+ const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, this);
bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen);
// if the screens have very different geometries and the menu is too big, we have to recalculate
@@ -2424,7 +2424,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
pos.setY(newY);
if (d->scroll && d->scroll->scrollFlags != QMenuPrivate::QMenuScroller::ScrollNone
- && !style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, 0, this)) {
+ && !style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, nullptr, this)) {
int below_height = above_height + d->scroll->scrollOffset;
for (int i2 = i; i2 < d->actionRects.count(); i2++)
below_height += d->actionRects.at(i2).height();
@@ -2483,7 +2483,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
}
}
}
- const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);
+ const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr, this);
QMenu *caused = qobject_cast<QMenu*>(d_func()->causedPopup.widget);
if (caused && caused->geometry().width() + menuSizeHint.width() + subMenuOffset < screen.width()) {
QRect parentActionRect(caused->d_func()->actionRect(caused->d_func()->currentAction));
@@ -2553,8 +2553,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
qScrollEffect(this, hGuess | vGuess);
} else {
// kill any running effect
- qFadeEffect(0);
- qScrollEffect(0);
+ qFadeEffect(nullptr);
+ qScrollEffect(nullptr);
show();
}
@@ -2690,22 +2690,22 @@ void QMenu::hideEvent(QHideEvent *)
emit aboutToHide();
if (d->eventLoop)
d->eventLoop->exit();
- d->setCurrentAction(0);
+ d->setCurrentAction(nullptr);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(this, QAccessible::PopupMenuEnd);
QAccessible::updateAccessibility(&event);
#endif
#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
- mb->d_func()->setCurrentAction(0);
+ mb->d_func()->setCurrentAction(nullptr);
#endif
if (QMenuPrivate::mouseDown == this)
QMenuPrivate::mouseDown = nullptr;
d->hasHadMouse = false;
if (d->activeMenu)
d->hideMenu(d->activeMenu);
- d->causedPopup.widget = 0;
- d->causedPopup.action = 0;
+ d->causedPopup.widget = nullptr;
+ d->causedPopup.action = nullptr;
if (d->scroll)
d->scroll->scrollTimer.stop(); //make sure the timer stops
}
@@ -2729,9 +2729,9 @@ void QMenu::paintEvent(QPaintEvent *e)
style()->drawPrimitive(QStyle::PE_PanelMenu, &menuOpt, &p, this);
//calculate the scroll up / down rect
- const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
- const int hmargin = style()->pixelMetric(QStyle::PM_MenuHMargin,0, this);
- const int vmargin = style()->pixelMetric(QStyle::PM_MenuVMargin, 0, this);
+ const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, this);
+ const int hmargin = style()->pixelMetric(QStyle::PM_MenuHMargin,nullptr, this);
+ const int vmargin = style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr, this);
QRect scrollUpRect, scrollDownRect;
const int leftmargin = fw + hmargin + d->leftmargin;
@@ -2751,7 +2751,7 @@ void QMenu::paintEvent(QPaintEvent *e)
QRect tearOffRect;
if (d->tearoff) {
tearOffRect.setRect(leftmargin, topmargin, contentWidth,
- style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));
+ style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, this));
if (d->scroll && d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
tearOffRect.translate(0, d->scrollerHeight());
}
@@ -2871,7 +2871,7 @@ void QMenu::mousePressEvent(QMouseEvent *e)
&& QRect(d->noReplayFor->mapToGlobal(QPoint()), d->noReplayFor->size()).contains(e->globalPos()))
setAttribute(Qt::WA_NoMouseReplay);
if (d->eventLoop) // synchronous operation
- d->syncAction = 0;
+ d->syncAction = nullptr;
d->hideUpToMenuBar();
return;
}
@@ -2921,12 +2921,12 @@ void QMenu::changeEvent(QEvent *e)
if (e->type() == QEvent::StyleChange || e->type() == QEvent::FontChange ||
e->type() == QEvent::LayoutDirectionChange) {
d->itemsDirty = 1;
- setMouseTracking(style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, this));
+ setMouseTracking(style()->styleHint(QStyle::SH_Menu_MouseTracking, nullptr, this));
if (isVisible())
resize(sizeHint());
- if (!style()->styleHint(QStyle::SH_Menu_Scrollable, 0, this)) {
+ if (!style()->styleHint(QStyle::SH_Menu_Scrollable, nullptr, this)) {
delete d->scroll;
- d->scroll = 0;
+ d->scroll = nullptr;
} else if (!d->scroll) {
d->scroll = new QMenuPrivate::QMenuScroller;
d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;
@@ -3095,7 +3095,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
case Qt::Key_Up:
case Qt::Key_Down: {
key_consumed = true;
- QAction *nextAction = 0;
+ QAction *nextAction = nullptr;
QMenuPrivate::QMenuScroller::ScrollLocation scroll_loc = QMenuPrivate::QMenuScroller::ScrollStay;
if (!d->currentAction) {
if(key == Qt::Key_Down) {
@@ -3104,7 +3104,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (d->actionRects.at(i).isNull())
continue;
if (!act->isSeparator() &&
- (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)
+ (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this)
|| act->isEnabled())) {
nextAction = act;
break;
@@ -3116,7 +3116,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (d->actionRects.at(i).isNull())
continue;
if (!act->isSeparator() &&
- (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)
+ (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this)
|| act->isEnabled())) {
nextAction = act;
break;
@@ -3130,7 +3130,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (key == Qt::Key_Up) {
for(int next_i = i-1; true; next_i--) {
if (next_i == -1) {
- if(!style()->styleHint(QStyle::SH_Menu_SelectionWrap, 0, this))
+ if (!style()->styleHint(QStyle::SH_Menu_SelectionWrap, nullptr, this))
break;
if (d->scroll)
scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom;
@@ -3143,13 +3143,13 @@ void QMenu::keyPressEvent(QKeyEvent *e)
continue;
if (next->isSeparator() ||
(!next->isEnabled() &&
- !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)))
+ !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this)))
continue;
nextAction = next;
if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)) {
int topVisible = d->scrollerHeight();
if (d->tearoff)
- topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
+ topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, this);
if (((y + d->scroll->scrollOffset) - topVisible) <= d->actionRects.at(next_i).height())
scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop;
}
@@ -3161,7 +3161,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
y += d->actionRects.at(i).height();
for(int next_i = i+1; true; next_i++) {
if (next_i == d->actionRects.count()) {
- if(!style()->styleHint(QStyle::SH_Menu_SelectionWrap, 0, this))
+ if (!style()->styleHint(QStyle::SH_Menu_SelectionWrap, nullptr, this))
break;
if (d->scroll)
scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop;
@@ -3174,7 +3174,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
continue;
if (next->isSeparator() ||
(!next->isEnabled() &&
- !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)))
+ !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, this)))
continue;
nextAction = next;
if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)) {
@@ -3182,7 +3182,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
bottomVisible -= d->scrollerHeight();
if (d->tearoff)
- bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
+ bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, nullptr, this);
if ((y + d->scroll->scrollOffset + d->actionRects.at(next_i).height()) > bottomVisible)
scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom;
}
@@ -3212,7 +3212,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
Q_FALLTHROUGH();
case Qt::Key_Left: {
if (d->currentAction && !d->scroll) {
- QAction *nextAction = 0;
+ QAction *nextAction = nullptr;
if (key == Qt::Key_Left) {
QRect actionR = d->actionRect(d->currentAction);
for(int x = actionR.left()-1; !nextAction && x >= 0; x--)
@@ -3241,7 +3241,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
break;
key_consumed = true;
- if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this))
+ if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this))
{
d->hideMenu(this);
#if QT_CONFIG(menubar)
@@ -3253,7 +3253,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
break;
case Qt::Key_Space:
- if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this))
+ if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, nullptr, this))
break;
// for motif, fall through
Q_FALLTHROUGH();
@@ -3319,8 +3319,8 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if ((!e->modifiers() || e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ShiftModifier) &&
e->text().length()==1) {
bool activateAction = false;
- QAction *nextAction = 0;
- if (style()->styleHint(QStyle::SH_Menu_KeyboardSearch, 0, this) && !e->modifiers()) {
+ QAction *nextAction = nullptr;
+ if (style()->styleHint(QStyle::SH_Menu_KeyboardSearch, nullptr, this) && !e->modifiers()) {
int best_match_count = 0;
d->searchBufferTimer.start(2000, this);
d->searchBuffer += e->text();
@@ -3343,7 +3343,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
#ifndef QT_NO_SHORTCUT
else {
int clashCount = 0;
- QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0;
+ QAction *first = nullptr, *currentSelected = nullptr, *firstAfterCurrent = nullptr;
QChar c = e->text().at(0).toUpper();
for(int i = 0; i < d->actions.size(); ++i) {
if (d->actionRects.at(i).isNull())
@@ -3432,7 +3432,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
QMenuPrivate::mouseDown = this;
if (d->activeMenu)
- d->activeMenu->d_func()->setCurrentAction(0);
+ d->activeMenu->d_func()->setCurrentAction(nullptr);
QMenuSloppyState::MouseEventResult sloppyEventResult = d->sloppyState.processMouseEvent(e->localPos(), action, d->currentAction);
if (sloppyEventResult == QMenuSloppyState::EventShouldBePropagated) {
@@ -3462,7 +3462,7 @@ void QMenu::leaveEvent(QEvent *)
Q_D(QMenu);
d->hasReceievedEnter = false;
if (!d->activeMenu && d->currentAction)
- setActiveAction(0);
+ setActiveAction(nullptr);
}
/*!
@@ -3525,7 +3525,7 @@ void QMenu::actionEvent(QActionEvent *e)
} else if (e->type() == QEvent::ActionRemoved) {
e->action()->disconnect(this);
if (e->action() == d->currentAction)
- d->currentAction = 0;
+ d->currentAction = nullptr;
if (QWidgetAction *wa = qobject_cast<QWidgetAction *>(e->action())) {
if (QWidget *widget = d->widgetItems.value(wa)) {
#ifdef Q_OS_OSX
@@ -3601,7 +3601,7 @@ void QMenu::internalDelayedPopup()
#endif
screen = d->popupGeometry(QDesktopWidgetPrivate::screenNumber(pos()));
- int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);
+ int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr, this);
const QRect actionRect(d->actionRect(d->currentAction));
QPoint subMenuPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));
if (subMenuPos.x() > screen.right())
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index afa5ca7142..2de7cdff71 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -90,7 +90,7 @@ QMenuBarExtension::QMenuBarExtension(QWidget *parent)
#if QT_CONFIG(menu)
setPopupMode(QToolButton::InstantPopup);
#endif
- setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, 0, parentWidget()));
+ setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, nullptr, parentWidget()));
}
void QMenuBarExtension::paintEvent(QPaintEvent *)
@@ -106,7 +106,7 @@ void QMenuBarExtension::paintEvent(QPaintEvent *)
QSize QMenuBarExtension::sizeHint() const
{
- int ext = style()->pixelMetric(QStyle::PM_ToolBarExtensionExtent, 0, parentWidget());
+ int ext = style()->pixelMetric(QStyle::PM_ToolBarExtensionExtent, nullptr, parentWidget());
return QSize(ext, ext);
}
@@ -120,14 +120,14 @@ QAction *QMenuBarPrivate::actionAt(QPoint p) const
if(actionRect(actions.at(i)).contains(p))
return actions.at(i);
}
- return 0;
+ return nullptr;
}
QRect QMenuBarPrivate::menuRect(bool extVisible) const
{
Q_Q(const QMenuBar);
- int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q);
+ int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q);
QRect result = q->rect();
result.adjust(hmargin, 0, -hmargin, 0);
@@ -167,13 +167,13 @@ void QMenuBarPrivate::updateGeometries()
Q_Q(QMenuBar);
if(!itemsDirty)
return;
- int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2);
+ int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q)*2);
int q_start = -1;
if(leftWidget || rightWidget) {
- int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q)
- + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q);
- int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q)
- + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q);
+ int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q)
+ + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q);
+ int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, q)
+ + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q);
if (leftWidget && leftWidget->isVisible()) {
QSize sz = leftWidget->sizeHint();
q_width -= sz.width();
@@ -198,7 +198,7 @@ void QMenuBarPrivate::updateGeometries()
}
#endif
calcActionRects(q_width, q_start);
- currentAction = 0;
+ currentAction = nullptr;
#ifndef QT_NO_SHORTCUT
if(itemsDirty) {
for(int j = 0; j < shortcutIndexMap.size(); ++j)
@@ -246,7 +246,7 @@ void QMenuBarPrivate::updateGeometries()
pop->clear();
pop->addActions(hiddenActions);
- int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q);
+ int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q);
int x = q->isRightToLeft()
? menuRect.left() - extension->sizeHint().width() + 1
: menuRect.right();
@@ -285,8 +285,8 @@ void QMenuBarPrivate::focusFirstAction()
void QMenuBarPrivate::setKeyboardMode(bool b)
{
Q_Q(QMenuBar);
- if (b && !q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, q)) {
- setCurrentAction(0);
+ if (b && !q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, q)) {
+ setCurrentAction(nullptr);
return;
}
keyboardState = b;
@@ -298,11 +298,11 @@ void QMenuBarPrivate::setKeyboardMode(bool b)
q->setFocus(Qt::MenuBarFocusReason);
} else {
if(!popupState)
- setCurrentAction(0);
+ setCurrentAction(nullptr);
if(keyboardFocusWidget) {
if (QApplication::focusWidget() == q)
keyboardFocusWidget->setFocus(Qt::MenuBarFocusReason);
- keyboardFocusWidget = 0;
+ keyboardFocusWidget = nullptr;
}
}
q->update();
@@ -372,9 +372,9 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat
doChildEffects = (popup && !activeMenu);
Q_Q(QMenuBar);
- QWidget *fw = 0;
+ QWidget *fw = nullptr;
if(QMenu *menu = activeMenu) {
- activeMenu = 0;
+ activeMenu = nullptr;
if (popup) {
fw = q->window()->focusWidget();
q->setFocus(Qt::NoFocusReason);
@@ -419,14 +419,14 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const
const QStyle *style = q->style();
- const int itemSpacing = style->pixelMetric(QStyle::PM_MenuBarItemSpacing, 0, q);
+ const int itemSpacing = style->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr, q);
int max_item_height = 0, separator = -1, separator_start = 0, separator_len = 0;
//calculate size
const QFontMetrics fm = q->fontMetrics();
- const int hmargin = style->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q),
- vmargin = style->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q),
- icone = style->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
+ const int hmargin = style->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, q),
+ vmargin = style->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q),
+ icone = style->pixelMetric(QStyle::PM_SmallIconSize, nullptr, q);
for(int i = 0; i < actions.count(); i++) {
QAction *action = actions.at(i);
if(!action->isVisible())
@@ -436,7 +436,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const
//calc what I think the size is..
if(action->isSeparator()) {
- if (style->styleHint(QStyle::SH_DrawMenuBarSeparator, 0, q))
+ if (style->styleHint(QStyle::SH_DrawMenuBarSeparator, nullptr, q))
separator = i;
continue; //we don't really position these!
} else {
@@ -470,7 +470,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const
}
//calculate position
- const int fw = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q);
+ const int fw = q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q);
int x = fw + ((start == -1) ? hmargin : start) + itemSpacing;
int y = fw + vmargin;
for(int i = 0; i < actions.count(); i++) {
@@ -703,7 +703,7 @@ void QMenuBarPrivate::init()
q->hide();
q->setBackgroundRole(QPalette::Button);
handleReparent();
- q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
+ q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, nullptr, q));
extension = new QMenuBarExtension(q);
extension->setFocusPolicy(Qt::NoFocus);
@@ -715,7 +715,7 @@ QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) c
{
Q_Q(const QMenuBar);
const_cast<QMenuBarPrivate*>(this)->updateGeometries();
- bool allowActiveAndDisabled = q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q);
+ bool allowActiveAndDisabled = q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q);
const int start = (_start == -1 && increment == -1) ? actions.count() : _start;
const int end = increment == -1 ? 0 : actions.count() - 1;
@@ -729,7 +729,7 @@ QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) c
if (_start != -1) //let's try from the beginning or the end
return getNextAction(-1, increment);
- return 0;
+ return nullptr;
}
/*!
@@ -749,7 +749,7 @@ QMenuBar::~QMenuBar()
{
Q_D(QMenuBar);
delete d->platformMenuBar;
- d->platformMenuBar = 0;
+ d->platformMenuBar = nullptr;
}
/*!
@@ -1001,7 +1001,7 @@ void QMenuBar::paintEvent(QPaintEvent *e)
style()->drawControl(QStyle::CE_MenuBarItem, &opt, &p, this);
}
//draw border
- if(int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this)) {
+ if (int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this)) {
QRegion borderReg;
borderReg += QRect(0, 0, fw, height()); //left
borderReg += QRect(width()-fw, 0, fw, height()); //right
@@ -1054,7 +1054,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
QAction *action = d->actionAt(e->pos());
if (!action || !d->isVisible(action) || !action->isEnabled()) {
- d->setCurrentAction(0);
+ d->setCurrentAction(nullptr);
#if QT_CONFIG(whatsthis)
if (QWhatsThis::inWhatsThisMode())
QWhatsThis::showText(e->globalPos(), d->whatsThis, this);
@@ -1064,7 +1064,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
if(d->currentAction == action && d->popupState) {
if(QMenu *menu = d->activeMenu) {
- d->activeMenu = 0;
+ d->activeMenu = nullptr;
menu->setAttribute(Qt::WA_NoMouseReplay);
menu->hide();
}
@@ -1124,7 +1124,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
case Qt::Key_Enter:
case Qt::Key_Space:
case Qt::Key_Return: {
- if(!style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this) || !d->currentAction)
+ if (!style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this) || !d->currentAction)
break;
if(d->currentAction->menu()) {
d->popupAction(d->currentAction, true);
@@ -1153,7 +1153,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
#ifndef QT_NO_SHORTCUT
if (!key_consumed && e->matches(QKeySequence::Cancel)) {
- d->setCurrentAction(0);
+ d->setCurrentAction(nullptr);
d->setKeyboardMode(false);
key_consumed = true;
}
@@ -1163,7 +1163,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
(!e->modifiers() ||
(e->modifiers()&(Qt::MetaModifier|Qt::AltModifier))) && e->text().length()==1 && !d->popupState) {
int clashCount = 0;
- QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0;
+ QAction *first = nullptr, *currentSelected = nullptr, *firstAfterCurrent = nullptr;
{
const QChar c = e->text().at(0).toUpper();
for(int i = 0; i < d->actions.size(); ++i) {
@@ -1187,7 +1187,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
}
}
}
- QAction *next_action = 0;
+ QAction *next_action = nullptr;
if(clashCount >= 1) {
if(clashCount == 1 || !d->currentAction || (currentSelected && !firstAfterCurrent))
next_action = first;
@@ -1233,14 +1233,14 @@ void QMenuBar::leaveEvent(QEvent *)
{
Q_D(QMenuBar);
if((!hasFocus() && !d->popupState) ||
- (d->currentAction && d->currentAction->menu() == 0))
- d->setCurrentAction(0);
+ (d->currentAction && d->currentAction->menu() == nullptr))
+ d->setCurrentAction(nullptr);
}
QPlatformMenu *QMenuBarPrivate::getPlatformMenu(const QAction *action)
{
if (!action || !action->menu())
- return 0;
+ return nullptr;
QPlatformMenu *platformMenu = action->menu()->platformMenu();
if (!platformMenu && platformMenuBar) {
@@ -1353,7 +1353,7 @@ void QMenuBar::focusOutEvent(QFocusEvent *)
{
Q_D(QMenuBar);
if(!d->popupState) {
- d->setCurrentAction(0);
+ d->setCurrentAction(nullptr);
d->setKeyboardMode(false);
}
}
@@ -1366,7 +1366,7 @@ void QMenuBar::timerEvent (QTimerEvent *e)
Q_D(QMenuBar);
if (e->timerId() == d->autoReleaseTimer.timerId()) {
d->autoReleaseTimer.stop();
- d->setCurrentAction(0);
+ d->setCurrentAction(nullptr);
}
QWidget::timerEvent(e);
}
@@ -1420,7 +1420,7 @@ void QMenuBarPrivate::handleReparent()
newWindow->createWinId();
platformMenuBar->handleReparent(newWindow->windowHandle());
} else {
- platformMenuBar->handleReparent(0);
+ platformMenuBar->handleReparent(nullptr);
}
}
}
@@ -1433,7 +1433,7 @@ void QMenuBar::changeEvent(QEvent *e)
Q_D(QMenuBar);
if(e->type() == QEvent::StyleChange) {
d->itemsDirty = true;
- setMouseTracking(style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, this));
+ setMouseTracking(style()->styleHint(QStyle::SH_MenuBar_MouseTracking, nullptr, this));
if(parentWidget())
resize(parentWidget()->width(), heightForWidth(parentWidget()->width()));
d->updateGeometries();
@@ -1542,7 +1542,7 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event)
d->platformMenuBar->handleReparent(handle);
}
- if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) {
+ if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this)) {
if (d->altPressed) {
switch (event->type()) {
case QEvent::KeyPress:
@@ -1618,10 +1618,10 @@ QSize QMenuBar::minimumSizeHint() const
ensurePolished();
QSize ret(0, 0);
const_cast<QMenuBarPrivate*>(d)->updateGeometries();
- const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, this);
- const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this);
- int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this);
- int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this);
+ const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, this);
+ const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this);
+ int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this);
+ int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this);
if(as_gui_menubar) {
int w = parentWidget() ? parentWidget()->width() : QDesktopWidgetPrivate::width();
d->calcActionRects(w - (2 * fw), 0);
@@ -1670,10 +1670,10 @@ QSize QMenuBar::sizeHint() const
ensurePolished();
QSize ret(0, 0);
const_cast<QMenuBarPrivate*>(d)->updateGeometries();
- const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, this);
- const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this);
- int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this);
- int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this);
+ const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, this);
+ const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this);
+ int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this);
+ int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this);
if(as_gui_menubar) {
const int w = parentWidget() ? parentWidget()->width() : QDesktopWidgetPrivate::width();
d->calcActionRects(w - (2 * fw), 0);
@@ -1722,9 +1722,9 @@ int QMenuBar::heightForWidth(int) const
const_cast<QMenuBarPrivate*>(d)->updateGeometries();
int height = 0;
- const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this);
- int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this);
- int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this);
+ const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this);
+ int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this);
+ int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this);
if(as_gui_menubar) {
for (int i = 0; i < d->actionRects.count(); ++i)
height = qMax(height, d->actionRects.at(i).height());
@@ -1770,7 +1770,7 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id)
activateAction(act, QAction::Trigger);
//100 is the same as the default value in QPushButton::animateClick
autoReleaseTimer.start(100, q);
- } else if (act && q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, q)) {
+ } else if (act && q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, q)) {
// When we open a menu using a shortcut, we should end up in keyboard state
setKeyboardMode(true);
}
@@ -1836,7 +1836,7 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner)
QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
{
Q_D(const QMenuBar);
- QWidget *w = 0;
+ QWidget *w = nullptr;
switch(corner) {
case Qt::TopLeftCorner:
w = d->leftWidget;
@@ -1875,7 +1875,7 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
if (nativeMenuBar != bool(d->platformMenuBar)) {
if (!nativeMenuBar) {
delete d->platformMenuBar;
- d->platformMenuBar = 0;
+ d->platformMenuBar = nullptr;
} else {
if (!d->platformMenuBar)
d->platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 0a81931b57..1856f0296b 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -81,7 +81,7 @@ class QPlainTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivat
Q_DECLARE_PUBLIC(QPlainTextDocumentLayout)
public:
QPlainTextDocumentLayoutPrivate() {
- mainViewPrivate = 0;
+ mainViewPrivate = nullptr;
width = 0;
maximumWidth = 0;
maximumWidthBlockNumber = 0;
@@ -755,7 +755,7 @@ void QPlainTextEditPrivate::updateViewport()
}
QPlainTextEditPrivate::QPlainTextEditPrivate()
- : control(0),
+ : control(nullptr),
tabChangesFocus(false),
lineWrap(QPlainTextEdit::WidgetWidth),
wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere),
@@ -1302,7 +1302,7 @@ QPlainTextEdit::~QPlainTextEdit()
Q_D(QPlainTextEdit);
if (d->documentLayoutPtr) {
if (d->documentLayoutPtr->priv()->mainViewPrivate == d)
- d->documentLayoutPtr->priv()->mainViewPrivate = 0;
+ d->documentLayoutPtr->priv()->mainViewPrivate = nullptr;
}
}
@@ -1321,7 +1321,7 @@ QPlainTextEdit::~QPlainTextEdit()
void QPlainTextEdit::setDocument(QTextDocument *document)
{
Q_D(QPlainTextEdit);
- QPlainTextDocumentLayout *documentLayout = 0;
+ QPlainTextDocumentLayout *documentLayout = nullptr;
if (!document) {
document = new QTextDocument(d->control);
@@ -1891,7 +1891,7 @@ void QPlainTextEditPrivate::relayoutDocument()
int width = viewport->width();
- if (documentLayout->priv()->mainViewPrivate == 0
+ if (documentLayout->priv()->mainViewPrivate == nullptr
|| documentLayout->priv()->mainViewPrivate == this
|| width > documentLayout->textWidth()) {
documentLayout->priv()->mainViewPrivate = this;
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index f48b5706f7..b0d3ba51f9 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -297,7 +297,7 @@ QDialog *QPushButtonPrivate::dialogParent() const
if (const QDialog *dialog = qobject_cast<const QDialog *>(p))
return const_cast<QDialog *>(dialog);
}
- return 0;
+ return nullptr;
}
#endif
@@ -353,7 +353,7 @@ bool QPushButton::autoDefault() const
{
Q_D(const QPushButton);
if(d->autoDefault == QPushButtonPrivate::Auto)
- return ( d->dialogParent() != 0 );
+ return ( d->dialogParent() != nullptr );
return d->autoDefault;
}
@@ -496,7 +496,7 @@ void QPushButton::focusOutEvent(QFocusEvent *e)
#if QT_CONFIG(dialog)
QDialog *dlg = qobject_cast<QDialog*>(window());
if (dlg)
- dlg->d_func()->setDefault(0);
+ dlg->d_func()->setDefault(nullptr);
else
d->defaultButton = false;
#endif
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index 68aa545082..ce08e3439a 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -259,7 +259,7 @@ void QScrollArea::setWidget(QWidget *widget)
return;
delete d->widget;
- d->widget = 0;
+ d->widget = nullptr;
d->hbar->setValue(0);
d->vbar->setValue(0);
if (widget->parentWidget() != d->viewport)
@@ -285,9 +285,9 @@ QWidget *QScrollArea::takeWidget()
{
Q_D(QScrollArea);
QWidget *w = d->widget;
- d->widget = 0;
+ d->widget = nullptr;
if (w)
- w->setParent(0);
+ w->setParent(nullptr);
return w;
}
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 08d771a27a..34ea017279 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -224,7 +224,7 @@ void QScrollBarPrivate::setTransient(bool value)
if (transient != value) {
transient = value;
if (q->isVisible()) {
- if (q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, q))
+ if (q->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, q))
q->update();
} else if (!transient) {
q->show();
@@ -235,7 +235,7 @@ void QScrollBarPrivate::setTransient(bool value)
void QScrollBarPrivate::flash()
{
Q_Q(QScrollBar);
- if (!flashed && q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, q)) {
+ if (!flashed && q->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, q)) {
flashed = true;
if (!q->isVisible())
q->show();
@@ -319,7 +319,7 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const
option->upsideDown = d->invertedAppearance;
if (d->orientation == Qt::Horizontal)
option->state |= QStyle::State_Horizontal;
- if ((d->flashed || !d->transient) && style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this))
+ if ((d->flashed || !d->transient) && style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, this))
option->state |= QStyle::State_On;
}
@@ -376,7 +376,7 @@ void QScrollBarPrivate::init()
invertedControls = true;
pressedControl = hoverControl = QStyle::SC_None;
pointerOutsidePressedControl = false;
- transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, q);
+ transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, q);
flashed = false;
flashTimer = 0;
q->setFocusPolicy(Qt::NoFocus);
@@ -392,7 +392,7 @@ void QScrollBarPrivate::init()
/*! \reimp */
void QScrollBar::contextMenuEvent(QContextMenuEvent *event)
{
- if (!style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, this)) {
+ if (!style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, nullptr, this)) {
QAbstractSlider::contextMenuEvent(event);
return ;
}
@@ -412,7 +412,7 @@ void QScrollBar::contextMenuEvent(QContextMenuEvent *event)
QAction *actScrollDn = menu->addAction(horiz ? tr("Scroll right") : tr("Scroll down"));
QAction *actionSelected = menu->exec(event->globalPos());
delete menu;
- if (actionSelected == 0)
+ if (actionSelected == nullptr)
/* do nothing */ ;
else if (actionSelected == actScrollHere)
setValue(d_func()->pixelPosToRangeValue(horiz ? event->pos().x() : event->pos().y()));
@@ -472,11 +472,11 @@ bool QScrollBar::event(QEvent *event)
d_func()->updateHoverControl(he->pos());
break;
case QEvent::StyleChange:
- d_func()->setTransient(style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this));
+ d_func()->setTransient(style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, this));
break;
case QEvent::Timer:
if (static_cast<QTimerEvent *>(event)->timerId() == d->flashTimer) {
- if (d->flashed && style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this)) {
+ if (d->flashed && style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, this)) {
d->flashed = false;
update();
}
@@ -545,7 +545,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e)
d->stopRepeatAction();
bool midButtonAbsPos = style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition,
- 0, this);
+ nullptr, this);
QStyleOptionSlider opt;
initStyleOption(&opt);
diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp
index 662d4c9e92..2a4b4a0ad4 100644
--- a/src/widgets/widgets/qsizegrip.cpp
+++ b/src/widgets/widgets/qsizegrip.cpp
@@ -128,7 +128,7 @@ QSizeGripPrivate::QSizeGripPrivate()
: dxMax(0)
, dyMax(0)
, gotMousePress(false)
- , tlw(0)
+ , tlw(nullptr)
, m_platformSizeGrip(false)
{
}
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index b7c3426e08..70f05033ea 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -137,7 +137,7 @@ public:
perhaps Qt::WindowStaysOnTopHint.
*/
QSplashScreen::QSplashScreen(const QPixmap &pixmap, Qt::WindowFlags f)
- : QWidget(*(new QSplashScreenPrivate()), 0, Qt::SplashScreen | Qt::FramelessWindowHint | f)
+ : QWidget(*(new QSplashScreenPrivate()), nullptr, Qt::SplashScreen | Qt::FramelessWindowHint | f)
{
setPixmap(pixmap); // Does an implicit repaint
}
@@ -271,14 +271,14 @@ inline static bool waitForWindowExposed(QWindow *window, int timeout = 1000)
if (remaining <= 0)
break;
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
#if defined(Q_OS_WINRT)
WaitForSingleObjectEx(GetCurrentThread(), TimeOutMs, false);
#elif defined(Q_OS_WIN)
Sleep(uint(TimeOutMs));
#else
struct timespec ts = { TimeOutMs / 1000, (TimeOutMs % 1000) * 1000 * 1000 };
- nanosleep(&ts, NULL);
+ nanosleep(&ts, nullptr);
#endif
}
return window->isExposed();
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 1a5fb7f251..090aa5cc8b 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -1494,7 +1494,7 @@ int QSplitter::closestLegalPosition(int pos, int index)
bool QSplitter::opaqueResize() const
{
Q_D(const QSplitter);
- return d->opaqueResizeSet ? d->opaque : style()->styleHint(QStyle::SH_Splitter_OpaqueResize, 0, this);
+ return d->opaqueResizeSet ? d->opaque : style()->styleHint(QStyle::SH_Splitter_OpaqueResize, nullptr, this);
}
@@ -1639,7 +1639,7 @@ int QSplitter::handleWidth() const
if (d->handleWidth >= 0) {
return d->handleWidth;
} else {
- return style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
+ return style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr, this);
}
}
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp
index f863964c58..a565d4ab4c 100644
--- a/src/widgets/widgets/qstackedwidget.cpp
+++ b/src/widgets/widgets/qstackedwidget.cpp
@@ -49,7 +49,7 @@ class QStackedWidgetPrivate : public QFramePrivate
{
Q_DECLARE_PUBLIC(QStackedWidget)
public:
- QStackedWidgetPrivate():layout(0){}
+ QStackedWidgetPrivate():layout(nullptr){}
QStackedLayout *layout;
bool blockChildAdd;
};
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 943b576ee3..4a1fef8b65 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -229,11 +229,11 @@ QStatusBar::QStatusBar(QWidget * parent)
: QWidget(*new QStatusBarPrivate, parent, { })
{
Q_D(QStatusBar);
- d->box = 0;
- d->timer = 0;
+ d->box = nullptr;
+ d->timer = nullptr;
#if QT_CONFIG(sizegrip)
- d->resizer = 0;
+ d->resizer = nullptr;
setSizeGripEnabled(true); // causes reformat()
#else
reformat();
@@ -451,7 +451,7 @@ void QStatusBar::setSizeGripEnabled(bool enabled)
d->showSizeGrip = true;
} else {
delete d->resizer;
- d->resizer = 0;
+ d->resizer = nullptr;
d->showSizeGrip = false;
}
reformat();
@@ -497,7 +497,7 @@ void QStatusBar::reformat()
int i;
QStatusBarPrivate::SBItem* item;
- for (i=0,item=0; i<d->items.size(); ++i) {
+ for (i=0,item=nullptr; i<d->items.size(); ++i) {
item = d->items.at(i);
if (!item || item->p)
break;
@@ -508,7 +508,7 @@ void QStatusBar::reformat()
l->addStretch(0);
- for (item=0; i<d->items.size(); ++i) {
+ for (item=nullptr; i<d->items.size(); ++i) {
item = d->items.at(i);
if (!item)
break;
@@ -556,7 +556,7 @@ void QStatusBar::showMessage(const QString &message, int timeout)
d->timer->start(timeout);
} else if (d->timer) {
delete d->timer;
- d->timer = 0;
+ d->timer = nullptr;
}
if (d->tempItem == message)
return;
@@ -578,7 +578,7 @@ void QStatusBar::clearMessage()
return;
if (d->timer) {
qDeleteInEventHandler(d->timer);
- d->timer = 0;
+ d->timer = nullptr;
}
d->tempItem.clear();
hideOrShow();
@@ -617,7 +617,7 @@ void QStatusBar::hideOrShow()
Q_D(QStatusBar);
bool haveMessage = !d->tempItem.isEmpty();
- QStatusBarPrivate::SBItem* item = 0;
+ QStatusBarPrivate::SBItem* item = nullptr;
for (int i=0; i<d->items.size(); ++i) {
item = d->items.at(i);
if (!item || item->p)
@@ -711,7 +711,7 @@ bool QStatusBar::event(QEvent *e)
// Calculate new strut height and call reformat() if it has changed
int maxH = fontMetrics().height();
- QStatusBarPrivate::SBItem* item = 0;
+ QStatusBarPrivate::SBItem* item = nullptr;
for (int i=0; i<d->items.size(); ++i) {
item = d->items.at(i);
if (!item)
@@ -731,7 +731,7 @@ bool QStatusBar::event(QEvent *e)
update();
}
if (e->type() == QEvent::ChildRemoved) {
- QStatusBarPrivate::SBItem* item = 0;
+ QStatusBarPrivate::SBItem* item = nullptr;
for (int i=0; i<d->items.size(); ++i) {
item = d->items.at(i);
if (!item)
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index dfe362bdca..4e75cca704 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -76,7 +76,7 @@ class CloseButton : public QAbstractButton
Q_OBJECT
public:
- explicit CloseButton(QWidget *parent = 0);
+ explicit CloseButton(QWidget *parent = nullptr);
QSize sizeHint() const override;
QSize minimumSizeHint() const override
@@ -424,18 +424,18 @@ void QTabBarPrivate::init()
rightB->setAccessibleName(QTabBar::tr("Scroll Right"));
#endif
q->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- elideMode = Qt::TextElideMode(q->style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, q));
- useScrollButtons = !q->style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, q);
+ elideMode = Qt::TextElideMode(q->style()->styleHint(QStyle::SH_TabBar_ElideMode, nullptr, q));
+ useScrollButtons = !q->style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, nullptr, q);
}
QTabBarPrivate::Tab *QTabBarPrivate::at(int index)
{
- return validIndex(index)?&tabList[index]:0;
+ return validIndex(index)?&tabList[index]:nullptr;
}
const QTabBarPrivate::Tab *QTabBarPrivate::at(int index) const
{
- return validIndex(index)?&tabList[index]:0;
+ return validIndex(index)?&tabList[index]:nullptr;
}
int QTabBarPrivate::indexAtPos(const QPoint &p) const
@@ -460,7 +460,7 @@ void QTabBarPrivate::layoutTabs()
bool vertTabs = verticalTabs(shape);
int tabChainIndex = 0;
- Qt::Alignment tabAlignment = Qt::Alignment(q->style()->styleHint(QStyle::SH_TabBar_Alignment, 0, q));
+ Qt::Alignment tabAlignment = Qt::Alignment(q->style()->styleHint(QStyle::SH_TabBar_Alignment, nullptr, q));
QVector<QLayoutStruct> tabChain(tabList.count() + 2);
// We put an empty item at the front and back and set its expansive attribute
@@ -787,7 +787,7 @@ void QTabBarPrivate::_q_closeTab()
Q_Q(QTabBar);
QObject *object = q->sender();
int tabToClose = -1;
- QTabBar::ButtonPosition closeSide = (QTabBar::ButtonPosition)q->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, q);
+ QTabBar::ButtonPosition closeSide = (QTabBar::ButtonPosition)q->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, q);
for (int i = 0; i < tabList.count(); ++i) {
if (closeSide == QTabBar::LeftSide) {
if (tabList.at(i).leftWidget == object) {
@@ -984,7 +984,7 @@ int QTabBar::insertTab(int index, const QIcon& icon, const QString &text)
if (d->closeButtonOnTabs) {
QStyleOptionTab opt;
initStyleOption(&opt, index);
- ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
+ ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
QAbstractButton *closeButton = new CloseButton(this);
connect(closeButton, SIGNAL(clicked()), this, SLOT(_q_closeTab()));
setTabButton(index, closeSide, closeButton);
@@ -1019,12 +1019,12 @@ void QTabBar::removeTab(int index)
if (d->tabList[index].leftWidget) {
d->tabList[index].leftWidget->hide();
d->tabList[index].leftWidget->deleteLater();
- d->tabList[index].leftWidget = 0;
+ d->tabList[index].leftWidget = nullptr;
}
if (d->tabList[index].rightWidget) {
d->tabList[index].rightWidget->hide();
d->tabList[index].rightWidget->deleteLater();
- d->tabList[index].rightWidget = 0;
+ d->tabList[index].rightWidget = nullptr;
}
int newIndex = d->tabList[index].lastTab;
@@ -1395,7 +1395,7 @@ QSize QTabBar::iconSize() const
Q_D(const QTabBar);
if (d->iconSize.isValid())
return d->iconSize;
- int iconExtent = style()->pixelMetric(QStyle::PM_TabBarIconSize, 0, this);
+ int iconExtent = style()->pixelMetric(QStyle::PM_TabBarIconSize, nullptr, this);
return QSize(iconExtent, iconExtent);
}
@@ -1797,7 +1797,7 @@ void QTabBar::paintEvent(QPaintEvent *)
if (!d->dragInProgress)
p.drawControl(QStyle::CE_TabBarTab, tab);
else {
- int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this);
+ int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr, this);
if (verticalTabs(d->shape))
d->movingTab->setGeometry(tab.rect.adjusted(0, -taboverlap, 0, taboverlap));
else
@@ -2065,7 +2065,7 @@ void QTabBarPrivate::setupMovableTab()
if (!movingTab)
movingTab = new QMovableTabWidget(q);
- int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q);
+ int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr ,q);
QRect grabRect = q->tabRect(pressedIndex);
if (verticalTabs(shape))
grabRect.adjust(0, -taboverlap, 0, taboverlap);
@@ -2221,9 +2221,9 @@ void QTabBar::changeEvent(QEvent *event)
switch (event->type()) {
case QEvent::StyleChange:
if (!d->elideModeSetByUser)
- d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));
+ d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, nullptr, this));
if (!d->useScrollButtonsSetByUser)
- d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);
+ d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, nullptr, this);
Q_FALLTHROUGH();
case QEvent::FontChange:
d->textSizes.clear();
@@ -2333,16 +2333,16 @@ void QTabBar::setTabsClosable(bool closable)
if (d->closeButtonOnTabs == closable)
return;
d->closeButtonOnTabs = closable;
- ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
+ ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
if (!closable) {
for (int i = 0; i < d->tabList.count(); ++i) {
if (closeSide == LeftSide && d->tabList[i].leftWidget) {
d->tabList[i].leftWidget->deleteLater();
- d->tabList[i].leftWidget = 0;
+ d->tabList[i].leftWidget = nullptr;
}
if (closeSide == RightSide && d->tabList[i].rightWidget) {
d->tabList[i].rightWidget->deleteLater();
- d->tabList[i].rightWidget = 0;
+ d->tabList[i].rightWidget = nullptr;
}
}
} else {
@@ -2637,8 +2637,8 @@ CloseButton::CloseButton(QWidget *parent)
QSize CloseButton::sizeHint() const
{
ensurePolished();
- int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this);
- int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this);
+ int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, this);
+ int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, this);
return QSize(width, height);
}
@@ -2671,7 +2671,7 @@ void CloseButton::paintEvent(QPaintEvent *)
if (const QTabBar *tb = qobject_cast<const QTabBar *>(parent())) {
int index = tb->currentIndex();
- QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tb);
+ QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, tb);
if (tb->tabButton(index, position) == this)
opt.state |= QStyle::State_Selected;
}
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 5552c43548..6f77579108 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -105,9 +105,9 @@ public:
struct Tab {
inline Tab(const QIcon &ico, const QString &txt)
: enabled(true) , shortcutId(0), text(txt), icon(ico),
- leftWidget(0), rightWidget(0), lastTab(-1), dragOffset(0)
+ leftWidget(nullptr), rightWidget(nullptr), lastTab(-1), dragOffset(0)
#if QT_CONFIG(animation)
- , animation(0)
+ , animation(nullptr)
#endif // animation
{}
bool operator==(const Tab &other) const { return &other == this; }
diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp
index 2b3b8280bb..28c91a89e7 100644
--- a/src/widgets/widgets/qtabwidget.cpp
+++ b/src/widgets/widgets/qtabwidget.cpp
@@ -215,9 +215,9 @@ public:
};
QTabWidgetPrivate::QTabWidgetPrivate()
- : tabs(0), stack(0), dirty(true),
+ : tabs(nullptr), stack(nullptr), dirty(true),
pos(QTabWidget::North), shape(QTabWidget::Rounded),
- leftCornerWidget(0), rightCornerWidget(0)
+ leftCornerWidget(nullptr), rightCornerWidget(nullptr)
{}
QTabWidgetPrivate::~QTabWidgetPrivate()
@@ -249,7 +249,7 @@ void QTabWidgetPrivate::init()
q->setFocusPolicy(Qt::TabFocus);
q->setFocusProxy(tabs);
q->setTabPosition(static_cast<QTabWidget::TabPosition> (q->style()->styleHint(
- QStyle::SH_TabWidget_DefaultTabPosition, 0, q )));
+ QStyle::SH_TabWidget_DefaultTabPosition, nullptr, q )));
}
@@ -280,7 +280,7 @@ void QTabWidgetPrivate::initBasicStyleOption(QStyleOptionTabWidgetFrame *option)
if (q->documentMode())
option->lineWidth = 0;
else
- option->lineWidth = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q);
+ option->lineWidth = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, q);
switch (pos) {
case QTabWidget::North:
@@ -319,7 +319,7 @@ void QTabWidget::initStyleOption(QStyleOptionTabWidgetFrame *option) const
Q_D(const QTabWidget);
d->initBasicStyleOption(option);
- int exth = style()->pixelMetric(QStyle::PM_TabBarBaseHeight, 0, this);
+ int exth = style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr, this);
QSize t(0, d->stack->frameWidth());
if (d->tabs->isVisibleTo(const_cast<QTabWidget *>(this))) {
t = d->tabs->sizeHint();
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index dd2ea3f18f..10de7d0b9e 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -117,7 +117,7 @@ public:
};
QTextEditPrivate::QTextEditPrivate()
- : control(0),
+ : control(nullptr),
autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false),
lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0),
wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0),
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 79182dfa33..b4e90c7d71 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -91,7 +91,7 @@ void QToolBarPrivate::init()
q->setAttribute(Qt::WA_X11NetWmWindowTypeToolBar);
QStyle *style = q->style();
- int e = style->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
+ int e = style->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, q);
iconSize = QSize(e, e);
layout = new QToolBarLayout(q);
@@ -99,7 +99,7 @@ void QToolBarPrivate::init()
toggleViewAction = new QAction(q);
toggleViewAction->setCheckable(true);
- q->setMovable(q->style()->styleHint(QStyle::SH_ToolBar_Movable, 0, q ));
+ q->setMovable(q->style()->styleHint(QStyle::SH_ToolBar_Movable, nullptr, q ));
QObject::connect(toggleViewAction, SIGNAL(triggered(bool)), q, SLOT(_q_toggleView(bool)));
}
@@ -173,21 +173,21 @@ void QToolBarPrivate::initDrag(const QPoint &pos)
{
Q_Q(QToolBar);
- if (state != 0)
+ if (state != nullptr)
return;
QMainWindow *win = qobject_cast<QMainWindow*>(parent);
- Q_ASSERT(win != 0);
+ Q_ASSERT(win != nullptr);
QMainWindowLayout *layout = qt_mainwindow_layout(win);
- Q_ASSERT(layout != 0);
- if (layout->pluggingWidget != 0) // the main window is animating a docking operation
+ Q_ASSERT(layout != nullptr);
+ if (layout->pluggingWidget != nullptr) // the main window is animating a docking operation
return;
state = new DragState;
state->pressPos = pos;
state->dragging = false;
state->moving = false;
- state->widgetItem = 0;
+ state->widgetItem = nullptr;
if (q->isRightToLeft())
state->pressPos = QPoint(q->width() - state->pressPos.x(), state->pressPos.y());
@@ -197,19 +197,19 @@ void QToolBarPrivate::startDrag(bool moving)
{
Q_Q(QToolBar);
- Q_ASSERT(state != 0);
+ Q_ASSERT(state != nullptr);
if ((moving && state->moving) || state->dragging)
return;
QMainWindow *win = qobject_cast<QMainWindow*>(parent);
- Q_ASSERT(win != 0);
+ Q_ASSERT(win != nullptr);
QMainWindowLayout *layout = qt_mainwindow_layout(win);
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
if (!moving) {
state->widgetItem = layout->unplug(q);
- Q_ASSERT(state->widgetItem != 0);
+ Q_ASSERT(state->widgetItem != nullptr);
}
state->dragging = !moving;
state->moving = moving;
@@ -218,13 +218,13 @@ void QToolBarPrivate::startDrag(bool moving)
void QToolBarPrivate::endDrag()
{
Q_Q(QToolBar);
- Q_ASSERT(state != 0);
+ Q_ASSERT(state != nullptr);
q->releaseMouse();
if (state->dragging) {
QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
if (!layout->plug(state->widgetItem)) {
if (q->isFloatable()) {
@@ -239,7 +239,7 @@ void QToolBarPrivate::endDrag()
}
delete state;
- state = 0;
+ state = nullptr;
}
bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
@@ -278,7 +278,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*)
{
- if (state != 0) {
+ if (state != nullptr) {
endDrag();
return true;
} else {
@@ -310,13 +310,13 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
}
QMainWindow *win = qobject_cast<QMainWindow*>(parent);
- if (win == 0)
+ if (win == nullptr)
return true;
QMainWindowLayout *layout = qt_mainwindow_layout(win);
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
- if (layout->pluggingWidget == 0
+ if (layout->pluggingWidget == nullptr
&& (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) {
const bool wasDragging = state->dragging;
const bool moving = !q->isWindow() && (orientation == Qt::Vertical ?
@@ -673,16 +673,16 @@ void QToolBar::setIconSize(const QSize &iconSize)
if (mw && mw->layout()) {
QLayout *layout = mw->layout();
int i = 0;
- QLayoutItem *item = 0;
+ QLayoutItem *item = nullptr;
do {
item = layout->itemAt(i++);
if (item && (item->widget() == this))
sz = mw->iconSize();
- } while (!sz.isValid() && item != 0);
+ } while (!sz.isValid() && item != nullptr);
}
}
if (!sz.isValid()) {
- const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, this);
+ const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, nullptr, this);
sz = QSize(metric, metric);
}
if (d->iconSize != sz) {
@@ -945,7 +945,7 @@ QAction *QToolBar::actionAt(const QPoint &p) const
QWidget *widget = childAt(p);
int index = d->layout->indexOf(widget);
if (index == -1)
- return 0;
+ return nullptr;
QLayoutItem *item = d->layout->itemAt(index);
return static_cast<QToolBarItem*>(item)->action;
}
@@ -966,7 +966,7 @@ void QToolBar::actionEvent(QActionEvent *event)
switch (event->type()) {
case QEvent::ActionAdded: {
- Q_ASSERT_X(widgetAction == 0 || d->layout->indexOf(widgetAction) == -1,
+ Q_ASSERT_X(widgetAction == nullptr || d->layout->indexOf(widgetAction) == -1,
"QToolBar", "widgets cannot be inserted multiple times");
// reparent the action to this toolbar if it has been created
@@ -974,7 +974,7 @@ void QToolBar::actionEvent(QActionEvent *event)
// preserve Qt 4.1.x behavior. The widget is already
// reparented to us due to the createWidget call inside
// createItem()
- if (widgetAction != 0 && widgetAction->d_func()->autoCreated)
+ if (widgetAction != nullptr && widgetAction->d_func()->autoCreated)
widgetAction->setParent(this);
int index = d->layout->count();
@@ -1059,18 +1059,18 @@ void QToolBar::paintEvent(QPaintEvent *)
*/
static bool waitForPopup(QToolBar *tb, QWidget *popup)
{
- if (popup == 0 || popup->isHidden())
+ if (popup == nullptr || popup->isHidden())
return false;
QWidget *w = popup;
- while (w != 0) {
+ while (w != nullptr) {
if (w == tb)
return true;
w = w->parentWidget();
}
QMenu *menu = qobject_cast<QMenu*>(popup);
- if (menu == 0)
+ if (menu == nullptr)
return false;
QAction *action = menu->menuAction();
@@ -1161,7 +1161,7 @@ bool QToolBar::event(QEvent *event)
return true;
break;
case QEvent::Leave:
- if (d->state != 0 && d->state->dragging) {
+ if (d->state != nullptr && d->state->dragging) {
#ifdef Q_OS_WIN
// This is a workaround for loosing the mouse on Vista.
QPoint pos = QCursor::pos();
@@ -1213,7 +1213,7 @@ QWidget *QToolBar::widgetForAction(QAction *action) const
int index = d->layout->indexOf(action);
if (index == -1)
- return 0;
+ return nullptr;
return d->layout->itemAt(index)->widget();
}
@@ -1233,7 +1233,7 @@ void QToolBar::initStyleOption(QStyleOptionToolBar *option) const
option->initFrom(this);
if (orientation() == Qt::Horizontal)
option->state |= QStyle::State_Horizontal;
- option->lineWidth = style()->pixelMetric(QStyle::PM_ToolBarFrameWidth, 0, this);
+ option->lineWidth = style()->pixelMetric(QStyle::PM_ToolBarFrameWidth, nullptr, this);
option->features = d->layout->movable()
? QStyleOptionToolBar::Movable
: QStyleOptionToolBar::None;
@@ -1247,7 +1247,7 @@ void QToolBar::initStyleOption(QStyleOptionToolBar *option) const
return;
QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow);
- Q_ASSERT_X(layout != 0, "QToolBar::initStyleOption()",
+ Q_ASSERT_X(layout != nullptr, "QToolBar::initStyleOption()",
"QMainWindow->layout() != QMainWindowLayout");
layout->getStyleOptionInfo(option, const_cast<QToolBar *>(this));
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index adc329131c..493c094cc1 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -91,7 +91,7 @@ bool QToolBarAreaLayoutItem::skip() const
{
if (gap)
return false;
- return widgetItem == 0 || widgetItem->isEmpty();
+ return widgetItem == nullptr || widgetItem->isEmpty();
}
/******************************************************************************
@@ -302,7 +302,7 @@ QLayoutItem *QToolBarAreaLayoutInfo::insertToolBar(QToolBar *before, QToolBar *t
void QToolBarAreaLayoutInfo::insertItem(QToolBar *before, QLayoutItem *item)
{
- if (before == 0) {
+ if (before == nullptr) {
if (lines.isEmpty())
lines.append(QToolBarAreaLayoutLine(o));
lines.last().toolBarItems.append(item);
@@ -330,7 +330,7 @@ void QToolBarAreaLayoutInfo::removeToolBar(QToolBar *toolBar)
QToolBarAreaLayoutItem &item = line.toolBarItems[k];
if (item.widgetItem->widget() == toolBar) {
delete item.widgetItem;
- item.widgetItem = 0;
+ item.widgetItem = nullptr;
line.toolBarItems.removeAt(k);
if (line.toolBarItems.isEmpty() && j < lines.count() - 1)
@@ -344,7 +344,7 @@ void QToolBarAreaLayoutInfo::removeToolBar(QToolBar *toolBar)
void QToolBarAreaLayoutInfo::insertToolBarBreak(QToolBar *before)
{
- if (before == 0) {
+ if (before == nullptr) {
if (!lines.isEmpty() && lines.constLast().toolBarItems.isEmpty())
return;
lines.append(QToolBarAreaLayoutLine(o));
@@ -729,7 +729,7 @@ QRect QToolBarAreaLayout::rectHint(const QRect &r) const
QLayoutItem *QToolBarAreaLayout::itemAt(int *x, int index) const
{
- Q_ASSERT(x != 0);
+ Q_ASSERT(x != nullptr);
for (int i = 0; i < QInternal::DockCount; ++i) {
const QToolBarAreaLayoutInfo &dock = docks[i];
@@ -744,12 +744,12 @@ QLayoutItem *QToolBarAreaLayout::itemAt(int *x, int index) const
}
}
- return 0;
+ return nullptr;
}
QLayoutItem *QToolBarAreaLayout::takeAt(int *x, int index)
{
- Q_ASSERT(x != 0);
+ Q_ASSERT(x != nullptr);
for (int i = 0; i < QInternal::DockCount; ++i) {
QToolBarAreaLayoutInfo &dock = docks[i];
@@ -768,7 +768,7 @@ QLayoutItem *QToolBarAreaLayout::takeAt(int *x, int index)
}
}
- return 0;
+ return nullptr;
}
void QToolBarAreaLayout::deleteAllLayoutItems()
@@ -783,7 +783,7 @@ void QToolBarAreaLayout::deleteAllLayoutItems()
QToolBarAreaLayoutItem &item = line.toolBarItems[k];
if (!item.gap)
delete item.widgetItem;
- item.widgetItem = 0;
+ item.widgetItem = nullptr;
}
}
}
@@ -811,7 +811,7 @@ QLayoutItem *QToolBarAreaLayout::insertToolBar(QToolBar *before, QToolBar *toolB
{
QInternal::DockPosition pos = findToolBar(before);
if (pos == QInternal::DockCount)
- return 0;
+ return nullptr;
return docks[pos].insertToolBar(before, toolBar);
}
@@ -826,7 +826,7 @@ void QToolBarAreaLayout::removeToolBar(QToolBar *toolBar)
QLayoutItem *QToolBarAreaLayout::addToolBar(QInternal::DockPosition pos, QToolBar *toolBar)
{
- return docks[pos].insertToolBar(0, toolBar);
+ return docks[pos].insertToolBar(nullptr, toolBar);
}
void QToolBarAreaLayout::insertToolBarBreak(QToolBar *before)
@@ -847,7 +847,7 @@ void QToolBarAreaLayout::removeToolBarBreak(QToolBar *before)
void QToolBarAreaLayout::addToolBarBreak(QInternal::DockPosition pos)
{
- docks[pos].insertToolBarBreak(0);
+ docks[pos].insertToolBarBreak(nullptr);
}
void QToolBarAreaLayout::moveToolBar(QToolBar *toolbar, int p)
@@ -878,7 +878,7 @@ void QToolBarAreaLayout::insertItem(QToolBar *before, QLayoutItem *item)
void QToolBarAreaLayout::apply(bool animate)
{
QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow);
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
Qt::LayoutDirection dir = mainWindow->layoutDirection();
@@ -1117,13 +1117,13 @@ QToolBarAreaLayoutItem *QToolBarAreaLayout::item(const QList<int> &path)
Q_ASSERT(path.count() == 3);
if (path.at(0) < 0 || path.at(0) >= QInternal::DockCount)
- return 0;
+ return nullptr;
QToolBarAreaLayoutInfo &info = docks[path.at(0)];
if (path.at(1) < 0 || path.at(1) >= info.lines.count())
- return 0;
+ return nullptr;
QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
if (path.at(2) < 0 || path.at(2) >= line.toolBarItems.count())
- return 0;
+ return nullptr;
return &(line.toolBarItems[path.at(2)]);
}
@@ -1143,10 +1143,10 @@ QLayoutItem *QToolBarAreaLayout::plug(const QList<int> &path)
QToolBarAreaLayoutItem *item = this->item(path);
if (Q_UNLIKELY(!item)) {
qWarning() << "No item at" << path;
- return 0;
+ return nullptr;
}
Q_ASSERT(item->gap);
- Q_ASSERT(item->widgetItem != 0);
+ Q_ASSERT(item->widgetItem != nullptr);
item->gap = false;
return item->widgetItem;
}
@@ -1352,14 +1352,14 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
rect = unpackRect(geom0, geom1, &floating);
}
- QToolBar *toolBar = 0;
+ QToolBar *toolBar = nullptr;
for (int x = 0; x < toolBars.count(); ++x) {
if (toolBars.at(x)->objectName() == objectName) {
toolBar = toolBars.takeAt(x);
break;
}
}
- if (toolBar == 0) {
+ if (toolBar == nullptr) {
continue;
}
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index ec60309806..89c7f32b28 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -69,13 +69,13 @@ extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
*/
QToolBarItem::QToolBarItem(QWidget *widget)
- : QWidgetItem(widget), action(0), customWidget(false)
+ : QWidgetItem(widget), action(nullptr), customWidget(false)
{
}
bool QToolBarItem::isEmpty() const
{
- return action == 0 || !action->isVisible();
+ return action == nullptr || !action->isVisible();
}
/******************************************************************************
@@ -84,7 +84,7 @@ bool QToolBarItem::isEmpty() const
QToolBarLayout::QToolBarLayout(QWidget *parent)
: QLayout(parent), expanded(false), animating(false), dirty(true),
- expanding(false), empty(true), expandFlag(false), popupMenu(0)
+ expanding(false), empty(true), expandFlag(false), popupMenu(nullptr)
{
QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (!tb)
@@ -132,15 +132,15 @@ bool QToolBarLayout::hasExpandFlag() const
void QToolBarLayout::setUsePopupMenu(bool set)
{
- if (!dirty && ((popupMenu == 0) == set))
+ if (!dirty && ((popupMenu == nullptr) == set))
invalidate();
if (!set) {
QObject::connect(extension, SIGNAL(clicked(bool)),
this, SLOT(setExpanded(bool)), Qt::UniqueConnection);
extension->setPopupMode(QToolButton::DelayedPopup);
- extension->setMenu(0);
+ extension->setMenu(nullptr);
delete popupMenu;
- popupMenu = 0;
+ popupMenu = nullptr;
} else {
QObject::disconnect(extension, SIGNAL(clicked(bool)),
this, SLOT(setExpanded(bool)));
@@ -169,21 +169,21 @@ void QToolBarLayout::addItem(QLayoutItem*)
QLayoutItem *QToolBarLayout::itemAt(int index) const
{
if (index < 0 || index >= items.count())
- return 0;
+ return nullptr;
return items.at(index);
}
QLayoutItem *QToolBarLayout::takeAt(int index)
{
if (index < 0 || index >= items.count())
- return 0;
+ return nullptr;
QToolBarItem *item = items.takeAt(index);
if (popupMenu)
popupMenu->removeAction(item->action);
QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(item->action);
- if (widgetAction != 0 && item->customWidget) {
+ if (widgetAction != nullptr && item->customWidget) {
widgetAction->releaseWidget(item->widget());
} else {
// destroy the QToolButton/QToolBarSeparator
@@ -251,7 +251,7 @@ bool QToolBarLayout::movable() const
if (!tb)
return false;
QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget());
- return tb->isMovable() && win != 0;
+ return tb->isMovable() && win != nullptr;
}
void QToolBarLayout::updateGeomArray() const
@@ -343,7 +343,7 @@ void QToolBarLayout::updateGeomArray() const
static bool defaultWidgetAction(QToolBarItem *item)
{
QWidgetAction *a = qobject_cast<QWidgetAction*>(item->action);
- return a != 0 && a->defaultWidget() == item->widget();
+ return a != nullptr && a->defaultWidget() == item->widget();
}
void QToolBarLayout::updateMacBorderMetrics()
@@ -568,7 +568,7 @@ bool QToolBarLayout::layoutActions(const QSize &size)
// widgets into the menu. If only custom widget actions are chopped off, the popup menu
// is empty. So we show the little extension button to show something is chopped off,
// but we make it disabled.
- extension->setEnabled(popupMenu == 0 || !extensionMenuContainsOnlyWidgetActions);
+ extension->setEnabled(popupMenu == nullptr || !extensionMenuContainsOnlyWidgetActions);
// we have to do the show/hide here, because it triggers more calls to setGeometry :(
for (int i = 0; i < showWidgets.count(); ++i)
@@ -615,7 +615,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const
++rows; // we want to expand to at least two rows
int space = total_w/rows + spacing + extensionExtent;
space = qMax(space, min_w - pick(o, margins) - handleExtent);
- if (win != 0)
+ if (win != nullptr)
space = qMin(space, pick(o, win->size()) - pick(o, margins) - handleExtent);
int w = 0;
@@ -651,7 +651,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const
w += pick(Qt::Horizontal, margins) + handleExtent + spacing + extensionExtent;
w = qMax(w, min_w);
- if (win != 0)
+ if (win != nullptr)
w = qMin(w, pick(o, win->size()));
h += pick(Qt::Vertical, margins) - spacing; //there is no spacing before the first row
@@ -710,14 +710,14 @@ QToolBarItem *QToolBarLayout::createItem(QAction *action)
{
bool customWidget = false;
bool standardButtonWidget = false;
- QWidget *widget = 0;
+ QWidget *widget = nullptr;
QToolBar *tb = qobject_cast<QToolBar*>(parentWidget());
if (!tb)
- return (QToolBarItem *)0;
+ return (QToolBarItem *)nullptr;
if (QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(action)) {
widget = widgetAction->requestWidget(tb);
- if (widget != 0) {
+ if (widget != nullptr) {
widget->setAttribute(Qt::WA_LayoutUsesWidgetRect);
customWidget = true;
}
diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp
index 4d7f543a99..4767394842 100644
--- a/src/widgets/widgets/qtoolbox.cpp
+++ b/src/widgets/widgets/qtoolbox.cpp
@@ -111,7 +111,7 @@ public:
typedef std::vector<std::unique_ptr<Page>> PageList;
inline QToolBoxPrivate()
- : currentPage(0)
+ : currentPage(nullptr)
{
}
void _q_buttonClicked();
@@ -157,7 +157,7 @@ const QToolBoxPrivate::Page *QToolBoxPrivate::page(int index) const
void QToolBoxPrivate::updateTabs()
{
- QToolBoxButton *lastButton = currentPage ? currentPage->button : 0;
+ QToolBoxButton *lastButton = currentPage ? currentPage->button : nullptr;
bool after = false;
int index = 0;
for (const auto &page : pageList) {
@@ -184,7 +184,7 @@ QSize QToolBoxButton::sizeHint() const
{
QSize iconSize(8, 8);
if (!icon().isNull()) {
- int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() /* QToolBox */);
+ int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, parentWidget() /* QToolBox */);
iconSize += QSize(icone + 2, icone);
}
QSize textSize = fontMetrics().size(Qt::TextShowMnemonic, text()) + QSize(0, 8);
@@ -197,7 +197,7 @@ QSize QToolBoxButton::minimumSizeHint() const
{
if (icon().isNull())
return QSize();
- int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() /* QToolBox */);
+ int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, parentWidget() /* QToolBox */);
return QSize(icone + 8, icone + 8);
}
@@ -378,7 +378,7 @@ int QToolBox::insertItem(int index, QWidget *widget, const QIcon &icon, const QS
QWidget *current = d->currentPage->widget;
int oldindex = indexOf(current);
if (index <= oldindex) {
- d->currentPage = 0; // trigger change
+ d->currentPage = nullptr; // trigger change
setCurrentIndex(oldindex);
}
}
@@ -472,10 +472,10 @@ void QToolBoxPrivate::_q_widgetDestroyed(QObject *object)
pageList.erase(std::remove_if(pageList.begin(), pageList.end(), pageEquals(c)), pageList.end());
if (pageList.empty()) {
- currentPage = 0;
+ currentPage = nullptr;
emit q->currentChanged(-1);
} else if (removeCurrent) {
- currentPage = 0;
+ currentPage = nullptr;
q->setCurrentIndex(0);
}
}
@@ -562,7 +562,7 @@ QWidget *QToolBox::widget(int index) const
int QToolBox::indexOf(QWidget *widget) const
{
Q_D(const QToolBox);
- const QToolBoxPrivate::Page *c = (widget ? d->page(widget) : 0);
+ const QToolBoxPrivate::Page *c = (widget ? d->page(widget) : nullptr);
if (!c)
return -1;
const auto it = std::find_if(d->pageList.cbegin(), d->pageList.cend(), pageEquals(c));
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index b00b219386..263fe5d8ce 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -202,7 +202,7 @@ QToolButton::QToolButton(QWidget * parent)
void QToolButtonPrivate::init()
{
Q_Q(QToolButton);
- defaultAction = 0;
+ defaultAction = nullptr;
#if QT_CONFIG(toolbar)
if (qobject_cast<QToolBar*>(parent))
autoRaise = true;
@@ -227,7 +227,7 @@ void QToolButtonPrivate::init()
#endif
setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem);
- delay = q->style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, q);
+ delay = q->style()->styleHint(QStyle::SH_ToolButton_PopupDelay, nullptr, q);
}
/*!
@@ -477,10 +477,10 @@ void QToolButton::actionEvent(QActionEvent *event)
break;
case QEvent::ActionRemoved:
if (d->defaultAction == action)
- d->defaultAction = 0;
+ d->defaultAction = nullptr;
#if QT_CONFIG(menu)
if (action == d->menuAction)
- d->menuAction = 0;
+ d->menuAction = nullptr;
#endif
action->disconnect(this);
break;
@@ -583,7 +583,7 @@ void QToolButton::changeEvent(QEvent *e)
|| e->type() == QEvent::MacSizeChange
#endif
) {
- d->delay = style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, this);
+ d->delay = style()->styleHint(QStyle::SH_ToolButton_PopupDelay, nullptr, this);
d->setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem);
}
#endif
@@ -649,7 +649,7 @@ void QToolButton::setMenu(QMenu* menu)
{
Q_D(QToolButton);
- if (d->menuAction == (menu ? menu->menuAction() : 0))
+ if (d->menuAction == (menu ? menu->menuAction() : nullptr))
return;
if (d->menuAction)
@@ -659,7 +659,7 @@ void QToolButton::setMenu(QMenu* menu)
d->menuAction = menu->menuAction();
addAction(d->menuAction);
} else {
- d->menuAction = 0;
+ d->menuAction = nullptr;
}
// changing the menu set may change the size hint, so reset it
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index 486d65d92c..cec6ba1dea 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -99,7 +99,7 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
#if QT_CONFIG(animation)
//If the QStyle has animations, animate
- if (const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, widget)) {
+ if (const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, widget)) {
AnimationMap::const_iterator it = m_animation_map.constFind(widget);
if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry)
return;
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 9cdae4f28f..a242947c11 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -964,7 +964,7 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
if (maskFields.isEmpty() || delimiter == 0) {
if (m_maskData) {
delete [] m_maskData;
- m_maskData = 0;
+ m_maskData = nullptr;
m_maxLength = 32767;
internalSetText(QString(), -1, false);
}
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 1c169c3325..0b3c30312d 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -125,7 +125,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor)
}
QWidgetTextControlPrivate::QWidgetTextControlPrivate()
- : doc(0), cursorOn(false), cursorVisible(false), cursorIsFocusIndicator(false),
+ : doc(nullptr), cursorOn(false), cursorVisible(false), cursorIsFocusIndicator(false),
#ifndef Q_OS_ANDROID
interactionFlags(Qt::TextEditorInteraction),
#else
@@ -683,7 +683,7 @@ void QWidgetTextControlPrivate::_q_contentsChanged(int from, int charsRemoved, i
// always report the right number of removed chars, but in lack of the real string use spaces
QString oldText = QString(charsRemoved, QLatin1Char(' '));
- QAccessibleEvent *ev = 0;
+ QAccessibleEvent *ev = nullptr;
if (charsRemoved == 0) {
ev = new QAccessibleTextInsertEvent(q->parent(), from, newText);
} else if (charsAdded == 0) {
@@ -906,12 +906,12 @@ void QWidgetTextControl::setDocument(QTextDocument *document)
d->doc->disconnect(this);
d->doc->documentLayout()->disconnect(this);
- d->doc->documentLayout()->setPaintDevice(0);
+ d->doc->documentLayout()->setPaintDevice(nullptr);
if (d->doc->parent() == this)
delete d->doc;
- d->doc = 0;
+ d->doc = nullptr;
d->setContent(Qt::RichText, QString(), document);
}
@@ -2302,7 +2302,7 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
d->linkToCopy = anchorAt(pos);
if (d->linkToCopy.isEmpty() && !showTextSelectionActions)
- return 0;
+ return nullptr;
QMenu *menu = new QMenu(parent);
QAction *a;
@@ -2656,7 +2656,7 @@ void QWidgetTextControl::print(QPagedPaintDevice *printer) const
Q_D(const QWidgetTextControl);
if (!printer)
return;
- QTextDocument *tempDoc = 0;
+ QTextDocument *tempDoc = nullptr;
const QTextDocument *doc = d->doc;
if (QPagedPaintDevicePrivate::get(printer)->printSelectionOnly) {
if (!d->cursor.hasSelection())