mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
core/settings: allow signals to be strongly typed in C++
Register enums to allow them to be used in signal handlers instead of int. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
75fe59b0da
commit
13b2b9f19c
2 changed files with 19 additions and 0 deletions
|
@ -49,6 +49,15 @@ void qPref::loadSync(bool doSync)
|
||||||
Q_DECLARE_METATYPE(deco_mode);
|
Q_DECLARE_METATYPE(deco_mode);
|
||||||
Q_DECLARE_METATYPE(def_file_behavior);
|
Q_DECLARE_METATYPE(def_file_behavior);
|
||||||
Q_DECLARE_METATYPE(taxonomy_category);
|
Q_DECLARE_METATYPE(taxonomy_category);
|
||||||
|
Q_DECLARE_METATYPE(units::DURATION);
|
||||||
|
Q_DECLARE_METATYPE(units::LENGTH);
|
||||||
|
Q_DECLARE_METATYPE(units::PRESSURE);
|
||||||
|
Q_DECLARE_METATYPE(units::TEMPERATURE);
|
||||||
|
Q_DECLARE_METATYPE(unit_system_values);
|
||||||
|
Q_DECLARE_METATYPE(units::TIME);
|
||||||
|
Q_DECLARE_METATYPE(units::VOLUME);
|
||||||
|
Q_DECLARE_METATYPE(units::WEIGHT);
|
||||||
|
|
||||||
void qPref::registerQML(QQmlEngine *engine)
|
void qPref::registerQML(QQmlEngine *engine)
|
||||||
{
|
{
|
||||||
if (engine) {
|
if (engine) {
|
||||||
|
@ -77,4 +86,12 @@ void qPref::registerQML(QQmlEngine *engine)
|
||||||
qRegisterMetaType<deco_mode>();
|
qRegisterMetaType<deco_mode>();
|
||||||
qRegisterMetaType<def_file_behavior>();
|
qRegisterMetaType<def_file_behavior>();
|
||||||
qRegisterMetaType<taxonomy_category>();
|
qRegisterMetaType<taxonomy_category>();
|
||||||
|
qRegisterMetaType<units::DURATION>();
|
||||||
|
qRegisterMetaType<units::LENGTH>();
|
||||||
|
qRegisterMetaType<units::PRESSURE>();
|
||||||
|
qRegisterMetaType<units::TEMPERATURE>();
|
||||||
|
qRegisterMetaType<unit_system_values>();
|
||||||
|
qRegisterMetaType<units::TIME>();
|
||||||
|
qRegisterMetaType<units::VOLUME>();
|
||||||
|
qRegisterMetaType<units::WEIGHT>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "core/pref.h"
|
#include "core/pref.h"
|
||||||
#include "core/qthelper.h"
|
#include "core/qthelper.h"
|
||||||
|
#include "core/settings/qPref.h"
|
||||||
#include "core/settings/qPrefUnit.h"
|
#include "core/settings/qPrefUnit.h"
|
||||||
|
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
@ -13,6 +14,7 @@ void TestQPrefUnits::initTestCase()
|
||||||
QCoreApplication::setOrganizationName("Subsurface");
|
QCoreApplication::setOrganizationName("Subsurface");
|
||||||
QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
|
QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
|
||||||
QCoreApplication::setApplicationName("SubsurfaceTestQPrefUnits");
|
QCoreApplication::setApplicationName("SubsurfaceTestQPrefUnits");
|
||||||
|
qPref::registerQML(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQPrefUnits::test_struct_get()
|
void TestQPrefUnits::test_struct_get()
|
||||||
|
|
Loading…
Reference in a new issue