swapDevice in BootLoaderModel.
This commit is contained in:
parent
b767f0b18f
commit
cbbaa8b592
@ -129,3 +129,18 @@ BootLoaderModel::data( const QModelIndex& index, int role ) const
|
||||
return QStandardItemModel::data( index, role );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BootLoaderModel::swapDevice( Device* oldDevice, Device* newDevice )
|
||||
{
|
||||
Q_ASSERT( oldDevice );
|
||||
Q_ASSERT( newDevice );
|
||||
Q_ASSERT( oldDevice->deviceNode() == newDevice->deviceNode() );
|
||||
|
||||
int indexOfOldDevice = m_devices.indexOf( oldDevice );
|
||||
if ( indexOfOldDevice < 0 )
|
||||
return;
|
||||
|
||||
m_devices[ indexOfOldDevice ] = newDevice;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
|
||||
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
|
||||
|
||||
void swapDevice( Device* oldDevice, Device* newDevice );
|
||||
|
||||
private:
|
||||
QList< Device* > m_devices;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user