From 69f488f07b29b2e58d3dd39a8b71e78716f450da Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 15 Jan 2016 18:31:57 +0100 Subject: [PATCH] Override mousePressEvent to correctly handle selection filter. --- src/modules/partition/gui/PartitionLabelsView.cpp | 11 +++++++++++ src/modules/partition/gui/PartitionLabelsView.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index e2c9e09e3..0c15a5472 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -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 PartitionLabelsView::updateGeometries() { diff --git a/src/modules/partition/gui/PartitionLabelsView.h b/src/modules/partition/gui/PartitionLabelsView.h index 6b68fe582..479dc4ed3 100644 --- a/src/modules/partition/gui/PartitionLabelsView.h +++ b/src/modules/partition/gui/PartitionLabelsView.h @@ -66,6 +66,7 @@ protected: void mouseMoveEvent( QMouseEvent* event ) override; void leaveEvent( QEvent* event ) override; + void mousePressEvent( QMouseEvent* event ) override; protected slots: void updateGeometries() override;