Skip to content

Commit 0e13911

Browse files
author
jef
committed
use qobject_cast instead of dynamic_cast where possible
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11790 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent fd866b4 commit 0e13911

68 files changed

Lines changed: 343 additions & 371 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/analysis/vector/qgsgeometryanalyzer.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ bool QgsGeometryAnalyzer::exportGeometryInformation( QgsVectorLayer* layer,
195195
const QString& shapefileName,
196196
const QString& fileEncoding )
197197
{
198+
return false;
199+
#if 0
198200
QgsVectorDataProvider* provider = layer->dataProvider();
199201
QgsAttributeList allAttrs = provider->attributeIndexes();
200202
provider->select( allAttrs, QgsRectangle(), true );
@@ -223,7 +225,7 @@ bool QgsGeometryAnalyzer::exportGeometryInformation( QgsVectorLayer* layer,
223225
writer.addFeature( outFeat );
224226
}
225227
return true;
226-
228+
#endif
227229
}
228230
bool QgsGeometryAnalyzer::simplifyGeometry( QgsVectorLayer* layer,
229231
const QString shapefileName,

‎src/app/attributetable/qgsattributetabledelegate.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
QgsVectorLayer *QgsAttributeTableDelegate::layer( const QAbstractItemModel *model ) const
3030
{
31-
const QgsAttributeTableModel *tm = dynamic_cast<const QgsAttributeTableModel*>( model );
31+
const QgsAttributeTableModel *tm = qobject_cast<const QgsAttributeTableModel *>( model );
3232
if ( tm )
3333
return tm->layer();
3434

35-
const QgsAttributeTableFilterModel *fm = dynamic_cast<const QgsAttributeTableFilterModel*>( model );
35+
const QgsAttributeTableFilterModel *fm = dynamic_cast<const QgsAttributeTableFilterModel *>( model );
3636
if ( fm )
3737
return fm->layer();
3838

@@ -41,11 +41,11 @@ QgsVectorLayer *QgsAttributeTableDelegate::layer( const QAbstractItemModel *mode
4141

4242
int QgsAttributeTableDelegate::fieldIdx( const QModelIndex &index ) const
4343
{
44-
const QgsAttributeTableModel *tm = dynamic_cast<const QgsAttributeTableModel*>( index.model() );
44+
const QgsAttributeTableModel *tm = qobject_cast<const QgsAttributeTableModel *>( index.model() );
4545
if ( tm )
4646
return tm->fieldIdx( index.column() );
4747

48-
const QgsAttributeTableFilterModel *fm = dynamic_cast<const QgsAttributeTableFilterModel*>( index.model() );
48+
const QgsAttributeTableFilterModel *fm = dynamic_cast<const QgsAttributeTableFilterModel *>( index.model() );
4949
if ( fm )
5050
return fm->tableModel()->fieldIdx( index.column() );
5151

‎src/app/composer/qgscomposer.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ QgsComposer::QgsComposer( QgisApp *qgis ): QMainWindow(), mFirstPaint( true )
121121
appMenu->addAction( QgisApp::instance()->actionOptions() );
122122

123123
QMenu *fileMenu = menuBar()->addMenu( tr( "File" ) );
124-
QAction *closeAction = fileMenu->addAction( tr( "Close" ), this, SLOT( close() ), tr( "Ctrl+W" ) );
124+
fileMenu->addAction( tr( "Close" ), this, SLOT( close() ), tr( "Ctrl+W" ) );
125125
fileMenu->addAction( mActionExportAsImage );
126126
fileMenu->addAction( mActionExportAsPDF );
127127
fileMenu->addAction( mActionExportAsSVG );
@@ -300,7 +300,7 @@ void QgsComposer::paintEvent( QPaintEvent* event )
300300
QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.begin();
301301
for ( ; it != mItemWidgetMap.constEnd(); ++it )
302302
{
303-
QgsComposerMap* cm = dynamic_cast<QgsComposerMap*>( it.key() );
303+
QgsComposerMap* cm = qobject_cast<QgsComposerMap *>( it.key() );
304304
if ( cm )
305305
{
306306
mFirstPaint = false;
@@ -1077,7 +1077,7 @@ void QgsComposer::readXML( const QDomDocument& doc )
10771077
delete( *it );
10781078
}
10791079
//delete composition widget
1080-
QgsCompositionWidget* oldCompositionWidget = dynamic_cast<QgsCompositionWidget*>( mCompositionOptionsFrame->children().at( 0 ) );
1080+
QgsCompositionWidget* oldCompositionWidget = qobject_cast<QgsCompositionWidget *>( mCompositionOptionsFrame->children().at( 0 ) );
10811081
delete oldCompositionWidget;
10821082
delete mCompositionOptionsLayout;
10831083
mCompositionOptionsLayout = 0;
@@ -1271,7 +1271,7 @@ bool QgsComposer::containsWMSLayer() const
12711271
for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it )
12721272
{
12731273
currentItem = item_it.key();
1274-
currentMap = dynamic_cast<QgsComposerMap*>( currentItem );
1274+
currentMap = dynamic_cast<QgsComposerMap *>( currentItem );
12751275
if ( currentMap )
12761276
{
12771277
if ( currentMap->containsWMSLayer() )
@@ -1308,15 +1308,15 @@ void QgsComposer::cleanupAfterTemplateRead()
13081308
for ( ; itemIt != mItemWidgetMap.constEnd(); ++itemIt )
13091309
{
13101310
//update all legends completely
1311-
QgsComposerLegend* legendItem = dynamic_cast<QgsComposerLegend*>( itemIt.key() );
1311+
QgsComposerLegend* legendItem = dynamic_cast<QgsComposerLegend *>( itemIt.key() );
13121312
if ( legendItem )
13131313
{
13141314
legendItem->updateLegend();
13151315
continue;
13161316
}
13171317

13181318
//update composer map extent if it does not intersect the full extent of all layers
1319-
QgsComposerMap* mapItem = dynamic_cast<QgsComposerMap*>( itemIt.key() );
1319+
QgsComposerMap* mapItem = dynamic_cast<QgsComposerMap *>( itemIt.key() );
13201320
if ( mapItem )
13211321
{
13221322
//test if composer map extent intersects extent of all layers

‎src/app/composer/qgscomposeritemwidget.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_clicked()
7777
mItem->setBrush( QBrush( QColor( newBackgroundColor ), Qt::SolidPattern ) );
7878
//if the item is a composer map, we need to regenerate the map image
7979
//because it usually is cached
80-
QgsComposerMap* cm = dynamic_cast<QgsComposerMap*>( mItem );
80+
QgsComposerMap* cm = dynamic_cast<QgsComposerMap *>( mItem );
8181
if ( cm )
8282
{
8383
cm->cache();

‎src/app/composer/qgscomposerlegendwidget.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void QgsComposerLegendWidget::on_mBoxSpaceSpinBox_valueChanged( double d )
200200

201201
void QgsComposerLegendWidget::on_mMoveDownPushButton_clicked()
202202
{
203-
QStandardItemModel* itemModel = dynamic_cast<QStandardItemModel*>( mItemTreeView->model() );
203+
QStandardItemModel* itemModel = qobject_cast<QStandardItemModel *>( mItemTreeView->model() );
204204
if ( !itemModel )
205205
{
206206
return;
@@ -250,7 +250,7 @@ void QgsComposerLegendWidget::on_mMoveDownPushButton_clicked()
250250

251251
void QgsComposerLegendWidget::on_mMoveUpPushButton_clicked()
252252
{
253-
QStandardItemModel* itemModel = dynamic_cast<QStandardItemModel*>( mItemTreeView->model() );
253+
QStandardItemModel* itemModel = qobject_cast<QStandardItemModel *>( mItemTreeView->model() );
254254
if ( !itemModel )
255255
{
256256
return;
@@ -301,7 +301,7 @@ void QgsComposerLegendWidget::on_mMoveUpPushButton_clicked()
301301

302302
void QgsComposerLegendWidget::on_mRemovePushButton_clicked()
303303
{
304-
QStandardItemModel* itemModel = dynamic_cast<QStandardItemModel*>( mItemTreeView->model() );
304+
QStandardItemModel* itemModel = qobject_cast<QStandardItemModel *>( mItemTreeView->model() );
305305
if ( !itemModel )
306306
{
307307
return;
@@ -325,7 +325,7 @@ void QgsComposerLegendWidget::on_mRemovePushButton_clicked()
325325

326326
void QgsComposerLegendWidget::on_mEditPushButton_clicked()
327327
{
328-
QStandardItemModel* itemModel = dynamic_cast<QStandardItemModel*>( mItemTreeView->model() );
328+
QStandardItemModel* itemModel = qobject_cast<QStandardItemModel *>( mItemTreeView->model() );
329329
if ( !itemModel )
330330
{
331331
return;
@@ -359,7 +359,7 @@ void QgsComposerLegendWidget::on_mEditPushButton_clicked()
359359
void QgsComposerLegendWidget::on_mUpdatePushButton_clicked()
360360
{
361361
//get current item
362-
QStandardItemModel* itemModel = dynamic_cast<QStandardItemModel*>( mItemTreeView->model() );
362+
QStandardItemModel* itemModel = qobject_cast<QStandardItemModel *>( mItemTreeView->model() );
363363
if ( !itemModel )
364364
{
365365
return;

0 commit comments

Comments
 (0)