Make math utils Q_GADGET

This commit is contained in:
Nyall Dawson 2025-08-06 14:11:10 +10:00
parent f9faca4445
commit 53d20879de
3 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,9 @@ Contains utility functions for mathematical operations.
%TypeHeaderCode
#include "qgsmathutils.h"
%End
public:
static const QMetaObject staticMetaObject;
public:
static void doubleToRational( double value, qlonglong &numerator /Out/, qlonglong &denominator /Out/, double tolerance = 1.0e-9, int maxIterations = 100 );

View File

@ -20,6 +20,9 @@ Contains utility functions for mathematical operations.
%TypeHeaderCode
#include "qgsmathutils.h"
%End
public:
static const QMetaObject staticMetaObject;
public:
static void doubleToRational( double value, qlonglong &numerator /Out/, qlonglong &denominator /Out/, double tolerance = 1.0e-9, int maxIterations = 100 );

View File

@ -29,6 +29,8 @@
*/
class CORE_EXPORT QgsMathUtils
{
Q_GADGET
public:
/**
@ -40,7 +42,7 @@ class CORE_EXPORT QgsMathUtils
* \param tolerance desired precision. The returned fraction will be at within this tolerance of the original value.
* \param maxIterations maximum number of iterations. Higher values result in better approximations, but at the cost of additional computation.
*/
static void doubleToRational( double value, qlonglong &numerator SIP_OUT, qlonglong &denominator SIP_OUT, double tolerance = 1.0e-9, int maxIterations = 100 );
Q_INVOKABLE static void doubleToRational( double value, qlonglong &numerator SIP_OUT, qlonglong &denominator SIP_OUT, double tolerance = 1.0e-9, int maxIterations = 100 );
};