Get rid of QMatrix
Task-number: QTBUG-81628 Change-Id: Iad66bfdf49b9ee65558a451108c086fc40dc3884 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
d2068b24e4
commit
1ba46c9b63
@ -367,7 +367,6 @@ Q_GLOBAL_STATIC(QMetaTypeCustomRegistery, customTypeRegistery)
|
||||
\value QPixmap QPixmap
|
||||
\value QLocale QLocale
|
||||
\value QBitmap QBitmap
|
||||
\value QMatrix QMatrix
|
||||
\value QTransform QTransform
|
||||
\value QMatrix4x4 QMatrix4x4
|
||||
\value QVector2D QVector2D
|
||||
|
@ -176,7 +176,6 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
|
||||
F(QPen, 76, QPen) \
|
||||
F(QTextLength, 77, QTextLength) \
|
||||
F(QTextFormat, 78, QTextFormat) \
|
||||
F(QMatrix, 79, QMatrix) \
|
||||
F(QTransform, 80, QTransform) \
|
||||
F(QMatrix4x4, 81, QMatrix4x4) \
|
||||
F(QVector2D, 82, QVector2D) \
|
||||
@ -473,7 +472,7 @@ public:
|
||||
QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68,
|
||||
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,
|
||||
QTransform = 80, QMatrix4x4 = 81, QVector2D = 82,
|
||||
QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86, QColorSpace = 87,
|
||||
|
||||
// Widget types
|
||||
|
@ -1669,7 +1669,6 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names
|
||||
\value Locale a QLocale
|
||||
\value LongLong a \l qlonglong
|
||||
\value Map a QVariantMap
|
||||
\value Matrix a QMatrix
|
||||
\value Transform a QTransform
|
||||
\value Matrix4x4 a QMatrix4x4
|
||||
\value Palette a QPalette
|
||||
@ -2486,7 +2485,7 @@ void QVariant::load(QDataStream &s)
|
||||
typeId = QMetaType::QSizePolicy;
|
||||
} else if (typeId > 75 && typeId <= 86) {
|
||||
// and as a result these types received lower ids too
|
||||
// QKeySequence QPen QTextLength QTextFormat QMatrix QTransform QMatrix4x4 QVector2D QVector3D QVector4D QQuaternion
|
||||
// QKeySequence QPen QTextLength QTextFormat QTransform QMatrix4x4 QVector2D QVector3D QVector4D QQuaternion
|
||||
typeId -=1;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ class QEasingCurve;
|
||||
class QLine;
|
||||
class QLineF;
|
||||
class QLocale;
|
||||
class QMatrix;
|
||||
class QTransform;
|
||||
class QStringList;
|
||||
class QTime;
|
||||
@ -190,7 +189,6 @@ class Q_CORE_EXPORT QVariant
|
||||
Pen = QMetaType::QPen,
|
||||
TextLength = QMetaType::QTextLength,
|
||||
TextFormat = QMetaType::QTextFormat,
|
||||
Matrix = QMetaType::QMatrix,
|
||||
Transform = QMetaType::QTransform,
|
||||
Matrix4x4 = QMetaType::QMatrix4x4,
|
||||
Vector2D = QMetaType::QVector2D,
|
||||
|
@ -265,7 +265,6 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend class QMatrix;
|
||||
friend class QTransform;
|
||||
|
||||
qreal xp;
|
||||
|
@ -160,7 +160,6 @@ qt_add_module(Gui
|
||||
painting/qgrayraster.c painting/qgrayraster_p.h
|
||||
painting/qicc.cpp painting/qicc_p.h
|
||||
painting/qimagescale.cpp
|
||||
painting/qmatrix.cpp painting/qmatrix.h
|
||||
painting/qmemrotate.cpp painting/qmemrotate_p.h
|
||||
painting/qoutlinemapper.cpp painting/qoutlinemapper_p.h
|
||||
painting/qpagedpaintdevice.cpp painting/qpagedpaintdevice.h painting/qpagedpaintdevice_p.h
|
||||
|
@ -310,18 +310,4 @@ QBitmap QBitmap::transformed(const QTransform &matrix) const
|
||||
return bm;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\overload
|
||||
\obsolete
|
||||
|
||||
This convenience function converts the \a matrix to a QTransform
|
||||
and calls the overloaded function.
|
||||
*/
|
||||
QBitmap QBitmap::transformed(const QMatrix &matrix) const
|
||||
{
|
||||
return transformed(QTransform(matrix));
|
||||
}
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -76,10 +76,6 @@ public:
|
||||
static QBitmap fromData(const QSize &size, const uchar *bits,
|
||||
QImage::Format monoFormat = QImage::Format_MonoLSB);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QBitmap::transformed(QTransform) instead")
|
||||
QBitmap transformed(const QMatrix &) const;
|
||||
#endif
|
||||
QBitmap transformed(const QTransform &matrix) const;
|
||||
|
||||
typedef QExplicitlySharedDataPointer<QPlatformPixmap> DataPtr;
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "qdatastream.h"
|
||||
#include "qcolortransform.h"
|
||||
#include "qmap.h"
|
||||
#include "qmatrix.h"
|
||||
#include "qtransform.h"
|
||||
#include "qimagereader.h"
|
||||
#include "qimagewriter.h"
|
||||
@ -2856,65 +2855,6 @@ QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const
|
||||
return transformed(wm, mode);
|
||||
}
|
||||
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use trueMatrix(const QTransform &matrix, int w, int h) instead.
|
||||
|
||||
\fn QMatrix QImage::trueMatrix(const QMatrix &matrix, int width, int height)
|
||||
|
||||
Returns the actual matrix used for transforming an image with the
|
||||
given \a width, \a height and \a matrix.
|
||||
|
||||
When transforming an image using the transformed() function, the
|
||||
transformation matrix is internally adjusted to compensate for
|
||||
unwanted translation, i.e. transformed() returns the smallest
|
||||
image containing all transformed points of the original image.
|
||||
This function returns the modified matrix, which maps points
|
||||
correctly from the original image into the new image.
|
||||
|
||||
\sa transformed(), {QImage#Image Transformations}{Image
|
||||
Transformations}
|
||||
*/
|
||||
QMatrix QImage::trueMatrix(const QMatrix &matrix, int w, int h)
|
||||
{
|
||||
return trueMatrix(QTransform(matrix), w, h).toAffine();
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use transformed(const QTransform &matrix, Qt::TransformationMode mode) instead.
|
||||
|
||||
Returns a copy of the image that is transformed using the given
|
||||
transformation \a matrix and transformation \a mode.
|
||||
|
||||
The returned image will normally have the same {Image Formats}{format} as
|
||||
the original image. However, a complex transformation may result in an
|
||||
image where not all pixels are covered by the transformed pixels of the
|
||||
original image. In such cases, those background pixels will be assigned a
|
||||
transparent color value, and the transformed image will be given a format
|
||||
with an alpha channel, even if the orginal image did not have that.
|
||||
|
||||
The transformation \a matrix is internally adjusted to compensate
|
||||
for unwanted translation; i.e. the image produced is the smallest
|
||||
image that contains all the transformed points of the original
|
||||
image. Use the trueMatrix() function to retrieve the actual matrix
|
||||
used for transforming an image.
|
||||
|
||||
\sa trueMatrix(), {QImage#Image Transformations}{Image
|
||||
Transformations}
|
||||
*/
|
||||
QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const
|
||||
{
|
||||
return transformed(QTransform(matrix), mode);
|
||||
}
|
||||
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
Builds and returns a 1-bpp mask from the alpha buffer in this
|
||||
image. Returns a null image if the image's format is
|
||||
|
@ -60,7 +60,6 @@ QT_BEGIN_NAMESPACE
|
||||
class QColorSpace;
|
||||
class QColorTransform;
|
||||
class QIODevice;
|
||||
class QMatrix;
|
||||
class QStringList;
|
||||
class QTransform;
|
||||
class QVariant;
|
||||
@ -247,12 +246,6 @@ public:
|
||||
Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use transformed(const QTransform &matrix, Qt::TransformationMode mode)")
|
||||
QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
QT_DEPRECATED_X("trueMatrix(const QTransform &, int w, int h)")
|
||||
static QMatrix trueMatrix(const QMatrix &, int w, int h);
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
static QTransform trueMatrix(const QTransform &, int w, int h);
|
||||
QImage mirrored(bool horizontally = false, bool vertically = true) const &
|
||||
|
@ -465,7 +465,7 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
|
||||
QPen pen;
|
||||
QBrush brush;
|
||||
QRegion rgn;
|
||||
QMatrix wmatrix;
|
||||
qreal wmatrix[6];
|
||||
QTransform matrix;
|
||||
|
||||
QTransform worldMatrix = painter->transform();
|
||||
@ -820,8 +820,12 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
|
||||
if (d->formatMajor >= 8) {
|
||||
s >> matrix >> i_8;
|
||||
} else {
|
||||
s >> wmatrix >> i_8;
|
||||
matrix = QTransform(wmatrix);
|
||||
s >> wmatrix[0] >> wmatrix[1]
|
||||
>> wmatrix[2] >> wmatrix[3]
|
||||
>> wmatrix[4] >> wmatrix[5] >> i_8;
|
||||
matrix = QTransform(wmatrix[0], wmatrix[1],
|
||||
wmatrix[2], wmatrix[3],
|
||||
wmatrix[4], wmatrix[5]);
|
||||
}
|
||||
// i_8 is always false due to updateXForm() in qpaintengine_pic.cpp
|
||||
painter->setTransform(matrix * worldMatrix, i_8);
|
||||
|
@ -458,24 +458,6 @@ QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h)
|
||||
return QImage::trueMatrix(m, w, h);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\overload
|
||||
\obsolete
|
||||
|
||||
Use trueMatrix(const QTransform &m, int w, int h) instead.
|
||||
|
||||
This convenience function loads the matrix \a m into a
|
||||
QTransform and calls the overloaded function with the
|
||||
QTransform and the width \a w and the height \a h.
|
||||
*/
|
||||
QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)
|
||||
{
|
||||
return trueMatrix(QTransform(m), w, h).toAffine();
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool QPixmap::isQBitmap() const
|
||||
|
||||
@ -1238,29 +1220,6 @@ QPixmap QPixmap::transformed(const QTransform &transform,
|
||||
return data->transformed(transform, mode);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\overload
|
||||
\obsolete
|
||||
|
||||
Use transformed(const QTransform &transform, Qt::TransformationMode mode)() instead.
|
||||
|
||||
This convenience function loads the \a matrix into a
|
||||
QTransform and calls the overloaded function.
|
||||
*/
|
||||
QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const
|
||||
{
|
||||
return transformed(QTransform(matrix), mode);
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\class QPixmap
|
||||
\inmodule QtGui
|
||||
|
@ -129,12 +129,6 @@ public:
|
||||
Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use transformed(const QTransform &, Qt::TransformationMode mode)")
|
||||
QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
QT_DEPRECATED_X("Use trueMatrix(const QTransform &m, int w, int h)")
|
||||
static QMatrix trueMatrix(const QMatrix &m, int w, int h);
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||
static QTransform trueMatrix(const QTransform &m, int w, int h);
|
||||
|
||||
|
@ -68,7 +68,6 @@ class QFontMetrics;
|
||||
class QFontInfo;
|
||||
class QPen;
|
||||
class QBrush;
|
||||
class QMatrix;
|
||||
class QPixmap;
|
||||
class QBitmap;
|
||||
class QMovie;
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "qmatrix4x4.h"
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#include <QtGui/qtransform.h>
|
||||
|
||||
#include <cmath>
|
||||
@ -187,42 +186,6 @@ QMatrix4x4::QMatrix4x4(const float *values, int cols, int rows)
|
||||
flagBits = General;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Constructs a 4x4 matrix from a conventional Qt 2D affine
|
||||
transformation \a matrix.
|
||||
|
||||
If \a matrix has a special type (identity, translate, scale, etc),
|
||||
the programmer should follow this constructor with a call to
|
||||
optimize() if they wish QMatrix4x4 to optimize further
|
||||
calls to translate(), scale(), etc.
|
||||
|
||||
\sa toAffine(), optimize()
|
||||
*/
|
||||
QMatrix4x4::QMatrix4x4(const QMatrix& matrix)
|
||||
{
|
||||
m[0][0] = matrix.m11();
|
||||
m[0][1] = matrix.m12();
|
||||
m[0][2] = 0.0f;
|
||||
m[0][3] = 0.0f;
|
||||
m[1][0] = matrix.m21();
|
||||
m[1][1] = matrix.m22();
|
||||
m[1][2] = 0.0f;
|
||||
m[1][3] = 0.0f;
|
||||
m[2][0] = 0.0f;
|
||||
m[2][1] = 0.0f;
|
||||
m[2][2] = 1.0f;
|
||||
m[2][3] = 0.0f;
|
||||
m[3][0] = matrix.dx();
|
||||
m[3][1] = matrix.dy();
|
||||
m[3][2] = 0.0f;
|
||||
m[3][3] = 1.0f;
|
||||
flagBits = Translation | Scale | Rotation2D;
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
Constructs a 4x4 matrix from the conventional Qt 2D
|
||||
transformation matrix \a transform.
|
||||
@ -1663,26 +1626,6 @@ void QMatrix4x4::copyDataTo(float *values) const
|
||||
values[row * 4 + col] = float(m[col][row]);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use toTransform() instead.
|
||||
|
||||
Returns the conventional Qt 2D affine transformation matrix that
|
||||
corresponds to this matrix. It is assumed that this matrix
|
||||
only contains 2D affine transformation elements.
|
||||
|
||||
\sa toTransform()
|
||||
*/
|
||||
QMatrix QMatrix4x4::toAffine() const
|
||||
{
|
||||
return QMatrix(m[0][0], m[0][1],
|
||||
m[1][0], m[1][1],
|
||||
m[3][0], m[3][1]);
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
Returns the conventional Qt 2D transformation matrix that
|
||||
corresponds to this matrix.
|
||||
|
@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_MATRIX4X4
|
||||
|
||||
class QMatrix;
|
||||
class QTransform;
|
||||
class QVariant;
|
||||
|
||||
@ -72,9 +71,6 @@ public:
|
||||
|
||||
QMatrix4x4(const float *values, int cols, int rows);
|
||||
QMatrix4x4(const QTransform& transform);
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QMatrix4x4(const QMatrix& matrix);
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
inline const float& operator()(int row, int column) const;
|
||||
inline float& operator()(int row, int column);
|
||||
@ -158,9 +154,6 @@ public:
|
||||
|
||||
void copyDataTo(float *values) const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use toTransform()") QMatrix toAffine() const;
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
QTransform toTransform() const;
|
||||
QTransform toTransform(float distanceToPlane) const;
|
||||
|
||||
|
@ -26,7 +26,6 @@ HEADERS += \
|
||||
painting/qfixed_p.h \
|
||||
painting/qgrayraster_p.h \
|
||||
painting/qicc_p.h \
|
||||
painting/qmatrix.h \
|
||||
painting/qmemrotate_p.h \
|
||||
painting/qoutlinemapper_p.h \
|
||||
painting/qpagedpaintdevice.h \
|
||||
@ -83,7 +82,6 @@ SOURCES += \
|
||||
painting/qgrayraster.c \
|
||||
painting/qicc.cpp \
|
||||
painting/qimagescale.cpp \
|
||||
painting/qmatrix.cpp \
|
||||
painting/qmemrotate.cpp \
|
||||
painting/qoutlinemapper.cpp \
|
||||
painting/qpagedpaintdevice.cpp \
|
||||
|
@ -892,26 +892,6 @@ bool QBrush::isOpaque() const
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
|
||||
Use setTransform() instead.
|
||||
|
||||
Sets \a matrix as an explicit transformation matrix on the
|
||||
current brush. The brush transformation matrix is merged with
|
||||
QPainter transformation matrix to produce the final result.
|
||||
|
||||
\sa matrix()
|
||||
*/
|
||||
void QBrush::setMatrix(const QMatrix &matrix)
|
||||
{
|
||||
setTransform(QTransform(matrix));
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
#include <QtGui/qcolor.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#include <QtGui/qtransform.h>
|
||||
#include <QtGui/qimage.h>
|
||||
#include <QtGui/qpixmap.h>
|
||||
@ -89,11 +88,6 @@ public:
|
||||
inline Qt::BrushStyle style() const;
|
||||
void setStyle(Qt::BrushStyle);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use transform()") inline QMatrix matrix() const;
|
||||
QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &mat);
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
inline QTransform transform() const;
|
||||
void setTransform(const QTransform &);
|
||||
|
||||
@ -159,10 +153,6 @@ struct QBrushData
|
||||
|
||||
inline Qt::BrushStyle QBrush::style() const { return d->style; }
|
||||
inline const QColor &QBrush::color() const { return d->color; }
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use transform()")
|
||||
inline QMatrix QBrush::matrix() const { return d->transform.toAffine(); }
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
inline QTransform QBrush::transform() const { return d->transform; }
|
||||
inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; }
|
||||
|
||||
|
@ -112,7 +112,7 @@ inline bool operator!=(const QColorVector &v1, const QColorVector &v2)
|
||||
|
||||
|
||||
// A matrix mapping 3 value colors.
|
||||
// Not using QMatrix because only floats are needed and performance is critical.
|
||||
// Not using QTransform because only floats are needed and performance is critical.
|
||||
class QColorMatrix
|
||||
{
|
||||
public:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,194 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QMATRIX_H
|
||||
#define QMATRIX_H
|
||||
|
||||
#include <QtGui/qtguiglobal.h>
|
||||
#include <QtGui/qpolygon.h>
|
||||
#include <QtGui/qregion.h>
|
||||
#include <QtGui/qwindowdefs.h>
|
||||
#include <QtCore/qline.h>
|
||||
#include <QtCore/qpoint.h>
|
||||
#include <QtCore/qrect.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QPainterPath;
|
||||
class QVariant;
|
||||
|
||||
class Q_GUI_EXPORT QMatrix // 2D transform matrix
|
||||
{
|
||||
public:
|
||||
inline explicit QMatrix(Qt::Initialization) {}
|
||||
QMatrix();
|
||||
QMatrix(qreal m11, qreal m12, qreal m21, qreal m22,
|
||||
qreal dx, qreal dy);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
// ### Qt 6: remove; the compiler-generated ones are fine!
|
||||
QMatrix &operator=(QMatrix &&other) noexcept // = default
|
||||
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); return *this; }
|
||||
QMatrix &operator=(const QMatrix &) noexcept; // = default
|
||||
QMatrix(QMatrix &&other) noexcept // = default
|
||||
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); }
|
||||
QMatrix(const QMatrix &other) noexcept; // = default
|
||||
#endif
|
||||
|
||||
void setMatrix(qreal m11, qreal m12, qreal m21, qreal m22,
|
||||
qreal dx, qreal dy);
|
||||
|
||||
qreal m11() const { return _m11; }
|
||||
qreal m12() const { return _m12; }
|
||||
qreal m21() const { return _m21; }
|
||||
qreal m22() const { return _m22; }
|
||||
qreal dx() const { return _dx; }
|
||||
qreal dy() const { return _dy; }
|
||||
|
||||
void map(int x, int y, int *tx, int *ty) const;
|
||||
void map(qreal x, qreal y, qreal *tx, qreal *ty) const;
|
||||
QRect mapRect(const QRect &) const;
|
||||
QRectF mapRect(const QRectF &) const;
|
||||
|
||||
QPoint map(const QPoint &p) const;
|
||||
QPointF map(const QPointF&p) const;
|
||||
QLine map(const QLine &l) const;
|
||||
QLineF map(const QLineF &l) const;
|
||||
QPolygonF map(const QPolygonF &a) const;
|
||||
QPolygon map(const QPolygon &a) const;
|
||||
QRegion map(const QRegion &r) const;
|
||||
QPainterPath map(const QPainterPath &p) const;
|
||||
QPolygon mapToPolygon(const QRect &r) const;
|
||||
|
||||
void reset();
|
||||
inline bool isIdentity() const;
|
||||
|
||||
QMatrix &translate(qreal dx, qreal dy);
|
||||
QMatrix &scale(qreal sx, qreal sy);
|
||||
QMatrix &shear(qreal sh, qreal sv);
|
||||
QMatrix &rotate(qreal a);
|
||||
|
||||
bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
|
||||
qreal determinant() const { return _m11*_m22 - _m12*_m21; }
|
||||
|
||||
Q_REQUIRED_RESULT QMatrix inverted(bool *invertible = nullptr) const;
|
||||
|
||||
bool operator==(const QMatrix &) const;
|
||||
bool operator!=(const QMatrix &) const;
|
||||
|
||||
QMatrix &operator*=(const QMatrix &);
|
||||
QMatrix operator*(const QMatrix &o) const;
|
||||
|
||||
operator QVariant() const;
|
||||
|
||||
private:
|
||||
inline QMatrix(bool)
|
||||
: _m11(1.)
|
||||
, _m12(0.)
|
||||
, _m21(0.)
|
||||
, _m22(1.)
|
||||
, _dx(0.)
|
||||
, _dy(0.) {}
|
||||
inline QMatrix(qreal am11, qreal am12, qreal am21, qreal am22, qreal adx, qreal ady, bool)
|
||||
: _m11(am11)
|
||||
, _m12(am12)
|
||||
, _m21(am21)
|
||||
, _m22(am22)
|
||||
, _dx(adx)
|
||||
, _dy(ady) {}
|
||||
friend class QTransform;
|
||||
qreal _m11, _m12;
|
||||
qreal _m21, _m22;
|
||||
qreal _dx, _dy;
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QMatrix, Q_MOVABLE_TYPE);
|
||||
|
||||
Q_GUI_EXPORT Q_DECL_CONST_FUNCTION uint qHash(const QMatrix &key, uint seed = 0) noexcept;
|
||||
|
||||
// mathematical semantics
|
||||
inline QPoint operator*(const QPoint &p, const QMatrix &m)
|
||||
{ return m.map(p); }
|
||||
inline QPointF operator*(const QPointF &p, const QMatrix &m)
|
||||
{ return m.map(p); }
|
||||
inline QLineF operator*(const QLineF &l, const QMatrix &m)
|
||||
{ return m.map(l); }
|
||||
inline QLine operator*(const QLine &l, const QMatrix &m)
|
||||
{ return m.map(l); }
|
||||
inline QPolygon operator *(const QPolygon &a, const QMatrix &m)
|
||||
{ return m.map(a); }
|
||||
inline QPolygonF operator *(const QPolygonF &a, const QMatrix &m)
|
||||
{ return m.map(a); }
|
||||
inline QRegion operator *(const QRegion &r, const QMatrix &m)
|
||||
{ return m.map(r); }
|
||||
Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m);
|
||||
|
||||
inline bool QMatrix::isIdentity() const
|
||||
{
|
||||
return qFuzzyIsNull(_m11 - 1) && qFuzzyIsNull(_m22 - 1) && qFuzzyIsNull(_m12)
|
||||
&& qFuzzyIsNull(_m21) && qFuzzyIsNull(_dx) && qFuzzyIsNull(_dy);
|
||||
}
|
||||
|
||||
inline bool qFuzzyCompare(const QMatrix& m1, const QMatrix& m2)
|
||||
{
|
||||
return qFuzzyCompare(m1.m11(), m2.m11())
|
||||
&& qFuzzyCompare(m1.m12(), m2.m12())
|
||||
&& qFuzzyCompare(m1.m21(), m2.m21())
|
||||
&& qFuzzyCompare(m1.m22(), m2.m22())
|
||||
&& qFuzzyCompare(m1.dx(), m2.dx())
|
||||
&& qFuzzyCompare(m1.dy(), m2.dy());
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
QMatrix stream functions
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix &);
|
||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &);
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMATRIX_H
|
@ -508,7 +508,7 @@ void QPaintEngine::drawEllipse(const QRectF &rect)
|
||||
if (hasFeature(PainterPaths)) {
|
||||
drawPath(path);
|
||||
} else {
|
||||
QPolygonF polygon = path.toFillPolygon(QTransform());
|
||||
QPolygonF polygon = path.toFillPolygon();
|
||||
drawPolygon(polygon.data(), polygon.size(), ConvexMode);
|
||||
}
|
||||
}
|
||||
|
@ -273,9 +273,6 @@ public:
|
||||
QBrush backgroundBrush() const;
|
||||
Qt::BGMode backgroundMode() const;
|
||||
QFont font() const;
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use transform()") QMatrix matrix() const;
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
QTransform transform() const;
|
||||
|
||||
Qt::ClipOperation clipOperation() const;
|
||||
|
@ -2560,19 +2560,19 @@ QRegion QPainter::clipRegion() const
|
||||
case QPainterClipInfo::PathClip: {
|
||||
QTransform matrix = (info.matrix * d->invMatrix);
|
||||
if (lastWasNothing) {
|
||||
region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(),
|
||||
region = QRegion((info.path * matrix).toFillPolygon().toPolygon(),
|
||||
info.path.fillRule());
|
||||
lastWasNothing = false;
|
||||
continue;
|
||||
}
|
||||
if (info.operation == Qt::IntersectClip) {
|
||||
region &= QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(),
|
||||
region &= QRegion((info.path * matrix).toFillPolygon().toPolygon(),
|
||||
info.path.fillRule());
|
||||
} else if (info.operation == Qt::NoClip) {
|
||||
lastWasNothing = true;
|
||||
region = QRegion();
|
||||
} else {
|
||||
region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(),
|
||||
region = QRegion((info.path * matrix).toFillPolygon().toPolygon(),
|
||||
info.path.fillRule());
|
||||
}
|
||||
break;
|
||||
@ -2896,175 +2896,6 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
|
||||
d->updateState(d->state);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
|
||||
Sets the transformation matrix to \a matrix and enables transformations.
|
||||
|
||||
\note It is advisable to use setWorldTransform() instead of this function to
|
||||
preserve the properties of perspective transformations.
|
||||
|
||||
If \a combine is true, then \a matrix is combined with the current
|
||||
transformation matrix; otherwise \a matrix replaces the current
|
||||
transformation matrix.
|
||||
|
||||
If \a matrix is the identity matrix and \a combine is false, this
|
||||
function calls setWorldMatrixEnabled(false). (The identity matrix is the
|
||||
matrix where QMatrix::m11() and QMatrix::m22() are 1.0 and the
|
||||
rest are 0.0.)
|
||||
|
||||
The following functions can transform the coordinate system without using
|
||||
a QMatrix:
|
||||
\list
|
||||
\li translate()
|
||||
\li scale()
|
||||
\li shear()
|
||||
\li rotate()
|
||||
\endlist
|
||||
|
||||
They operate on the painter's worldMatrix() and are implemented like this:
|
||||
|
||||
\snippet code/src_gui_painting_qpainter.cpp 4
|
||||
|
||||
Note that when using setWorldMatrix() function you should always have
|
||||
\a combine be true when you are drawing into a QPicture. Otherwise
|
||||
it may not be possible to replay the picture with additional
|
||||
transformations; using the translate(), scale(), etc. convenience
|
||||
functions is safe.
|
||||
|
||||
For more information about the coordinate system, transformations
|
||||
and window-viewport conversion, see \l {Coordinate System}.
|
||||
|
||||
\sa setWorldTransform(), QTransform
|
||||
*/
|
||||
|
||||
void QPainter::setWorldMatrix(const QMatrix &matrix, bool combine)
|
||||
{
|
||||
setWorldTransform(QTransform(matrix), combine);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
|
||||
Returns the world transformation matrix.
|
||||
|
||||
It is advisable to use worldTransform() because worldMatrix() does not
|
||||
preserve the properties of perspective transformations.
|
||||
|
||||
\sa {QPainter#Coordinate Transformations}{Coordinate Transformations},
|
||||
{Coordinate System}
|
||||
*/
|
||||
|
||||
QMatrix QPainter::worldMatrix() const
|
||||
{
|
||||
Q_D(const QPainter);
|
||||
if (!d->engine) {
|
||||
qWarning("QPainter::worldMatrix: Painter not active");
|
||||
return d->fakeState()->transform.toAffine();
|
||||
}
|
||||
return d->state->worldMatrix.toAffine();
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use setWorldTransform() instead.
|
||||
|
||||
\sa setWorldTransform()
|
||||
*/
|
||||
|
||||
void QPainter::setMatrix(const QMatrix &matrix, bool combine)
|
||||
{
|
||||
setWorldTransform(QTransform(matrix), combine);
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use worldTransform() instead.
|
||||
|
||||
\sa worldTransform()
|
||||
*/
|
||||
|
||||
QMatrix QPainter::matrix() const
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
return worldMatrix();
|
||||
QT_WARNING_POP
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
|
||||
Returns the transformation matrix combining the current
|
||||
window/viewport and world transformation.
|
||||
|
||||
It is advisable to use combinedTransform() instead of this
|
||||
function to preserve the properties of perspective transformations.
|
||||
|
||||
\sa setWorldTransform(), setWindow(), setViewport()
|
||||
*/
|
||||
QMatrix QPainter::combinedMatrix() const
|
||||
{
|
||||
return combinedTransform().toAffine();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Returns the matrix that transforms from logical coordinates to
|
||||
device coordinates of the platform dependent paint device.
|
||||
|
||||
\note It is advisable to use deviceTransform() instead of this
|
||||
function to preserve the properties of perspective transformations.
|
||||
|
||||
This function is \e only needed when using platform painting
|
||||
commands on the platform dependent handle (Qt::HANDLE), and the
|
||||
platform does not do transformations nativly.
|
||||
|
||||
The QPaintEngine::PaintEngineFeature enum can be queried to
|
||||
determine whether the platform performs the transformations or
|
||||
not.
|
||||
|
||||
\sa worldMatrix(), QPaintEngine::hasFeature(),
|
||||
*/
|
||||
QMatrix QPainter::deviceMatrix() const
|
||||
{
|
||||
Q_D(const QPainter);
|
||||
if (!d->engine) {
|
||||
qWarning("QPainter::deviceMatrix: Painter not active");
|
||||
return d->fakeState()->transform.toAffine();
|
||||
}
|
||||
return d->state->matrix.toAffine();
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Resets any transformations that were made using translate(), scale(),
|
||||
shear(), rotate(), setWorldMatrix(), setViewport() and
|
||||
setWindow().
|
||||
|
||||
It is advisable to use resetTransform() instead of this function
|
||||
to preserve the properties of perspective transformations.
|
||||
|
||||
\sa {QPainter#Coordinate Transformations}{Coordinate
|
||||
Transformations}
|
||||
*/
|
||||
|
||||
void QPainter::resetMatrix()
|
||||
{
|
||||
resetTransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.2
|
||||
|
||||
@ -3114,34 +2945,6 @@ bool QPainter::worldMatrixEnabled() const
|
||||
return d->state->WxF;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use setWorldMatrixEnabled() instead.
|
||||
|
||||
\sa setWorldMatrixEnabled()
|
||||
*/
|
||||
|
||||
void QPainter::setMatrixEnabled(bool enable)
|
||||
{
|
||||
setWorldMatrixEnabled(enable);
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use worldMatrixEnabled() instead
|
||||
|
||||
\sa worldMatrixEnabled()
|
||||
*/
|
||||
|
||||
bool QPainter::matrixEnabled() const
|
||||
{
|
||||
return worldMatrixEnabled();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Scales the coordinate system by (\a{sx}, \a{sy}).
|
||||
|
||||
@ -8075,33 +7878,6 @@ QFont QPaintEngineState::font() const
|
||||
return static_cast<const QPainterState *>(this)->font;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
|
||||
Use transform() instead.
|
||||
|
||||
Returns the matrix in the current paint engine
|
||||
state.
|
||||
|
||||
\note It is advisable to use transform() instead of this function to
|
||||
preserve the properties of perspective transformations.
|
||||
|
||||
This variable should only be used when the state() returns a
|
||||
combination which includes the QPaintEngine::DirtyTransform flag.
|
||||
|
||||
\sa state(), QPaintEngine::updateState()
|
||||
*/
|
||||
|
||||
QMatrix QPaintEngineState::matrix() const
|
||||
{
|
||||
const QPainterState *st = static_cast<const QPainterState *>(this);
|
||||
|
||||
return st->matrix.toAffine();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include <QtGui/qpolygon.h>
|
||||
#include <QtGui/qpen.h>
|
||||
#include <QtGui/qbrush.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#include <QtGui/qtransform.h>
|
||||
#include <QtGui/qfontinfo.h>
|
||||
#include <QtGui/qfontmetrics.h>
|
||||
@ -236,35 +235,11 @@ public:
|
||||
void restore();
|
||||
|
||||
// XForm functions
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use setTransform() instead")
|
||||
void setMatrix(const QMatrix &matrix, bool combine = false);
|
||||
QT_DEPRECATED_X("Use transform() instead")
|
||||
QMatrix matrix() const;
|
||||
QT_DEPRECATED_X("Use deviceTransform() instead")
|
||||
QMatrix deviceMatrix() const;
|
||||
QT_DEPRECATED_X("Use resetTransform() instead")
|
||||
void resetMatrix();
|
||||
#endif
|
||||
|
||||
void setTransform(const QTransform &transform, bool combine = false);
|
||||
const QTransform &transform() const;
|
||||
const QTransform &deviceTransform() const;
|
||||
void resetTransform();
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use setWorldTransform() instead")
|
||||
void setWorldMatrix(const QMatrix &matrix, bool combine = false);
|
||||
QT_DEPRECATED_X("Use worldTransform() instead")
|
||||
QMatrix worldMatrix() const;
|
||||
QT_DEPRECATED_X("Use combinedTransform() instead")
|
||||
QMatrix combinedMatrix() const;
|
||||
QT_DEPRECATED_X("Use setWorldMatrixEnabled() instead")
|
||||
void setMatrixEnabled(bool enabled);
|
||||
QT_DEPRECATED_X("Use worldMatrixEnabled() instead")
|
||||
bool matrixEnabled() const;
|
||||
#endif
|
||||
|
||||
void setWorldTransform(const QTransform &matrix, bool combine = false);
|
||||
const QTransform &worldTransform() const;
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include <qdebug.h>
|
||||
#include <qiodevice.h>
|
||||
#include <qlist.h>
|
||||
#include <qmatrix.h>
|
||||
#include <qpen.h>
|
||||
#include <qpolygon.h>
|
||||
#include <qtextlayout.h>
|
||||
@ -1603,6 +1602,25 @@ QPainterPath QPainterPath::toReversed() const
|
||||
return rev;
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
|
||||
Converts the path into a list of polygons without any transformation,
|
||||
and returns the list.
|
||||
|
||||
This function creates one polygon for each subpath regardless of
|
||||
intersecting subpaths (i.e. overlapping bounding rectangles). To
|
||||
make sure that such overlapping subpaths are filled correctly, use
|
||||
the toFillPolygons() function instead.
|
||||
|
||||
\sa toFillPolygons(), toFillPolygon(), {QPainterPath#QPainterPath
|
||||
Conversion}{QPainterPath Conversion}
|
||||
*/
|
||||
QList<QPolygonF> QPainterPath::toSubpathPolygons() const
|
||||
{
|
||||
return toSubpathPolygons(QTransform());
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts the path into a list of polygons using the QTransform
|
||||
\a matrix, and returns the list.
|
||||
@ -1660,18 +1678,34 @@ QList<QPolygonF> QPainterPath::toSubpathPolygons(const QTransform &matrix) const
|
||||
return flatCurves;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\overload
|
||||
\obsolete
|
||||
\overload
|
||||
|
||||
Use toSubpathPolygons(const QTransform &matrix) instead.
|
||||
*/
|
||||
QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const
|
||||
Converts the path into a list of polygons without any transformation,
|
||||
and returns the list.
|
||||
|
||||
The function differs from the toFillPolygon() function in that it
|
||||
creates several polygons. It is provided because it is usually
|
||||
faster to draw several small polygons than to draw one large
|
||||
polygon, even though the total number of points drawn is the same.
|
||||
|
||||
The toFillPolygons() function differs from the toSubpathPolygons()
|
||||
function in that it create only polygon for subpaths that have
|
||||
overlapping bounding rectangles.
|
||||
|
||||
Like the toFillPolygon() function, this function uses a rewinding
|
||||
technique to make sure that overlapping subpaths can be filled
|
||||
using the correct fill rule. Note that rewinding inserts addition
|
||||
lines in the polygons so the outline of the fill polygon does not
|
||||
match the outline of the path.
|
||||
|
||||
\sa toSubpathPolygons(), toFillPolygon(),
|
||||
{QPainterPath#QPainterPath Conversion}{QPainterPath Conversion}
|
||||
*/
|
||||
QList<QPolygonF> QPainterPath::toFillPolygons() const
|
||||
{
|
||||
return toSubpathPolygons(QTransform(matrix));
|
||||
return toFillPolygons(QTransform());
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
Converts the path into a list of polygons using the
|
||||
@ -1792,19 +1826,6 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const
|
||||
return polys;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\overload
|
||||
\obsolete
|
||||
|
||||
Use toFillPolygons(const QTransform &matrix) instead.
|
||||
*/
|
||||
QList<QPolygonF> QPainterPath::toFillPolygons(const QMatrix &matrix) const
|
||||
{
|
||||
return toFillPolygons(QTransform(matrix));
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
//same as qt_polygon_isect_line in qpolygon.cpp
|
||||
static void qt_painterpath_isect_line(const QPointF &p1,
|
||||
const QPointF &p2,
|
||||
@ -2881,6 +2902,28 @@ void QPainterPathStroker::setDashOffset(qreal offset)
|
||||
d_func()->dashOffset = offset;
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
|
||||
Converts the path into a polygon without any transformation,
|
||||
and returns the polygon.
|
||||
|
||||
The polygon is created by first converting all subpaths to
|
||||
polygons, then using a rewinding technique to make sure that
|
||||
overlapping subpaths can be filled using the correct fill rule.
|
||||
|
||||
Note that rewinding inserts addition lines in the polygon so
|
||||
the outline of the fill polygon does not match the outline of
|
||||
the path.
|
||||
|
||||
\sa toSubpathPolygons(), toFillPolygons(),
|
||||
{QPainterPath#QPainterPath Conversion}{QPainterPath Conversion}
|
||||
*/
|
||||
QPolygonF QPainterPath::toFillPolygon() const
|
||||
{
|
||||
return toFillPolygon(QTransform());
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts the path into a polygon using the QTransform
|
||||
\a matrix, and returns the polygon.
|
||||
@ -2898,7 +2941,6 @@ void QPainterPathStroker::setDashOffset(qreal offset)
|
||||
*/
|
||||
QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const
|
||||
{
|
||||
|
||||
const QList<QPolygonF> flats = toSubpathPolygons(matrix);
|
||||
QPolygonF polygon;
|
||||
if (flats.isEmpty())
|
||||
@ -2914,19 +2956,6 @@ QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const
|
||||
return polygon;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\overload
|
||||
\obsolete
|
||||
|
||||
Use toFillPolygon(const QTransform &matrix) instead.
|
||||
*/
|
||||
QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const
|
||||
{
|
||||
return toFillPolygon(QTransform(matrix));
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
//derivative of the equation
|
||||
static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d)
|
||||
{
|
||||
|
@ -41,7 +41,6 @@
|
||||
#define QPAINTERPATH_H
|
||||
|
||||
#include <QtGui/qtguiglobal.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtCore/qline.h>
|
||||
@ -59,6 +58,7 @@ class QPainterPathStrokerPrivate;
|
||||
class QPen;
|
||||
class QPolygonF;
|
||||
class QRegion;
|
||||
class QTransform;
|
||||
class QVectorPath;
|
||||
|
||||
class Q_GUI_EXPORT QPainterPath
|
||||
@ -176,16 +176,11 @@ public:
|
||||
|
||||
Q_REQUIRED_RESULT QPainterPath toReversed() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use toSubpathPolygons(const QTransform &)")
|
||||
QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
|
||||
QT_DEPRECATED_X("Use toFillPolygons(const QTransform &")
|
||||
QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const;
|
||||
QT_DEPRECATED_X("Use toFillPolygon(const QTransform &)")
|
||||
QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const;
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
QList<QPolygonF> toSubpathPolygons() const;
|
||||
QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const;
|
||||
QList<QPolygonF> toFillPolygons() const;
|
||||
QList<QPolygonF> toFillPolygons(const QTransform &matrix) const;
|
||||
QPolygonF toFillPolygon() const;
|
||||
QPolygonF toFillPolygon(const QTransform &matrix) const;
|
||||
|
||||
int elementCount() const;
|
||||
@ -238,7 +233,6 @@ private:
|
||||
friend class QPainterPathData;
|
||||
friend class QPainterPathStroker;
|
||||
friend class QPainterPathStrokerPrivate;
|
||||
friend class QMatrix;
|
||||
friend class QTransform;
|
||||
friend class QVectorPath;
|
||||
friend Q_GUI_EXPORT const QVectorPath &qtVectorPathForPath(const QPainterPath &);
|
||||
|
@ -74,7 +74,6 @@ public:
|
||||
friend class QPainterPathData;
|
||||
friend class QPainterPathStroker;
|
||||
friend class QPainterPathStrokerPrivate;
|
||||
friend class QMatrix;
|
||||
friend class QTransform;
|
||||
friend class QVectorPath;
|
||||
friend struct QPainterPathPrivateDeleter;
|
||||
|
@ -899,7 +899,7 @@ QPolygon QPolygon::united(const QPolygon &r) const
|
||||
QPainterPath subject; subject.addPolygon(*this);
|
||||
QPainterPath clip; clip.addPolygon(r);
|
||||
|
||||
return subject.united(clip).toFillPolygon(QTransform()).toPolygon();
|
||||
return subject.united(clip).toFillPolygon().toPolygon();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -918,7 +918,7 @@ QPolygon QPolygon::intersected(const QPolygon &r) const
|
||||
QPainterPath subject; subject.addPolygon(*this);
|
||||
QPainterPath clip; clip.addPolygon(r);
|
||||
|
||||
return subject.intersected(clip).toFillPolygon(QTransform()).toPolygon();
|
||||
return subject.intersected(clip).toFillPolygon().toPolygon();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -936,7 +936,7 @@ QPolygon QPolygon::subtracted(const QPolygon &r) const
|
||||
QPainterPath subject; subject.addPolygon(*this);
|
||||
QPainterPath clip; clip.addPolygon(r);
|
||||
|
||||
return subject.subtracted(clip).toFillPolygon(QTransform()).toPolygon();
|
||||
return subject.subtracted(clip).toFillPolygon().toPolygon();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -975,7 +975,7 @@ QPolygonF QPolygonF::united(const QPolygonF &r) const
|
||||
QPainterPath subject; subject.addPolygon(*this);
|
||||
QPainterPath clip; clip.addPolygon(r);
|
||||
|
||||
return subject.united(clip).toFillPolygon(QTransform());
|
||||
return subject.united(clip).toFillPolygon();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -994,7 +994,7 @@ QPolygonF QPolygonF::intersected(const QPolygonF &r) const
|
||||
QPainterPath subject; subject.addPolygon(*this);
|
||||
QPainterPath clip; clip.addPolygon(r);
|
||||
|
||||
return subject.intersected(clip).toFillPolygon(QTransform());
|
||||
return subject.intersected(clip).toFillPolygon();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1011,7 +1011,7 @@ QPolygonF QPolygonF::subtracted(const QPolygonF &r) const
|
||||
{
|
||||
QPainterPath subject; subject.addPolygon(*this);
|
||||
QPainterPath clip; clip.addPolygon(r);
|
||||
return subject.subtracted(clip).toFillPolygon(QTransform());
|
||||
return subject.subtracted(clip).toFillPolygon();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -47,8 +47,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QMatrix;
|
||||
class QTransform;
|
||||
class QRect;
|
||||
class QVariant;
|
||||
|
@ -3917,7 +3917,7 @@ QRegion::QRegion(const QRect &r, RegionType t)
|
||||
} else if (t == Ellipse) {
|
||||
QPainterPath path;
|
||||
path.addEllipse(r.x(), r.y(), r.width(), r.height());
|
||||
QPolygon a = path.toSubpathPolygons(QTransform()).at(0).toPolygon();
|
||||
QPolygon a = path.toSubpathPolygons().at(0).toPolygon();
|
||||
d->qt_rgn = PolygonRegion(a.constData(), a.size(), EvenOddRule);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "qdatastream.h"
|
||||
#include "qdebug.h"
|
||||
#include "qhashfunctions.h"
|
||||
#include "qmatrix.h"
|
||||
#include "qregion.h"
|
||||
#include "qpainterpath.h"
|
||||
#include "qpainterpath_p.h"
|
||||
@ -109,14 +108,6 @@ static void nanWarning(const char *func)
|
||||
or project the coordinate system, and is typically used when
|
||||
rendering graphics.
|
||||
|
||||
QTransform differs from QMatrix in that it is a true 3x3 matrix,
|
||||
allowing perspective transformations. QTransform's toAffine()
|
||||
method allows casting QTransform to QMatrix. If a perspective
|
||||
transformation has been specified on the matrix, then the
|
||||
conversion will cause loss of data.
|
||||
|
||||
QTransform is the recommended transformation class in Qt.
|
||||
|
||||
A QTransform object can be built using the setMatrix(), scale(),
|
||||
rotate(), translate() and shear() functions. Alternatively, it
|
||||
can be built by applying \l {QTransform#Basic Matrix
|
||||
@ -308,26 +299,6 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21,
|
||||
{
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\fn QTransform::QTransform(const QMatrix &matrix)
|
||||
\obsolete
|
||||
|
||||
Constructs a matrix that is a copy of the given \a matrix.
|
||||
Note that the \c m13, \c m23, and \c m33 elements are set to 0, 0,
|
||||
and 1 respectively.
|
||||
*/
|
||||
QTransform::QTransform(const QMatrix &mtx)
|
||||
: m_matrix{ {mtx._m11, mtx._m12, 0}, {mtx._m21, mtx._m22, 0}, {mtx._dx, mtx._dy, 1} }
|
||||
, m_type(TxNone)
|
||||
, m_dirty(TxShear)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
, d(nullptr)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
Returns the adjoint of this matrix.
|
||||
*/
|
||||
@ -1557,7 +1528,7 @@ QRegion QTransform::map(const QRegion &r) const
|
||||
}
|
||||
|
||||
QPainterPath p = map(qt_regionToPath(r));
|
||||
return p.toFillPolygon(QTransform()).toPolygon();
|
||||
return p.toFillPolygon().toPolygon();
|
||||
}
|
||||
|
||||
struct QHomogeneousCoordinate
|
||||
@ -2095,22 +2066,6 @@ void QTransform::map(int x, int y, int *tx, int *ty) const
|
||||
*ty = qRound(fy);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\obsolete
|
||||
Returns the QTransform as an affine matrix.
|
||||
|
||||
\warning If a perspective transformation has been specified,
|
||||
then the conversion will cause loss of data.
|
||||
*/
|
||||
QMatrix QTransform::toAffine() const
|
||||
{
|
||||
return QMatrix(m_matrix[0][0], m_matrix[0][1],
|
||||
m_matrix[1][0], m_matrix[1][1],
|
||||
m_matrix[2][0], m_matrix[2][1]);
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
Returns the transformation type of this matrix.
|
||||
|
||||
@ -2402,4 +2357,50 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
|
||||
}
|
||||
}
|
||||
|
||||
QDataStream & operator>>(QDataStream &s, QTransform::Affine &m)
|
||||
{
|
||||
if (s.version() == 1) {
|
||||
float m11, m12, m21, m22, dx, dy;
|
||||
s >> m11; s >> m12; s >> m21; s >> m22; s >> dx; s >> dy;
|
||||
|
||||
m.m_matrix[0][0] = m11;
|
||||
m.m_matrix[0][1] = m12;
|
||||
m.m_matrix[1][0] = m21;
|
||||
m.m_matrix[1][1] = m22;
|
||||
m.m_matrix[2][0] = dx;
|
||||
m.m_matrix[2][1] = dy;
|
||||
} else {
|
||||
s >> m.m_matrix[0][0];
|
||||
s >> m.m_matrix[0][1];
|
||||
s >> m.m_matrix[1][0];
|
||||
s >> m.m_matrix[1][1];
|
||||
s >> m.m_matrix[2][0];
|
||||
s >> m.m_matrix[2][1];
|
||||
}
|
||||
m.m_matrix[0][2] = 0;
|
||||
m.m_matrix[1][2] = 0;
|
||||
m.m_matrix[2][2] = 1;
|
||||
return s;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &s, const QTransform::Affine &m)
|
||||
{
|
||||
if (s.version() == 1) {
|
||||
s << (float)m.m_matrix[0][0]
|
||||
<< (float)m.m_matrix[0][1]
|
||||
<< (float)m.m_matrix[1][0]
|
||||
<< (float)m.m_matrix[1][1]
|
||||
<< (float)m.m_matrix[2][0]
|
||||
<< (float)m.m_matrix[2][1];
|
||||
} else {
|
||||
s << m.m_matrix[0][0]
|
||||
<< m.m_matrix[0][1]
|
||||
<< m.m_matrix[1][0]
|
||||
<< m.m_matrix[1][1]
|
||||
<< m.m_matrix[2][0]
|
||||
<< m.m_matrix[2][1];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -40,7 +40,6 @@
|
||||
#define QTRANSFORM_H
|
||||
|
||||
#include <QtGui/qtguiglobal.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#include <QtGui/qpainterpath.h>
|
||||
#include <QtGui/qpolygon.h>
|
||||
#include <QtGui/qregion.h>
|
||||
@ -73,9 +72,6 @@ public:
|
||||
qreal h31, qreal h32, qreal h33 = 1.0);
|
||||
QTransform(qreal h11, qreal h12, qreal h21,
|
||||
qreal h22, qreal dx, qreal dy);
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
explicit QTransform(const QMatrix &mtx);
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
// ### Qt 6: remove; the compiler-generated ones are fine!
|
||||
@ -160,10 +156,6 @@ public:
|
||||
void map(int x, int y, int *tx, int *ty) const;
|
||||
void map(qreal x, qreal y, qreal *tx, qreal *ty) const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QMatrix toAffine() const;
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
QTransform &operator*=(qreal div);
|
||||
QTransform &operator/=(qreal div);
|
||||
QTransform &operator+=(qreal div);
|
||||
@ -172,6 +164,16 @@ public:
|
||||
static QTransform fromTranslate(qreal dx, qreal dy);
|
||||
static QTransform fromScale(qreal dx, qreal dy);
|
||||
|
||||
private:
|
||||
struct Affine {
|
||||
qreal (& m_matrix)[3][3];
|
||||
};
|
||||
|
||||
public:
|
||||
auto asAffineMatrix() { return Affine { m_matrix }; }
|
||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &s, Affine &m);
|
||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const Affine &m);
|
||||
|
||||
private:
|
||||
inline QTransform(qreal h11, qreal h12, qreal h13,
|
||||
qreal h21, qreal h22, qreal h23,
|
||||
|
@ -530,9 +530,6 @@
|
||||
setEnabled() in itemChange() as this notification is delivered. The return
|
||||
value is ignored.
|
||||
|
||||
\value ItemMatrixChange The item's affine transformation matrix is
|
||||
changing. This value is obsolete; you can use ItemTransformChange instead.
|
||||
|
||||
\value ItemPositionChange The item's position changes. This notification
|
||||
is sent if the ItemSendsGeometryChanges flag is enabled, and when the
|
||||
item's local position changes, relative to its parent (i.e., as a result
|
||||
@ -1506,7 +1503,7 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con
|
||||
return;
|
||||
|
||||
// Initialize QStyleOptionGraphicsItem specific values (matrix, exposedRect).
|
||||
option->matrix = worldTransform.toAffine(); //### discards perspective
|
||||
option->matrix = worldTransform; //### discards perspective
|
||||
|
||||
if (!allItems) {
|
||||
// Determine the item's exposed area
|
||||
@ -3997,24 +3994,6 @@ void QGraphicsItem::ensureVisible(const QRectF &rect, int xmargin, int ymargin)
|
||||
ensureVisible(QRectF(\a x, \a y, \a w, \a h), \a xmargin, \a ymargin).
|
||||
*/
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Returns the item's affine transformation matrix. This is a subset or the
|
||||
item's full transformation matrix, and might not represent the item's full
|
||||
transformation.
|
||||
|
||||
Use transform() instead.
|
||||
|
||||
\sa setTransform(), sceneTransform()
|
||||
*/
|
||||
QMatrix QGraphicsItem::matrix() const
|
||||
{
|
||||
return transform().toAffine();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
|
||||
@ -4323,22 +4302,6 @@ void QGraphicsItem::setTransformOriginPoint(const QPointF &origin)
|
||||
\sa setTransformOriginPoint(), {Transformations}
|
||||
*/
|
||||
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use sceneTransform() instead.
|
||||
|
||||
\sa transform(), setTransform(), scenePos(), {The Graphics View Coordinate System}
|
||||
*/
|
||||
QMatrix QGraphicsItem::sceneMatrix() const
|
||||
{
|
||||
d_ptr->ensureSceneTransform();
|
||||
return d_ptr->sceneTransform.toAffine();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
|
||||
@ -4549,50 +4512,6 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co
|
||||
return x;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Sets the item's affine transformation matrix. This is a subset or the
|
||||
item's full transformation matrix, and might not represent the item's full
|
||||
transformation.
|
||||
|
||||
Use setTransform() instead.
|
||||
|
||||
\sa transform(), {The Graphics View Coordinate System}
|
||||
*/
|
||||
void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine)
|
||||
{
|
||||
if (!d_ptr->transformData)
|
||||
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
|
||||
|
||||
QTransform newTransform(combine ? QTransform(matrix) * d_ptr->transformData->transform : QTransform(matrix));
|
||||
if (d_ptr->transformData->transform == newTransform)
|
||||
return;
|
||||
|
||||
// Update and set the new transformation.
|
||||
if (!(d_ptr->flags & ItemSendsGeometryChanges)) {
|
||||
d_ptr->setTransformHelper(newTransform);
|
||||
return;
|
||||
}
|
||||
|
||||
// Notify the item that the transformation matrix is changing.
|
||||
const QVariant newMatrixVariant = QVariant::fromValue<QMatrix>(newTransform.toAffine());
|
||||
newTransform = QTransform(qvariant_cast<QMatrix>(itemChange(ItemMatrixChange, newMatrixVariant)));
|
||||
if (d_ptr->transformData->transform == newTransform)
|
||||
return;
|
||||
|
||||
// Update and set the new transformation.
|
||||
d_ptr->setTransformHelper(newTransform);
|
||||
|
||||
// Send post-notification.
|
||||
itemChange(ItemTransformHasChanged, QVariant::fromValue<QTransform>(newTransform));
|
||||
}
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
|
||||
@ -4646,18 +4565,6 @@ void QGraphicsItem::setTransform(const QTransform &matrix, bool combine)
|
||||
d_ptr->sendScenePosChange();
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use resetTransform() instead.
|
||||
*/
|
||||
void QGraphicsItem::resetMatrix()
|
||||
{
|
||||
resetTransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
|
||||
@ -11526,14 +11433,6 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change)
|
||||
case QGraphicsItem::ItemFlagsHaveChanged:
|
||||
str = "ItemFlagsHaveChanged";
|
||||
break;
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
case QGraphicsItem::ItemMatrixChange:
|
||||
str = "ItemMatrixChange";
|
||||
break;
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
case QGraphicsItem::ItemParentChange:
|
||||
str = "ItemParentChange";
|
||||
break;
|
||||
|
@ -71,7 +71,6 @@ class QGraphicsTransform;
|
||||
class QGraphicsWidget;
|
||||
class QInputMethodEvent;
|
||||
class QKeyEvent;
|
||||
class QMatrix;
|
||||
class QMenu;
|
||||
class QPainter;
|
||||
class QPen;
|
||||
@ -110,9 +109,6 @@ public:
|
||||
|
||||
enum GraphicsItemChange {
|
||||
ItemPositionChange,
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
ItemMatrixChange Q_DECL_ENUMERATOR_DEPRECATED_X("Use ItemTransformChange instead"),
|
||||
#endif
|
||||
ItemVisibleChange = 2,
|
||||
ItemEnabledChange,
|
||||
ItemSelectedChange,
|
||||
@ -285,16 +281,6 @@ public:
|
||||
inline void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin = 50, int ymargin = 50);
|
||||
|
||||
// Local transformation
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use transform() instead")
|
||||
QMatrix matrix() const;
|
||||
QT_DEPRECATED_X("Use sceneTransform() instead")
|
||||
QMatrix sceneMatrix() const;
|
||||
QT_DEPRECATED_X("Use setTransform() instead")
|
||||
void setMatrix(const QMatrix &matrix, bool combine = false);
|
||||
QT_DEPRECATED_X("Use resetTransform() instead")
|
||||
void resetMatrix();
|
||||
#endif
|
||||
QTransform transform() const;
|
||||
QTransform sceneTransform() const;
|
||||
QTransform deviceTransform(const QTransform &viewportTransform) const;
|
||||
|
@ -87,7 +87,6 @@
|
||||
#include <QtCore/qpoint.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtCore/qpair.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -294,19 +293,6 @@ QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::posList() const
|
||||
return list;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
/*!
|
||||
Returns the matrix used to transform the item at the specified \a step value.
|
||||
|
||||
\obsolete Use transformAt() instead
|
||||
*/
|
||||
QMatrix QGraphicsItemAnimation::matrixAt(qreal step) const
|
||||
{
|
||||
check_step_valid(step, "matrixAt");
|
||||
return transformAt(step).toAffine();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Returns the transform used for the item at the specified \a step value.
|
||||
|
||||
|
@ -48,7 +48,6 @@ QT_REQUIRE_CONFIG(graphicsview);
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QGraphicsItem;
|
||||
class QMatrix;
|
||||
class QPointF;
|
||||
class QTimeLine;
|
||||
class QTransform;
|
||||
@ -72,10 +71,6 @@ public:
|
||||
QList<QPair<qreal, QPointF> > posList() const;
|
||||
void setPosAt(qreal step, const QPointF &pos);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
QT_DEPRECATED_X("Use transformAt() instead")
|
||||
QMatrix matrixAt(qreal step) const;
|
||||
#endif
|
||||
QTransform transformAt(qreal step) const;
|
||||
|
||||
qreal rotationAt(qreal step) const;
|
||||
|
@ -292,7 +292,6 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtWidgets/qlayout.h>
|
||||
#include <QtGui/qtransform.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtWidgets/qscrollbar.h>
|
||||
#include <QtWidgets/qstyleoption.h>
|
||||
@ -1824,75 +1823,6 @@ void QGraphicsView::setSceneRect(const QRectF &rect)
|
||||
d->recalculateContentSize();
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use transform() instead.
|
||||
|
||||
Returns the current transformation matrix for the view. If no current
|
||||
transformation is set, the identity matrix is returned.
|
||||
|
||||
\sa setMatrix(), transform(), rotate(), scale(), shear(), translate()
|
||||
*/
|
||||
QMatrix QGraphicsView::matrix() const
|
||||
{
|
||||
Q_D(const QGraphicsView);
|
||||
return d->matrix.toAffine();
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use setTransform() instead.
|
||||
|
||||
Sets the view's current transformation matrix to \a matrix.
|
||||
|
||||
If \a combine is true, then \a matrix is combined with the current matrix;
|
||||
otherwise, \a matrix \e replaces the current matrix. \a combine is false
|
||||
by default.
|
||||
|
||||
The transformation matrix tranforms the scene into view coordinates. Using
|
||||
the default transformation, provided by the identity matrix, one pixel in
|
||||
the view represents one unit in the scene (e.g., a 10x10 rectangular item
|
||||
is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is
|
||||
applied, the scene will be drawn in 1:2 (e.g., a 10x10 rectangular item is
|
||||
then drawn using 20x20 pixels in the view).
|
||||
|
||||
Example:
|
||||
|
||||
\snippet code/src_gui_graphicsview_qgraphicsview.cpp 3
|
||||
|
||||
To simplify interation with items using a transformed view, QGraphicsView
|
||||
provides mapTo... and mapFrom... functions that can translate between
|
||||
scene and view coordinates. For example, you can call mapToScene() to map
|
||||
a view coordinate to a floating point scene coordinate, or mapFromScene()
|
||||
to map from floating point scene coordinates to view coordinates.
|
||||
|
||||
\sa matrix(), setTransform(), rotate(), scale(), shear(), translate()
|
||||
*/
|
||||
void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine)
|
||||
{
|
||||
setTransform(QTransform(matrix), combine);
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use resetTransform() instead.
|
||||
|
||||
Resets the view transformation matrix to the identity matrix.
|
||||
|
||||
\sa resetTransform()
|
||||
*/
|
||||
void QGraphicsView::resetMatrix()
|
||||
{
|
||||
resetTransform();
|
||||
}
|
||||
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
Rotates the current view transformation \a angle degrees clockwise.
|
||||
|
||||
|
@ -165,11 +165,6 @@ public:
|
||||
void setSceneRect(const QRectF &rect);
|
||||
inline void setSceneRect(qreal x, qreal y, qreal w, qreal h);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use transform()") QMatrix matrix() const;
|
||||
QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &matrix, bool combine = false);
|
||||
QT_DEPRECATED_X("Use resetTransform()") void resetMatrix();
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
QTransform transform() const;
|
||||
QTransform viewportTransform() const;
|
||||
bool isTransformed() const;
|
||||
|
@ -3763,7 +3763,7 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
|
||||
\brief the complete transformation matrix for the item
|
||||
\obsolete
|
||||
|
||||
The QMatrix provided through this member does include information about
|
||||
The QTransform provided through this member does include information about
|
||||
any perspective transformations applied to the view or item. To get the
|
||||
correct transformation matrix, use QPainter::transform() on the painter
|
||||
passed into the QGraphicsItem::paint() implementation.
|
||||
@ -3774,7 +3774,7 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
|
||||
item drawing.
|
||||
|
||||
To find the dimensions of an item in screen coordinates (i.e., pixels),
|
||||
you can use the mapping functions of QMatrix, such as QMatrix::map().
|
||||
you can use the mapping functions of QTransform, such as QTransform::map().
|
||||
|
||||
This member is only initialized for items that have the
|
||||
QGraphicsItem::ItemUsesExtendedStyleOption flag set.
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include <QtWidgets/qabstractspinbox.h>
|
||||
#endif
|
||||
#include <QtGui/qicon.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#include <QtGui/qtransform.h>
|
||||
#if QT_CONFIG(slider)
|
||||
#include <QtWidgets/qslider.h>
|
||||
#endif
|
||||
@ -693,7 +693,7 @@ public:
|
||||
enum StyleOptionVersion { Version = 1 };
|
||||
|
||||
QRectF exposedRect;
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
qreal levelOfDetail;
|
||||
|
||||
QStyleOptionGraphicsItem();
|
||||
|
Binary file not shown.
@ -1769,7 +1769,6 @@ void tst_QVariant::typeName_data()
|
||||
QTest::newRow("39") << int(QVariant::RectF) << QByteArray("QRectF");
|
||||
QTest::newRow("40") << int(QVariant::PointF) << QByteArray("QPointF");
|
||||
QTest::newRow("41") << int(QVariant::RegExp) << QByteArray("QRegExp");
|
||||
QTest::newRow("43") << int(QVariant::Matrix) << QByteArray("QMatrix");
|
||||
QTest::newRow("44") << int(QVariant::Transform) << QByteArray("QTransform");
|
||||
QTest::newRow("45") << int(QVariant::Hash) << QByteArray("QVariantHash");
|
||||
QTest::newRow("46") << int(QVariant::Matrix4x4) << QByteArray("QMatrix4x4");
|
||||
|
@ -3297,7 +3297,7 @@ void tst_QDataStream::streamRealDataTypes()
|
||||
stream.setVersion(QDataStream::Qt_4_2);
|
||||
stream << qreal(0) << qreal(1.0) << qreal(1.1) << qreal(3.14) << qreal(-3.14) << qreal(-1);
|
||||
stream << QPointF(3, 5) << QRectF(-1, -2, 3, 4) << (QPolygonF() << QPointF(0, 0) << QPointF(1, 2));
|
||||
stream << QMatrix().rotate(90).scale(2, 2);
|
||||
stream << QTransform().rotate(90).scale(2, 2).asAffineMatrix();
|
||||
stream << path;
|
||||
stream << picture;
|
||||
stream << QTextLength(QTextLength::VariableLength, 1.5);
|
||||
@ -3311,7 +3311,7 @@ void tst_QDataStream::streamRealDataTypes()
|
||||
QPointF point;
|
||||
QRectF rect;
|
||||
QPolygonF polygon;
|
||||
QMatrix matrix;
|
||||
QTransform transform;
|
||||
QPainterPath p;
|
||||
QPicture pict;
|
||||
QTextLength textLength;
|
||||
@ -3361,8 +3361,9 @@ void tst_QDataStream::streamRealDataTypes()
|
||||
QCOMPARE(rect, QRectF(-1, -2, 3, 4));
|
||||
stream >> polygon;
|
||||
QCOMPARE((QVector<QPointF> &)polygon, (QPolygonF() << QPointF(0, 0) << QPointF(1, 2)));
|
||||
auto matrix = transform.asAffineMatrix();
|
||||
stream >> matrix;
|
||||
QCOMPARE(matrix, QMatrix().rotate(90).scale(2, 2));
|
||||
QCOMPARE(transform, QTransform().rotate(90).scale(2, 2));
|
||||
stream >> p;
|
||||
QCOMPARE(p, path);
|
||||
if (i == 1) {
|
||||
@ -3384,10 +3385,7 @@ void tst_QDataStream::streamRealDataTypes()
|
||||
QCOMPARE(col, color);
|
||||
stream >> rGrad;
|
||||
QCOMPARE(rGrad.style(), radialBrush.style());
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QCOMPARE(rGrad.matrix(), radialBrush.matrix());
|
||||
QT_WARNING_POP
|
||||
QCOMPARE(rGrad.transform(), radialBrush.transform());
|
||||
QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type());
|
||||
QCOMPARE(rGrad.gradient()->stops(), radialBrush.gradient()->stops());
|
||||
QCOMPARE(rGrad.gradient()->spread(), radialBrush.gradient()->spread());
|
||||
@ -3396,10 +3394,7 @@ QT_WARNING_POP
|
||||
QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius());
|
||||
stream >> cGrad;
|
||||
QCOMPARE(cGrad.style(), conicalBrush.style());
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QCOMPARE(cGrad.matrix(), conicalBrush.matrix());
|
||||
QT_WARNING_POP
|
||||
QCOMPARE(cGrad.transform(), conicalBrush.transform());
|
||||
QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type());
|
||||
QCOMPARE(cGrad.gradient()->stops(), conicalBrush.gradient()->stops());
|
||||
QCOMPARE(cGrad.gradient()->spread(), conicalBrush.gradient()->spread());
|
||||
|
@ -67,7 +67,6 @@ private slots:
|
||||
F(QPen, QPen) \
|
||||
F(QTextLength, QTextLength) \
|
||||
F(QTextFormat, QTextFormat) \
|
||||
F(QMatrix, QMatrix) \
|
||||
F(QTransform, QTransform) \
|
||||
F(QMatrix4x4, QMatrix4x4) \
|
||||
F(QVector2D, QVector2D) \
|
||||
@ -197,14 +196,6 @@ template<> struct TestValueFactory<QMetaType::QTextLength> {
|
||||
template<> struct TestValueFactory<QMetaType::QTextFormat> {
|
||||
static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); }
|
||||
};
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
template<> struct TestValueFactory<QMetaType::QMatrix> {
|
||||
static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); }
|
||||
};
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
template<> struct TestValueFactory<QMetaType::QTransform> {
|
||||
static QTransform *create() { return new QTransform(10, 20, 30, 40, 50, 60); }
|
||||
};
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <qcursor.h>
|
||||
#include <qimage.h>
|
||||
#include <qicon.h>
|
||||
#include <qmatrix.h>
|
||||
#include <qmatrix4x4.h>
|
||||
#include <qpen.h>
|
||||
#include <qpolygon.h>
|
||||
@ -87,8 +86,6 @@ private slots:
|
||||
void toBrush_data();
|
||||
void toBrush();
|
||||
|
||||
void matrix();
|
||||
|
||||
void transform();
|
||||
|
||||
void matrix4x4();
|
||||
@ -402,24 +399,6 @@ void tst_QGuiVariant::toString()
|
||||
QCOMPARE( str, result );
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
void tst_QGuiVariant::matrix()
|
||||
{
|
||||
QVariant variant;
|
||||
QMatrix matrix = qvariant_cast<QMatrix>(variant);
|
||||
QVERIFY(matrix.isIdentity());
|
||||
variant.setValue(QMatrix().rotate(90));
|
||||
QCOMPARE(QMatrix().rotate(90), qvariant_cast<QMatrix>(variant));
|
||||
|
||||
void *mmatrix = QMetaType::create(QVariant::Matrix, 0);
|
||||
QVERIFY(mmatrix);
|
||||
QMetaType::destroy(QVariant::Matrix, mmatrix);
|
||||
}
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
void tst_QGuiVariant::matrix4x4()
|
||||
{
|
||||
QVariant variant;
|
||||
@ -711,7 +690,6 @@ void tst_QGuiVariant::implicitConstruction()
|
||||
F(Pen) \
|
||||
F(TextLength) \
|
||||
F(TextFormat) \
|
||||
F(Matrix) \
|
||||
F(Transform) \
|
||||
F(Matrix4x4) \
|
||||
F(Vector2D) \
|
||||
|
@ -144,7 +144,6 @@ private slots:
|
||||
|
||||
void columnsAndRows();
|
||||
|
||||
void convertQMatrix();
|
||||
void convertQTransform();
|
||||
|
||||
void fill();
|
||||
@ -3061,58 +3060,6 @@ void tst_QMatrixNxN::columnsAndRows()
|
||||
QVERIFY(m1.row(3) == QVector4D(4, 8, 12, 16));
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
// Test converting QMatrix objects into QMatrix4x4 and then
|
||||
// checking that transformations in the original perform the
|
||||
// equivalent transformations in the new matrix.
|
||||
void tst_QMatrixNxN::convertQMatrix()
|
||||
{
|
||||
QMatrix m1;
|
||||
m1.translate(-3.5, 2.0);
|
||||
QPointF p1 = m1.map(QPointF(100.0, 150.0));
|
||||
QCOMPARE(p1.x(), 100.0 - 3.5);
|
||||
QCOMPARE(p1.y(), 150.0 + 2.0);
|
||||
|
||||
QMatrix4x4 m2(m1);
|
||||
QPointF p2 = m2 * QPointF(100.0, 150.0);
|
||||
QCOMPARE((double)p2.x(), 100.0 - 3.5);
|
||||
QCOMPARE((double)p2.y(), 150.0 + 2.0);
|
||||
QCOMPARE(m1, m2.toAffine());
|
||||
|
||||
QMatrix m3;
|
||||
m3.scale(1.5, -2.0);
|
||||
QPointF p3 = m3.map(QPointF(100.0, 150.0));
|
||||
QCOMPARE(p3.x(), 1.5 * 100.0);
|
||||
QCOMPARE(p3.y(), -2.0 * 150.0);
|
||||
|
||||
QMatrix4x4 m4(m3);
|
||||
QPointF p4 = m4 * QPointF(100.0, 150.0);
|
||||
QCOMPARE((double)p4.x(), 1.5 * 100.0);
|
||||
QCOMPARE((double)p4.y(), -2.0 * 150.0);
|
||||
QCOMPARE(m3, m4.toAffine());
|
||||
|
||||
QMatrix m5;
|
||||
m5.rotate(45.0);
|
||||
QPointF p5 = m5.map(QPointF(100.0, 150.0));
|
||||
|
||||
QMatrix4x4 m6(m5);
|
||||
QPointF p6 = m6 * QPointF(100.0, 150.0);
|
||||
QVERIFY(qFuzzyCompare(float(p5.x()), float(p6.x())));
|
||||
QVERIFY(qFuzzyCompare(float(p5.y()), float(p6.y())));
|
||||
|
||||
QMatrix m7 = m6.toAffine();
|
||||
QVERIFY(qFuzzyCompare(float(m5.m11()), float(m7.m11())));
|
||||
QVERIFY(qFuzzyCompare(float(m5.m12()), float(m7.m12())));
|
||||
QVERIFY(qFuzzyCompare(float(m5.m21()), float(m7.m21())));
|
||||
QVERIFY(qFuzzyCompare(float(m5.m22()), float(m7.m22())));
|
||||
QVERIFY(qFuzzyCompare(float(m5.dx()), float(m7.dx())));
|
||||
QVERIFY(qFuzzyCompare(float(m5.dy()), float(m7.dy())));
|
||||
}
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
// Test converting QTransform objects into QMatrix4x4 and then
|
||||
// checking that transformations in the original perform the
|
||||
// equivalent transformations in the new matrix.
|
||||
|
@ -16,5 +16,4 @@ endif()
|
||||
add_subdirectory("qpen")
|
||||
add_subdirectory("qpaintengine")
|
||||
# add_subdirectory("qtransform")
|
||||
# add_subdirectory("qwmatrix")
|
||||
# add_subdirectory("qpolygon")
|
||||
|
@ -14,7 +14,6 @@ SUBDIRS=\
|
||||
qpen \
|
||||
qpaintengine \
|
||||
qtransform \
|
||||
qwmatrix \
|
||||
qpolygon \
|
||||
|
||||
!qtConfig(private_tests): SUBDIRS -= \
|
||||
|
@ -140,7 +140,7 @@ private slots:
|
||||
|
||||
void setWindow();
|
||||
|
||||
void combinedMatrix();
|
||||
void combinedTransform();
|
||||
void renderHints();
|
||||
|
||||
void disableEnableClipping();
|
||||
@ -1692,7 +1692,7 @@ void tst_QPainter::setWindow()
|
||||
QVERIFY(195 < painted.height() && painted.height() < 205); // correct value is around 200
|
||||
}
|
||||
|
||||
void tst_QPainter::combinedMatrix()
|
||||
void tst_QPainter::combinedTransform()
|
||||
{
|
||||
QPixmap pm(64, 64);
|
||||
|
||||
@ -1703,15 +1703,7 @@ void tst_QPainter::combinedMatrix()
|
||||
p.translate(0.5, 0.5);
|
||||
|
||||
QTransform ct = p.combinedTransform();
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QMatrix cm = p.combinedMatrix();
|
||||
QCOMPARE(cm, ct.toAffine());
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
QPointF pt = QPointF(0, 0) * ct.toAffine();
|
||||
QPointF pt = QPointF(0, 0) * ct;
|
||||
|
||||
QCOMPARE(pt.x(), 48.0);
|
||||
QCOMPARE(pt.y(), 16.0);
|
||||
@ -4067,7 +4059,7 @@ void tst_QPainter::drawPolygon()
|
||||
path.moveTo(2, 34);
|
||||
path.lineTo(34, 2);
|
||||
|
||||
QPolygonF poly = stroker.createStroke(path).toFillPolygon(QTransform());
|
||||
QPolygonF poly = stroker.createStroke(path).toFillPolygon();
|
||||
|
||||
img.fill(0xffffffff);
|
||||
QPainter p(&img);
|
||||
@ -4135,24 +4127,12 @@ void tst_QPainter::inactivePainter()
|
||||
p.setClipRegion(region);
|
||||
p.setClipping(true);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
p.combinedMatrix();
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
p.combinedTransform();
|
||||
|
||||
p.compositionMode();
|
||||
p.setCompositionMode(QPainter::CompositionMode_Plus);
|
||||
|
||||
p.device();
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
p.deviceMatrix();
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
p.deviceTransform();
|
||||
|
||||
p.font();
|
||||
@ -4176,12 +4156,6 @@ QT_WARNING_POP
|
||||
p.setRenderHint(QPainter::Antialiasing, true);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
p.resetMatrix();
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
p.resetTransform();
|
||||
p.rotate(1);
|
||||
p.scale(2, 2);
|
||||
@ -4197,13 +4171,9 @@ QT_WARNING_POP
|
||||
p.window();
|
||||
p.setWindow(QRect(10, 10, 620, 460));
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
p.worldMatrix();
|
||||
p.setWorldMatrix(QMatrix().translate(43, 21), true);
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
p.worldTransform();
|
||||
p.setWorldTransform(QTransform().translate(43, 21), true);
|
||||
|
||||
p.setWorldMatrixEnabled(true);
|
||||
|
||||
p.transform();
|
||||
|
@ -1,6 +0,0 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qwmatrix
|
||||
SOURCES += tst_qwmatrix.cpp
|
||||
QT += testlib
|
||||
|
||||
unix:!darwin:!haiku:!integrity: LIBS += -lm
|
@ -1,334 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
#include <qmatrix.h>
|
||||
#include <qmath.h>
|
||||
#include <qpolygon.h>
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
|
||||
class tst_QWMatrix : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void mapRect_data();
|
||||
void mapToPolygon_data();
|
||||
void mapRect();
|
||||
void operator_star_qwmatrix();
|
||||
void assignments();
|
||||
void mapToPolygon();
|
||||
void translate();
|
||||
void scale();
|
||||
void mapPolygon();
|
||||
|
||||
private:
|
||||
void mapping_data();
|
||||
};
|
||||
|
||||
void tst_QWMatrix::mapRect_data()
|
||||
{
|
||||
mapping_data();
|
||||
}
|
||||
|
||||
void tst_QWMatrix::mapToPolygon_data()
|
||||
{
|
||||
mapping_data();
|
||||
}
|
||||
|
||||
void tst_QWMatrix::mapping_data()
|
||||
{
|
||||
//create the testtable instance and define the elements
|
||||
QTest::addColumn<QMatrix>("matrix");
|
||||
QTest::addColumn<QRect>("src");
|
||||
QTest::addColumn<QPolygon>("res");
|
||||
|
||||
//next we fill it with data
|
||||
|
||||
// identity
|
||||
QTest::newRow( "identity" ) << QMatrix( 1, 0, 0, 1, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 10, 20, 30, 40 ) );
|
||||
// scaling
|
||||
QTest::newRow( "scale 0" ) << QMatrix( 2, 0, 0, 2, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 20, 40, 60, 80 ) );
|
||||
QTest::newRow( "scale 1" ) << QMatrix( 10, 0, 0, 10, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 100, 200, 300, 400 ) );
|
||||
// mirroring
|
||||
QTest::newRow( "mirror 0" ) << QMatrix( -1, 0, 0, 1, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -40, 20, 30, 40 ) );
|
||||
QTest::newRow( "mirror 1" ) << QMatrix( 1, 0, 0, -1, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 10, -60, 30, 40 ) );
|
||||
QTest::newRow( "mirror 2" ) << QMatrix( -1, 0, 0, -1, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -40, -60, 30, 40 ) );
|
||||
QTest::newRow( "mirror 3" ) << QMatrix( -2, 0, 0, -2, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -80, -120, 60, 80 ) );
|
||||
QTest::newRow( "mirror 4" ) << QMatrix( -10, 0, 0, -10, 0, 0 )
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -400, -600, 300, 400 ) );
|
||||
QTest::newRow( "mirror 5" ) << QMatrix( -1, 0, 0, 1, 0, 0 )
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -30, 0, 30, 40 ) );
|
||||
QTest::newRow( "mirror 6" ) << QMatrix( 1, 0, 0, -1, 0, 0 )
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( 0, -40, 30, 40 ) );
|
||||
QTest::newRow( "mirror 7" ) << QMatrix( -1, 0, 0, -1, 0, 0 )
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -30, -40, 30, 40 ) );
|
||||
QTest::newRow( "mirror 8" ) << QMatrix( -2, 0, 0, -2, 0, 0 )
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -60, -80, 60, 80 ) );
|
||||
QTest::newRow( "mirror 9" ) << QMatrix( -10, 0, 0, -10, 0, 0 )
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -300, -400, 300, 400 ) );
|
||||
|
||||
const auto rotate = [](qreal degrees) {
|
||||
const qreal rad = qDegreesToRadians(degrees);
|
||||
return QMatrix(std::cos(rad), -std::sin(rad),
|
||||
std::sin(rad), std::cos(rad), 0, 0);
|
||||
};
|
||||
|
||||
// rotations
|
||||
QTest::newRow( "rot 0 a" ) << rotate(0.)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon ( QRect( 0, 0, 30, 40 ) );
|
||||
QTest::newRow( "rot 0 b" ) << rotate(0.00001f)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon ( QRect( 0, 0, 30, 40 ) );
|
||||
QTest::newRow( "rot 0 c" ) << rotate(0.)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon ( QRect( 10, 20, 30, 40 ) );
|
||||
QTest::newRow( "rot 0 d" ) << rotate(0.00001f)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon ( QRect( 10, 20, 30, 40 ) );
|
||||
|
||||
#if 0
|
||||
const auto rotScale = [](qreal degrees, qreal scale) {
|
||||
const qreal rad = qDegreesToRadians(degrees);
|
||||
return QMatrix(scale * std::cos(rad), -scale * std::sin(rad),
|
||||
scale * std::sin(rad), scale * std::cos(rad), 0, 0);
|
||||
};
|
||||
// rotations with scaling
|
||||
QTest::newRow( "rotscale 90 a" ) << rotScale(90., 10)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( 0, -299, 400, 300 ) );
|
||||
QTest::newRow( "rotscale 90 b" ) << rotScale(90.00001, 10)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( 0, -299, 400, 300 ) );
|
||||
QTest::newRow( "rotscale 90 c" ) << rotScale(90., 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 200, -399, 400, 300 ) );
|
||||
QTest::newRow( "rotscale 90 d" ) << rotScale(90.00001, 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 200, -399, 400, 300 ) );
|
||||
|
||||
QTest::newRow( "rotscale 180 a" ) << rotScale(180., 10)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -299, -399, 300, 400 ) );
|
||||
QTest::newRow( "rotscale 180 b" ) << rotScale(180.000001, 10)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -299, -399, 300, 400 ) );
|
||||
QTest::newRow( "rotscale 180 c" ) << rotScale(180., 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -399, -599, 300, 400 ) );
|
||||
QTest::newRow( "rotscale 180 d" ) << rotScale(180.000001, 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -399, -599, 300, 400 ) );
|
||||
|
||||
QTest::newRow( "rotscale 270 a" ) << rotScale(270., 10)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -399, 00, 400, 300 ) );
|
||||
QTest::newRow( "rotscale 270 b" ) << rotScale(270.0000001, 10)
|
||||
<< QRect( 0, 0, 30, 40 )
|
||||
<< QPolygon( QRect( -399, 00, 400, 300 ) );
|
||||
QTest::newRow( "rotscale 270 c" ) << rotScale(270., 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -599, 100, 400, 300 ) );
|
||||
QTest::newRow( "rotscale 270 d" ) << rotScale(270.000001, 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -599, 100, 400, 300 ) );
|
||||
|
||||
// rotations that are not multiples of 90 degrees. mapRect returns the bounding rect here.
|
||||
QTest::newRow( "rot 45 a" ) << rotate(45)
|
||||
<< QRect( 0, 0, 10, 10 )
|
||||
<< QPolygon( QRect( 0, -7, 14, 14 ) );
|
||||
QTest::newRow( "rot 45 b" ) << rotate(45)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 21, -14, 49, 49 ) );
|
||||
QTest::newRow( "rot 45 c" ) << rotScale(45, 10)
|
||||
<< QRect( 0, 0, 10, 10 )
|
||||
<< QPolygon( QRect( 0, -70, 141, 141 ) );
|
||||
QTest::newRow( "rot 45 d" ) << rotScale(45, 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( 212, -141, 495, 495 ) );
|
||||
|
||||
QTest::newRow( "rot -45 a" ) << rotate(-45)
|
||||
<< QRect( 0, 0, 10, 10 )
|
||||
<< QPolygon( QRect( -7, 0, 14, 14 ) );
|
||||
QTest::newRow( "rot -45 b" ) << rotate(-45)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -35, 21, 49, 49 ) );
|
||||
QTest::newRow( "rot -45 c" ) << rotScale(-45, 10)
|
||||
<< QRect( 0, 0, 10, 10 )
|
||||
<< QPolygon( QRect( -70, 0, 141, 141 ) );
|
||||
QTest::newRow( "rot -45 d" ) << rotScale(-45, 10)
|
||||
<< QRect( 10, 20, 30, 40 )
|
||||
<< QPolygon( QRect( -353, 212, 495, 495 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QWMatrix::mapRect()
|
||||
{
|
||||
QFETCH( QMatrix, matrix );
|
||||
QFETCH( QRect, src );
|
||||
// qDebug( "got src: %d/%d (%d/%d), matrix=[ %f %f %f %f %f %f ]",
|
||||
// src.x(), src.y(), src.width(), src.height(),
|
||||
// matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), matrix.dx(), matrix.dy() );
|
||||
QTEST( QPolygon( matrix.mapRect(src) ), "res" );
|
||||
}
|
||||
|
||||
void tst_QWMatrix::operator_star_qwmatrix()
|
||||
{
|
||||
QMatrix m1( 2, 3, 4, 5, 6, 7 );
|
||||
QMatrix m2( 3, 4, 5, 6, 7, 8 );
|
||||
|
||||
QMatrix result1x2( 21, 26, 37, 46, 60, 74 );
|
||||
QMatrix result2x1( 22, 29, 34, 45, 52, 68);
|
||||
|
||||
QMatrix product12 = m1*m2;
|
||||
QMatrix product21 = m2*m1;
|
||||
|
||||
QVERIFY( product12==result1x2 );
|
||||
QVERIFY( product21==result2x1 );
|
||||
}
|
||||
|
||||
|
||||
void tst_QWMatrix::assignments()
|
||||
{
|
||||
QMatrix m;
|
||||
m.scale(2, 3);
|
||||
m.rotate(45);
|
||||
m.shear(4, 5);
|
||||
|
||||
QMatrix c1(m);
|
||||
|
||||
QCOMPARE(m.m11(), c1.m11());
|
||||
QCOMPARE(m.m12(), c1.m12());
|
||||
QCOMPARE(m.m21(), c1.m21());
|
||||
QCOMPARE(m.m22(), c1.m22());
|
||||
QCOMPARE(m.dx(), c1.dx());
|
||||
QCOMPARE(m.dy(), c1.dy());
|
||||
|
||||
QMatrix c2 = m;
|
||||
QCOMPARE(m.m11(), c2.m11());
|
||||
QCOMPARE(m.m12(), c2.m12());
|
||||
QCOMPARE(m.m21(), c2.m21());
|
||||
QCOMPARE(m.m22(), c2.m22());
|
||||
QCOMPARE(m.dx(), c2.dx());
|
||||
QCOMPARE(m.dy(), c2.dy());
|
||||
}
|
||||
|
||||
|
||||
void tst_QWMatrix::mapToPolygon()
|
||||
{
|
||||
QFETCH( QMatrix, matrix );
|
||||
QFETCH( QRect, src );
|
||||
QFETCH( QPolygon, res );
|
||||
|
||||
QCOMPARE( matrix.mapToPolygon( src ), res );
|
||||
}
|
||||
|
||||
|
||||
void tst_QWMatrix::translate()
|
||||
{
|
||||
QMatrix m( 1, 2, 3, 4, 5, 6 );
|
||||
QMatrix res2( m );
|
||||
QMatrix res( 1, 2, 3, 4, 75, 106 );
|
||||
m.translate( 10, 20 );
|
||||
QVERIFY( m == res );
|
||||
m.translate( -10, -20 );
|
||||
QVERIFY( m == res2 );
|
||||
}
|
||||
|
||||
void tst_QWMatrix::scale()
|
||||
{
|
||||
QMatrix m( 1, 2, 3, 4, 5, 6 );
|
||||
QMatrix res2( m );
|
||||
QMatrix res( 10, 20, 60, 80, 5, 6 );
|
||||
m.scale( 10, 20 );
|
||||
QVERIFY( m == res );
|
||||
m.scale( 1./10., 1./20. );
|
||||
QVERIFY( m == res2 );
|
||||
}
|
||||
|
||||
void tst_QWMatrix::mapPolygon()
|
||||
{
|
||||
QPolygon poly;
|
||||
poly << QPoint(0, 0) << QPoint(1, 1) << QPoint(100, 1) << QPoint(1, 100) << QPoint(-1, -1) << QPoint(-1000, 1000);
|
||||
|
||||
{
|
||||
QMatrix m;
|
||||
m.rotate(90);
|
||||
|
||||
// rotating 90 degrees four times should result in original poly
|
||||
QPolygon mapped = m.map(m.map(m.map(m.map(poly))));
|
||||
QCOMPARE(mapped, poly);
|
||||
|
||||
QMatrix m2;
|
||||
m2.scale(10, 10);
|
||||
QMatrix m3;
|
||||
m3.scale(0.1, 0.1);
|
||||
|
||||
mapped = m3.map(m2.map(poly));
|
||||
QCOMPARE(mapped, poly);
|
||||
}
|
||||
|
||||
{
|
||||
QMatrix m(1, 2, 3, 4, 5, 6);
|
||||
|
||||
QPolygon mapped = m.map(poly);
|
||||
for (int i = 0; i < mapped.size(); ++i)
|
||||
QCOMPARE(mapped.at(i), m.map(poly.at(i)));
|
||||
}
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QWMatrix)
|
||||
#include "tst_qwmatrix.moc"
|
@ -4496,19 +4496,6 @@ protected:
|
||||
break;
|
||||
case QGraphicsItem::ItemPositionHasChanged:
|
||||
break;
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
case QGraphicsItem::ItemMatrixChange: {
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QVariant variant;
|
||||
variant.setValue<QMatrix>(matrix());
|
||||
oldValues << variant;
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case QGraphicsItem::ItemTransformChange: {
|
||||
QVariant variant;
|
||||
variant.setValue<QTransform>(transform());
|
||||
@ -4626,32 +4613,7 @@ void tst_QGraphicsItem::itemChange()
|
||||
QCOMPARE(tester.oldValues.constLast(), QVariant(true));
|
||||
QCOMPARE(tester.isEnabled(), true);
|
||||
}
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED // QDesktopWidget::screen()
|
||||
// ItemMatrixChange / ItemTransformHasChanged
|
||||
tester.itemChangeReturnValue.setValue<QMatrix>(QMatrix().rotate(90));
|
||||
tester.setMatrix(QMatrix().translate(50, 0), true);
|
||||
++changeCount; // notification sent too
|
||||
QCOMPARE(tester.changes.size(), ++changeCount);
|
||||
QCOMPARE(int(tester.changes.at(tester.changes.size() - 2)), int(QGraphicsItem::ItemMatrixChange));
|
||||
QCOMPARE(int(tester.changes.last()), int(QGraphicsItem::ItemTransformHasChanged));
|
||||
QCOMPARE(qvariant_cast<QMatrix>(tester.values.at(tester.values.size() - 2)),
|
||||
QMatrix().translate(50, 0));
|
||||
QCOMPARE(tester.values.constLast(), QVariant(QTransform(QMatrix().rotate(90))));
|
||||
QVariant variant;
|
||||
variant.setValue<QMatrix>(QMatrix());
|
||||
QCOMPARE(tester.oldValues.constLast(), variant);
|
||||
QCOMPARE(tester.matrix(), QMatrix().rotate(90));
|
||||
QT_WARNING_POP
|
||||
}
|
||||
#endif
|
||||
{
|
||||
tester.resetTransform();
|
||||
++changeCount;
|
||||
++changeCount; // notification sent too
|
||||
|
||||
// ItemTransformChange / ItemTransformHasChanged
|
||||
tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90));
|
||||
tester.setTransform(QTransform::fromTranslate(50, 0), true);
|
||||
@ -8016,21 +7978,10 @@ public:
|
||||
//Doesn't use the extended style option so the exposed rect is the boundingRect
|
||||
if (!(flags() & QGraphicsItem::ItemUsesExtendedStyleOption)) {
|
||||
QCOMPARE(option->exposedRect, boundingRect());
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QCOMPARE(option->matrix, QMatrix());
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
} else {
|
||||
QVERIFY(option->exposedRect != QRect());
|
||||
QVERIFY(option->exposedRect != boundingRect());
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QCOMPARE(option->matrix, sceneTransform().toAffine());
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
QCOMPARE(option->matrix, sceneTransform());
|
||||
}
|
||||
}
|
||||
QGraphicsRectItem::paint(painter, option, widget);
|
||||
|
@ -2125,8 +2125,8 @@ void tst_QGraphicsView::mapFromScenePath()
|
||||
QPainterPath path2;
|
||||
path2.addPolygon(polygon2);
|
||||
|
||||
QPolygonF pathPoly = view.mapFromScene(path).toFillPolygon(QTransform());
|
||||
QPolygonF path2Poly = path2.toFillPolygon(QTransform());
|
||||
QPolygonF pathPoly = view.mapFromScene(path).toFillPolygon();
|
||||
QPolygonF path2Poly = path2.toFillPolygon();
|
||||
|
||||
for (int i = 0; i < pathPoly.size(); ++i) {
|
||||
QVERIFY(qAbs(pathPoly[i].x() - path2Poly[i].x()) < 3);
|
||||
|
@ -39,7 +39,6 @@
|
||||
Q_DECLARE_METATYPE(ExpectedValueDescription)
|
||||
Q_DECLARE_METATYPE(QList<int>)
|
||||
Q_DECLARE_METATYPE(QList<QRectF>)
|
||||
Q_DECLARE_METATYPE(QMatrix)
|
||||
Q_DECLARE_METATYPE(QPainterPath)
|
||||
Q_DECLARE_METATYPE(Qt::ScrollBarPolicy)
|
||||
Q_DECLARE_METATYPE(ScrollBarCount)
|
||||
|
Loading…
Reference in New Issue
Block a user