Sort note patterns after both position and key

This commit is contained in:
Oskar Wallgren
2017-10-13 20:46:55 +02:00
parent 20ea945cee
commit 81966fa1a6
2 changed files with 11 additions and 24 deletions

View File

@@ -113,11 +113,19 @@ public:
void quantizeLength( const int qGrid );
void quantizePos( const int qGrid );
static inline bool lessThan( Note * &lhs, Note * &rhs )
static inline bool lessThan( const Note * lhs, const Note * rhs )
{
// function to compare two notes - must be called explictly when
// using qSort
return (bool) ((int) ( *lhs ).pos() < (int) ( *rhs ).pos());
if( (int)( *lhs ).pos() < (int)( *rhs ).pos() )
{
return true;
}
else if( (int)( *lhs ).pos() > (int)( *rhs ).pos() )
{
return false;
}
return ( (int)( *lhs ).key() > (int)( *rhs ).key() );
}
inline bool selected() const