summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-09 01:00:35 +0100
committerLars Knoll <lars.knoll@qt.io>2019-12-09 10:16:01 +0100
commitbef74b6c3a0a9c8649ea8eb333d80015f76863e4 (patch)
tree41cdf5b6776c90a6d04a1d6680f4d47a90593746 /src/widgets/widgets
parentf8d2975b6a8b36bf8dd304c99783947a72081b79 (diff)
parent4c3c63d4cbb81b38e88e06b72749e7e01497b6f1 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/widgets/widgets')
-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
43 files changed, 672 insertions, 672 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 8e6c2cb882..29d28847f3 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -176,7 +176,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),
@@ -216,14 +216,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()
@@ -256,7 +256,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();
@@ -1271,7 +1271,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 751e17b717..b0689d0b9e 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 7dffc55a36..0d2568b85d 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -448,7 +448,7 @@ void QLineEdit::addAction(QAction *action, ActionPosition position)
{
Q_D(QLineEdit);
QWidget::addAction(action);
- d->addAction(action, 0, position);
+ d->addAction(action, nullptr, position);
}
/*!
@@ -642,15 +642,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)),
@@ -685,7 +685,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()
@@ -1953,7 +1953,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);
@@ -2192,7 +2192,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 462691ffb3..29e0ae3b39 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -489,7 +489,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;
@@ -569,12 +569,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 (QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(newAction)) {
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index bb2a0530f1..9fe571b4bb 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 a2254112c2..f8460a4718 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -255,7 +255,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()
@@ -366,7 +366,7 @@ class ControlLabel : public QWidget
{
Q_OBJECT
public:
- ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = 0);
+ ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = nullptr);
QSize sizeHint() const override;
@@ -483,8 +483,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();
}
@@ -498,7 +498,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
@@ -544,7 +544,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());
@@ -699,10 +699,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)
{
@@ -727,9 +727,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)
@@ -743,12 +743,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
}
@@ -792,50 +792,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)
@@ -856,14 +856,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),
@@ -928,7 +928,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 {
@@ -1011,8 +1011,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;
}
@@ -1049,19 +1049,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
@@ -1463,7 +1463,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,
@@ -1545,7 +1545,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;
@@ -1740,7 +1740,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;
@@ -1769,7 +1769,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);
@@ -1835,7 +1835,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
@@ -1865,7 +1865,7 @@ void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
return;
}
- QWidget *titleWidget = 0;
+ QWidget *titleWidget = nullptr;
if (isRequestFromChild)
titleWidget = baseWidget;
else
@@ -2133,7 +2133,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)
@@ -2235,7 +2235,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
@@ -2342,7 +2342,7 @@ QWidget *QMdiSubWindow::maximizedButtonsWidget() const
&& !isChildOfTabbedQMdiArea(this)) {
return d->controlContainer->controllerWidget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -2355,7 +2355,7 @@ QWidget *QMdiSubWindow::maximizedSystemMenuIconWidget() const
&& !isChildOfTabbedQMdiArea(this)) {
return d->controlContainer->systemMenuLabel();
}
- return 0;
+ return nullptr;
}
/*!
@@ -2478,7 +2478,7 @@ void QMdiSubWindow::setSystemMenu(QMenu *systemMenu)
if (d->systemMenu) {
delete d->systemMenu;
- d->systemMenu = 0;
+ d->systemMenu = nullptr;
}
if (!systemMenu)
@@ -2862,7 +2862,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())
@@ -3137,7 +3137,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))
@@ -3512,7 +3512,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 0fc89ad2e4..ddcd022fb6 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);
@@ -203,15 +203,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()
@@ -263,7 +263,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());
@@ -284,7 +284,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);
}
}
@@ -305,7 +305,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
@@ -544,9 +544,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)) {
@@ -554,12 +554,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)
@@ -576,7 +576,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();
@@ -590,10 +590,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)
@@ -620,7 +620,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;
@@ -648,7 +648,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;
@@ -664,7 +664,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
@@ -721,8 +721,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()) {
@@ -870,13 +870,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)
@@ -979,7 +979,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)
@@ -994,7 +994,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);
@@ -1069,8 +1069,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++) {
@@ -1111,7 +1111,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)) {
@@ -1122,7 +1122,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
@@ -1184,7 +1184,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);
@@ -1199,7 +1199,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);
@@ -1220,8 +1220,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++) {
@@ -1302,7 +1302,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)
@@ -1321,7 +1321,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)) {
@@ -1442,7 +1442,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e
#endif
action->showStatusText(topCausedWidget());
} else {
- actionAboutToTrigger = 0;
+ actionAboutToTrigger = nullptr;
}
}
@@ -2265,7 +2265,7 @@ QAction *QMenu::actionAt(const QPoint &pt) const
{
if (QAction *ret = d_func()->actionAt(pt))
return ret;
- return 0;
+ return nullptr;
}
/*!
@@ -2387,7 +2387,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
@@ -2431,7 +2431,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();
@@ -2490,7 +2490,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));
@@ -2560,8 +2560,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();
}
@@ -2697,22 +2697,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
}
@@ -2736,9 +2736,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;
@@ -2758,7 +2758,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());
}
@@ -2878,7 +2878,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;
}
@@ -2928,12 +2928,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;
@@ -3102,7 +3102,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) {
@@ -3111,7 +3111,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;
@@ -3123,7 +3123,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;
@@ -3137,7 +3137,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;
@@ -3150,13 +3150,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;
}
@@ -3168,7 +3168,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;
@@ -3181,7 +3181,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)) {
@@ -3189,7 +3189,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;
}
@@ -3219,7 +3219,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--)
@@ -3248,7 +3248,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)
@@ -3260,7 +3260,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();
@@ -3326,8 +3326,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();
@@ -3350,7 +3350,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())
@@ -3439,7 +3439,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) {
@@ -3469,7 +3469,7 @@ void QMenu::leaveEvent(QEvent *)
Q_D(QMenu);
d->hasReceievedEnter = false;
if (!d->activeMenu && d->currentAction)
- setActiveAction(0);
+ setActiveAction(nullptr);
}
/*!
@@ -3532,7 +3532,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
@@ -3609,7 +3609,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 97816cc889..a50068b5a0 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) {
@@ -1354,7 +1354,7 @@ void QMenuBar::focusOutEvent(QFocusEvent *)
{
Q_D(QMenuBar);
if(!d->popupState) {
- d->setCurrentAction(0);
+ d->setCurrentAction(nullptr);
d->setKeyboardMode(false);
}
}
@@ -1367,7 +1367,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);
}
@@ -1421,7 +1421,7 @@ void QMenuBarPrivate::handleReparent()
newWindow->createWinId();
platformMenuBar->handleReparent(newWindow->windowHandle());
} else {
- platformMenuBar->handleReparent(0);
+ platformMenuBar->handleReparent(nullptr);
}
}
}
@@ -1434,7 +1434,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();
@@ -1543,7 +1543,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:
@@ -1619,10 +1619,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);
@@ -1671,10 +1671,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);
@@ -1723,9 +1723,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());
@@ -1771,7 +1771,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);
}
@@ -1837,7 +1837,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;
@@ -1876,7 +1876,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 bed5c3ec3e..f35c02f2fb 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 03368fd5c2..c95fa4ceee 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 cced36738c..127960b23c 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 f5d3f2f9c0..ce807c9f75 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())