mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 02:45:44 -05:00
Better use QItemSelectionModel to detect selection changes
This commit is contained in:
parent
6b164a9dcf
commit
344d7ac610
1 changed files with 7 additions and 5 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
// Qt
|
||||
#include <QDebug>
|
||||
#include <QItemSelectionModel>
|
||||
|
||||
PartitionPage::PartitionPage( QWidget* parent )
|
||||
: Calamares::AbstractPage( parent )
|
||||
|
@ -49,11 +50,12 @@ PartitionPage::PartitionPage( QWidget* parent )
|
|||
|
||||
m_deviceModel->init( m_backend->scanDevices() );
|
||||
|
||||
connect( m_ui->deviceListView, &QListView::clicked, [ this ]( const QModelIndex & index )
|
||||
{
|
||||
Device* device = m_deviceModel->deviceForIndex( index );
|
||||
m_partitionModel->init( device );
|
||||
} );
|
||||
connect( m_ui->deviceListView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
[ this ]( const QModelIndex& index, const QModelIndex& oldIndex )
|
||||
{
|
||||
Device* device = m_deviceModel->deviceForIndex( index );
|
||||
m_partitionModel->init( device );
|
||||
} );
|
||||
}
|
||||
|
||||
PartitionPage::~PartitionPage()
|
||||
|
|
Loading…
Add table
Reference in a new issue