aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickwidgets/qquickwidget.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /src/quickwidgets/qquickwidget.cpp
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff)
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quickwidgets/qquickwidget.cpp')
-rw-r--r--src/quickwidgets/qquickwidget.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 6a767dbb46..6f3b685974 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -184,15 +184,15 @@ void QQuickWidgetPrivate::handleWindowChange()
}
QQuickWidgetPrivate::QQuickWidgetPrivate()
- : root(0)
- , component(0)
- , offscreenWindow(0)
- , offscreenSurface(0)
- , renderControl(0)
+ : root(nullptr)
+ , component(nullptr)
+ , offscreenWindow(nullptr)
+ , offscreenSurface(nullptr)
+ , renderControl(nullptr)
#if QT_CONFIG(opengl)
- , fbo(0)
- , resolvedFbo(0)
- , context(0)
+ , fbo(nullptr)
+ , resolvedFbo(nullptr)
+ , context(nullptr)
#endif
, resizeMode(QQuickWidget::SizeViewToRootObject)
, initialSize(0,0)
@@ -233,11 +233,11 @@ void QQuickWidgetPrivate::execute()
if (root) {
delete root;
- root = 0;
+ root = nullptr;
}
if (component) {
delete component;
- component = 0;
+ component = nullptr;
}
if (!source.isEmpty()) {
QML_MEMORY_SCOPE_URL(engine.data()->baseUrl().resolved(source));
@@ -500,7 +500,7 @@ QImage QQuickWidgetPrivate::grabFramebuffer()
*/
QQuickWidget::QQuickWidget(QWidget *parent)
-: QWidget(*(new QQuickWidgetPrivate), parent, 0)
+: QWidget(*(new QQuickWidgetPrivate), parent, nullptr)
{
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
@@ -528,7 +528,7 @@ QQuickWidget::QQuickWidget(const QUrl &source, QWidget *parent)
\sa Status, status(), errors()
*/
QQuickWidget::QQuickWidget(QQmlEngine* engine, QWidget *parent)
- : QWidget(*(new QQuickWidgetPrivate), parent, 0)
+ : QWidget(*(new QQuickWidgetPrivate), parent, nullptr)
{
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
@@ -544,7 +544,7 @@ QQuickWidget::~QQuickWidget()
// be a child of the QQuickWidgetPrivate, and will be destroyed by its dtor
Q_D(QQuickWidget);
delete d->root;
- d->root = 0;
+ d->root = nullptr;
}
/*!
@@ -588,7 +588,7 @@ void QQuickWidget::setContent(const QUrl& url, QQmlComponent *component, QObject
if (d->component && d->component->isError()) {
const QList<QQmlError> errorList = d->component->errors();
for (const QQmlError &error : errorList) {
- QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
+ QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning()
<< error;
}
emit statusChanged(status());
@@ -797,7 +797,7 @@ void QQuickWidgetPrivate::updateSize()
void QQuickWidgetPrivate::updatePosition()
{
Q_Q(QQuickWidget);
- if (offscreenWindow == 0)
+ if (offscreenWindow == nullptr)
return;
const QPoint &pos = q->mapToGlobal(QPoint(0, 0));
@@ -871,7 +871,7 @@ void QQuickWidgetPrivate::createContext()
if (!context->create()) {
const bool isEs = context->isOpenGLES();
delete context;
- context = 0;
+ context = nullptr;
handleContextCreationFailure(offscreenWindow->requestedFormat(), isEs);
return;
}
@@ -897,10 +897,10 @@ void QQuickWidgetPrivate::createContext()
void QQuickWidgetPrivate::destroyContext()
{
delete offscreenSurface;
- offscreenSurface = 0;
+ offscreenSurface = nullptr;
#if QT_CONFIG(opengl)
delete context;
- context = 0;
+ context = nullptr;
#endif
}
@@ -1010,9 +1010,9 @@ void QQuickWidget::destroyFramebufferObject()
#if QT_CONFIG(opengl)
delete d->fbo;
- d->fbo = 0;
+ d->fbo = nullptr;
delete d->resolvedFbo;
- d->resolvedFbo = 0;
+ d->resolvedFbo = nullptr;
#endif
}
@@ -1033,7 +1033,7 @@ void QQuickWidget::continueExecute()
if (d->component->isError()) {
const QList<QQmlError> errorList = d->component->errors();
for (const QQmlError &error : errorList) {
- QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
+ QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning()
<< error;
}
emit statusChanged(status());
@@ -1045,7 +1045,7 @@ void QQuickWidget::continueExecute()
if (d->component->isError()) {
const QList<QQmlError> errorList = d->component->errors();
for (const QQmlError &error : errorList) {
- QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
+ QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning()
<< error;
}
emit statusChanged(status());
@@ -1078,7 +1078,7 @@ void QQuickWidgetPrivate::setRootObject(QObject *obj)
<< "Ensure your QML code is written for QtQuick 2, and uses a root that is or" << endl
<< "inherits from QtQuick's Item (not a Timer, QtObject, etc)." << endl;
delete obj;
- root = 0;
+ root = nullptr;
}
if (root) {
initialSize = rootObjectSize();