Skip to content
Permalink
Browse files
[composer] Fix attribute table column sort order could not be changed…
… after initially adding columns to sort
  • Loading branch information
nyalldawson committed Jun 21, 2014
1 parent 0b96d5a commit 20e34e8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
@@ -153,6 +153,11 @@ class QgsComposerTableSortColumnsProxyModel : QSortFilterProxyModel
*/
QgsComposerTableColumn* columnFromSourceIndex( const QModelIndex& sourceIndex ) const;

/**Invalidates the current filter used by the proxy model
* @note added in 2.3
*/
void resetFilter();

protected:
bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;

@@ -350,6 +350,9 @@ void QgsAttributeSelectionDialog::on_mAddSortColumnPushButton_clicked()
}

mColumnModel->setColumnAsSorted( column, mOrderComboBox->currentIndex() == 0 ? Qt::AscendingOrder : Qt::DescendingOrder );

//required so that rows can be reordered if initially no rows were shown in the table view
mSortedProxyModel->resetFilter();
}

void QgsAttributeSelectionDialog::on_mRemoveSortColumnPushButton_clicked()
@@ -591,3 +591,8 @@ QgsComposerTableColumn *QgsComposerTableSortColumnsProxyModel::columnFromRow( in
QModelIndex proxyIndex = index( row, 0 );
return columnFromIndex( proxyIndex );
}

void QgsComposerTableSortColumnsProxyModel::resetFilter()
{
invalidate();
}
@@ -183,6 +183,11 @@ class CORE_EXPORT QgsComposerTableSortColumnsProxyModel: public QSortFilterProxy
*/
QgsComposerTableColumn* columnFromSourceIndex( const QModelIndex& sourceIndex ) const;

/**Invalidates the current filter used by the proxy model
* @note added in 2.3
*/
void resetFilter();

protected:
bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;

0 comments on commit 20e34e8

Please sign in to comment.