Use QMetaEnum::fromType() instead of staticMetaObject.enumerator()
The old way relied on the order of enums within the type; using fromType() makes the enum specific. Change-Id: I418473a6983861ca105ccc5eb249f441dbbb28cf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
f67ef4934b
commit
3905d3c4df
@ -124,9 +124,7 @@ void tst_QCalendar::basic_data()
|
|||||||
{
|
{
|
||||||
QTest::addColumn<QCalendar::System>("system");
|
QTest::addColumn<QCalendar::System>("system");
|
||||||
|
|
||||||
QMetaEnum e = QCalendar::staticMetaObject.enumerator(0);
|
const QMetaEnum e = QMetaEnum::fromType<QCalendar::System>();
|
||||||
Q_ASSERT(qstrcmp(e.name(), "System") == 0);
|
|
||||||
|
|
||||||
for (int i = 0; i <= int(QCalendar::System::Last); ++i) {
|
for (int i = 0; i <= int(QCalendar::System::Last); ++i) {
|
||||||
// There may be gaps in the enum's numbering; and Last is a duplicate:
|
// There may be gaps in the enum's numbering; and Last is a duplicate:
|
||||||
if (e.value(i) != -1 && qstrcmp(e.key(i), "Last"))
|
if (e.value(i) != -1 && qstrcmp(e.key(i), "Last"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user