Skip to content
Permalink
Browse files

hide the sort indicator in the attribute table until first sort

  • Loading branch information
SebDieBln committed Nov 22, 2015
1 parent 504c252 commit caab4c12f5f51562ffa0758d3fe856947bffcb28
@@ -53,12 +53,14 @@ QgsAttributeTableView::QgsAttributeTableView( QWidget *parent )

setSelectionBehavior( QAbstractItemView::SelectRows );
setSelectionMode( QAbstractItemView::ExtendedSelection );
setSortingEnabled( true );
setSortingEnabled( true ); // At this point no data is in the model yet, so actually nothing is sorted.
horizontalHeader()->setSortIndicatorShown( false ); // So hide the indicator to avoid confusion.

verticalHeader()->viewport()->installEventFilter( this );

connect( verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( selectRow( int ) ) );
connect( verticalHeader(), SIGNAL( sectionEntered( int ) ), this, SLOT( _q_selectRow( int ) ) );
connect( horizontalHeader(), SIGNAL( sortIndicatorChanged( int, Qt::SortOrder ) ), this, SLOT( showHorizontalSortIndicator() ) );
}

QgsAttributeTableView::~QgsAttributeTableView()
@@ -282,3 +284,8 @@ void QgsAttributeTableView::selectRow( int row, bool anchor )
mFeatureSelectionModel->selectFeatures( QItemSelection( tl, br ), command );
}
}

void QgsAttributeTableView::showHorizontalSortIndicator()
{
horizontalHeader()->setSortIndicatorShown( true );
}
@@ -139,6 +139,7 @@ class GUI_EXPORT QgsAttributeTableView : public QTableView

private slots:
void modelDeleted();
void showHorizontalSortIndicator();

private:
void selectRow( int row, bool anchor );

0 comments on commit caab4c1

Please sign in to comment.
You can’t perform that action at this time.