Override mousePressEvent to correctly handle selection filter.

This commit is contained in:
Teo Mrnjavac 2016-01-15 18:31:57 +01:00
parent 16da0bd8d8
commit 69f488f07b
2 changed files with 12 additions and 0 deletions

View File

@ -564,6 +564,17 @@ PartitionLabelsView::leaveEvent( QEvent* event )
} }
void
PartitionLabelsView::mousePressEvent( QMouseEvent* event )
{
QModelIndex candidateIndex = indexAt( event->pos() );
if ( canBeSelected( candidateIndex ) )
QAbstractItemView::mousePressEvent( event );
else
event->accept();
}
void void
PartitionLabelsView::updateGeometries() PartitionLabelsView::updateGeometries()
{ {

View File

@ -66,6 +66,7 @@ protected:
void mouseMoveEvent( QMouseEvent* event ) override; void mouseMoveEvent( QMouseEvent* event ) override;
void leaveEvent( QEvent* event ) override; void leaveEvent( QEvent* event ) override;
void mousePressEvent( QMouseEvent* event ) override;
protected slots: protected slots:
void updateGeometries() override; void updateGeometries() override;