From 91e7009aec8cf6d1b1af46349254313a0622a9ec Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 30 Jun 2021 11:31:58 +0200 Subject: [PATCH] Use "auto" as type when initializing using "new" The type is immediately visible from the right hand side then. Change-Id: Ifc1a15e3eea9b5a91ff8647f759d207a0ee221b8 Reviewed-by: Fabian Kosmale --- .../quickwidgets/qquickviewcomparison/mainwindow.cpp | 8 ++++---- examples/quick/scenegraph/customgeometry/beziercurve.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp b/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp index 2e45bc2df6..b393937809 100644 --- a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp +++ b/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp @@ -63,10 +63,10 @@ MainWindow::MainWindow(bool transparency, bool noRenderAlpha) m_transparent(transparency), m_noRenderAlpha(noRenderAlpha) { - QVBoxLayout *layout = new QVBoxLayout; + auto *layout = new QVBoxLayout; QGroupBox *groupBox = new QGroupBox(tr("Type")); - QVBoxLayout *vbox = new QVBoxLayout; + auto *vbox = new QVBoxLayout; m_radioView = new QRadioButton(tr("QQuickView in a window container (direct)")); m_radioWidget = new QRadioButton(tr("QQuickWidget (indirect through framebuffer objects)")); vbox->addWidget(m_radioWidget); @@ -161,7 +161,7 @@ void MainWindow::updateView() QUrl source("qrc:qquickviewcomparison/test.qml"); if (m_state == UseWindow) { - QQuickView *quickView = new QQuickView; + auto *quickView = new QQuickView; // m_transparent is not supported here since many systems have problems with semi-transparent child windows quickView->setFormat(m_format); quickView->setResizeMode(QQuickView::SizeRootObjectToView); @@ -171,7 +171,7 @@ void MainWindow::updateView() m_currentRootObject = quickView->rootObject(); switchTo(QWidget::createWindowContainer(quickView)); } else if (m_state == UseWidget) { - QQuickWidget *quickWidget = new QQuickWidget; + auto *quickWidget = new QQuickWidget; if (m_transparent) quickWidget->setClearColor(Qt::transparent); quickWidget->setFormat(m_format); diff --git a/examples/quick/scenegraph/customgeometry/beziercurve.cpp b/examples/quick/scenegraph/customgeometry/beziercurve.cpp index 72fc7e6f1b..97be754f41 100644 --- a/examples/quick/scenegraph/customgeometry/beziercurve.cpp +++ b/examples/quick/scenegraph/customgeometry/beziercurve.cpp @@ -139,7 +139,7 @@ QSGNode *BezierCurve::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) node->setGeometry(geometry); node->setFlag(QSGNode::OwnsGeometry); //! [5] //! [6] - QSGFlatColorMaterial *material = new QSGFlatColorMaterial; + auto *material = new QSGFlatColorMaterial; material->setColor(QColor(255, 0, 0)); node->setMaterial(material); node->setFlag(QSGNode::OwnsMaterial);