Minor test cleanup: nullptr, unused variable

Change-Id: I8d70ee1b34f4227cc22634658437507be9d1193c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Frederik Gladhorn 2018-06-24 09:58:50 +02:00
parent 3b1340fdc1
commit 647eca0a26
2 changed files with 9 additions and 10 deletions

View File

@ -42,7 +42,7 @@ public:
}; };
DragWidget::DragWidget(QString text, QWidget *parent) DragWidget::DragWidget(QString text, QWidget *parent)
: QWidget(parent), otherWindow(0) : QWidget(parent), otherWindow(nullptr)
{ {
int x = 5; int x = 5;
int y = 5; int y = 5;

View File

@ -61,7 +61,7 @@
class DemoContainerBase class DemoContainerBase
{ {
public: public:
DemoContainerBase() : m_widget(0) {} DemoContainerBase() : m_widget(nullptr) {}
virtual ~DemoContainerBase() {} virtual ~DemoContainerBase() {}
QString name() { return option().names().first(); } QString name() { return option().names().first(); }
virtual QCommandLineOption &option() = 0; virtual QCommandLineOption &option() = 0;
@ -157,7 +157,7 @@ static qreal getScreenFactorWithoutPixelDensity(const QScreen *screen)
static inline qreal getGlobalScaleFactor() static inline qreal getGlobalScaleFactor()
{ {
QScreen *noScreen = 0; QScreen *noScreen = nullptr;
return QHighDpiScaling::factor(noScreen); return QHighDpiScaling::factor(noScreen);
} }
@ -356,6 +356,7 @@ TiledPixmapPainter::TiledPixmapPainter()
void TiledPixmapPainter::paintEvent(QPaintEvent *event) void TiledPixmapPainter::paintEvent(QPaintEvent *event)
{ {
Q_UNUSED(event);
QPainter p(this); QPainter p(this);
int xoff = 10; int xoff = 10;
@ -634,7 +635,7 @@ template <typename T>
void apiTestdevicePixelRatioGetter() void apiTestdevicePixelRatioGetter()
{ {
if (0) { if (0) {
T *t = 0; T *t = nullptr;
t->devicePixelRatio(); t->devicePixelRatio();
} }
} }
@ -643,7 +644,7 @@ template <typename T>
void apiTestdevicePixelRatioSetter() void apiTestdevicePixelRatioSetter()
{ {
if (0) { if (0) {
T *t = 0; T *t = nullptr;
t->setDevicePixelRatio(2.0); t->setDevicePixelRatio(2.0);
} }
} }
@ -846,7 +847,7 @@ class CursorTester : public QWidget
{ {
public: public:
CursorTester() CursorTester()
:moveLabel(0), moving(false) :moveLabel(nullptr), moving(false)
{ {
} }
@ -944,7 +945,7 @@ class ScreenDisplayer : public QWidget
{ {
public: public:
ScreenDisplayer() ScreenDisplayer()
: QWidget(), moveLabel(0), scaleFactor(1.0) : QWidget(), moveLabel(nullptr), scaleFactor(1.0)
{ {
} }
@ -1159,9 +1160,7 @@ public:
GraphicsViewCaching() { GraphicsViewCaching() {
QGraphicsScene *scene = new QGraphicsScene(0, 0, 400, 400); QGraphicsScene *scene = new QGraphicsScene(0, 0, 400, 400);
QGraphicsTextItem *item = 0; QGraphicsTextItem *item = scene->addText("NoCache");
item = scene->addText("NoCache");
item->setCacheMode(QGraphicsItem::NoCache); item->setCacheMode(QGraphicsItem::NoCache);
item->setPos(10, 10); item->setPos(10, 10);