Skip to content

Commit ec8e778

Browse files
committed
Registr MetaEnumVariable for comparison
This is needed to ensure that MetaEnumVariable can be properly handled for comparisons, e.g. as done via QVariant::compare(). Followup of commit 3b1931e
1 parent 20d415b commit ec8e778

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

templates/lib/engine.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#include "exception.h"
2525
#include "grantlee_config_p.h"
2626
#include "grantlee_version.h"
27+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
28+
#include "metaenumvariable_p.h"
29+
#endif
2730
#ifdef QT_QML_LIB
2831
#include "scriptabletags.h"
2932
#endif
@@ -32,6 +35,9 @@
3235

3336
#include <QtCore/QCoreApplication>
3437
#include <QtCore/QDir>
38+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
39+
#include <QtCore/QMetaType>
40+
#endif
3541
#include <QtCore/QPluginLoader>
3642
#include <QtCore/QTextStream>
3743

@@ -48,6 +54,10 @@ Engine::Engine(QObject *parent)
4854

4955
d_ptr->m_pluginDirs = QCoreApplication::libraryPaths();
5056
d_ptr->m_pluginDirs << QString::fromLocal8Bit(GRANTLEE_PLUGIN_PATH);
57+
58+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
59+
QMetaType::registerComparators<MetaEnumVariable>();
60+
#endif
5161
}
5262

5363
Engine::~Engine()

0 commit comments

Comments
 (0)