4#include <private/qquickvaluetypes_p.h>
7#include <private/qqmlvaluetype_p.h>
8#include <private/qcolorspace_p.h>
9#include <private/qfont_p.h>
75 return v.hsvSaturationF();
90 return v.hslSaturationF();
95 return v.lightnessF();
146 float hue, saturation, lightness,
alpha;
147 v.getHslF(&hue, &saturation, &lightness, &
alpha);
153 float hue, saturation, lightness,
alpha;
154 v.getHslF(&hue, &saturation, &lightness, &
alpha);
160 float hue, saturation, lightness,
alpha;
161 v.getHslF(&hue, &saturation, &lightness, &
alpha);
165template<
typename T,
int NumParams>
168 Q_STATIC_ASSERT_X(NumParams == 2 || NumParams == 3 || NumParams == 4 || NumParams == 16,
169 "Unsupported number of params; add an additional case below if necessary.");
171 if (
s.count(u
',') != NumParams - 1)
179 next = (parameters.
size() == NumParams - 1) ?
length :
s.indexOf(u
',', prev);
185 if constexpr (NumParams == 2) {
186 return T(parameters[0], parameters[1]);
187 }
else if constexpr (NumParams == 3) {
188 return T(parameters[0], parameters[1], parameters[2]);
189 }
else if constexpr (NumParams == 4) {
190 return T(parameters[0], parameters[1], parameters[2], parameters[3]);
191 }
else if constexpr (NumParams == 16) {
192 return T(parameters[0], parameters[1], parameters[2], parameters[3],
193 parameters[4], parameters[5], parameters[6], parameters[7],
194 parameters[8], parameters[9], parameters[10], parameters[11],
195 parameters[12], parameters[13], parameters[14], parameters[15]);
206 return createValueTypeFromNumberString<QVector2D, 2>(
params.toString());
274 return v.toVector3D();
279 return v.toVector4D();
285 if (
qAbs(
v.x() - vec.
x()) > absEps)
287 if (
qAbs(
v.y() - vec.
y()) > absEps)
300 return createValueTypeFromNumberString<QVector3D, 3>(
params.toString());
304 params.property(2).toNumber());
391 return v.toVector2D();
396 return v.toVector4D();
402 if (
qAbs(
v.x() - vec.
x()) > absEps)
404 if (
qAbs(
v.y() - vec.
y()) > absEps)
406 if (
qAbs(
v.z() - vec.
z()) > absEps)
419 return createValueTypeFromNumberString<QVector4D, 4>(
params.toString());
423 params.property(2).toNumber(),
params.property(3).toNumber());
516 return v.toVector2D();
521 return v.toVector3D();
527 if (
qAbs(
v.x() - vec.
x()) > absEps)
529 if (
qAbs(
v.y() - vec.
y()) > absEps)
531 if (
qAbs(
v.z() - vec.
z()) > absEps)
533 if (
qAbs(
v.w() - vec.
w()) > absEps)
546 return createValueTypeFromNumberString<QQuaternion, 4>(
params.toString());
550 params.property(2).toNumber(),
params.property(3).toNumber());
653 return v.toEulerAngles();
658 return v.toVector4D();
664 if (
qAbs(
v.scalar() -
q.scalar()) > absEps)
666 if (
qAbs(
v.x() -
q.x()) > absEps)
668 if (
qAbs(
v.y() -
q.y()) > absEps)
670 if (
qAbs(
v.z() -
q.z()) > absEps)
686 return createValueTypeFromNumberString<QMatrix4x4, 16>(
params.toString());
690 params.property(1).toNumber(),
691 params.property(2).toNumber(),
692 params.property(3).toNumber(),
693 params.property(4).toNumber(),
694 params.property(5).toNumber(),
695 params.property(6).toNumber(),
696 params.property(7).toNumber(),
697 params.property(8).toNumber(),
698 params.property(9).toNumber(),
699 params.property(10).toNumber(),
700 params.property(11).toNumber(),
701 params.property(12).toNumber(),
702 params.property(13).toNumber(),
703 params.property(14).toNumber(),
704 params.property(15).toNumber());
752 return v.determinant();
778 for (
int i = 0;
i < 4; ++
i) {
779 for (
int j = 0;
j < 4; ++
j) {
799 if constexpr (std::is_same_v<T, bool>) {
800 if (
value.isBool()) {
804 }
else if constexpr (std::is_same_v<
805 typename std::remove_cv<typename std::remove_reference<T>::type>
::type,
807 if (
value.isString()) {
811 }
else if constexpr (std::is_integral_v<T> || std::is_enum_v<T>) {
812 if (
value.isNumber()) {
816 }
else if constexpr (std::is_floating_point_v<T>) {
817 if (
value.isNumber()) {
882 return v.styleName();
887 v.setStyleName(style);
922 return v.underline();
942 return v.strikeOut();
952 if (
v.pointSizeF() == -1) {
955 return v.pointSizeF();
961 qWarning() <<
"Both point size and pixel size set. Using pixel size.";
966 v.setPointSizeF(
size);
972 if (
v.pixelSize() == -1) {
975 return v.pixelSize();
982 qWarning() <<
"Both point size and pixel size set. Using pixel size.";
983 v.setPixelSize(
size);
999 return v.letterSpacing();
1009 return v.wordSpacing();
1014 v.setWordSpacing(
size);
1057 qWarning() <<
"Invalid font feature" << featureName <<
"ignored";
1064 qWarning() <<
"Font feature value" <<
it.value() <<
"is not an integer.";
1078 ret.insert(featureName,
v.featureValue(
tag));
1150 v.setTransferFunction(
v.transferFunction(),
gamma);
1155#include "moc_qquickvaluetypes_p.cpp"
static const QColorSpacePrivate * get(const QColorSpace &colorSpace)
The QColorSpace class provides a color space abstraction.
Primaries
Predefined sets of primary colors.
NamedColorSpace
Predefined color spaces.
TransferFunction
Predefined transfer functions or gamma curves.
The QColor class provides colors based on RGB, HSV or CMYK values.
static QColor fromString(QAnyStringView name) noexcept
static QByteArray tagToString(quint32 tag)
void setPointSize(int)
Sets the point size to pointSize.
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
void setCapitalization(Capitalization)
void setWordSpacing(qreal spacing)
void setFamily(const QString &)
Sets the family name of the font.
void setKerning(bool)
Enables kerning for this font if enable is true; otherwise disables it.
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
void setBold(bool)
If enable is true sets the font's weight to \l{Weight}{QFont::Bold}; otherwise sets the weight to \l{...
void setHintingPreference(HintingPreference hintingPreference)
void setItalic(bool b)
Sets the style() of the font to QFont::StyleItalic if enable is true; otherwise the style is set to Q...
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
StyleStrategy
The style strategy tells the \l{QFont}{font matching} algorithm what type of fonts should be used to ...
static quint32 stringToTag(const char *tagString)
Weight
Qt uses a weighting scale from 1 to 1000 compatible with OpenType.
void setWeight(Weight weight)
Sets the weight of the font to weight, using the scale defined by \l QFont::Weight enumeration.
The QJSValue class acts as a container for Qt/JavaScript data types.
bool toBool() const
Returns the boolean value of this QJSValue, using the conversion rules described in \l{ECMA-262} sect...
qint32 toInt() const
Returns the signed 32-bit integer value of this QJSValue, using the conversion rules described in \l{...
double toNumber() const
Returns the number value of this QJSValue, as defined in \l{ECMA-262} section 9.3,...
bool isNumber() const
Returns true if this QJSValue is of the primitive type Number; otherwise returns false.
bool isBool() const
Returns true if this QJSValue is of the primitive type Boolean; otherwise returns false.
QJSValue property(const QString &name) const
Returns the value of this QJSValue's property with the given name.
const_iterator constBegin() const
const_iterator constEnd() const
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
QMatrix4x4 transposed() const
Returns this matrix, transposed about its diagonal.
QMatrix4x4 inverted(bool *invertible=nullptr) const
Returns the inverse of this matrix.
QPoint map(const QPoint &point) const
Maps point by multiplying this matrix by point.
\inmodule QtCore\reentrant
virtual QVariant lighter(const QVariant &, qreal)
virtual QVariant tint(const QVariant &, const QVariant &)
virtual QVariant darker(const QVariant &, qreal)
virtual QVariant alpha(const QVariant &, qreal)
The QQuaternion class represents a quaternion consisting of a vector and scalar.
QQuaternion conjugated() const
QQuaternion normalized() const
Returns the normalized unit form of this quaternion.
static constexpr float dotProduct(const QQuaternion &q1, const QQuaternion &q2)
QQuaternion inverted() const
static QVariant create(const QJSValue ¶ms)
void setNamedColorSpace(QQuickColorSpaceEnums::NamedColorSpace namedColorSpace)
QQuickColorSpaceEnums::NamedColorSpace namedColorSpace
void setGamma(float gamma)
QQuickColorSpaceEnums::TransferFunction transferFunction
void setPrimaries(QQuickColorSpaceEnums::Primaries primariesId)
QQuickColorSpaceEnums::Primaries primaries
void setTransferFunction(QQuickColorSpaceEnums::TransferFunction transferFunction)
Q_INVOKABLE QVariant alpha(qreal value) const
Q_INVOKABLE QVariant lighter(qreal factor=1.5) const
void setHslLightness(qreal)
Q_INVOKABLE QQuickColorValueType(const QString &string)
Q_INVOKABLE QString toString() const
static QVariant create(const QJSValue ¶ms)
void setHslSaturation(qreal)
void setHsvSaturation(qreal)
Q_INVOKABLE QVariant darker(qreal factor=2.0) const
Q_INVOKABLE QVariant tint(QVariant factor) const
void setStrikeout(bool b)
void setLetterSpacing(qreal spacing)
void setStyleName(const QString &)
QQuickFontEnums::Capitalization capitalization
void setCapitalization(QQuickFontEnums::Capitalization)
void setFeatures(const QVariantMap &features)
void setPixelSize(int size)
QQuickFontEnums::HintingPreference hintingPreference
void setPreferShaping(bool b)
void setPointSize(qreal size)
void setHintingPreference(QQuickFontEnums::HintingPreference)
Q_INVOKABLE QString toString() const
void setWordSpacing(qreal spacing)
void setUnderline(bool b)
static QVariant create(const QJSValue &value)
void setFamily(const QString &)
static QVariant create(const QJSValue ¶ms)
Q_INVOKABLE QMatrix4x4 minus(const QMatrix4x4 &m) const
Q_INVOKABLE QMatrix4x4 times(const QMatrix4x4 &m) const
Q_INVOKABLE QVector4D column(int m) const
Q_INVOKABLE qreal determinant() const
Q_INVOKABLE bool fuzzyEquals(const QMatrix4x4 &m, qreal epsilon) const
Q_INVOKABLE QPointF map(const QPointF p) const
Q_INVOKABLE QRectF mapRect(const QRectF r) const
Q_INVOKABLE QVector4D row(int n) const
Q_INVOKABLE QMatrix4x4 plus(const QMatrix4x4 &m) const
Q_INVOKABLE QMatrix4x4 transposed() const
Q_INVOKABLE QMatrix4x4 inverted() const
Q_INVOKABLE QQuaternion times(const QQuaternion &q) const
Q_INVOKABLE QVector4D toVector4d() const
Q_INVOKABLE qreal dotProduct(const QQuaternion &q) const
Q_INVOKABLE QString toString() const
Q_INVOKABLE qreal length() const
Q_INVOKABLE QQuaternion inverted() const
Q_INVOKABLE QQuaternion minus(const QQuaternion &q) const
Q_INVOKABLE QQuaternion conjugated() const
Q_INVOKABLE QQuaternion normalized() const
static QVariant create(const QJSValue ¶ms)
Q_INVOKABLE QQuaternion plus(const QQuaternion &q) const
Q_INVOKABLE bool fuzzyEquals(const QQuaternion &q, qreal epsilon) const
Q_INVOKABLE QVector3D toEulerAngles() const
Q_INVOKABLE bool fuzzyEquals(const QVector2D &vec, qreal epsilon) const
static QVariant create(const QJSValue ¶ms)
Q_INVOKABLE QString toString() const
Q_INVOKABLE qreal dotProduct(const QVector2D &vec) const
Q_INVOKABLE QVector4D toVector4d() const
Q_INVOKABLE QVector2D times(const QVector2D &vec) const
Q_INVOKABLE QVector2D minus(const QVector2D &vec) const
Q_INVOKABLE QVector2D normalized() const
Q_INVOKABLE QVector3D toVector3d() const
Q_INVOKABLE qreal length() const
Q_INVOKABLE QVector2D plus(const QVector2D &vec) const
Q_INVOKABLE QString toString() const
Q_INVOKABLE QVector3D normalized() const
Q_INVOKABLE qreal length() const
static QVariant create(const QJSValue ¶ms)
Q_INVOKABLE QVector3D minus(const QVector3D &vec) const
Q_INVOKABLE qreal dotProduct(const QVector3D &vec) const
Q_INVOKABLE QVector3D times(const QMatrix4x4 &m) const
Q_INVOKABLE bool fuzzyEquals(const QVector3D &vec, qreal epsilon) const
Q_INVOKABLE QVector3D plus(const QVector3D &vec) const
Q_INVOKABLE QVector4D toVector4d() const
Q_INVOKABLE QVector3D crossProduct(const QVector3D &vec) const
Q_INVOKABLE QVector2D toVector2d() const
Q_INVOKABLE QVector4D plus(const QVector4D &vec) const
Q_INVOKABLE qreal dotProduct(const QVector4D &vec) const
Q_INVOKABLE QString toString() const
Q_INVOKABLE QVector3D toVector3d() const
Q_INVOKABLE qreal length() const
Q_INVOKABLE QVector2D toVector2d() const
Q_INVOKABLE bool fuzzyEquals(const QVector4D &vec, qreal epsilon) const
static QVariant create(const QJSValue ¶ms)
Q_INVOKABLE QVector4D normalized() const
Q_INVOKABLE QVector4D times(const QVector4D &vec) const
Q_INVOKABLE QVector4D minus(const QVector4D &vec) const
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
QByteArray toUtf8() const &
constexpr size_type size() const noexcept
The QVector2D class represents a vector or vertex in 2D space.
constexpr float y() const noexcept
Returns the y coordinate of this point.
QVector2D normalized() const noexcept
Returns the normalized unit vector form of this vector.
constexpr float x() const noexcept
Returns the x coordinate of this point.
static constexpr float dotProduct(QVector2D v1, QVector2D v2) noexcept
Returns the dot product of v1 and v2.
The QVector3D class represents a vector or vertex in 3D space.
QVector3D normalized() const noexcept
Returns the normalized unit vector form of this vector.
constexpr float y() const noexcept
Returns the y coordinate of this point.
constexpr float x() const noexcept
Returns the x coordinate of this point.
static constexpr float dotProduct(QVector3D v1, QVector3D v2) noexcept
Returns the dot product of v1 and v2.
static constexpr QVector3D crossProduct(QVector3D v1, QVector3D v2) noexcept
Returns the cross-product of vectors v1 and v2, which is normal to the plane spanned by v1 and v2.
constexpr float z() const noexcept
Returns the z coordinate of this point.
The QVector4D class represents a vector or vertex in 4D space.
QVector4D normalized() const noexcept
Returns the normalized unit vector form of this vector.
constexpr float x() const noexcept
Returns the x coordinate of this point.
constexpr float w() const noexcept
Returns the w coordinate of this point.
constexpr float y() const noexcept
Returns the y coordinate of this point.
static constexpr float dotProduct(QVector4D v1, QVector4D v2) noexcept
Returns the dot product of v1 and v2.
constexpr float z() const noexcept
Returns the z coordinate of this point.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
#define Q_STATIC_ASSERT_X(Condition, Message)
AudioChannelLayoutTag tag
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Q_GUI_EXPORT int qt_defaultDpi()
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLdouble GLdouble GLdouble GLdouble q
GLfloat GLfloat GLfloat alpha
GLsizei const GLchar *const * string
[0]
static bool fromString(const QMetaObject *mo, QString s, Allocate &&allocate)
Q_AUTOTEST_EXPORT QQmlColorProvider * QQml_colorProvider(void)
static const qreal epsilon
QVariant createValueTypeFromNumberString(const QString &s)
void setFontProperty(QFont &font, void(QFont::*setter)(T value), QString name, const QJSValue ¶ms, bool *ok)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
static int toInt(const QChar &qc, int R)