QGIS API Documentation  3.17.0-Master (fba5093f18)
qgis.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgis.h - QGIS namespace
3  -------------------
4  begin : Sat Jun 30 2002
5  copyright : (C) 2002 by Gary E.Sherman
6  email : sherman at mrcc.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGIS_H
19 #define QGIS_H
20 
21 #include <QMetaEnum>
22 #include <cfloat>
23 #include <memory>
24 #include <cmath>
25 
26 #include "qgstolerance.h"
27 #include "qgis_core.h"
28 #include "qgis_sip.h"
29 
30 #ifdef SIP_RUN
31 % ModuleHeaderCode
32 #include <qgis.h>
33 % End
34 
35 % ModuleCode
36 int QgisEvent = QEvent::User + 1;
37 % End
38 #endif
39 
40 
45 class CORE_EXPORT Qgis
46 {
47  Q_GADGET
48  public:
49 
55  static QString version();
56 
62  static int versionInt();
63 
69  static QString releaseName();
70 
72  static const char *QGIS_DEV_VERSION;
73 
79  static QString devVersion();
80 
81  // Enumerations
82  //
83 
89  {
90  Info = 0,
91  Warning = 1,
92  Critical = 2,
93  Success = 3,
94  None = 4
95  };
96 
101  enum DataType
102  {
103  UnknownDataType = 0,
104  Byte = 1,
105  UInt16 = 2,
106  Int16 = 3,
107  UInt32 = 4,
108  Int32 = 5,
109  Float32 = 6,
110  Float64 = 7,
111  CInt16 = 8,
112  CInt32 = 9,
113  CFloat32 = 10,
114  CFloat64 = 11,
115  ARGB32 = 12,
116  ARGB32_Premultiplied = 13
117  };
118  Q_ENUM( DataType )
119 
120 
125  {
126  Never = 0,
127  Ask = 1,
128  SessionOnly = 2,
129  Always = 3,
131  };
132  Q_ENUM( PythonMacroMode )
133 
134 
138  static const double DEFAULT_SEARCH_RADIUS_MM;
139 
141  static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
142 
149  static const QColor DEFAULT_HIGHLIGHT_COLOR;
150 
155  static const double DEFAULT_HIGHLIGHT_BUFFER_MM;
156 
161  static const double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM;
162 
169  static const double SCALE_PRECISION;
170 
176  static const double DEFAULT_Z_COORDINATE;
177 
183  static const double UI_SCALE_FACTOR;
184 
189  static const double DEFAULT_SNAP_TOLERANCE;
190 
195  static const QgsTolerance::UnitType DEFAULT_SNAP_UNITS;
196 
202  static QString defaultProjectScales();
203 };
204 
205 // hack to workaround warnings when casting void pointers
206 // retrieved from QLibrary::resolve to function pointers.
207 // It's assumed that this works on all systems supporting
208 // QLibrary
209 #define cast_to_fptr(f) f
210 
211 
220 // based on Boojum's code from http://stackoverflow.com/questions/3556687/prevent-firing-signals-in-qt
221 template<class Object> class QgsSignalBlocker SIP_SKIP SIP_SKIP // clazy:exclude=rule-of-three
222 {
223  public:
224 
229  explicit QgsSignalBlocker( Object *object )
230  : mObject( object )
231  , mPreviousState( object->blockSignals( true ) )
232  {}
233 
235  {
236  mObject->blockSignals( mPreviousState );
237  }
238 
240  Object *operator->() { return mObject; }
241 
242  private:
243 
244  Object *mObject = nullptr;
245  bool mPreviousState;
246 
247 };
248 
262 // based on Boojum's code from http://stackoverflow.com/questions/3556687/prevent-firing-signals-in-qt
263 template<class Object> inline QgsSignalBlocker<Object> whileBlocking( Object *object ) SIP_SKIP SIP_SKIP
264 {
265  return QgsSignalBlocker<Object>( object );
266 }
267 
269 CORE_EXPORT uint qHash( const QVariant &variant );
270 
276 inline QString qgsDoubleToString( double a, int precision = 17 )
277 {
278  if ( precision )
279  {
280  QString str = QString::number( a, 'f', precision );
281  if ( str.contains( QLatin1Char( '.' ) ) )
282  {
283  // remove ending 0s
284  int idx = str.length() - 1;
285  while ( str.at( idx ) == '0' && idx > 1 )
286  {
287  idx--;
288  }
289  if ( idx < str.length() - 1 )
290  str.truncate( str.at( idx ) == '.' ? idx : idx + 1 );
291  }
292  return str;
293  }
294  else
295  {
296  // avoid printing -0
297  // see https://bugreports.qt.io/browse/QTBUG-71439
298  const QString str( QString::number( a, 'f', precision ) );
299  if ( str == QLatin1String( "-0" ) )
300  {
301  return QLatin1String( "0" );
302  }
303  else
304  {
305  return str;
306  }
307  }
308 }
309 
316 inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * std::numeric_limits<double>::epsilon() )
317 {
318  if ( std::isnan( a ) || std::isnan( b ) )
319  return std::isnan( a ) && std::isnan( b ) ;
320 
321  const double diff = a - b;
322  return diff > -epsilon && diff <= epsilon;
323 }
324 
331 inline bool qgsFloatNear( float a, float b, float epsilon = 4 * FLT_EPSILON )
332 {
333  if ( std::isnan( a ) || std::isnan( b ) )
334  return std::isnan( a ) && std::isnan( b ) ;
335 
336  const float diff = a - b;
337  return diff > -epsilon && diff <= epsilon;
338 }
339 
341 inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
342 {
343  if ( std::isnan( a ) || std::isnan( b ) )
344  return std::isnan( a ) && std::isnan( b ) ;
345 
346  // The most simple would be to print numbers as %.xe and compare as strings
347  // but that is probably too costly
348  // Then the fastest would be to set some bits directly, but little/big endian
349  // has to be considered (maybe TODO)
350  // Is there a better way?
351  int aexp, bexp;
352  double ar = std::frexp( a, &aexp );
353  double br = std::frexp( b, &bexp );
354 
355  return aexp == bexp &&
356  std::round( ar * std::pow( 10.0, significantDigits ) ) == std::round( br * std::pow( 10.0, significantDigits ) );
357 }
358 
364 inline double qgsRound( double number, int places )
365 {
366  double m = ( number < 0.0 ) ? -1.0 : 1.0;
367  double scaleFactor = std::pow( 10.0, places );
368  return ( std::round( number * m * scaleFactor ) / scaleFactor ) * m;
369 }
370 
371 
372 #ifndef SIP_RUN
373 
375 
385 namespace qgis
386 {
387  // as_const
388 
397  template <typename T> struct QgsAddConst { typedef const T Type; };
398 
399  template <typename T>
400  constexpr typename QgsAddConst<T>::Type &as_const( T &t ) noexcept { return t; }
401 
402  template <typename T>
403  void as_const( const T && ) = delete;
404 
405  // make_unique - from https://stackoverflow.com/a/17902439/1861260
406 
407  template<class T> struct _Unique_if
408  {
409  typedef std::unique_ptr<T> _Single_object;
410  };
411 
412  template<class T> struct _Unique_if<T[]>
413  {
414  typedef std::unique_ptr<T[]> _Unknown_bound;
415  };
416 
417  template<class T, size_t N> struct _Unique_if<T[N]>
418  {
419  typedef void _Known_bound;
420  };
421 
422  template<class T, class... Args>
423  typename _Unique_if<T>::_Single_object
424  make_unique( Args &&... args )
425  {
426  return std::unique_ptr<T>( new T( std::forward<Args>( args )... ) );
427  }
428 
429  template<class T>
430  typename _Unique_if<T>::_Unknown_bound
431  make_unique( size_t n )
432  {
433  typedef typename std::remove_extent<T>::type U;
434  return std::unique_ptr<T>( new U[n]() );
435  }
436 
437  template<class T, class... Args>
438  typename _Unique_if<T>::_Known_bound
439  make_unique( Args &&... ) = delete;
440 
453  template<typename... Args> struct overload
454  {
455  template<typename C, typename R>
456  static constexpr auto of( R( C::*pmf )( Args... ) ) -> decltype( pmf )
457  {
458  return pmf;
459  }
460  };
461 
462  template<class T>
463  QSet<T> listToSet( const QList<T> &list )
464  {
465 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
466  return list.toSet();
467 #else
468  return QSet<T>( list.begin(), list.end() );
469 #endif
470  }
471 
472  template<class T>
473  QList<T> setToList( const QSet<T> &set )
474  {
475 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
476  return set.toList();
477 #else
478  return QList<T>( set.begin(), set.end() );
479 #endif
480  }
481 }
483 #endif
484 
490 template<class T> const QMap<T, QString> qgsEnumMap() SIP_SKIP
491 {
492  QMetaEnum metaEnum = QMetaEnum::fromType<T>();
493  Q_ASSERT( metaEnum.isValid() );
494  QMap<T, QString> enumMap;
495  for ( int idx = 0; idx < metaEnum.keyCount(); ++idx )
496  {
497  const char *enumKey = metaEnum.key( idx );
498  enumMap.insert( static_cast<T>( metaEnum.keyToValue( enumKey ) ), QString( enumKey ) );
499  }
500  return enumMap;
501 }
502 
507 template<class T> QString qgsEnumValueToKey( const T &value ) SIP_SKIP
508 {
509  QMetaEnum metaEnum = QMetaEnum::fromType<T>();
510  Q_ASSERT( metaEnum.isValid() );
511  return QString::fromUtf8( metaEnum.valueToKey( static_cast<int>( value ) ) );
512 }
513 
520 template<class T> T qgsEnumKeyToValue( const QString &key, const T &defaultValue, bool tryValueAsKey = true ) SIP_SKIP
521 {
522  QMetaEnum metaEnum = QMetaEnum::fromType<T>();
523  Q_ASSERT( metaEnum.isValid() );
524  bool ok = false;
525  T v = static_cast<T>( metaEnum.keyToValue( key.toUtf8().data(), &ok ) );
526  if ( ok )
527  {
528  return v;
529  }
530  else
531  {
532  // if conversion has failed, try with conversion from int value
533  if ( tryValueAsKey )
534  {
535  bool canConvert = false;
536  int intValue = key.toInt( &canConvert );
537  if ( canConvert && metaEnum.valueToKey( intValue ) )
538  {
539  return static_cast<T>( intValue );
540  }
541  }
542  }
543  return defaultValue;
544 }
545 
550 template<class T> QString qgsFlagValueToKeys( const T &value ) SIP_SKIP
551 {
552  QMetaEnum metaEnum = QMetaEnum::fromType<T>();
553  Q_ASSERT( metaEnum.isValid() );
554  return QString::fromUtf8( metaEnum.valueToKeys( static_cast<int>( value ) ) );
555 }
556 
562 template<class T> T qgsFlagKeysToValue( const QString &keys, const T &defaultValue ) SIP_SKIP
563 {
564  QMetaEnum metaEnum = QMetaEnum::fromType<T>();
565  Q_ASSERT( metaEnum.isValid() );
566  bool ok = false;
567  T v = static_cast<T>( metaEnum.keysToValue( keys.toUtf8().constData(), &ok ) );
568  if ( ok )
569  return v;
570  else
571  return defaultValue;
572 }
573 
574 
584 CORE_EXPORT double qgsPermissiveToDouble( QString string, bool &ok );
585 
595 CORE_EXPORT int qgsPermissiveToInt( QString string, bool &ok );
596 
606 CORE_EXPORT qlonglong qgsPermissiveToLongLong( QString string, bool &ok );
607 
617 CORE_EXPORT bool qgsVariantLessThan( const QVariant &lhs, const QVariant &rhs );
618 
627 CORE_EXPORT bool qgsVariantEqual( const QVariant &lhs, const QVariant &rhs );
628 
629 
636 CORE_EXPORT bool qgsVariantGreaterThan( const QVariant &lhs, const QVariant &rhs );
637 
641 template<> CORE_EXPORT bool qMapLessThanKey<QVariantList>( const QVariantList &key1, const QVariantList &key2 ) SIP_SKIP;
642 
643 
644 CORE_EXPORT QString qgsVsiPrefix( const QString &path );
645 
651 void CORE_EXPORT *qgsMalloc( size_t size ) SIP_SKIP;
652 
660 void CORE_EXPORT *qgsCalloc( size_t nmemb, size_t size ) SIP_SKIP;
661 
666 void CORE_EXPORT qgsFree( void *ptr ) SIP_SKIP;
667 
668 #ifndef SIP_RUN
669 
670 #ifdef _MSC_VER
671 #define CONSTLATIN1STRING inline const QLatin1String
672 #else
673 #define CONSTLATIN1STRING constexpr QLatin1String
674 #endif
675 
681 {
682 #if PROJ_VERSION_MAJOR>=6
683  return QLatin1String(
684  R"""(GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]] )"""
685  );
686 #else
687  return QLatin1String(
688  "GEOGCS[\"WGS 84\", "
689  " DATUM[\"WGS_1984\", "
690  " SPHEROID[\"WGS 84\",6378137,298.257223563, "
691  " AUTHORITY[\"EPSG\",\"7030\"]], "
692  " TOWGS84[0,0,0,0,0,0,0], "
693  " AUTHORITY[\"EPSG\",\"6326\"]], "
694  " PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]], "
695  " UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]], "
696  " AXIS[\"Lat\",NORTH], "
697  " AXIS[\"Long\",EAST], "
698  " AUTHORITY[\"EPSG\",\"4326\"]]"
699  );
700 #endif
701 }
702 
705 {
706  return QLatin1String( "+proj=longlat +datum=WGS84 +no_defs" );
707 }
708 
711 {
712  return QLatin1String( "EPSG:4326" );
713 }
714 
717 {
718  return QLatin1String( "NONE" );
719 }
720 
722 
724 const int PREVIEW_JOB_DELAY_MS = 250;
725 
727 const int MAXIMUM_LAYER_PREVIEW_TIME_MS = 250;
728 
730 
731 #endif
732 
734 const long GEOSRID = 4326;
735 
737 const long GEOCRS_ID = 3452;
738 
740 const long GEO_EPSG_CRS_ID = 4326;
741 
746 const int USER_CRS_START_ID = 100000;
747 
748 //
749 // Constants for point symbols
750 //
751 
753 const double DEFAULT_POINT_SIZE = 2.0;
754 const double DEFAULT_LINE_WIDTH = 0.26;
755 
757 const double DEFAULT_SEGMENT_EPSILON = 1e-8;
758 
759 typedef QMap<QString, QString> QgsStringMap SIP_SKIP;
760 
769 typedef unsigned long long qgssize;
770 
771 #ifndef SIP_RUN
772 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || defined(__clang__)
773 
774 #define Q_NOWARN_DEPRECATED_PUSH \
775  _Pragma("GCC diagnostic push") \
776  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"");
777 #define Q_NOWARN_DEPRECATED_POP \
778  _Pragma("GCC diagnostic pop");
779 #define Q_NOWARN_UNREACHABLE_PUSH
780 #define Q_NOWARN_UNREACHABLE_POP
781 
782 #elif defined(_MSC_VER)
783 
784 #define Q_NOWARN_DEPRECATED_PUSH \
785  __pragma(warning(push)) \
786  __pragma(warning(disable:4996))
787 #define Q_NOWARN_DEPRECATED_POP \
788  __pragma(warning(pop))
789 #define Q_NOWARN_UNREACHABLE_PUSH \
790  __pragma(warning(push)) \
791  __pragma(warning(disable:4702))
792 #define Q_NOWARN_UNREACHABLE_POP \
793  __pragma(warning(pop))
794 
795 #else
796 
797 #define Q_NOWARN_DEPRECATED_PUSH
798 #define Q_NOWARN_DEPRECATED_POP
799 #define Q_NOWARN_UNREACHABLE_PUSH
800 #define Q_NOWARN_UNREACHABLE_POP
801 
802 #endif
803 #endif
804 
805 #ifndef QGISEXTERN
806 #ifdef Q_OS_WIN
807 # define QGISEXTERN extern "C" __declspec( dllexport )
808 # ifdef _MSC_VER
809 // do not warn about C bindings returning QString
810 # pragma warning(disable:4190)
811 # endif
812 #else
813 # if defined(__GNUC__) || defined(__clang__)
814 # define QGISEXTERN extern "C" __attribute__ ((visibility ("default")))
815 # else
816 # define QGISEXTERN extern "C"
817 # endif
818 #endif
819 #endif
820 #endif
821 
822 #if __cplusplus >= 201500
823 #define FALLTHROUGH [[fallthrough]];
824 #elif defined(__clang__)
825 #define FALLTHROUGH [[clang::fallthrough]];
826 #elif defined(__GNUC__) && __GNUC__ >= 7
827 #define FALLTHROUGH [[gnu::fallthrough]];
828 #else
829 #define FALLTHROUGH
830 #endif
831 
832 // see https://infektor.net/posts/2017-01-19-using-cpp17-attributes-today.html#using-the-nodiscard-attribute
833 #if __cplusplus >= 201703L
834 #define NODISCARD [[nodiscard]]
835 #elif defined(__clang__)
836 #define NODISCARD [[nodiscard]]
837 #elif defined(_MSC_VER)
838 #define NODISCARD // no support
839 #elif defined(__has_cpp_attribute)
840 #if __has_cpp_attribute(nodiscard)
841 #define NODISCARD [[nodiscard]]
842 #elif __has_cpp_attribute(gnu::warn_unused_result)
843 #define NODISCARD [[gnu::warn_unused_result]]
844 #else
845 #define NODISCARD Q_REQUIRED_RESULT
846 #endif
847 #else
848 #define NODISCARD Q_REQUIRED_RESULT
849 #endif
850 
851 #if __cplusplus >= 201703L
852 #define MAYBE_UNUSED [[maybe_unused]]
853 #elif defined(__clang__)
854 #define MAYBE_UNUSED [[maybe_unused]]
855 #elif defined(_MSC_VER)
856 #define MAYBE_UNUSED // no support
857 #elif defined(__has_cpp_attribute)
858 #if __has_cpp_attribute(gnu::unused)
859 #define MAYBE_UNUSED [[gnu::unused]]
860 #else
861 #define MAYBE_UNUSED
862 #endif
863 #else
864 #define MAYBE_UNUSED
865 #endif
866 
867 #ifndef FINAL
868 #define FINAL final
869 #endif
870 
871 #ifdef SIP_RUN
872 
877 QString CORE_EXPORT geoWkt();
878 
880 QString CORE_EXPORT geoProj4();
881 
883 QString CORE_EXPORT geoEpsgCrsAuthId();
884 
886 QString CORE_EXPORT geoNone();
887 
888 #endif
CORE_EXPORT QString qgsVsiPrefix(const QString &path)
Definition: qgis.cpp:194
int precision
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true)
Returns the value corresponding to the given key of an enum.
Definition: qgis.h:520
static const char * QGIS_DEV_VERSION
The development version.
Definition: qgis.h:72
bool qgsFloatNear(float a, float b, float epsilon=4 *FLT_EPSILON)
Compare two floats (but allow some difference)
Definition: qgis.h:331
CORE_EXPORT bool qgsVariantEqual(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether they are equal, two NULL values are always treated a...
Definition: qgis.cpp:265
QString qgsEnumValueToKey(const T &value)
Returns the value for the given key of an enum.
Definition: qgis.h:507
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:316
CONSTLATIN1STRING geoWkt()
Wkt string that represents a geographic coord sys.
Definition: qgis.h:680
CONSTLATIN1STRING geoNone()
Constant that holds the string representation for "No ellips/No CRS".
Definition: qgis.h:716
DataType
Raster data types.
Definition: qgis.h:101
void CORE_EXPORT * qgsCalloc(size_t nmemb, size_t size)
Allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the alloc...
Definition: qgis.cpp:101
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:88
QMap< QString, QString > QgsStringMap
Definition: qgis.h:759
~QgsSignalBlocker()
Definition: qgis.h:234
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:45
CORE_EXPORT bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.
Definition: qgis.cpp:121
CORE_EXPORT bool qMapLessThanKey< QVariantList >(const QVariantList &key1, const QVariantList &key2)
Compares two QVariantList values and returns whether the first is less than the second.
Definition: qgis.cpp:299
QgsSignalBlocker(Object *object)
Constructor for QgsSignalBlocker.
Definition: qgis.h:229
#define CONSTLATIN1STRING
Definition: qgis.h:673
int significantDigits(const Qgis::DataType rasterDataType)
Returns the maximum number of significant digits a for the given rasterDataType.
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
Definition: qgis.h:757
Macros will not be run for this session.
Definition: qgis.h:130
#define SIP_SKIP
Definition: qgis_sip.h:126
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Definition: qgis.h:276
This is the class is providing tolerance value in map unit values.
Definition: qgstolerance.h:32
const long GEOCRS_ID
Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id.
Definition: qgis.h:737
CORE_EXPORT double qgsPermissiveToDouble(QString string, bool &ok)
Converts a string to a double in a permissive way, e.g., allowing for incorrect numbers of digits bet...
Definition: qgis.cpp:65
RAII signal blocking class.
Definition: qgis.h:221
T qgsFlagKeysToValue(const QString &keys, const T &defaultValue)
Returns the value corresponding to the given keys of a flag.
Definition: qgis.h:562
void CORE_EXPORT qgsFree(void *ptr)
Frees the memory space pointed to by ptr.
Definition: qgis.cpp:116
CORE_EXPORT qlonglong qgsPermissiveToLongLong(QString string, bool &ok)
Converts a string to an qlonglong in a permissive way, e.g., allowing for incorrect numbers of digits...
Definition: qgis.cpp:79
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition: qgis.h:769
const double DEFAULT_POINT_SIZE
Magic number that determines the default point size for point symbols.
Definition: qgis.h:753
CONSTLATIN1STRING geoProj4()
PROJ4 string that represents a geographic coord sys.
Definition: qgis.h:704
const int USER_CRS_START_ID
Magick number that determines whether a projection crsid is a system (srs.db) or user (~/...
Definition: qgis.h:746
const QMap< T, QString > qgsEnumMap()
Returns a map of all enum entries.
Definition: qgis.h:490
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:263
const long GEOSRID
Magic number for a geographic coord sys in POSTGIS SRID.
Definition: qgis.h:734
double qgsRound(double number, int places)
Returns a double number, rounded (as close as possible) to the specified number of places...
Definition: qgis.h:364
bool qgsDoubleNearSig(double a, double b, int significantDigits=10)
Compare two doubles using specified number of significant digits.
Definition: qgis.h:341
const double DEFAULT_LINE_WIDTH
Definition: qgis.h:754
PythonMacroMode
Authorisation to run Python Macros.
Definition: qgis.h:124
CORE_EXPORT uint qHash(const QVariant &variant)
Hash for QVariant.
Definition: qgis.cpp:219
QString qgsFlagValueToKeys(const T &value)
Returns the value for the given keys of a flag.
Definition: qgis.h:550
CORE_EXPORT int qgsPermissiveToInt(QString string, bool &ok)
Converts a string to an integer in a permissive way, e.g., allowing for incorrect numbers of digits b...
Definition: qgis.cpp:72
CONSTLATIN1STRING geoEpsgCrsAuthId()
Geographic coord sys from EPSG authority.
Definition: qgis.h:710
CORE_EXPORT bool qgsVariantGreaterThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is greater than the second.
Definition: qgis.cpp:189
void CORE_EXPORT * qgsMalloc(size_t size)
Allocates size bytes and returns a pointer to the allocated memory.
Definition: qgis.cpp:86
Object * operator->()
Returns pointer to blocked QObject.
Definition: qgis.h:240
const long GEO_EPSG_CRS_ID
Magic number for a geographic coord sys in EpsgCrsId ID format.
Definition: qgis.h:740