mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-25 16:38:21 -04:00
Sort device in DeviceModel by device node
This commit is contained in:
parent
20521f278c
commit
cb546d02f9
1 changed files with 7 additions and 0 deletions
|
@ -24,6 +24,9 @@
|
||||||
// KF5
|
// KF5
|
||||||
#include <KFormat>
|
#include <KFormat>
|
||||||
|
|
||||||
|
// STL
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
DeviceModel::DeviceModel( QObject* parent )
|
DeviceModel::DeviceModel( QObject* parent )
|
||||||
: QAbstractListModel( parent )
|
: QAbstractListModel( parent )
|
||||||
{
|
{
|
||||||
|
@ -38,6 +41,10 @@ DeviceModel::init( const QList< Device* >& devices )
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_devices = devices;
|
m_devices = devices;
|
||||||
|
std::sort( m_devices.begin(), m_devices.end(), []( const Device* dev1, const Device* dev2 )
|
||||||
|
{
|
||||||
|
return dev1->deviceNode() < dev2->deviceNode();
|
||||||
|
} );
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue