void QgsAttributeSelectionDialog::mRemoveSortColumnPushButton_clicked() { //remove selected rows from sort order widget QItemSelection sortSelection( mSortColumnTableView->selectionModel()->selection() ); if ( sortSelection.length() < 1 ) { return; } QModelIndex selectedIndex = sortSelection.indexes().at( 0 ); int rowToRemove = selectedIndex.row(); //find corresponding column QgsComposerTableColumn *column = nullptr; column = mSortedProxyModel->columnFromIndex( selectedIndex ); if ( !column ) { return; } //set column as unsorted mColumnModel->setColumnAsUnsorted( column ); //set next row as selected mSortColumnTableView->selectRow( rowToRemove ); }
void QgsAttributeSelectionDialog::on_mSortColumnDownPushButton_clicked() { //find selected row QItemSelection sortSelection( mSortColumnTableView->selectionModel()->selection() ); if ( sortSelection.length() < 1 ) { return; } QModelIndex selectedIndex = sortSelection.indexes().at( 0 ); if ( mComposerTable ) { QgsComposerTableColumn * column = mSortedProxyModel->columnFromIndex( selectedIndex ); if ( !column ) { return; } mColumnModel->moveColumnInSortRank( column, QgsComposerAttributeTableColumnModelV2::ShiftDown ); } else if ( mComposerTableV1 ) { QgsComposerTableColumn * column = mSortedProxyModelV1->columnFromIndex( selectedIndex ); if ( !column ) { return; } mColumnModelV1->moveColumnInSortRank( column, QgsComposerAttributeTableColumnModel::ShiftDown ); } }
void DownloadModel::sort(int column, Qt::SortOrder order){ qDebug() << QString("sort(%1,%2)").arg(column).arg(order); sortColumnOrder.removeAll(column); sortColumnOrder.prepend(column); sortIsAscending[column] = (order == Qt::AscendingOrder); beginResetModel(); sortSelection(); endResetModel(); reloaded(); }