diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-02-24 15:07:01 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-06-12 13:46:38 +0200 |
commit | c0f6506eda7ebd7f61f7c03b6d9a59cc530a7116 (patch) | |
tree | 08feb473ca77d6806ea5c1598297b1a25ee6a7b4 /examples | |
parent | 0a1e9dce13c1113a6fc6720c8102ee1663b713fe (diff) |
Use auto in graphgallery example
Fixing clazy warnings about not repeating type names.
Pick-to: 6.6 6.5
Task-number: QTBUG-110698
Change-Id: I574c79bc27ba93e2e84aa454281c8648cd5ddc47
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples')
10 files changed, 107 insertions, 110 deletions
diff --git a/examples/datavisualization/graphgallery/bargraph.cpp b/examples/datavisualization/graphgallery/bargraph.cpp index 0781a5d9..5873c757 100644 --- a/examples/datavisualization/graphgallery/bargraph.cpp +++ b/examples/datavisualization/graphgallery/bargraph.cpp @@ -32,7 +32,7 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra //! [1] m_barsWidget = new QWidget; - QHBoxLayout *hLayout = new QHBoxLayout(m_barsWidget); + auto *hLayout = new QHBoxLayout(m_barsWidget); m_container = QWidget::createWindowContainer(m_barsGraph, m_barsWidget); m_barsGraph->resize(minimumGraphSize); m_container->setMinimumSize(minimumGraphSize); @@ -41,11 +41,11 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra m_container->setFocusPolicy(Qt::StrongFocus); hLayout->addWidget(m_container, 1); - QVBoxLayout *vLayout = new QVBoxLayout(); + auto *vLayout = new QVBoxLayout(); hLayout->addLayout(vLayout); //! [1] - QComboBox *themeList = new QComboBox(m_barsWidget); + auto *themeList = new QComboBox(m_barsWidget); themeList->addItem(u"Qt"_s); themeList->addItem(u"Primary Colors"_s); themeList->addItem(u"Digia"_s); @@ -56,14 +56,14 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra themeList->addItem(u"Isabelle"_s); themeList->setCurrentIndex(0); - QPushButton *labelButton = new QPushButton(m_barsWidget); + auto *labelButton = new QPushButton(m_barsWidget); labelButton->setText(u"Change label style"_s); - QCheckBox *smoothCheckBox = new QCheckBox(m_barsWidget); + auto *smoothCheckBox = new QCheckBox(m_barsWidget); smoothCheckBox->setText(u"Smooth bars"_s); smoothCheckBox->setChecked(false); - QComboBox *barStyleList = new QComboBox(m_barsWidget); + auto *barStyleList = new QComboBox(m_barsWidget); barStyleList->addItem(u"Bar"_s, QAbstract3DSeries::MeshBar); barStyleList->addItem(u"Pyramid"_s, QAbstract3DSeries::MeshPyramid); barStyleList->addItem(u"Cone"_s, QAbstract3DSeries::MeshCone); @@ -72,13 +72,13 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra barStyleList->addItem(u"Sphere"_s, QAbstract3DSeries::MeshSphere); barStyleList->setCurrentIndex(4); - QPushButton *cameraButton = new QPushButton(m_barsWidget); + auto *cameraButton = new QPushButton(m_barsWidget); cameraButton->setText(u"Change camera preset"_s); - QPushButton *zoomToSelectedButton = new QPushButton(m_barsWidget); + auto *zoomToSelectedButton = new QPushButton(m_barsWidget); zoomToSelectedButton->setText(u"Zoom to selected bar"_s); - QComboBox *selectionModeList = new QComboBox(m_barsWidget); + auto *selectionModeList = new QComboBox(m_barsWidget); selectionModeList->addItem(u"None"_s, int(QAbstract3DGraph::SelectionNone)); selectionModeList->addItem(u"Bar"_s, @@ -114,52 +114,52 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra | QAbstract3DGraph::SelectionMultiSeries)); selectionModeList->setCurrentIndex(1); - QCheckBox *backgroundCheckBox = new QCheckBox(m_barsWidget); + auto *backgroundCheckBox = new QCheckBox(m_barsWidget); backgroundCheckBox->setText(u"Show background"_s); backgroundCheckBox->setChecked(false); - QCheckBox *gridCheckBox = new QCheckBox(m_barsWidget); + auto *gridCheckBox = new QCheckBox(m_barsWidget); gridCheckBox->setText(u"Show grid"_s); gridCheckBox->setChecked(true); - QCheckBox *seriesCheckBox = new QCheckBox(m_barsWidget); + auto *seriesCheckBox = new QCheckBox(m_barsWidget); seriesCheckBox->setText(u"Show second series"_s); seriesCheckBox->setChecked(false); - QCheckBox *reverseValueAxisCheckBox = new QCheckBox(m_barsWidget); + auto *reverseValueAxisCheckBox = new QCheckBox(m_barsWidget); reverseValueAxisCheckBox->setText(u"Reverse value axis"_s); reverseValueAxisCheckBox->setChecked(false); - QCheckBox *reflectionCheckBox = new QCheckBox(m_barsWidget); + auto *reflectionCheckBox = new QCheckBox(m_barsWidget); reflectionCheckBox->setText(u"Show reflections"_s); reflectionCheckBox->setChecked(false); //! [3] - QSlider *rotationSliderX = new QSlider(Qt::Horizontal, m_barsWidget); + auto *rotationSliderX = new QSlider(Qt::Horizontal, m_barsWidget); rotationSliderX->setTickInterval(30); rotationSliderX->setTickPosition(QSlider::TicksBelow); rotationSliderX->setMinimum(-180); rotationSliderX->setValue(0); rotationSliderX->setMaximum(180); //! [3] - QSlider *rotationSliderY = new QSlider(Qt::Horizontal, m_barsWidget); + auto *rotationSliderY = new QSlider(Qt::Horizontal, m_barsWidget); rotationSliderY->setTickInterval(15); rotationSliderY->setTickPosition(QSlider::TicksAbove); rotationSliderY->setMinimum(-90); rotationSliderY->setValue(0); rotationSliderY->setMaximum(90); - QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, m_barsWidget); + auto *fontSizeSlider = new QSlider(Qt::Horizontal, m_barsWidget); fontSizeSlider->setTickInterval(10); fontSizeSlider->setTickPosition(QSlider::TicksBelow); fontSizeSlider->setMinimum(1); fontSizeSlider->setValue(30); fontSizeSlider->setMaximum(100); - QFontComboBox *fontList = new QFontComboBox(m_barsWidget); + auto *fontList = new QFontComboBox(m_barsWidget); fontList->setCurrentFont(QFont("Times New Roman")); - QComboBox *shadowQuality = new QComboBox(m_barsWidget); + auto *shadowQuality = new QComboBox(m_barsWidget); shadowQuality->addItem(u"None"_s); shadowQuality->addItem(u"Low"_s); shadowQuality->addItem(u"Medium"_s); @@ -169,7 +169,7 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra shadowQuality->addItem(u"High Soft"_s); shadowQuality->setCurrentIndex(5); - QComboBox *rangeList = new QComboBox(m_barsWidget); + auto *rangeList = new QComboBox(m_barsWidget); rangeList->addItem(u"2015"_s); rangeList->addItem(u"2016"_s); rangeList->addItem(u"2017"_s); @@ -181,25 +181,25 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra rangeList->addItem(u"All"_s); rangeList->setCurrentIndex(8); - QCheckBox *axisTitlesVisibleCB = new QCheckBox(m_barsWidget); + auto *axisTitlesVisibleCB = new QCheckBox(m_barsWidget); axisTitlesVisibleCB->setText(u"Axis titles visible"_s); axisTitlesVisibleCB->setChecked(true); - QCheckBox *axisTitlesFixedCB = new QCheckBox(m_barsWidget); + auto *axisTitlesFixedCB = new QCheckBox(m_barsWidget); axisTitlesFixedCB->setText(u"Axis titles fixed"_s); axisTitlesFixedCB->setChecked(true); - QSlider *axisLabelRotationSlider = new QSlider(Qt::Horizontal, m_barsWidget); + auto *axisLabelRotationSlider = new QSlider(Qt::Horizontal, m_barsWidget); axisLabelRotationSlider->setTickInterval(10); axisLabelRotationSlider->setTickPosition(QSlider::TicksBelow); axisLabelRotationSlider->setMinimum(0); axisLabelRotationSlider->setValue(30); axisLabelRotationSlider->setMaximum(90); - QButtonGroup *modeGroup = new QButtonGroup(m_barsWidget); - QRadioButton *modeWeather = new QRadioButton(u"Temperature Data"_s, m_barsWidget); + auto *modeGroup = new QButtonGroup(m_barsWidget); + auto *modeWeather = new QRadioButton(u"Temperature Data"_s, m_barsWidget); modeWeather->setChecked(true); - QRadioButton *modeCustomProxy = new QRadioButton(u"Custom Proxy Data"_s, m_barsWidget); + auto *modeCustomProxy = new QRadioButton(u"Custom Proxy Data"_s, m_barsWidget); modeGroup->addButton(modeWeather); modeGroup->addButton(modeCustomProxy); @@ -240,7 +240,7 @@ bool BarGraph::initialize(const QSize &minimumGraphSize, const QSize &maximumGra vLayout->addWidget(modeCustomProxy, 1, Qt::AlignTop); //! [2] - GraphModifier *modifier = new GraphModifier(m_barsGraph, this); + auto *modifier = new GraphModifier(m_barsGraph, this); //! [2] //! [5] diff --git a/examples/datavisualization/graphgallery/graphmodifier.cpp b/examples/datavisualization/graphgallery/graphmodifier.cpp index db4b50c6..b0cb6f48 100644 --- a/examples/datavisualization/graphgallery/graphmodifier.cpp +++ b/examples/datavisualization/graphgallery/graphmodifier.cpp @@ -159,16 +159,14 @@ void GraphModifier::resetTemperatureData() // Create data arrays //! [9b] - QBarDataArray *dataSet = new QBarDataArray; - QBarDataArray *dataSet2 = new QBarDataArray; - QBarDataRow *dataRow = nullptr; - QBarDataRow *dataRow2= nullptr; + auto *dataSet = new QBarDataArray; + auto *dataSet2 = new QBarDataArray; dataSet->reserve(m_years.size()); for (qsizetype year = 0; year < m_years.size(); ++year) { // Create a data row - dataRow = new QBarDataRow(m_months.size()); - dataRow2 = new QBarDataRow(m_months.size()); + auto *dataRow = new QBarDataRow(m_months.size()); + auto *dataRow2 = new QBarDataRow(m_months.size()); for (qsizetype month = 0; month < m_months.size(); ++month) { // Add data to the row (*dataRow)[month].setValue(tempOulu[year][month]); @@ -195,7 +193,7 @@ void GraphModifier::changeRange(int range) void GraphModifier::changeStyle(int style) { - QComboBox *comboBox = qobject_cast<QComboBox *>(sender()); + auto *comboBox = qobject_cast<QComboBox *>(sender()); if (comboBox) { m_barMesh = comboBox->itemData(style).value<QAbstract3DSeries::Mesh>(); m_primarySeries->setMesh(m_barMesh); @@ -241,7 +239,7 @@ void GraphModifier::changeLabelBackground() void GraphModifier::changeSelectionMode(int selectionMode) { - QComboBox *comboBox = qobject_cast<QComboBox *>(sender()); + auto *comboBox = qobject_cast<QComboBox *>(sender()); if (comboBox) { int flags = comboBox->itemData(selectionMode).toInt(); m_graph->setSelectionMode(QAbstract3DGraph::SelectionFlags(flags)); diff --git a/examples/datavisualization/graphgallery/highlightseries.cpp b/examples/datavisualization/graphgallery/highlightseries.cpp index eab1a37d..3f10b421 100644 --- a/examples/datavisualization/graphgallery/highlightseries.cpp +++ b/examples/datavisualization/graphgallery/highlightseries.cpp @@ -63,10 +63,10 @@ void HighlightSeries::handlePositionChange(const QPoint &position) QSurfaceDataProxy *srcProxy = m_topographicSeries->dataProxy(); const QSurfaceDataArray &srcArray = *srcProxy->array(); - QSurfaceDataArray *dataArray = new QSurfaceDataArray; + auto *dataArray = new QSurfaceDataArray; dataArray->reserve(endZ - startZ); for (int i = startZ; i < endZ; ++i) { - QSurfaceDataRow *newRow = new QSurfaceDataRow; + auto *newRow = new QSurfaceDataRow; newRow->reserve(endX - startX); QSurfaceDataRow *srcRow = srcArray.at(i); for (int j = startX; j < endX; ++j) { diff --git a/examples/datavisualization/graphgallery/rainfalldata.cpp b/examples/datavisualization/graphgallery/rainfalldata.cpp index 76049bec..66a2553a 100644 --- a/examples/datavisualization/graphgallery/rainfalldata.cpp +++ b/examples/datavisualization/graphgallery/rainfalldata.cpp @@ -76,7 +76,7 @@ void RainfallData::addDataSet() { // Create a new variant data set and data item list m_dataSet = new VariantDataSet; - VariantDataItemList *itemList = new VariantDataItemList; + auto *itemList = new VariantDataItemList; // Read data from a data file into the data item list QFile dataFile(":/data/raindata.txt"); @@ -94,7 +94,7 @@ void RainfallData::addDataSet() } // Store year and month as strings, and rainfall value as double // into a variant data item and add the item to the item list. - VariantDataItem *newItem = new VariantDataItem; + auto *newItem = new VariantDataItem; for (int i = 0; i < 2; ++i) newItem->append(strList.at(i).trimmed().toString()); newItem->append(strList.at(2).trimmed().toDouble()); diff --git a/examples/datavisualization/graphgallery/scatterdatamodifier.cpp b/examples/datavisualization/graphgallery/scatterdatamodifier.cpp index 30ddcaca..1f3ec7ed 100644 --- a/examples/datavisualization/graphgallery/scatterdatamodifier.cpp +++ b/examples/datavisualization/graphgallery/scatterdatamodifier.cpp @@ -38,8 +38,8 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter, QObject *parent) : //! [0] //! [1] - QScatterDataProxy *proxy = new QScatterDataProxy; - QScatter3DSeries *series = new QScatter3DSeries(proxy); + auto *proxy = new QScatterDataProxy; + auto *series = new QScatter3DSeries(proxy); series->setItemLabelFormat(u"@xTitle: @xLabel @yTitle: @yLabel @zTitle: @zLabel"_s); series->setMeshSmooth(m_smooth); m_graph->addSeries(series); @@ -70,7 +70,7 @@ void ScatterDataModifier::addData() //! [3] //! [4] - QScatterDataArray *dataArray = new QScatterDataArray; + auto *dataArray = new QScatterDataArray; dataArray->reserve(m_itemCount); //! [4] diff --git a/examples/datavisualization/graphgallery/scattergraph.cpp b/examples/datavisualization/graphgallery/scattergraph.cpp index f075f31c..a426c10a 100644 --- a/examples/datavisualization/graphgallery/scattergraph.cpp +++ b/examples/datavisualization/graphgallery/scattergraph.cpp @@ -25,7 +25,7 @@ bool ScatterGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu return false; m_scatterWidget = new QWidget; - QHBoxLayout *hLayout = new QHBoxLayout(m_scatterWidget); + auto *hLayout = new QHBoxLayout(m_scatterWidget); m_container = QWidget::createWindowContainer(m_scatterGraph, m_scatterWidget); m_container->setMinimumSize(minimumGraphSize); m_container->setMaximumSize(maximumGraphSize); @@ -33,44 +33,44 @@ bool ScatterGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu m_container->setFocusPolicy(Qt::StrongFocus); hLayout->addWidget(m_container, 1); - QVBoxLayout *vLayout = new QVBoxLayout(); + auto *vLayout = new QVBoxLayout(); hLayout->addLayout(vLayout); - QCommandLinkButton *cameraButton = new QCommandLinkButton(m_scatterWidget); + auto *cameraButton = new QCommandLinkButton(m_scatterWidget); cameraButton->setText(u"Change camera preset"_s); cameraButton->setDescription(u"Switch between a number of preset camera positions"_s); cameraButton->setIconSize(QSize(0, 0)); - QCommandLinkButton *itemCountButton = new QCommandLinkButton(m_scatterWidget); + auto *itemCountButton = new QCommandLinkButton(m_scatterWidget); itemCountButton->setText(u"Toggle item count"_s); itemCountButton->setDescription(u"Switch between 900 and 10000 data points"_s); itemCountButton->setIconSize(QSize(0, 0)); - QCommandLinkButton *rangeButton = new QCommandLinkButton(m_scatterWidget); + auto *rangeButton = new QCommandLinkButton(m_scatterWidget); rangeButton->setText(u"Toggle axis ranges"_s); rangeButton->setDescription(u"Switch between automatic axis ranges and preset ranges"_s); rangeButton->setIconSize(QSize(0, 0)); - QCheckBox *backgroundCheckBox = new QCheckBox(m_scatterWidget); + auto *backgroundCheckBox = new QCheckBox(m_scatterWidget); backgroundCheckBox->setText(u"Show background"_s); backgroundCheckBox->setChecked(true); - QCheckBox *gridCheckBox = new QCheckBox(m_scatterWidget); + auto *gridCheckBox = new QCheckBox(m_scatterWidget); gridCheckBox->setText(u"Show grid"_s); gridCheckBox->setChecked(true); - QCheckBox *smoothCheckBox = new QCheckBox(m_scatterWidget); + auto *smoothCheckBox = new QCheckBox(m_scatterWidget); smoothCheckBox->setText(u"Smooth dots"_s); smoothCheckBox->setChecked(true); - QComboBox *itemStyleList = new QComboBox(m_scatterWidget); + auto *itemStyleList = new QComboBox(m_scatterWidget); itemStyleList->addItem(u"Sphere"_s, QAbstract3DSeries::MeshSphere); itemStyleList->addItem(u"Cube"_s, QAbstract3DSeries::MeshCube); itemStyleList->addItem(u"Minimal"_s, QAbstract3DSeries::MeshMinimal); itemStyleList->addItem(u"Point"_s, QAbstract3DSeries::MeshPoint); itemStyleList->setCurrentIndex(0); - QComboBox *themeList = new QComboBox(m_scatterWidget); + auto *themeList = new QComboBox(m_scatterWidget); themeList->addItem(u"Qt"_s); themeList->addItem(u"Primary Colors"_s); themeList->addItem(u"Digia"_s); @@ -81,7 +81,7 @@ bool ScatterGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu themeList->addItem(u"Isabelle"_s); themeList->setCurrentIndex(3); - QComboBox *shadowQuality = new QComboBox(m_scatterWidget); + auto *shadowQuality = new QComboBox(m_scatterWidget); shadowQuality->addItem(u"None"_s); shadowQuality->addItem(u"Low"_s); shadowQuality->addItem(u"Medium"_s); @@ -104,7 +104,7 @@ bool ScatterGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu vLayout->addWidget(new QLabel(u"Adjust shadow quality"_s)); vLayout->addWidget(shadowQuality, 1, Qt::AlignTop); - ScatterDataModifier *modifier = new ScatterDataModifier(m_scatterGraph, this); + auto *modifier = new ScatterDataModifier(m_scatterGraph, this); QObject::connect(cameraButton, &QCommandLinkButton::clicked, modifier, &ScatterDataModifier::changePresetCamera); diff --git a/examples/datavisualization/graphgallery/surfacegraph.cpp b/examples/datavisualization/graphgallery/surfacegraph.cpp index 1ea65e67..88cbc72f 100644 --- a/examples/datavisualization/graphgallery/surfacegraph.cpp +++ b/examples/datavisualization/graphgallery/surfacegraph.cpp @@ -87,7 +87,7 @@ bool SurfaceGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu return false; m_surfaceWidget = new QWidget; - QHBoxLayout *hLayout = new QHBoxLayout(m_surfaceWidget); + auto *hLayout = new QHBoxLayout(m_surfaceWidget); m_container = QWidget::createWindowContainer(m_surfaceGraph, m_surfaceWidget); m_container->setMinimumSize(minimumGraphSize); m_container->setMaximumSize(maximumGraphSize); @@ -95,76 +95,76 @@ bool SurfaceGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu m_container->setFocusPolicy(Qt::StrongFocus); hLayout->addWidget(m_container, 1); - QVBoxLayout *vLayout = new QVBoxLayout(); + auto *vLayout = new QVBoxLayout(); hLayout->addLayout(vLayout); vLayout->setAlignment(Qt::AlignTop); // Create control widgets - QGroupBox *modelGroupBox = new QGroupBox(u"Model"_s); + auto *modelGroupBox = new QGroupBox(u"Model"_s); - QRadioButton *sqrtSinModelRB = new QRadioButton(m_surfaceWidget); + auto *sqrtSinModelRB = new QRadioButton(m_surfaceWidget); sqrtSinModelRB->setText(u"Sqrt && Sin"_s); sqrtSinModelRB->setChecked(false); - QRadioButton *heightMapModelRB = new QRadioButton(m_surfaceWidget); + auto *heightMapModelRB = new QRadioButton(m_surfaceWidget); heightMapModelRB->setText(u"Multiseries\nHeight Map"_s); heightMapModelRB->setChecked(false); - QRadioButton *texturedModelRB = new QRadioButton(m_surfaceWidget); + auto *texturedModelRB = new QRadioButton(m_surfaceWidget); texturedModelRB->setText(u"Textured\nTopography"_s); texturedModelRB->setChecked(false); - QVBoxLayout *modelVBox = new QVBoxLayout; + auto *modelVBox = new QVBoxLayout; modelVBox->addWidget(sqrtSinModelRB); modelVBox->addWidget(heightMapModelRB); modelVBox->addWidget(texturedModelRB); modelGroupBox->setLayout(modelVBox); - QGroupBox *selectionGroupBox = new QGroupBox(u"Graph Selection Mode"_s); + auto *selectionGroupBox = new QGroupBox(u"Graph Selection Mode"_s); - QRadioButton *modeNoneRB = new QRadioButton(m_surfaceWidget); + auto *modeNoneRB = new QRadioButton(m_surfaceWidget); modeNoneRB->setText(u"No selection"_s); modeNoneRB->setChecked(false); - QRadioButton *modeItemRB = new QRadioButton(m_surfaceWidget); + auto *modeItemRB = new QRadioButton(m_surfaceWidget); modeItemRB->setText(u"Item"_s); modeItemRB->setChecked(false); - QRadioButton *modeSliceRowRB = new QRadioButton(m_surfaceWidget); + auto *modeSliceRowRB = new QRadioButton(m_surfaceWidget); modeSliceRowRB->setText(u"Row Slice"_s); modeSliceRowRB->setChecked(false); - QRadioButton *modeSliceColumnRB = new QRadioButton(m_surfaceWidget); + auto *modeSliceColumnRB = new QRadioButton(m_surfaceWidget); modeSliceColumnRB->setText(u"Column Slice"_s); modeSliceColumnRB->setChecked(false); - QVBoxLayout *selectionVBox = new QVBoxLayout; + auto *selectionVBox = new QVBoxLayout; selectionVBox->addWidget(modeNoneRB); selectionVBox->addWidget(modeItemRB); selectionVBox->addWidget(modeSliceRowRB); selectionVBox->addWidget(modeSliceColumnRB); selectionGroupBox->setLayout(selectionVBox); - QGroupBox *axisGroupBox = new QGroupBox(u"Axis ranges"_s); + auto *axisGroupBox = new QGroupBox(u"Axis ranges"_s); - QSlider *axisMinSliderX = new QSlider(Qt::Horizontal); + auto *axisMinSliderX = new QSlider(Qt::Horizontal); axisMinSliderX->setMinimum(0); axisMinSliderX->setTickInterval(1); axisMinSliderX->setEnabled(true); - QSlider *axisMaxSliderX = new QSlider(Qt::Horizontal); + auto *axisMaxSliderX = new QSlider(Qt::Horizontal); axisMaxSliderX->setMinimum(1); axisMaxSliderX->setTickInterval(1); axisMaxSliderX->setEnabled(true); - QSlider *axisMinSliderZ = new QSlider(Qt::Horizontal); + auto *axisMinSliderZ = new QSlider(Qt::Horizontal); axisMinSliderZ->setMinimum(0); axisMinSliderZ->setTickInterval(1); axisMinSliderZ->setEnabled(true); - QSlider *axisMaxSliderZ = new QSlider(Qt::Horizontal); + auto *axisMaxSliderZ = new QSlider(Qt::Horizontal); axisMaxSliderZ->setMinimum(1); axisMaxSliderZ->setTickInterval(1); axisMaxSliderZ->setEnabled(true); - QVBoxLayout *axisVBox = new QVBoxLayout; + auto *axisVBox = new QVBoxLayout; axisVBox->addWidget(new QLabel(u"Column range"_s)); axisVBox->addWidget(axisMinSliderX); axisVBox->addWidget(axisMaxSliderX); @@ -175,72 +175,71 @@ bool SurfaceGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu // Mode-dependent controls // sqrt-sin - QGroupBox *colorGroupBox = new QGroupBox(u"Custom gradient"_s); + auto *colorGroupBox = new QGroupBox(u"Custom gradient"_s); QPixmap pixmap = gradientBtoYPB_Pixmap(); - QPushButton *gradientBtoYPB = new QPushButton(m_surfaceWidget); + auto *gradientBtoYPB = new QPushButton(m_surfaceWidget); gradientBtoYPB->setIcon(QIcon(pixmap)); gradientBtoYPB->setIconSize(pixmap.size()); pixmap = gradientGtoRPB_Pixmap(); - QPushButton *gradientGtoRPB = new QPushButton(m_surfaceWidget); + auto *gradientGtoRPB = new QPushButton(m_surfaceWidget); gradientGtoRPB->setIcon(QIcon(pixmap)); gradientGtoRPB->setIconSize(pixmap.size()); - - QHBoxLayout *colorHBox = new QHBoxLayout; + auto *colorHBox = new QHBoxLayout; colorHBox->addWidget(gradientBtoYPB); colorHBox->addWidget(gradientGtoRPB); colorGroupBox->setLayout(colorHBox); // Multiseries heightmap - QGroupBox *showGroupBox = new QGroupBox(u"_show Object"_s); + auto *showGroupBox = new QGroupBox(u"_show Object"_s); showGroupBox->setVisible(false); - QCheckBox *checkboxShowOilRigOne = new QCheckBox(u"Oil Rig 1"_s); + auto *checkboxShowOilRigOne = new QCheckBox(u"Oil Rig 1"_s); checkboxShowOilRigOne->setChecked(true); - QCheckBox *checkboxShowOilRigTwo = new QCheckBox(u"Oil Rig 2"_s); + auto *checkboxShowOilRigTwo = new QCheckBox(u"Oil Rig 2"_s); checkboxShowOilRigTwo->setChecked(true); - QCheckBox *checkboxShowRefinery = new QCheckBox(u"Refinery"_s); + auto *checkboxShowRefinery = new QCheckBox(u"Refinery"_s); - QVBoxLayout *showVBox = new QVBoxLayout; + auto *showVBox = new QVBoxLayout; showVBox->addWidget(checkboxShowOilRigOne); showVBox->addWidget(checkboxShowOilRigTwo); showVBox->addWidget(checkboxShowRefinery); showGroupBox->setLayout(showVBox); - QGroupBox *visualsGroupBox = new QGroupBox(u"Visuals"_s); + auto *visualsGroupBox = new QGroupBox(u"Visuals"_s); visualsGroupBox->setVisible(false); - QCheckBox *checkboxVisualsSeeThrough = new QCheckBox(u"See-Through"_s); + auto *checkboxVisualsSeeThrough = new QCheckBox(u"See-Through"_s); - QCheckBox *checkboxHighlightOil = new QCheckBox(u"Highlight Oil"_s); + auto *checkboxHighlightOil = new QCheckBox(u"Highlight Oil"_s); - QCheckBox *checkboxShowShadows = new QCheckBox(u"Shadows"_s); + auto *checkboxShowShadows = new QCheckBox(u"Shadows"_s); checkboxShowShadows->setChecked(true); - QVBoxLayout *visualVBox = new QVBoxLayout; + auto *visualVBox = new QVBoxLayout; visualVBox->addWidget(checkboxVisualsSeeThrough); visualVBox->addWidget(checkboxHighlightOil); visualVBox->addWidget(checkboxShowShadows); visualsGroupBox->setLayout(visualVBox); - QLabel *labelSelection = new QLabel(u"Selection:"_s); + auto *labelSelection = new QLabel(u"Selection:"_s); labelSelection->setVisible(false); - QLabel *labelSelectedItem = new QLabel(u"Nothing"_s); + auto *labelSelectedItem = new QLabel(u"Nothing"_s); labelSelectedItem->setVisible(false); // Textured topography heightmap - QCheckBox *enableTexture = new QCheckBox(u"Surface texture"_s); + auto *enableTexture = new QCheckBox(u"Surface texture"_s); enableTexture->setVisible(false); - QLabel *label = new QLabel(m_surfaceWidget); + auto *label = new QLabel(m_surfaceWidget); label->setPixmap(highlightPixmap()); - QGroupBox *heightMapGroupBox = new QGroupBox(u"Highlight color map"_s); - QVBoxLayout *colorMapVBox = new QVBoxLayout; + auto *heightMapGroupBox = new QGroupBox(u"Highlight color map"_s); + auto *colorMapVBox = new QVBoxLayout; colorMapVBox->addWidget(label); heightMapGroupBox->setLayout(colorMapVBox); heightMapGroupBox->setVisible(false); @@ -265,7 +264,7 @@ bool SurfaceGraph::initialize(const QSize &minimumGraphSize, const QSize &maximu vLayout->addWidget(enableTexture); // Create the controller - SurfaceGraphModifier *modifier = new SurfaceGraphModifier(m_surfaceGraph, labelSelectedItem, this); + auto *modifier = new SurfaceGraphModifier(m_surfaceGraph, labelSelectedItem, this); // Connect widget controls to controller QObject::connect(heightMapModelRB, &QRadioButton::toggled, diff --git a/examples/datavisualization/graphgallery/surfacegraphmodifier.cpp b/examples/datavisualization/graphgallery/surfacegraphmodifier.cpp index 527a0d4a..190a96b9 100644 --- a/examples/datavisualization/graphgallery/surfacegraphmodifier.cpp +++ b/examples/datavisualization/graphgallery/surfacegraphmodifier.cpp @@ -152,10 +152,10 @@ void SurfaceGraphModifier::fillSqrtSinProxy() float stepZ = (sampleMax - sampleMin) / float(sampleCountZ - 1); //! [1] - QSurfaceDataArray *dataArray = new QSurfaceDataArray; + auto *dataArray = new QSurfaceDataArray; dataArray->reserve(sampleCountZ); for (int i = 0 ; i < sampleCountZ ; ++i) { - QSurfaceDataRow *newRow = new QSurfaceDataRow; + auto *newRow = new QSurfaceDataRow; newRow->reserve(sampleCountX); // Keep values within range bounds, since just adding step can cause minor drift due // to the rounding errors. @@ -447,10 +447,10 @@ void SurfaceGraphModifier::toggleItemOne(bool show) color.fill(Qt::red); //! [9] //! [11] - QCustom3DItem *item = new QCustom3DItem(":/data/oilrig.obj", positionOne, - QVector3D(0.025f, 0.025f, 0.025f), - QQuaternion::fromAxisAndAngle(0.f, 1.f, 0.f, 45.f), - color); + auto *item = new QCustom3DItem(":/data/oilrig.obj", positionOne, + QVector3D(0.025f, 0.025f, 0.025f), + QQuaternion::fromAxisAndAngle(0.f, 1.f, 0.f, 45.f), + color); //! [11] //! [12] m_graph->addCustomItem(item); @@ -463,7 +463,7 @@ void SurfaceGraphModifier::toggleItemOne(bool show) m_graph->addCustomItem(item); //! [13] - QCustom3DLabel *label = new QCustom3DLabel(); + auto *label = new QCustom3DLabel(); label->setText("Oil Rig One"); label->setPosition(positionOneLabel); label->setScaling(QVector3D(1.f, 1.f, 1.f)); @@ -487,7 +487,7 @@ void SurfaceGraphModifier::toggleItemTwo(bool show) if (show) { QImage color = QImage(2, 2, QImage::Format_RGB32); color.fill(Qt::red); - QCustom3DItem *item = new QCustom3DItem(); + auto *item = new QCustom3DItem(); item->setMeshFile(":/data/oilrig.obj"); item->setPosition(positionTwo); item->setScaling(QVector3D(0.025f, 0.025f, 0.025f)); @@ -501,7 +501,7 @@ void SurfaceGraphModifier::toggleItemTwo(bool show) item->setShadowCasting(false); m_graph->addCustomItem(item); - QCustom3DLabel *label = new QCustom3DLabel(); + auto *label = new QCustom3DLabel(); label->setText("Oil Rig Two"); label->setPosition(positionTwoLabel); label->setScaling(QVector3D(1.f, 1.f, 1.f)); @@ -521,7 +521,7 @@ void SurfaceGraphModifier::toggleItemThree(bool show) if (show) { QImage color = QImage(2, 2, QImage::Format_RGB32); color.fill(Qt::darkMagenta); - QCustom3DItem *item = new QCustom3DItem(); + auto *item = new QCustom3DItem(); item->setMeshFile(":/data/refinery.obj"); item->setPosition(positionThree); item->setScaling(QVector3D(0.04f, 0.04f, 0.04f)); @@ -529,7 +529,7 @@ void SurfaceGraphModifier::toggleItemThree(bool show) item->setTextureImage(color); m_graph->addCustomItem(item); - QCustom3DLabel *label = new QCustom3DLabel(); + auto *label = new QCustom3DLabel(); label->setText("Refinery"); label->setPosition(positionThreeLabel); label->setScaling(QVector3D(1.f, 1.f, 1.f)); diff --git a/examples/datavisualization/graphgallery/topographicseries.cpp b/examples/datavisualization/graphgallery/topographicseries.cpp index c934f63f..201a275e 100644 --- a/examples/datavisualization/graphgallery/topographicseries.cpp +++ b/examples/datavisualization/graphgallery/topographicseries.cpp @@ -28,12 +28,12 @@ void TopographicSeries::setTopographyFile(const QString file, float width, float float stepX = width / float(imageWidth); float stepZ = height / float(imageHeight); - QSurfaceDataArray *dataArray = new QSurfaceDataArray; + auto *dataArray = new QSurfaceDataArray; dataArray->reserve(imageHeight); for (int i = 0; i < imageHeight; ++i) { int p = i * widthBits; float z = height - float(i) * stepZ; - QSurfaceDataRow *newRow = new QSurfaceDataRow; + auto *newRow = new QSurfaceDataRow; newRow->reserve(imageWidth); for (int j = 0; j < imageWidth; ++j) { uchar aa = bits[p + 0]; diff --git a/examples/datavisualization/graphgallery/variantbardataproxy.cpp b/examples/datavisualization/graphgallery/variantbardataproxy.cpp index 87ab5f18..8fe73abc 100644 --- a/examples/datavisualization/graphgallery/variantbardataproxy.cpp +++ b/examples/datavisualization/graphgallery/variantbardataproxy.cpp @@ -100,9 +100,9 @@ void VariantBarDataProxy::resolveDataSet() } // Create a new data array in format the parent class understands - QBarDataArray *newProxyArray = new QBarDataArray; + auto *newProxyArray = new QBarDataArray; for (const QString &rowKey : rowList) { - QBarDataRow *newProxyRow = new QBarDataRow(columnList.size()); + auto *newProxyRow = new QBarDataRow(columnList.size()); for (qsizetype i = 0; i < columnList.size(); ++i) (*newProxyRow)[i].setValue(itemValueMap[rowKey][columnList.at(i)]); newProxyArray->append(newProxyRow); |