From 10c51528a96ab30c4471b943fd7d6b01703cf07b Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 13 Jan 2016 15:15:26 +0100 Subject: [PATCH] Repaint viewport on selection change. --- src/modules/partition/gui/PartitionBarsView.cpp | 14 +++++++++++++- src/modules/partition/gui/PartitionBarsView.h | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/gui/PartitionBarsView.cpp b/src/modules/partition/gui/PartitionBarsView.cpp index ce49fc7b6..77c8ccf47 100644 --- a/src/modules/partition/gui/PartitionBarsView.cpp +++ b/src/modules/partition/gui/PartitionBarsView.cpp @@ -1,7 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * Copyright 2015-2016, Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -385,6 +385,18 @@ PartitionBarsView::scrollTo( const QModelIndex& index, ScrollHint hint ) } +void +PartitionBarsView::setSelectionModel( QItemSelectionModel* selectionModel ) +{ + QAbstractItemView::setSelectionModel( selectionModel ); + connect( selectionModel, &QItemSelectionModel::selectionChanged, + this, [=] + { + viewport()->repaint(); + } ); +} + + QModelIndex PartitionBarsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) { diff --git a/src/modules/partition/gui/PartitionBarsView.h b/src/modules/partition/gui/PartitionBarsView.h index 33b5ede7c..0d4ff624f 100644 --- a/src/modules/partition/gui/PartitionBarsView.h +++ b/src/modules/partition/gui/PartitionBarsView.h @@ -1,7 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * Copyright 2015-2016, Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,6 +46,8 @@ public: QRect visualRect( const QModelIndex& index ) const override; void scrollTo( const QModelIndex& index, ScrollHint hint = EnsureVisible ) override; + void setSelectionModel( QItemSelectionModel* selectionModel ) override; + protected: // QAbstractItemView API QRegion visualRegionForSelection( const QItemSelection& selection ) const override;