qfield_qml_init.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /***************************************************************************
  2. qfield_qml_init.h
  3. -----------------
  4. begin : Jul 2021
  5. copyright : (C) 2021 by Mathieu Pellerin
  6. email : mathieu@opengis.ch
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. #include "layerutils.h"
  17. #include <qgsfield.h>
  18. #include <QtQuickTest>
  19. #include <QQmlEngine>
  20. #include <QQmlContext>
  21. #define REGISTER_SINGLETON( uri, _class, name ) qmlRegisterSingletonType<_class>( uri, 1, 0, name, []( QQmlEngine *engine, QJSEngine *scriptEngine ) -> QObject * { Q_UNUSED(engine); Q_UNUSED(scriptEngine); return new _class(); } )
  22. void qmlInit( QQmlEngine *engine )
  23. {
  24. Q_UNUSED( engine )
  25. REGISTER_SINGLETON( "org.qfield", LayerUtils, "LayerUtils" );
  26. qRegisterMetaType<QgsField>( "QgsField" );
  27. qRegisterMetaType<QVariant::Type>( "QVariant::Type" );
  28. }