mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 02:54:46 -04:00
added a border to selected/mouseHover elements in the grid view
This commit is contained in:
32
common/qnaturalsorting.cpp
Normal file
32
common/qnaturalsorting.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
#include <QCollator>
|
||||
|
||||
|
||||
|
||||
int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
QCollator c;
|
||||
c.setCaseSensitivity(caseSensitivity);
|
||||
c.setNumericMode(true);
|
||||
return c.compare(s1, s2);
|
||||
}
|
||||
bool naturalSortLessThanCS( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseSensitive ) < 0);
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCI( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseInsensitive ) < 0);
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCIFileInfo(const QFileInfo & left,const QFileInfo & right)
|
||||
{
|
||||
return naturalSortLessThanCI(left.fileName(),right.fileName());
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCILibraryItem(LibraryItem * left, LibraryItem * right)
|
||||
{
|
||||
return naturalSortLessThanCI(left->name,right->name);
|
||||
}
|
Reference in New Issue
Block a user