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 <fabian.kosmale@qt.io>
This commit is contained in:
Ulf Hermann 2021-06-30 11:31:58 +02:00
parent 121de28e01
commit 91e7009aec
2 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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);