QKeySequence: statically assert the sortedness of the MacSpecialKey array
This array has, in the past, silently failed this test
(cf. 5d8f815e10). Make sure it doesn't
happen again.
Change-Id: I26192749d43de4a7add9d14c7ca04391c1799525
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
bb10
parent
c0bb5b2aa1
commit
97269ab294
|
|
@ -18,6 +18,7 @@
|
|||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <q20algorithm.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -62,6 +63,11 @@ static constexpr MacSpecialKey entries[] = {
|
|||
{ Qt::Key_Eject, 0x23CF },
|
||||
};
|
||||
|
||||
static constexpr bool operator<(const MacSpecialKey &lhs, const MacSpecialKey &rhs)
|
||||
{
|
||||
return lhs.key < rhs.key;
|
||||
}
|
||||
|
||||
static constexpr bool operator<(const MacSpecialKey &lhs, int rhs)
|
||||
{
|
||||
return lhs.key < rhs;
|
||||
|
|
@ -72,6 +78,7 @@ static constexpr bool operator<(int lhs, const MacSpecialKey &rhs)
|
|||
return lhs < rhs.key;
|
||||
}
|
||||
|
||||
static_assert(q20::is_sorted(std::begin(entries), std::end(entries)));
|
||||
|
||||
QChar qt_macSymbolForQtKey(int key)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue