Sort device in DeviceModel by device node
This commit is contained in:
parent
20521f278c
commit
cb546d02f9
@ -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…
Reference in New Issue
Block a user