Exemple #1
0
bool QPaintEngineEx::supportsTransformations(qreal pixelSize, const QTransform &m) const
{
    Q_UNUSED(pixelSize);

    if (!m.isAffine())
        return true;

    return false;
}
Exemple #2
0
bool QPaintEngineEx::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const
{
    Q_UNUSED(fontEngine);

    if (!m.isAffine())
        return true;

    return false;
}
Exemple #3
0
void TransformTest::testTransformIdentity()
{
	// Default QTransform: identity
	QTransform qt;
	QVERIFY(qt.isIdentity());
	QCOMPARE(int(qt.type()), int(QTransform::TxNone));
	
	// Default TemplateTransform: identity
	TemplateTransform t;
	
	// TemplateTransform list initialization, and assignment
	t = { 12, -3, 0.1, 2.0, 3.0 };
	QCOMPARE(t.template_x, 12);
	QCOMPARE(t.template_y, -3);
	QCOMPARE(t.template_scale_x, 2.0);
	QCOMPARE(t.template_scale_y, 3.0);
	QCOMPARE(t.template_rotation, 0.1);
	
	// Now transfer the identity QTransform to the TemplateTransform
	t = TemplateTransform::fromQTransform(qt);
	QCOMPARE(t.template_x, 0);
	QCOMPARE(t.template_y, 0);
	QCOMPARE(t.template_scale_x, 1.0);
	QCOMPARE(t.template_scale_y, 1.0);
	QCOMPARE(t.template_rotation, 0.0);
	
	// Put something different in the QTransform
	qt.translate(4, 8);
	qt.rotate(1);
	qt.scale(2.0, 1.5);
	QVERIFY(qt.isAffine());
	QVERIFY(!qt.isIdentity());
	QVERIFY(qt.isTranslating());
	QVERIFY(qt.isRotating());
	QVERIFY(qt.isScaling());
}