Fix clazy warnings

This commit is contained in:
Nyall Dawson 2019-11-07 08:10:13 +10:00
parent c8bf6a9b74
commit 6ce8856741
46 changed files with 58 additions and 82 deletions

View File

@ -495,7 +495,7 @@ void Qgs3DMapScene::updateCameraLens()
void Qgs3DMapScene::onRenderersChanged()
{
// remove entities (if any)
qDeleteAll( mRenderersEntities.values() );
qDeleteAll( mRenderersEntities );
mRenderersEntities.clear();
// re-add entities from new set of renderers

View File

@ -41,6 +41,8 @@ class QgsMeshLayer;
//! Entity that handles rendering of polygons
class QgsMesh3DSymbolEntity : public Qt3DCore::QEntity
{
Q_OBJECT
public:
QgsMesh3DSymbolEntity( const Qgs3DMapSettings &map, QgsMeshLayer *layer, const QgsMesh3DSymbol &symbol, Qt3DCore::QNode *parent = nullptr );
@ -50,6 +52,8 @@ class QgsMesh3DSymbolEntity : public Qt3DCore::QEntity
class QgsMesh3DSymbolEntityNode : public Qt3DCore::QEntity
{
Q_OBJECT
public:
QgsMesh3DSymbolEntityNode( const Qgs3DMapSettings &map, QgsMeshLayer *layer, const QgsMesh3DSymbol &symbol, Qt3DCore::QNode *parent = nullptr );

View File

@ -53,6 +53,8 @@ namespace QgsRayCastingUtils
*/
class DemTerrainTileGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
public:
/**

View File

@ -357,7 +357,6 @@ void QgsMeshContours::populateCache( const QgsMeshDatasetIndex &index, QgsMeshRe
{
if ( mCachedIndex != index )
{
QVector<QgsMeshVertex> vertices = mTriangularMesh->vertices();
bool scalarDataOnVertices = mMeshLayer->dataProvider()->datasetGroupMetadata( index ).dataType() != QgsMeshDatasetGroupMetadata::DataOnFaces;
int count = scalarDataOnVertices ? mNativeMesh->vertices.count() : mNativeMesh->faces.count();

View File

@ -588,7 +588,6 @@ int main( int argc, char *argv[] )
// The user can specify a path which will override the default path of custom
// user settings (~/.qgis) and it will be used for QgsSettings INI file
QString configpath;
QString authdbdirectory;
QString pythonfile;
@ -604,7 +603,7 @@ int main( int argc, char *argv[] )
#if defined(ANDROID)
QgsDebugMsg( QStringLiteral( "Android: All params stripped" ) );// Param %1" ).arg( argv[0] ) );
//put all QGIS settings in the same place
configpath = QgsApplication::qgisSettingsDirPath();
QString configpath = QgsApplication::qgisSettingsDirPath();
QgsDebugMsg( QStringLiteral( "Android: configpath set to %1" ).arg( configpath ) );
#endif

View File

@ -264,7 +264,7 @@ class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdenti
};
QMenu *mActionPopup = nullptr;
QMap<QTreeWidgetItem *, QgsHighlight * > mHighlights;
QHash<QTreeWidgetItem *, QgsHighlight * > mHighlights;
QgsMapCanvas *mCanvas = nullptr;
QList<QgsFeature> mFeatures;
QMap< QString, QMap< QString, QVariant > > mWidgetCaches;

View File

@ -123,7 +123,6 @@ void QgsMapToolReshape::reshape( QgsVectorLayer *vlayer )
QgsPointSequence pts;
QVector<QgsPoint> points;
captureCurve()->points( pts );
QgsLineString reshapeLineString( pts );

View File

@ -498,7 +498,6 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
cb->setChecked( activeChecks.contains( factory->id() ) );
mGeometryCheckFactoriesGroupBoxes.insert( cb, factory->id() );
topologyCheckLayout->addWidget( cb );
QString id = factory->id();
if ( factory->id() == QStringLiteral( "QgsGeometryGapCheck" ) )
{
const QVariantMap gapCheckConfig = mLayer->geometryOptions()->checkConfiguration( QStringLiteral( "QgsGeometryGapCheck" ) );

View File

@ -52,7 +52,7 @@ QgsWmsDimensionDialog::QgsWmsDimensionDialog( QgsVectorLayer *layer, QStringList
QString name( pnMetaEnum.key( i ) );
if ( !alreadyDefinedDimensions.contains( name.toLower() ) )
{
mNameComboBox->addItem( QStringLiteral( "%1%2" ).arg( name.left( 1 ), name.mid( 1 ).toLower() ), QVariant( pnMetaEnum.value( i ) ) );
mNameComboBox->addItem( QStringLiteral( "%1%2" ).arg( !name.isEmpty() ? name.at( 0 ) : QString(), name.mid( 1 ).toLower() ), QVariant( pnMetaEnum.value( i ) ) );
}
}

View File

@ -177,8 +177,8 @@ void QgsLayoutItemHtml::loadHtml( const bool useCache, const QgsExpressionContex
bool loaded = false;
QEventLoop loop;
connect( mWebPage.get(), &QWebPage::loadFinished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } );
connect( mFetcher, &QgsNetworkContentFetcher::finished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } );
connect( mWebPage.get(), &QWebPage::loadFinished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } ); // clazy:exclude=lambda-in-connect
connect( mFetcher, &QgsNetworkContentFetcher::finished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } ); // clazy:exclude=lambda-in-connect
//reset page size. otherwise viewport size increases but never decreases again
mWebPage->setViewportSize( QSize( maxFrameWidth() * mHtmlUnitsToLayoutUnits, 0 ) );
@ -283,7 +283,7 @@ QString QgsLayoutItemHtml::fetchHtml( const QUrl &url )
//pause until HTML fetch
bool loaded = false;
QEventLoop loop;
connect( mFetcher, &QgsNetworkContentFetcher::finished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } );
connect( mFetcher, &QgsNetworkContentFetcher::finished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } ); // clazy:exclude=lambda-in-connect
mFetcher->fetchContent( url );
if ( !loaded )

View File

@ -44,6 +44,7 @@ class QgsRenderContext;
*/
class QgsMeshLayerRendererFeedback : public QgsRasterBlockFeedback
{
Q_OBJECT
};

View File

@ -2005,7 +2005,7 @@ void QgsTextFormat::readFromLayer( QgsVectorLayer *layer )
d->blendMode = QgsPainting::getCompositionMode(
static_cast< QgsPainting::BlendMode >( layer->customProperty( QStringLiteral( "labeling/blendMode" ), QVariant( QgsPainting::BlendNormal ) ).toUInt() ) );
d->multilineHeight = layer->customProperty( QStringLiteral( "labeling/multilineHeight" ), QVariant( 1.0 ) ).toDouble();
d->previewBackgroundColor = _readColor( layer, QStringLiteral( "labeling/previewBkgrdColor" ), "#ffffff", false );
d->previewBackgroundColor = _readColor( layer, QStringLiteral( "labeling/previewBkgrdColor" ), QColor( 255, 255, 255 ), false );
mBufferSettings.readFromLayer( layer );
mShadowSettings.readFromLayer( layer );

View File

@ -1789,7 +1789,6 @@ bool QgsRasterLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &c
}
// Collect format
QDomNode formatNode = rpNode.namedItem( QStringLiteral( "wmsFormat" ) );
uri.setParam( QStringLiteral( "format" ), rpNode.namedItem( QStringLiteral( "wmsFormat" ) ).toElement().text() );
// WMS CRS URL param should not be mixed with that assigned to the layer.

View File

@ -107,7 +107,6 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode
QgsFeatureId fid = model->data( index, QgsAttributeTableModel::FeatureIdRole ).toLongLong();
QVariant oldValue = model->data( index, Qt::EditRole );
QVariant newValue;
QgsEditorWidgetWrapper *eww = QgsEditorWidgetWrapper::fromWidget( editor );
if ( !eww )
return;

View File

@ -424,7 +424,7 @@ void QgsLayerTreeViewDefaultActions::moveOutOfGroup()
void QgsLayerTreeViewDefaultActions::moveToTop()
{
QMap <QgsLayerTreeGroup *, int> groupInsertIdx;
QHash <QgsLayerTreeGroup *, int> groupInsertIdx;
int insertIdx;
const QList< QgsLayerTreeNode * > selectedNodes = mView->selectedNodes();
for ( QgsLayerTreeNode *n : selectedNodes )

View File

@ -215,7 +215,6 @@ bool QgsGeoPackageItemGuiProvider::rename( QgsDataItem *item, const QString &new
}
else
{
QString filePath = parts.value( QStringLiteral( "path" ) ).toString();
const QList<QgsMapLayer *> layersList( layerItem->layersInProject() );
if ( ! layersList.isEmpty( ) )
{

View File

@ -295,7 +295,6 @@ QString QgsNewVectorLayerDialog::execAndCreateLayer( QString &errorMessage, QWid
settings.setValue( QStringLiteral( "UI/encoding" ), enc );
//try to create the new layer with OGRProvider instead of QgsVectorFileWriter
QString createError;
if ( geometrytype != QgsWkbTypes::Unknown )
{
QgsCoordinateReferenceSystem srs = geomDialog.crs();

View File

@ -285,7 +285,7 @@ void QgsOptionsDialogBase::registerTextSearchWidgets()
{
// get custom highlight widget in user added pages
QMap<QWidget *, QgsOptionsDialogHighlightWidget *> customHighlightWidgets;
QHash<QWidget *, QgsOptionsDialogHighlightWidget *> customHighlightWidgets;
QgsOptionsPageWidget *opw = qobject_cast<QgsOptionsPageWidget *>( mOptStackedWidget->widget( i ) );
if ( opw )
{

View File

@ -237,8 +237,6 @@ bool QgsOptionsDialogHighlightTree::highlightText( const QString &text )
QList<QTreeWidgetItem *> items = treeWidget->findItems( text, Qt::MatchContains | Qt::MatchRecursive, 0 );
success = !items.empty();
mTreeInitialExpand.clear();
QBrush highlightBackground( QColor( HIGHLIGHT_BACKGROUND_RED, HIGHLIGHT_BACKGROUND_GREEN, HIGHLIGHT_BACKGROUND_BLUE ) );
QBrush highlightText( QColor( HIGHLIGHT_TEXT_RED, HIGHLIGHT_TEXT_GREEN, HIGHLIGHT_TEXT_BLUE ) );
for ( QTreeWidgetItem *item : items )
{
setChildrenVisible( item, true );

View File

@ -44,6 +44,8 @@
*/
class QgsFilteredSelectionManager : public QgsVectorLayerSelectionManager
{
Q_OBJECT
public:
QgsFilteredSelectionManager( QgsVectorLayer *layer, const QgsFeatureRequest &request, QObject *parent = nullptr )
: QgsVectorLayerSelectionManager( layer, parent )

View File

@ -642,8 +642,6 @@ void QgsSymbolButton::showColorDialog()
return;
}
QColor newColor;
QgsColorDialog dialog( this, nullptr, mSymbol->color() );
dialog.setTitle( tr( "Symbol Color" ) );
dialog.setAllowOpacity( true );

View File

@ -514,8 +514,6 @@ void QgsMssqlSourceSelect::btnConnect_clicked()
return;
}
QString connectionName = db.connectionName();
// Test for geometry columns table first. Don't use it if not found.
QSqlQuery q = QSqlQuery( db );
q.setForwardOnly( true );

View File

@ -4391,7 +4391,6 @@ bool QgsSpatiaLiteProvider::changeAttributeValues( const QgsChangedAttributesMap
first = false;
QVariant::Type type = fld.type();
const auto typeName { fld.typeName() };
if ( val.isNull() || !val.isValid() )
{

View File

@ -206,7 +206,6 @@ QList<QgsSpatiaLiteProviderConnection::TableProperty> QgsSpatiaLiteProviderConne
}
QList<QgsSpatiaLiteProviderConnection::TableProperty> tableInfo;
QString errCause;
QList<QVariantList> results;
try
{
QgsSpatiaLiteConnection connection( pathFromUri() );

View File

@ -283,7 +283,6 @@ bool QgsSpatiaLiteSourceSelect::newConnection( QWidget *parent )
QFileInfo myFI( myFile );
QString myPath = myFI.path();
QString myName = myFI.fileName();
QString savedName = myFI.fileName();
QString baseKey = QStringLiteral( "/SpatiaLite/connections/" );

View File

@ -157,7 +157,6 @@ QgsExpression QgsServerApiUtils::temporalFilterExpression( const QgsVectorLayer
return QVariant::Type::Invalid;
}
const QgsField field { layer->fields().at( fieldIdx ) };
QString fieldRefValue;
return field.type();
};
@ -171,7 +170,6 @@ QgsExpression QgsServerApiUtils::temporalFilterExpression( const QgsVectorLayer
return QString();
}
QString fieldRefValue;
// Downcast only datetime -> date
// always cast strings
if ( fieldRealType == QVariant::Type::String )

View File

@ -40,7 +40,6 @@ using namespace inja;
QVariantMap QgsServerOgcApiHandler::values( const QgsServerApiContext &context ) const
{
QVariantMap result ;
QVariantList positional;
const auto constParameters { parameters( context ) };
for ( const auto &p : constParameters )
{

View File

@ -1094,7 +1094,6 @@ void QgsWfs3CollectionsItemsHandler::handleRequest( const QgsServerApiContext &c
checkLayerIsAccessible( mapLayer, context );
const std::string title { mapLayer->title().isEmpty() ? mapLayer->name().toStdString() : mapLayer->title().toStdString() };
const QString shortName { mapLayer->shortName().isEmpty() ? mapLayer->name() : mapLayer->shortName() };
// Get parameters
QVariantMap params { values( context )};

View File

@ -170,8 +170,6 @@ namespace QgsWms
QDomDocument doc;
QDomElement wmsCapabilitiesElement;
QgsServerRequest::Parameters parameters = request.parameters();
// Get service URL
QUrl href = serviceUrl( request, project );

View File

@ -42,8 +42,6 @@ namespace QgsWms
Q_UNUSED( version )
Q_UNUSED( serverIface )
QgsServerRequest::Parameters parameters = request.parameters();
QDomDocument xsdDoc;
QDir resourcesDir = QFileInfo( QgsApplication::serverResourcesPath() ).absoluteDir();

View File

@ -452,7 +452,6 @@ void QgsWmsRenderContext::searchLayersToRenderSld()
if ( !names.isEmpty() )
{
QString lname = names.item( 0 ).toElement().text();
QString err;
if ( mNicknameLayers.contains( lname ) )
{
mSlds[lname] = namedElem;

View File

@ -513,7 +513,7 @@ void TestQgs3DRendering::testAnimationExport()
nullptr );
QVERIFY( success );
QVERIFY( QFileInfo( QDir( dir ).filePath( QStringLiteral( "test3danimation001.png" ) ) ).exists() );
QVERIFY( QFileInfo::exists( ( QDir( dir ).filePath( QStringLiteral( "test3danimation001.png" ) ) ) ) );
}
void TestQgs3DRendering::testBillboardRendering()

View File

@ -323,7 +323,7 @@ class DummyAlgorithm : public QgsProcessingAlgorithm
};
//dummy provider for testing
class DummyProvider : public QgsProcessingProvider
class DummyProvider : public QgsProcessingProvider // clazy:exclude=missing-qobject-macro
{
public:
@ -379,7 +379,7 @@ class DummyProvider : public QgsProcessingProvider
friend class TestQgsProcessing;
};
class DummyProviderNoLoad : public DummyProvider
class DummyProviderNoLoad : public DummyProvider // clazy:exclude=missing-qobject-macro
{
public:
@ -420,7 +420,7 @@ class DummyAlgorithm2 : public QgsProcessingAlgorithm
};
class DummyProvider3 : public QgsProcessingProvider
class DummyProvider3 : public QgsProcessingProvider // clazy:exclude=missing-qobject-macro
{
public:
@ -450,7 +450,7 @@ class DummyProvider3 : public QgsProcessingProvider
};
class DummyProvider4 : public QgsProcessingProvider
class DummyProvider4 : public QgsProcessingProvider // clazy:exclude=missing-qobject-macro
{
public:

View File

@ -132,8 +132,6 @@ void TestQgsMapToolMoveFeature::testMoveFeature()
{
TestQgsMapToolAdvancedDigitizingUtils utils( mCaptureTool );
QSet<QgsFeatureId> oldFids = utils.existingFeatureIds();
utils.mouseClick( 1, 1, Qt::LeftButton, Qt::KeyboardModifiers(), true );
utils.mouseClick( 2, 1, Qt::LeftButton, Qt::KeyboardModifiers(), true );
@ -152,8 +150,6 @@ void TestQgsMapToolMoveFeature::testTopologicalMoveFeature()
TestQgsMapToolAdvancedDigitizingUtils utils( mCaptureTool );
QSet<QgsFeatureId> oldFids = utils.existingFeatureIds();
utils.mouseClick( 1, 1, Qt::LeftButton, Qt::KeyboardModifiers(), true );
utils.mouseClick( 2, 1, Qt::LeftButton, Qt::KeyboardModifiers(), true );

View File

@ -193,8 +193,6 @@ void TestQgsMapToolReshape::testReshapeZ()
// test with default Z value = 333
QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/default_z_value" ), 333 );
QSet<QgsFeatureId> oldFids = utils.existingFeatureIds();
// snap on a linestringz layer
utils.mouseClick( 1, 2, Qt::LeftButton, Qt::KeyboardModifiers(), true );
utils.mouseClick( 2, 1, Qt::LeftButton, Qt::KeyboardModifiers(), true );
@ -237,8 +235,6 @@ void TestQgsMapToolReshape::testTopologicalEditing()
// test with default Z value = 333
QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/default_z_value" ), 333 );
QSet<QgsFeatureId> oldFids = utils.existingFeatureIds();
utils.mouseClick( 4, 4, Qt::LeftButton, Qt::KeyboardModifiers(), true );
utils.mouseClick( 7, 2, Qt::LeftButton, Qt::KeyboardModifiers(), true );
utils.mouseClick( 4, 0, Qt::LeftButton, Qt::KeyboardModifiers(), true );

View File

@ -118,7 +118,7 @@ void TestQgs25DRenderer::render()
Qgs25DRenderer *renderer = new Qgs25DRenderer();
renderer->setShadowEnabled( false );
renderer->setWallShadingEnabled( false );
renderer->setRoofColor( QColor( "#fdbf6f" ) );
renderer->setRoofColor( QColor( 253, 191, 111 ) );
mpPolysLayer->setRenderer( renderer );
QVERIFY( imageCheck( "25d_render" ) );

View File

@ -129,7 +129,7 @@ void TestQgsJsonUtils::testParseJson()
}
// Test empty string: null
QCOMPARE( QString::fromStdString( QgsJsonUtils::jsonFromVariant( QgsJsonUtils::parseJson( QStringLiteral( "" ) ) ).dump() ), QString( "null" ) );
QCOMPARE( QString::fromStdString( QgsJsonUtils::jsonFromVariant( QgsJsonUtils::parseJson( QString() ) ).dump() ), QString( "null" ) );
// invalid json -> null
QCOMPARE( QString::fromStdString( QgsJsonUtils::jsonFromVariant( QgsJsonUtils::parseJson( QStringLiteral( "invalid json" ) ) ).dump() ), QString( "null" ) );
// String lists
@ -221,10 +221,10 @@ void TestQgsJsonUtils::testExportFeatureJson()
QgsJsonExporter exporter { &vl };
const auto expectedJson { QStringLiteral( "{\"bbox\":[1.12,1.12,5.45,5.33],\"geometry\":{\"coordinates\":"
"[[[1.12,1.34],[5.45,1.12],[5.34,5.33],[1.56,5.2],[1.12,1.34]],"
"[[2.0,2.0],[3.0,2.0],[3.0,3.0],[2.0,3.0],[2.0,2.0]]],\"type\":\"Polygon\"}"
",\"id\":0,\"properties\":{\"flddbl\":2.0,\"fldint\":1,\"fldtxt\":\"a value\"}"
",\"type\":\"Feature\"}" ) };
"[[[1.12,1.34],[5.45,1.12],[5.34,5.33],[1.56,5.2],[1.12,1.34]],"
"[[2.0,2.0],[3.0,2.0],[3.0,3.0],[2.0,3.0],[2.0,2.0]]],\"type\":\"Polygon\"}"
",\"id\":0,\"properties\":{\"flddbl\":2.0,\"fldint\":1,\"fldtxt\":\"a value\"}"
",\"type\":\"Feature\"}" ) };
const auto j( exporter.exportFeatureToJsonObject( feature ) );
QCOMPARE( QString::fromStdString( j.dump() ), expectedJson );
@ -234,10 +234,10 @@ void TestQgsJsonUtils::testExportFeatureJson()
QgsJsonExporter exporterPrecision { &vl, 1 };
const auto expectedJsonPrecision { QStringLiteral( "{\"bbox\":[1.1,1.1,5.5,5.3],\"geometry\":{\"coordinates\":"
"[[[1.1,1.3],[5.5,1.1],[5.3,5.3],[1.6,5.2],[1.1,1.3]],"
"[[2.0,2.0],[3.0,2.0],[3.0,3.0],[2.0,3.0],[2.0,2.0]]],\"type\":\"Polygon\"}"
",\"id\":0,\"properties\":{\"flddbl\":2.0,\"fldint\":1,\"fldtxt\":\"a value\"}"
",\"type\":\"Feature\"}" ) };
"[[[1.1,1.3],[5.5,1.1],[5.3,5.3],[1.6,5.2],[1.1,1.3]],"
"[[2.0,2.0],[3.0,2.0],[3.0,3.0],[2.0,3.0],[2.0,2.0]]],\"type\":\"Polygon\"}"
",\"id\":0,\"properties\":{\"flddbl\":2.0,\"fldint\":1,\"fldtxt\":\"a value\"}"
",\"type\":\"Feature\"}" ) };
const auto jPrecision( exporterPrecision.exportFeatureToJsonObject( feature ) );
QCOMPARE( QString::fromStdString( jPrecision.dump() ), expectedJsonPrecision );

View File

@ -256,7 +256,6 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures()
map2->setFollowVisibilityPresetName( QStringLiteral( "test preset3" ) );
QgsLayoutGeoPdfExporter geoPdfExporter2( &l );
const QString outputFile2 = geoPdfExporter2.generateTemporaryFilepath( QStringLiteral( "test_src2.pdf" ) );
settings = QgsLayoutExporter::PdfExportSettings();
settings.writeGeoPdf = true;
settings.exportMetadata = false;

View File

@ -230,19 +230,19 @@ void TestQgsRasterLayer::pseudoColor()
QList<QgsColorRampShader::ColorRampItem> colorRampItems;
QgsColorRampShader::ColorRampItem firstItem;
firstItem.value = 0.0;
firstItem.color = QColor( "#0000ff" );
firstItem.color = QColor( 0, 0, 255 );
colorRampItems.append( firstItem );
QgsColorRampShader::ColorRampItem secondItem;
secondItem.value = 3.0;
secondItem.color = QColor( "#00ffff" );
secondItem.color = QColor( 0, 255, 255 );
colorRampItems.append( secondItem );
QgsColorRampShader::ColorRampItem thirdItem;
thirdItem.value = 6.0;
thirdItem.color = QColor( "#ffff00" );
thirdItem.color = QColor( 255, 255, 0 );
colorRampItems.append( thirdItem );
QgsColorRampShader::ColorRampItem fourthItem;
fourthItem.value = 9.0;
fourthItem.color = QColor( "#ff0000" );
fourthItem.color = QColor( 255, 0, 0 );
colorRampItems.append( fourthItem );
colorRampShader->setColorRampItemList( colorRampItems );
@ -827,19 +827,19 @@ void TestQgsRasterLayer::singleBandPseudoRendererNoData()
QList<QgsColorRampShader::ColorRampItem> colorRampItems;
QgsColorRampShader::ColorRampItem firstItem;
firstItem.value = 0.0;
firstItem.color = QColor( "#0000ff" );
firstItem.color = QColor( 0, 0, 255 );
colorRampItems.append( firstItem );
QgsColorRampShader::ColorRampItem secondItem;
secondItem.value = 3.0;
secondItem.color = QColor( "#00ffff" );
secondItem.color = QColor( 0, 255, 255 );
colorRampItems.append( secondItem );
QgsColorRampShader::ColorRampItem thirdItem;
thirdItem.value = 6.0;
thirdItem.color = QColor( "#ffff00" );
thirdItem.color = QColor( 255, 255, 0 );
colorRampItems.append( thirdItem );
QgsColorRampShader::ColorRampItem fourthItem;
fourthItem.value = 9.0;
fourthItem.color = QColor( "#ff0000" );
fourthItem.color = QColor( 255, 0, 0 );
colorRampItems.append( fourthItem );
colorRampShader->setColorRampItemList( colorRampItems );
@ -869,19 +869,19 @@ void TestQgsRasterLayer::singleBandPseudoRendererNoDataColor()
QList<QgsColorRampShader::ColorRampItem> colorRampItems;
QgsColorRampShader::ColorRampItem firstItem;
firstItem.value = 0.0;
firstItem.color = QColor( "#0000ff" );
firstItem.color = QColor( 0, 0, 255 );
colorRampItems.append( firstItem );
QgsColorRampShader::ColorRampItem secondItem;
secondItem.value = 3.0;
secondItem.color = QColor( "#00ffff" );
secondItem.color = QColor( 0, 255, 255 );
colorRampItems.append( secondItem );
QgsColorRampShader::ColorRampItem thirdItem;
thirdItem.value = 6.0;
thirdItem.color = QColor( "#ffff00" );
thirdItem.color = QColor( 255, 255, 0 );
colorRampItems.append( thirdItem );
QgsColorRampShader::ColorRampItem fourthItem;
fourthItem.value = 9.0;
fourthItem.color = QColor( "#ff0000" );
fourthItem.color = QColor( 255, 0, 0 );
colorRampItems.append( fourthItem );
colorRampShader->setColorRampItemList( colorRampItems );

View File

@ -18,6 +18,8 @@
#include <QApplication>
#include <QFileInfo>
// clazy:excludeall=qcolor-from-literal
//qgis includes...
#include "qgsmultirenderchecker.h"
#include <qgsapplication.h>

View File

@ -86,7 +86,7 @@ class TestParamType : public QgsProcessingParameterDefinition
};
class TestWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper
class TestWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper // clazy:exclude=missing-qobject-macro
{
public:
@ -447,7 +447,7 @@ class TestProcessingContextGenerator : public QgsProcessingContextGenerator
};
class TestLayerWrapper : public QgsAbstractProcessingParameterWidgetWrapper
class TestLayerWrapper : public QgsAbstractProcessingParameterWidgetWrapper // clazy:exclude=missing-qobject-macro
{
public:
TestLayerWrapper( const QgsProcessingParameterDefinition *parameter = nullptr )

View File

@ -125,7 +125,7 @@ void TestQgsLayoutView::tool()
delete view;
}
class LoggingTool : public QgsLayoutViewTool
class LoggingTool : public QgsLayoutViewTool // clazy:exclude=missing-qobject-macro
{
public:
@ -237,7 +237,7 @@ void TestQgsLayoutView::events()
}
//simple item for testing, since some methods in QgsLayoutItem are pure virtual
class TestItem : public QgsLayoutItem
class TestItem : public QgsLayoutItem // clazy:exclude=missing-qobject-macro
{
public:

View File

@ -35,7 +35,7 @@ namespace QTest
}
}
class QgsMapToolTest : public QgsMapTool
class QgsMapToolTest : public QgsMapTool // clazy:exclude=missing-qobject-macro
{
public:
QgsMapToolTest( QgsMapCanvas *canvas ) : QgsMapTool( canvas ) {}

View File

@ -67,7 +67,7 @@ class DummyAlgorithm : public QgsProcessingAlgorithm
};
//dummy provider for testing
class DummyProvider : public QgsProcessingProvider
class DummyProvider : public QgsProcessingProvider // clazy:exclude=missing-qobject-macro
{
public:

View File

@ -416,7 +416,7 @@ void TestQgsRangeWidgetWrapper::test_focus()
QVERIFY( editor1->mLineEdit->hasFocus() );
QVERIFY( !editor2->mLineEdit->hasFocus() );
QVERIFY( !editor3->mLineEdit->hasFocus() );
QCOMPARE( editor1->mLineEdit->text(), QStringLiteral( "" ) );
QCOMPARE( editor1->mLineEdit->text(), QString() );
QCOMPARE( editor2->mLineEdit->text(), QStringLiteral( "nope" ) );
QCOMPARE( editor3->mLineEdit->text(), QStringLiteral( "nope" ) );
@ -428,7 +428,7 @@ void TestQgsRangeWidgetWrapper::test_focus()
QVERIFY( editor2->mLineEdit->hasFocus() );
QVERIFY( !editor3->mLineEdit->hasFocus() );
QCOMPARE( editor1->mLineEdit->text(), QStringLiteral( "nope" ) );
QCOMPARE( editor2->mLineEdit->text(), QStringLiteral( "" ) );
QCOMPARE( editor2->mLineEdit->text(), QString() );
QCOMPARE( editor3->mLineEdit->text(), QStringLiteral( "nope" ) );
editor3->mLineEdit->setFocus();
@ -462,7 +462,7 @@ void TestQgsRangeWidgetWrapper::test_focus()
QVERIFY( editor2->mLineEdit->hasFocus() );
QVERIFY( !editor3->mLineEdit->hasFocus() );
QCOMPARE( editor1->mLineEdit->text(), QStringLiteral( "151.000000000" ) );
QCOMPARE( editor2->mLineEdit->text(), QStringLiteral( "" ) );
QCOMPARE( editor2->mLineEdit->text(), QString() );
QCOMPARE( editor3->mLineEdit->text(), QStringLiteral( "nope" ) );
}

View File

@ -381,7 +381,7 @@ void TestQgsRelationReferenceWidget::testIdentifyOnMap()
// Monkey patch gui vector layer tool in order to simple add a new feature in
// referenced layer
class DummyVectorLayerTools : public QgsVectorLayerTools
class DummyVectorLayerTools : public QgsVectorLayerTools // clazy:exclude=missing-qobject-macro
{
bool addFeature( QgsVectorLayer *layer, const QgsAttributeMap &, const QgsGeometry &, QgsFeature *feat = nullptr ) const override
{