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;