Skip to content

Commit

Permalink
Register MetaEnumVariable for comparison
Browse files Browse the repository at this point in the history
This is needed to ensure that MetaEnumVariable can be properly handled
for comparisons, e.g. as done via QVariant::compare().

Followup of commit 3b1931e

Fixes steveire#89
  • Loading branch information
pinotree committed Aug 13, 2023
1 parent 20d415b commit e6a2c1f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions templates/lib/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include "exception.h"
#include "grantlee_config_p.h"
#include "grantlee_version.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include "metaenumvariable_p.h"
#endif
#ifdef QT_QML_LIB
#include "scriptabletags.h"
#endif
Expand All @@ -32,6 +35,9 @@

#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtCore/QMetaType>
#endif
#include <QtCore/QPluginLoader>
#include <QtCore/QTextStream>

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

d_ptr->m_pluginDirs = QCoreApplication::libraryPaths();
d_ptr->m_pluginDirs << QString::fromLocal8Bit(GRANTLEE_PLUGIN_PATH);

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QMetaType::registerComparators<MetaEnumVariable>();
#endif
}

Engine::~Engine()
Expand Down

0 comments on commit e6a2c1f

Please sign in to comment.