Skip to content

Commit 02c095b

Browse files
committedAug 31, 2017
Fix missing entries from composer map combo boxes (fixes #16924)
Followup cb33c0d
1 parent 4514c69 commit 02c095b

File tree

4 files changed

+4
-20
lines changed

4 files changed

+4
-20
lines changed
 

‎python/core/composer/qgscomposermodel.sip

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ class QgsComposerProxyModel: QSortFilterProxyModel
283283

284284
protected:
285285
bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
286-
bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
287286

288287
};
289288

‎src/core/composer/qgscomposermodel.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -961,29 +961,16 @@ QgsComposerProxyModel::QgsComposerProxyModel( QgsComposition *composition, QObje
961961
// WARNING: the below code triggers a Qt bug (tested on Qt 4.8, can't reproduce on Qt5) whenever the QgsComposerModel source model
962962
// calls beginInsertRows - since it's non functional anyway it's now disabled
963963
// PLEASE verify that the Qt issue is fixed before reenabling
964+
965+
setDynamicSortFilter( true );
964966
#if 0
965967
// TODO doesn't seem to work correctly - not updated when item changes
966-
setDynamicSortFilter( true );
967968
setSortLocaleAware( true );
968969
sort( QgsComposerModel::ItemId );
969970
#endif
970971
}
971972

972-
bool QgsComposerProxyModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const
973-
{
974-
//sort by item id
975-
const QgsComposerItem* item1 = itemFromSourceIndex( left );
976-
const QgsComposerItem* item2 = itemFromSourceIndex( right );
977-
if ( !item1 )
978-
return false;
979-
980-
if ( !item2 )
981-
return true;
982-
983-
return QString::localeAwareCompare( item1->displayName(), item2->displayName() ) < 0;
984-
}
985-
986-
QgsComposerItem* QgsComposerProxyModel::itemFromSourceIndex( const QModelIndex &sourceIndex ) const
973+
QgsComposerItem *QgsComposerProxyModel::itemFromSourceIndex( const QModelIndex &sourceIndex ) const
987974
{
988975
if ( !mComposition )
989976
return nullptr;

‎src/core/composer/qgscomposermodel.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@ class CORE_EXPORT QgsComposerProxyModel: public QSortFilterProxyModel
347347
QgsComposerItem* itemFromSourceIndex( const QModelIndex& sourceIndex ) const;
348348

349349
protected:
350-
bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const override;
351-
bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override;
350+
bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override;
352351

353352
private:
354353
QgsComposition* mComposition;

‎src/gui/qgscomposeritemcombobox.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void QgsComposerItemComboBox::setComposition( QgsComposition *composition )
3636
connect( mProxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( rowsChanged() ) );
3737
setModel( mProxyModel );
3838
setModelColumn( QgsComposerModel::ItemId );
39-
mProxyModel->sort( 0, Qt::AscendingOrder );
4039
}
4140

4241
void QgsComposerItemComboBox::setItem( const QgsComposerItem* item )

0 commit comments

Comments
 (0)
Please sign in to comment.