Register QColorSpace as a QtGui metatype

Helps pass it through QVariant, and needed for QML support.

Change-Id: Id161ff9b8f81ad55a7ee7a7c4c614bdf74bca4a1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2019-12-06 16:51:41 +01:00
parent 5c3b5efd40
commit f3d3c095a6
5 changed files with 17 additions and 3 deletions

View File

@ -252,6 +252,7 @@ struct DefinedTypesFilter {
\value QPolygon QPolygon
\value QPolygonF QPolygonF
\value QColor QColor
\value QColorSpace QColorSpace
\value QSizeF QSizeF
\value QRectF QRectF
\value QLine QLine

View File

@ -175,6 +175,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(QVector4D, 84, QVector4D) \
F(QQuaternion, 85, QQuaternion) \
F(QPolygonF, 86, QPolygonF) \
F(QColorSpace, 87, QColorSpace) \
#define QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\
@ -437,7 +438,7 @@ public:
FirstCoreType = Bool,
LastCoreType = QCborMap,
FirstGuiType = QFont,
LastGuiType = QPolygonF,
LastGuiType = QColorSpace,
FirstWidgetsType = QSizePolicy,
LastWidgetsType = QSizePolicy,
HighestInternalId = LastWidgetsType,
@ -472,12 +473,12 @@ public:
QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73,
QCursor = 74, QKeySequence = 75, QPen = 76, QTextLength = 77, QTextFormat = 78,
QMatrix = 79, QTransform = 80, QMatrix4x4 = 81, QVector2D = 82,
QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86,
QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86, QColorSpace = 87,
// Widget types
QSizePolicy = 121,
LastCoreType = QCborMap,
LastGuiType = QPolygonF,
LastGuiType = QColorSpace,
User = 1024
};
#endif

View File

@ -41,6 +41,7 @@
#include "qbitmap.h"
#include "qbrush.h"
#include "qcolor.h"
#include "qcolorspace.h"
#include "qcursor.h"
#include "qfont.h"
#include "qimage.h"

View File

@ -744,6 +744,15 @@ QColorTransform QColorSpace::transformationToColorSpace(const QColorSpace &color
return d_ptr->transformationToColorSpace(colorspace.d_ptr);
}
/*!
Returns the color space as a QVariant.
\since 5.15
*/
QColorSpace::operator QVariant() const
{
return QVariant(QMetaType::QColorSpace, this);
}
/*****************************************************************************
QColorSpace stream functions
*****************************************************************************/

View File

@ -44,6 +44,7 @@
#include <QtGui/qcolortransform.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
@ -125,6 +126,7 @@ public:
QColorTransform transformationToColorSpace(const QColorSpace &colorspace) const;
operator QVariant() const;
private:
Q_DECLARE_PRIVATE(QColorSpace)