From a27a5496b71e71725ec6c91790bf41bb00922718 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 11 Dec 2015 17:07:59 +0100 Subject: [PATCH] Try a statically calculated selection margin. --- src/modules/partition/gui/PartitionBarsView.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/modules/partition/gui/PartitionBarsView.cpp b/src/modules/partition/gui/PartitionBarsView.cpp index 55349d298..fd38f2cf6 100644 --- a/src/modules/partition/gui/PartitionBarsView.cpp +++ b/src/modules/partition/gui/PartitionBarsView.cpp @@ -35,7 +35,8 @@ static const int VIEW_HEIGHT = CalamaresUtils::defaultFontHeight() + 8; static const int CORNER_RADIUS = 3; -static const int EXTENDED_PARTITION_MARGIN = 4; +static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 ); +static const int SELECTION_MARGIN = ( EXTENDED_PARTITION_MARGIN - 2 ) / 2; PartitionBarsView::PartitionBarsView( QWidget* parent ) @@ -152,8 +153,6 @@ PartitionBarsView::drawSection( QPainter* painter, const QRect& rect_, int x, in highlightColor.setAlpha( 120 ); painter->setBrush( highlightColor ); - const int SEL_PADDING = 1; - QRect selectionRect = rect; selectionRect.setX( x + 1 ); selectionRect.setWidth( width - 3 ); //account for the previous rect.adjust @@ -164,10 +163,10 @@ PartitionBarsView::drawSection( QPainter* painter, const QRect& rect_, int x, in if ( rect.right() < selectionRect.right() ) //hack for last item selectionRect.adjust( 0, 0, - ( selectionRect.right() - rect.right() ), 0 ); - selectionRect.adjust( SEL_PADDING, - SEL_PADDING, - -SEL_PADDING, - -SEL_PADDING ); + selectionRect.adjust( SELECTION_MARGIN, + SELECTION_MARGIN, + -SELECTION_MARGIN, + -SELECTION_MARGIN ); painter->drawRoundedRect( selectionRect, radius - 1,