Skip to content

Commit 20e34e8

Browse files
committed
[composer] Fix attribute table column sort order could not be changed after initially adding columns to sort
1 parent 0b96d5a commit 20e34e8

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

python/core/composer/qgscomposerattributetablemodel.sip

+5
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ class QgsComposerTableSortColumnsProxyModel : QSortFilterProxyModel
153153
*/
154154
QgsComposerTableColumn* columnFromSourceIndex( const QModelIndex& sourceIndex ) const;
155155

156+
/**Invalidates the current filter used by the proxy model
157+
* @note added in 2.3
158+
*/
159+
void resetFilter();
160+
156161
protected:
157162
bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
158163

src/app/composer/qgsattributeselectiondialog.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ void QgsAttributeSelectionDialog::on_mAddSortColumnPushButton_clicked()
350350
}
351351

352352
mColumnModel->setColumnAsSorted( column, mOrderComboBox->currentIndex() == 0 ? Qt::AscendingOrder : Qt::DescendingOrder );
353+
354+
//required so that rows can be reordered if initially no rows were shown in the table view
355+
mSortedProxyModel->resetFilter();
353356
}
354357

355358
void QgsAttributeSelectionDialog::on_mRemoveSortColumnPushButton_clicked()

src/core/composer/qgscomposerattributetablemodel.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -591,3 +591,8 @@ QgsComposerTableColumn *QgsComposerTableSortColumnsProxyModel::columnFromRow( in
591591
QModelIndex proxyIndex = index( row, 0 );
592592
return columnFromIndex( proxyIndex );
593593
}
594+
595+
void QgsComposerTableSortColumnsProxyModel::resetFilter()
596+
{
597+
invalidate();
598+
}

src/core/composer/qgscomposerattributetablemodel.h

+5
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ class CORE_EXPORT QgsComposerTableSortColumnsProxyModel: public QSortFilterProxy
183183
*/
184184
QgsComposerTableColumn* columnFromSourceIndex( const QModelIndex& sourceIndex ) const;
185185

186+
/**Invalidates the current filter used by the proxy model
187+
* @note added in 2.3
188+
*/
189+
void resetFilter();
190+
186191
protected:
187192
bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
188193

0 commit comments

Comments
 (0)