本文整理汇总了C++中QTransform::m21方法的典型用法代码示例。如果您正苦于以下问题:C++ QTransform::m21方法的具体用法?C++ QTransform::m21怎么用?C++ QTransform::m21使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTransform
的用法示例。
在下文中一共展示了QTransform::m21方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translateOrigin
void ellipse::translateOrigin(qreal x, qreal y)
{
this->transformationTranslate = this->transformationTranslate.translate(x, y);
this->transformationMatrix = this->transformationScale* this->transformationRotate * this->transformationTranslate;
this->transformationMatrix = transformationScale * transformationRotate * transformationTranslate;
if(!this->transformationMatrix.isInvertible())
{
//qDebug() << "Notinvertible";
}
QTransform inverted = this->transformationMatrix.inverted();
data.scaleX = (cl_float) inverted.m11();
data.scaleY = (cl_float) inverted.m22();
data.angleX = (cl_float) inverted.m21();
data.angleY = (cl_float) inverted.m12();
data.dx = (cl_float) inverted.dx();
data.dy = (cl_float) inverted.dy();
}
示例2: QTransformToString
QString QTransformToString (const QTransform &transform)
{
const int FIELD_WIDTH = 12;
QString str = QString ("%1 %2 %3 %4\n"
"%5 %6 %7 %8\n"
"%9 %10 %11 %12")
.arg (INDENTATION_PAST_TIMESTAMP)
.arg (transform.m11 (), FIELD_WIDTH)
.arg (transform.m12 (), FIELD_WIDTH)
.arg (transform.m13 (), FIELD_WIDTH)
.arg (INDENTATION_PAST_TIMESTAMP)
.arg (transform.m21 (), FIELD_WIDTH)
.arg (transform.m22 (), FIELD_WIDTH)
.arg (transform.m23 (), FIELD_WIDTH)
.arg (INDENTATION_PAST_TIMESTAMP)
.arg (transform.m31 (), FIELD_WIDTH)
.arg (transform.m32 (), FIELD_WIDTH)
.arg (transform.m33 (), FIELD_WIDTH);
return str;
}
示例3: properties
QDomElement TupSerializer::properties(const QGraphicsItem *item, QDomDocument &doc)
{
QDomElement properties = doc.createElement("properties");
QString strMatrix = "matrix(";
QTransform m = item->transform();
qreal a = m.m11();
qreal b = m.m12();
qreal c = m.m21();
qreal d = m.m22();
qreal e = m.dx();
qreal f = m.dy();
strMatrix += QString::number(a) + "," + QString::number(b) + "," + QString::number(c) + "," + QString::number(d) + "," + QString::number(e) + "," + QString::number(f) + ")" ;
properties.setAttribute("transform", strMatrix);
properties.setAttribute("pos", "(" + QString::number(item->pos().x()) + "," + QString::number(item->pos().y()) + ")");
properties.setAttribute("enabled", item->isEnabled());
properties.setAttribute("flags", item->flags());
return properties;
}
示例4: loadTransform
bool GraphicsUtils::loadTransform(const QDomElement & transformElement, QTransform & transform)
{
if (transformElement.isNull()) return false;
double m11 = transform.m11();
double m12 = transform.m12();
double m13 = transform.m13();
double m21 = transform.m21();
double m22 = transform.m22();
double m23 = transform.m23();
double m31 = transform.m31();
double m32 = transform.m32();
double m33 = transform.m33();
bool ok;
double temp;
temp = transformElement.attribute("m11").toDouble(&ok);
if (ok) m11 = temp;
temp = transformElement.attribute("m12").toDouble(&ok);
if (ok) m12 = temp;
temp = transformElement.attribute("m13").toDouble(&ok);
if (ok) m13 = temp;
temp = transformElement.attribute("m21").toDouble(&ok);
if (ok) m21 = temp;
temp = transformElement.attribute("m22").toDouble(&ok);
if (ok) m22 = temp;
temp = transformElement.attribute("m23").toDouble(&ok);
if (ok) m23 = temp;
temp = transformElement.attribute("m31").toDouble(&ok);
if (ok) m31 = temp;
temp = transformElement.attribute("m32").toDouble(&ok);
if (ok) m32 = temp;
temp = transformElement.attribute("m33").toDouble(&ok);
if (ok) m33 = temp;
transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
return true;
}
示例5: updateSize
void CWhiteBoardView::updateSize(const QSize &size)
{
if(size.width() <= 0 && size.height() <= 0)
{
return;
}
QSize adjustSize = size;
if(m_data->m_needScale)
{
QRectF sceneRect = m_data->m_baseRect;
if(sceneRect.width() < 0.001 && sceneRect.height() < 0.001)
{
return;
}
qreal sx = size.width() / sceneRect.width();
qreal sy = size.height() / sceneRect.height();
QTransform form = this->transform();
form.setMatrix(sx,form.m12(),form.m13(),form.m21(),sy,form.m23(),form.m31(),form.m32(),form.m33());
this->setTransform(form);
adjustSize = sceneRect.size().toSize();
}
else
{
QTransform form = this->transform();
form.reset();
this->setTransform(form);
m_data->m_scene->setSceneRect(QRect(0,0,adjustSize.width(),adjustSize.height()));
}
if(m_data->m_backgroundColor.alpha() == 0)
{
m_data->m_backgroundColor.setAlpha(1);
}
QPixmap pixmap(adjustSize);
pixmap.fill(m_data->m_backgroundColor);
m_data->m_whiteBoardItem->setPixmap(pixmap);
}
示例6: diffxyz
QVector3D Conversions::enu2xyz(const QVector3D & enu, qreal reflat, qreal reflon, qreal refalt)
{
const QTransform R1 = Conversions::rot(90.0 + reflon,3);
const QTransform R2 = Conversions::rot(90.0 - reflat,1);
const QTransform R = R2*R1;
const QTransform invR = R.inverted();
if (invR.isIdentity())
{
qDebug() << "Failed to invert rotation matrix --- did you enter a bad lat,lon,or alt?";
return enu;
}
qreal x = invR.m11()*enu.x() + invR.m12()*enu.y() + invR.m13()*enu.z();
qreal y = invR.m21()*enu.x() + invR.m22()*enu.y() + invR.m23()*enu.z();
qreal z = invR.m31()*enu.x() + invR.m32()*enu.y() + invR.m33()*enu.z();
QVector3D diffxyz(x,y,z);
QVector3D refxyz = Conversions::lla2xyz(reflat,reflon,refalt);
return (diffxyz + refxyz);
}
示例7: QTransform
/*
* m11 m12 0
* m21 m22 0
* dx dy 1
*
* m11 = horizontale Skalierung
* m22 = vertikale Skalierung
*
* m21 = horizontale drehung
* m12 = vertikale drehung
*
* dx = translation x
* dy = translation y
*/
ellipse::ellipse(qreal midPointX, qreal midPointY, qreal radiusX, qreal radiusY)
{
//Constructor vertikale Skalierung, vertikale Drehung, horizontale Drehung, horizontale Skalierung, translate X, translate Y
this->transformationRotate = QTransform(1, 0, 0, 1, 0, 0);
this->transformationScale = QTransform(radiusX, 0, 0, radiusY, 0, 0);
this->transformationTranslate = QTransform(1, 0, 0, 1, midPointX, midPointY);
this->transformationMatrix = this->transformationScale * this->transformationRotate * this->transformationTranslate;
if(!this->transformationMatrix.isInvertible())
{
//qDebug() << "Notinvertible";
}
QTransform inverted = this->transformationMatrix.inverted();
data.scaleX = (cl_float) inverted.m11();
data.scaleY = (cl_float) inverted.m22();
data.angleX = (cl_float) inverted.m21();
data.angleY = (cl_float) inverted.m12();
data.dx = (cl_float) inverted.dx();
data.dy = (cl_float) inverted.dy();
}
示例8: checkEigenvalues
bool Features::checkEigenvalues(QTransform tr){
double eig1, eig2, eig3, minDist;
//qDebug() << "EIGENVALUES";
QString program = "./eig/eig.exe";
QStringList arguments;
arguments << QString::number(tr.m11());
arguments << QString::number(tr.m12());
arguments << QString::number(tr.m13());
arguments << QString::number(tr.m21());
arguments << QString::number(tr.m22());
arguments << QString::number(tr.m23());
arguments << QString::number(tr.m31());
arguments << QString::number(tr.m32());
arguments << QString::number(tr.m33());
QProcess *eig = new QProcess();
eig->start(program, arguments);
eig->waitForFinished();
QString line;
line = eig->readLine();
eig1 = line.left(line.indexOf('.') + 5).remove('\n').toDouble();
line = eig->readLine();
eig2 = line.left(line.indexOf('.') + 5).remove('\n').toDouble();
line = eig->readLine();
eig3 = line.left(line.indexOf('.') + 5).remove('\n').toDouble();
//qDebug() << "Eig1:" << eig1 << "| Eig2:" << eig2 << "| Eig3:" << eig3;
minDist = abs(eig1 - eig2);
if(abs(eig1 - eig3) < minDist) minDist = abs(eig1 - eig3);
if(abs(eig2 - eig3) < minDist) minDist = abs(eig2 - eig3);
//qDebug() << "MinDist:" << minDist;
return minDist <= 0.5;
}
示例9: paintCheckerPattern
void Tile::paintCheckerPattern(GraphicsContext* context, const FloatRect& target)
{
QPainter* painter = context->platformContext();
QTransform worldTransform = painter->worldTransform();
qreal scaleX = worldTransform.m11();
qreal scaleY = worldTransform.m22();
QRect targetViewRect = QRectF(target.x() * scaleX,
target.y() * scaleY,
target.width() * scaleX,
target.height() * scaleY).toAlignedRect();
QTransform adjustedTransform(1., worldTransform.m12(), worldTransform.m13(),
worldTransform.m21(), 1., worldTransform.m23(),
worldTransform.m31(), worldTransform.m32(), worldTransform.m33());
painter->setWorldTransform(adjustedTransform);
painter->drawTiledPixmap(targetViewRect,
checkeredPixmap(),
QPoint(targetViewRect.left() % checkerSize,
targetViewRect.top() % checkerSize));
painter->setWorldTransform(worldTransform);
}
示例10: getNewItemPosition
void CanvasMode_Rotate::getNewItemPosition(PageItem* item, FPoint& pos, double& rotation)
{
double newAngle = xy2Deg(m_canvasCurrCoord.x() - m_rotCenter.x(), m_canvasCurrCoord.y() - m_rotCenter.y());
if (m_angleConstrained)
{
newAngle = constrainAngle(newAngle, m_doc->opToolPrefs().constrain);
/*double oldAngle = constrainAngle(m_startAngle, m_doc->opToolPrefs.constrain);
newAngle = m_doc->m_Selection->isMultipleSelection() ? (newAngle - oldAngle) : newAngle;*/
m_view->oldW = constrainAngle(m_view->oldW, m_doc->opToolPrefs().constrain);
newAngle = m_doc->m_Selection->isMultipleSelection() ? (newAngle - m_view->oldW) : newAngle;
}
else if (m_doc->m_Selection->isMultipleSelection())
newAngle = (newAngle - m_startAngle);
else
newAngle = item->rotation() - (m_startAngle - newAngle);
if (m_doc->m_Selection->isMultipleSelection())
{
QTransform ma;
ma.translate(m_rotCenter.x(), m_rotCenter.y());
ma.scale(1, 1);
ma.rotate(newAngle);
FPoint n(item->xPos() - m_rotCenter.x(), item->yPos() - m_rotCenter.y());
pos.setXY(ma.m11() * n.x() + ma.m21() * n.y() + ma.dx(), ma.m22() * n.y() + ma.m12() * n.x() + ma.dy());
rotation = item->rotation() + newAngle;
}
else if (m_rotMode != 0)
{
FPoint n(0,0);
QTransform ma;
ma.translate(item->xPos(), item->yPos());
ma.scale(1, 1);
ma.rotate(item->rotation());
double ro = newAngle - item->rotation();
switch (m_rotMode)
{
case 2:
ma.translate(item->width()/2.0, item->height()/2.0);
n = FPoint(-item->width()/2.0, -item->height()/2.0);
break;
case 4:
ma.translate(item->width(), item->height());
n = FPoint(-item->width(), -item->height());
break;
case 3:
ma.translate(0, item->height());
n = FPoint(0, -item->height());
break;
case 1:
ma.translate(item->width(), 0);
n = FPoint(-item->width(), 0);
break;
}
ma.rotate(ro);
pos.setXY(ma.m11() * n.x() + ma.m21() * n.y() + ma.dx(), ma.m22() * n.y() + ma.m12() * n.x() + ma.dy());
rotation = newAngle;
}
else
{
pos.setXY(item->xPos(), item->yPos());
rotation = newAngle;
}
}
示例11: imageForGlyph
QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
QFixed subPixelPosition,
int margin,
const QTransform &xform)
{
glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform);
int width = (metrics.width + margin * 2 + 4).ceil().toInt() ;
int height = (metrics.height + margin * 2 + 4).ceil().toInt();
UINT16 glyphIndex = t;
FLOAT glyphAdvance = metrics.xoff.toReal();
DWRITE_GLYPH_OFFSET glyphOffset;
glyphOffset.advanceOffset = 0;
glyphOffset.ascenderOffset = 0;
DWRITE_GLYPH_RUN glyphRun;
glyphRun.fontFace = m_directWriteFontFace;
glyphRun.fontEmSize = fontDef.pixelSize;
glyphRun.glyphCount = 1;
glyphRun.glyphIndices = &glyphIndex;
glyphRun.glyphAdvances = &glyphAdvance;
glyphRun.isSideways = false;
glyphRun.bidiLevel = 0;
glyphRun.glyphOffsets = &glyphOffset;
QFixed x = margin - metrics.x.floor() + subPixelPosition;
QFixed y = margin - metrics.y.floor();
DWRITE_MATRIX transform;
transform.dx = x.toReal();
transform.dy = y.toReal();
transform.m11 = xform.m11();
transform.m12 = xform.m12();
transform.m21 = xform.m21();
transform.m22 = xform.m22();
IDWriteGlyphRunAnalysis *glyphAnalysis = NULL;
HRESULT hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis(
&glyphRun,
1.0f,
&transform,
DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC,
DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0,
&glyphAnalysis
);
if (SUCCEEDED(hr)) {
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = width;
rect.bottom = height;
int size = width * height * 3;
BYTE *alphaValues = new BYTE[size];
memset(alphaValues, size, 0);
hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1,
&rect,
alphaValues,
size);
if (SUCCEEDED(hr)) {
QImage img(width, height, QImage::Format_RGB32);
img.fill(0xffffffff);
for (int y=0; y<height; ++y) {
uint *dest = reinterpret_cast<uint *>(img.scanLine(y));
BYTE *src = alphaValues + width * 3 * y;
for (int x=0; x<width; ++x) {
dest[x] = *(src) << 16
| *(src + 1) << 8
| *(src + 2);
src += 3;
}
}
delete[] alphaValues;
glyphAnalysis->Release();
return img;
} else {
delete[] alphaValues;
glyphAnalysis->Release();
qErrnoWarning("%s: CreateAlphaTexture failed", __FUNCTION__);
}
} else {
qErrnoWarning("%s: CreateGlyphRunAnalysis failed", __FUNCTION__);
}
return QImage();
}
示例12: saveOdf
//.........这里部分代码省略.........
// horizontal-pos
switch (d->horizontalPos) {
case HCenter:
shape()->setAdditionalStyleAttribute("style:horizontal-pos", "center");
break;
case HFromInside:
shape()->setAdditionalStyleAttribute("style:horizontal-pos", "from-inside");
break;
case HFromLeft:
shape()->setAdditionalStyleAttribute("style:horizontal-pos", "from-left");
break;
case HInside:
shape()->setAdditionalStyleAttribute("style:horizontal-posl", "inside");
break;
case HLeft:
shape()->setAdditionalStyleAttribute("style:horizontal-pos", "left");
break;
case HOutside:
shape()->setAdditionalStyleAttribute("style:horizontal-pos", "outside");
break;
case HRight:
shape()->setAdditionalStyleAttribute("style:horizontal-pos", "right");
break;
default:
break;
}
// horizontal-rel
switch (d->horizontalRel) {
case HChar:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "char");
break;
case HPage:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "page");
break;
case HPageContent:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "page-content");
break;
case HPageStartMargin:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "page-start-margin");
break;
case HPageEndMargin:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "page-end-margin");
break;
case HFrame:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "frame");
break;
case HFrameContent:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "frame-content");
break;
case HFrameEndMargin:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "frame-end-margin");
break;
case HFrameStartMargin:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "frame-start-margin");
break;
case HParagraph:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "paragraph");
break;
case HParagraphContent:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "paragraph-content");
break;
case HParagraphEndMargin:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "paragraph-end-margin");
break;
case HParagraphStartMargin:
shape()->setAdditionalStyleAttribute("style:horizontal-rel", "paragraph-start-margin");
break;
default:
break;
}
if (!d->wrapInfluenceOnPosition.isEmpty()) {
shape()->setAdditionalStyleAttribute("draw:wrap-influence-on-position", d->wrapInfluenceOnPosition);
}
if (d->flowWithText) {
shape()->setAdditionalStyleAttribute("style:flow-with-text", "true");
} else {
shape()->setAdditionalStyleAttribute("style:flow-with-text", "false");
}
if (shape()->parent()) {// an anchor may not yet have been layout-ed
QTransform parentMatrix = shape()->parent()->absoluteTransformation(0).inverted();
QTransform shapeMatrix = shape()->absoluteTransformation(0);;
qreal dx = d->offset.x() - shapeMatrix.dx()*parentMatrix.m11()
- shapeMatrix.dy()*parentMatrix.m21();
qreal dy = d->offset.y() - shapeMatrix.dx()*parentMatrix.m12()
- shapeMatrix.dy()*parentMatrix.m22();
context.addShapeOffset(shape(), QTransform(parentMatrix.m11(),parentMatrix.m12(),
parentMatrix.m21(),parentMatrix.m22(),
dx,dy));
}
shape()->saveOdf(context);
context.removeShapeOffset(shape());
}
示例13: device_rect
void
PixmapRenderer::drawPixmap(
QPainter& painter, QPixmap const& pixmap)
{
#if !defined(Q_WS_X11)
drawPixmapNoXRender(painter, pixmap);
#else
QPaintDevice* const dev = painter.device();
QPoint offset; // Both x and y will be either zero or negative.
QPaintDevice* const redir_dev = QPainter::redirected(painter.device(), &offset);
QPaintDevice* const paint_dev = redir_dev ? redir_dev : dev;
#if defined(ENABLE_OPENGL)
if (dynamic_cast<QGLWidget*>(paint_dev)) {
drawPixmapNoXRender(painter, pixmap);
return;
}
#endif
QRect const device_rect(
QRect(0, 0, dev->width(), dev->height()).translated(-offset)
);
QRectF const src_rect(pixmap.rect());
Display* const dpy = QX11Info::display();
Picture const src_pict = pixmap.x11PictureHandle();
Picture dst_pict = 0;
if (QWidget* widget = dynamic_cast<QWidget*>(paint_dev)) {
dst_pict = widget->x11PictureHandle();
} else if (QPixmap* pixmap = dynamic_cast<QPixmap*>(paint_dev)) {
dst_pict = pixmap->x11PictureHandle();
}
if (!dst_pict) {
drawPixmapNoXRender(painter, pixmap);
return;
}
// Note that device transform already accounts for offset
// within a destination surface.
QTransform const src_to_dst(painter.deviceTransform());
QTransform const dst_to_src(src_to_dst.inverted());
QPolygonF const dst_poly(src_to_dst.map(src_rect));
XTransform xform = {{
{
XDoubleToFixed(dst_to_src.m11()),
XDoubleToFixed(dst_to_src.m21()),
XDoubleToFixed(dst_to_src.m31())
},
{
XDoubleToFixed(dst_to_src.m12()),
XDoubleToFixed(dst_to_src.m22()),
XDoubleToFixed(dst_to_src.m32())
},
{
XDoubleToFixed(dst_to_src.m13()),
XDoubleToFixed(dst_to_src.m23()),
XDoubleToFixed(dst_to_src.m33())
}
}};
XRenderSetPictureTransform(dpy, src_pict, &xform);
char const* filter = "fast";
if (painter.testRenderHint(QPainter::SmoothPixmapTransform)) {
filter = "good";
}
XRenderSetPictureFilter(dpy, src_pict, filter, 0, 0);
QRectF const dst_rect_precise(dst_poly.boundingRect());
QRect const dst_rect_fitting(
QPoint(
int(ceil(dst_rect_precise.left())),
int(ceil(dst_rect_precise.top()))
),
QPoint(
int(floor(dst_rect_precise.right())) - 1,
int(floor(dst_rect_precise.bottom())) - 1
)
);
QRect dst_bounding_rect(device_rect);
if (painter.hasClipping()) {
QRect const clip_rect(
src_to_dst.map(painter.clipPath()).boundingRect().toRect()
);
dst_bounding_rect = dst_bounding_rect.intersected(clip_rect);
}
QRect const dst_rect(dst_rect_fitting.intersect(dst_bounding_rect));
// Note that XRenderComposite() expects destination coordinates
// everywhere, even for source picture origin.
XRenderComposite(
dpy, PictOpSrc,
src_pict, 0, dst_pict, dst_rect.left(), dst_rect.top(), 0, 0,
dst_rect.left(), dst_rect.top(), dst_rect.width(), dst_rect.height()
);
//.........这里部分代码省略.........
示例14: setData
bool PropertyMatrixModel::setData(const QModelIndex &index, const QVariant &data, int role)
{
if (!index.isValid())
return false;
if (role != Qt::EditRole)
return false;
bool ok = false;
float floatData = data.toFloat(&ok);
if (!ok)
return false;
switch (m_matrix.type()) {
case QVariant::Vector2D: {
QVector2D value = m_matrix.value<QVector2D>();
switch (index.row()) {
case 0: value.setX(floatData); break;
case 1: value.setY(floatData); break;
}
m_matrix = value;
break;
}
case QVariant::Vector3D: {
QVector3D value = m_matrix.value<QVector3D>();
switch (index.row()) {
case 0: value.setX(floatData); break;
case 1: value.setY(floatData); break;
case 2: value.setZ(floatData); break;
}
m_matrix = value;
break;
}
case QVariant::Vector4D: {
QVector4D value = m_matrix.value<QVector4D>();
switch (index.row()) {
case 0: value.setX(floatData); break;
case 1: value.setY(floatData); break;
case 2: value.setZ(floatData); break;
case 3: value.setW(floatData); break;
}
m_matrix = value;
break;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QVariant::Quaternion: {
float pitch, yaw, roll;
const QQuaternion value = m_matrix.value<QQuaternion>();
value.getEulerAngles(&pitch, &yaw, &roll);
switch (index.row()) {
case 0: pitch = floatData; break;
case 1: yaw = floatData; break;
case 2: roll = floatData; break;
}
m_matrix = QQuaternion::fromEulerAngles(pitch, yaw, roll);
break;
}
#endif
case QVariant::Matrix: {
QMatrix value = m_matrix.value<QMatrix>();
switch (index.row() << 4 | index.column()) {
case 0x00: value.setMatrix(floatData, value.m12(), value.m21(), value.m22(), value.dx(), value.dy()); break;
case 0x01: value.setMatrix(value.m11(), floatData, value.m21(), value.m22(), value.dx(), value.dy()); break;
case 0x10: value.setMatrix(value.m11(), value.m12(), floatData, value.m22(), value.dx(), value.dy()); break;
case 0x11: value.setMatrix(value.m11(), value.m12(), value.m21(), floatData, value.dx(), value.dy()); break;
case 0x20: value.setMatrix(value.m11(), value.m12(), value.m21(), value.m22(), floatData, value.dy()); break;
case 0x21: value.setMatrix(value.m11(), value.m12(), value.m21(), value.m22(), value.dx(), floatData); break;
}
m_matrix = value;
break;
}
case QVariant::Transform: {
QTransform value = m_matrix.value<QTransform>();
switch (index.row() << 4 | index.column()) {
case 0x00: value.setMatrix(floatData, value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x01: value.setMatrix(value.m11(), floatData, value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x02: value.setMatrix(value.m11(), value.m12(), floatData, value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x10: value.setMatrix(value.m11(), value.m12(), value.m13(), floatData, value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x11: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), floatData, value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x12: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), floatData, value.m31(), value.m32(), value.m33()); break;
case 0x20: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), floatData, value.m32(), value.m33()); break;
case 0x21: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), floatData, value.m33()); break;
case 0x22: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), floatData); break;
}
m_matrix = value;
//.........这里部分代码省略.........
示例15: transform
WMatrix transform(const QTransform& matrix)
{
return WMatrix(matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), matrix.dx(), matrix.dy());
}