Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 15, 2014
1 parent 57c7b8a commit 6a6cc19
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 49 deletions.
95 changes: 48 additions & 47 deletions src/core/composer/qgsatlascomposition.cpp
Expand Up @@ -107,53 +107,6 @@ void QgsAtlasComposition::setComposerMap( QgsComposerMap* map )
map->setAtlasDriven( true );
}

bool QgsAtlasComposition::fixedScale() const
{
//deprecated method. Until removed just return the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return false;
}

return map->atlasFixedScale();
}

void QgsAtlasComposition::setFixedScale( bool fixed )
{
//deprecated method. Until removed just set the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return;
}

map->setAtlasFixedScale( fixed );
}

float QgsAtlasComposition::margin() const
{
//deprecated method. Until removed just return the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return 0;
}

return map->atlasMargin();
}

void QgsAtlasComposition::setMargin( float margin )
{
//deprecated method. Until removed just set the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return;
}

map->setAtlasMargin(( double ) margin );
}

int QgsAtlasComposition::sortKeyAttributeIndex() const
{
Expand Down Expand Up @@ -745,4 +698,52 @@ void QgsAtlasComposition::evalFeatureFilename()
}
}

Q_NOWARN_DEPRECATED_PUSH
bool QgsAtlasComposition::fixedScale() const
{
//deprecated method. Until removed just return the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return false;
}

return map->atlasFixedScale();
}

void QgsAtlasComposition::setFixedScale( bool fixed )
{
//deprecated method. Until removed just set the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return;
}

map->setAtlasFixedScale( fixed );
}

float QgsAtlasComposition::margin() const
{
//deprecated method. Until removed just return the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return 0;
}

return map->atlasMargin();
}

void QgsAtlasComposition::setMargin( float margin )
{
//deprecated method. Until removed just set the property for the first atlas-enabled composer map
QgsComposerMap * map = composerMap();
if ( !map )
{
return;
}

map->setAtlasMargin(( double ) margin );
}
Q_NOWARN_DEPRECATED_POP
4 changes: 3 additions & 1 deletion src/core/composer/qgscomposerattributetablemodel.h
Expand Up @@ -43,6 +43,7 @@ class CORE_EXPORT QgsComposerAttributeTableColumnModel: public QAbstractTableMod

/**Constructor for QgsComposerAttributeTableColumnModel.
* @param composerTable QgsComposerAttributeTable the model is attached to
* @param parent optional parent
*/
QgsComposerAttributeTableColumnModel( QgsComposerAttributeTable *composerTable, QObject *parent = 0 );
virtual ~QgsComposerAttributeTableColumnModel();
Expand Down Expand Up @@ -140,6 +141,7 @@ class CORE_EXPORT QgsComposerTableSortColumnsProxyModel: public QSortFilterProxy
/**Constructor for QgsComposerTableSortColumnsProxyModel.
* @param composerTable QgsComposerAttributeTable the model is attached to
* @param filterType filter for columns, controls whether sorted or unsorted columns are shown
* @param parent optional parent
*/
QgsComposerTableSortColumnsProxyModel( QgsComposerAttributeTable *composerTable, ColumnFilterType filterType, QObject *parent = 0 );

Expand Down Expand Up @@ -173,7 +175,7 @@ class CORE_EXPORT QgsComposerTableSortColumnsProxyModel: public QSortFilterProxy
/**Returns the QgsComposerTableColumn corresponding to an index from the source
* QgsComposerAttributeTableColumnModel model.
* @returns QgsComposerTableColumn for specified index from QgsComposerAttributeTableColumnModel
* @param index a QModelIndex
* @param sourceIndex a QModelIndex
* @note added in 2.3
* @see columnFromRow
* @see columnFromIndex
Expand Down
6 changes: 6 additions & 0 deletions src/core/composer/qgscomposeritem.h
Expand Up @@ -314,6 +314,12 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const;

/**Like the above, but with a rectangle for multiline text
* @param p painter to use
* @param rect rectangle to draw into
* @param text text to draw
* @param font font to use
* @param halignment optional horizontal alignment
* @param valignment optional vertical alignment
* @param flags allows for passing Qt::TextFlags to control appearance of rendered text
*/
void drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::AlignmentFlag valignment = Qt::AlignTop, int flags = Qt::TextWordWrap ) const;
Expand Down
5 changes: 4 additions & 1 deletion src/core/symbology-ng/qgsellipsesymbollayerv2.h
Expand Up @@ -110,7 +110,10 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
/**Setup mPainterPath
@param symbolName name of symbol
@param context render context
@param f feature f to render (0 if no data defined rendering)*/
@param scaledWidth optional width
@param scaledHeight optional height
@param f optional feature to render (0 if no data defined rendering)
*/
void preparePath( const QString& symbolName, QgsSymbolV2RenderContext& context, double* scaledWidth = 0, double* scaledHeight = 0, const QgsFeature* f = 0 );

/**True if this symbol layer uses a data defined property*/
Expand Down
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgssymbolslistwidget.cpp
Expand Up @@ -208,6 +208,8 @@ void QgsSymbolsListWidget::setLineWidth( double width )

void QgsSymbolsListWidget::symbolAddedToStyle( QString name, QgsSymbolV2* symbol )
{
Q_UNUSED( name );
Q_UNUSED( symbol );
populateSymbolView();
}

Expand Down
8 changes: 8 additions & 0 deletions tests/src/core/testqgsatlascomposition.cpp
Expand Up @@ -215,9 +215,11 @@ void TestQgsAtlasComposition::autoscale_render()

void TestQgsAtlasComposition::autoscale_render_2_0_api()
{
Q_NOWARN_DEPRECATED_PUSH
mAtlas->setComposerMap( mAtlasMap );
mAtlas->setFixedScale( false );
mAtlas->setMargin( 0.10f );
Q_NOWARN_DEPRECATED_POP

mAtlas->beginRender();

Expand All @@ -230,9 +232,11 @@ void TestQgsAtlasComposition::autoscale_render_2_0_api()
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
Q_NOWARN_DEPRECATED_PUSH
mAtlas->setComposerMap( 0 );
mAtlas->setFixedScale( false );
mAtlas->setMargin( 0 );
Q_NOWARN_DEPRECATED_POP
}

void TestQgsAtlasComposition::fixedscale_render()
Expand Down Expand Up @@ -260,8 +264,10 @@ void TestQgsAtlasComposition::fixedscale_render()
void TestQgsAtlasComposition::fixedscale_render_2_0_api()
{
mAtlasMap->setNewExtent( QgsRectangle( 209838.166, 6528781.020, 610491.166, 6920530.620 ) );
Q_NOWARN_DEPRECATED_PUSH
mAtlas->setComposerMap( mAtlasMap );
mAtlas->setFixedScale( true );
Q_NOWARN_DEPRECATED_POP
mAtlas->beginRender();

for ( int fit = 0; fit < 2; ++fit )
Expand All @@ -273,8 +279,10 @@ void TestQgsAtlasComposition::fixedscale_render_2_0_api()
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
Q_NOWARN_DEPRECATED_PUSH
mAtlas->setComposerMap( 0 );
mAtlas->setFixedScale( false );
Q_NOWARN_DEPRECATED_POP
}

void TestQgsAtlasComposition::two_map_autoscale_render()
Expand Down
20 changes: 20 additions & 0 deletions tests/src/core/testqgscomposertable.cpp
Expand Up @@ -322,7 +322,9 @@ void TestQgsComposerTable::attributeTableSetAliasOnSubset()
aliases.insert( 1, QString( "1Heading" ) );
aliases.insert( 3, QString( "2Pilots" ) );
aliases.insert( 4, QString( "3Cabin Crew" ) );
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setFieldAliasMap( aliases );
Q_NOWARN_DEPRECATED_POP

//get header labels and compare
QMap<int, QString> headerMap = mComposerAttributeTable->headerLabels();
Expand All @@ -338,7 +340,9 @@ void TestQgsComposerTable::attributeTableSetAliasOnSubset()
attributes.clear();
aliases.clear();
mComposerAttributeTable->setDisplayAttributes( attributes );
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setFieldAliasMap( aliases );
Q_NOWARN_DEPRECATED_POP
}

void TestQgsComposerTable::attributeTableGetAttributes()
Expand All @@ -348,7 +352,9 @@ void TestQgsComposerTable::attributeTableGetAttributes()
attributes << 0 << 3 << 4;
mComposerAttributeTable->setDisplayAttributes( attributes );

Q_NOWARN_DEPRECATED_PUSH
QSet<int> evaluated = mComposerAttributeTable->displayAttributes();
Q_NOWARN_DEPRECATED_POP

QCOMPARE( evaluated, attributes );

Expand All @@ -363,7 +369,9 @@ void TestQgsComposerTable::attributeTableAlias()

fieldAliasMap.insert( 0, QString( "alias 0" ) );
fieldAliasMap.insert( 3, QString( "alias 3" ) );
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setFieldAliasMap( fieldAliasMap );
Q_NOWARN_DEPRECATED_POP

QStringList expectedHeaders;
expectedHeaders << "alias 0" << "Heading" << "Importance" << "alias 3" << "Cabin Crew" << "Staff";
Expand All @@ -381,7 +389,9 @@ void TestQgsComposerTable::attributeTableAlias()
}

fieldAliasMap.clear();
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setFieldAliasMap( fieldAliasMap );
Q_NOWARN_DEPRECATED_POP
}

void TestQgsComposerTable::attributeTableGetAlias()
Expand All @@ -395,15 +405,19 @@ void TestQgsComposerTable::attributeTableGetAlias()

fieldAliasMap.insert( 1, QString( "alias 1" ) );
fieldAliasMap.insert( 2, QString( "alias 2" ) );
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setFieldAliasMap( fieldAliasMap );
Q_NOWARN_DEPRECATED_POP

QMap<int, QString> expectedAliases;
expectedAliases.insert( 1, QString( "alias 1" ) );
expectedAliases.insert( 3, QString( "Pilots" ) );
expectedAliases.insert( 4, QString( "Cabin Crew" ) );

//get header labels and compare
Q_NOWARN_DEPRECATED_PUSH
QMap<int, QString> aliasMap = mComposerAttributeTable->fieldAliasMap();
Q_NOWARN_DEPRECATED_POP
QMap<int, QString>::const_iterator aliasIt = aliasMap.constBegin();
QString expected;
QString evaluated;
Expand All @@ -415,7 +429,9 @@ void TestQgsComposerTable::attributeTableGetAlias()
}

fieldAliasMap.clear();
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setFieldAliasMap( fieldAliasMap );
Q_NOWARN_DEPRECATED_POP
attributes.clear();
mComposerAttributeTable->setDisplayAttributes( attributes );
}
Expand All @@ -427,7 +443,9 @@ void TestQgsComposerTable::attributeTableSort()
sort.append( qMakePair( 0, true ) );
sort.append( qMakePair( 1, false ) );
sort.append( qMakePair( 3, true ) );
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setSortAttributes( sort );
Q_NOWARN_DEPRECATED_POP
mComposerAttributeTable->setMaximumNumberOfFeatures( 5 );

QList<QStringList> expectedRows;
Expand All @@ -451,7 +469,9 @@ void TestQgsComposerTable::attributeTableSort()
compareTable( expectedRows );

sort.clear();
Q_NOWARN_DEPRECATED_PUSH
mComposerAttributeTable->setSortAttributes( sort );
Q_NOWARN_DEPRECATED_POP
}

void TestQgsComposerTable::attributeTableVisibleOnly()
Expand Down
2 changes: 2 additions & 0 deletions tests/src/gui/testqgsmapcanvas.cpp
Expand Up @@ -33,7 +33,9 @@ void TestQgsMapCanvas::cleanupTestCase()

void TestQgsMapCanvas::testMapRendererInteraction()
{
Q_NOWARN_DEPRECATED_PUSH
QgsMapRenderer* mr = mCanvas->mapRenderer();
Q_NOWARN_DEPRECATED_POP

// CRS transforms

Expand Down

0 comments on commit 6a6cc19

Please sign in to comment.