From b374404c6f7532015b150c15d21c0bb3430c1c03 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Thu, 11 Feb 2016 16:00:07 +0100 Subject: [PATCH] Allow hiding extended partition in Labels view. --- src/modules/partition/gui/PartitionLabelsView.cpp | 11 ++++++++++- src/modules/partition/gui/PartitionLabelsView.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index 0c15a5472..920c80800 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -164,7 +164,9 @@ PartitionLabelsView::getIndexesToDraw( const QModelIndex& parent ) const index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB ) continue; - list.append( index ); + if ( !modl->hasChildren( index ) || !m_extendedPartitionHidden ) + list.append( index ); + if ( modl->hasChildren( index ) ) list.append( getIndexesToDraw( index ) ); } @@ -514,6 +516,13 @@ PartitionLabelsView::setSelectionFilter( SelectionFilter canBeSelected ) } +void +PartitionLabelsView::setExtendedPartitionHidden( bool hidden ) +{ + m_extendedPartitionHidden = hidden; +} + + QModelIndex PartitionLabelsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) { diff --git a/src/modules/partition/gui/PartitionLabelsView.h b/src/modules/partition/gui/PartitionLabelsView.h index 479dc4ed3..fef453d44 100644 --- a/src/modules/partition/gui/PartitionLabelsView.h +++ b/src/modules/partition/gui/PartitionLabelsView.h @@ -55,6 +55,8 @@ public: void setSelectionFilter( SelectionFilter canBeSelected ); + void setExtendedPartitionHidden( bool hidden ); + protected: // QAbstractItemView API QRegion visualRegionForSelection( const QItemSelection& selection ) const override; @@ -82,6 +84,7 @@ private: QStringList buildTexts( const QModelIndex& index ) const; SelectionFilter canBeSelected; + bool m_extendedPartitionHidden; QString m_customNewRootLabel; QPersistentModelIndex m_hoveredIndex;