Fix support Qt 5.0.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-10-23 19:38:34 +03:00
parent 0a83886f09
commit c203986111

View File

@ -420,9 +420,16 @@ void VToolDetail::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
{
if (scene()->views().count() > 0)
{
QPoint pt0 = scene()->views().at(0)->mapFromScene(0, 0);
QPoint pt = scene()->views().at(0)->mapFromScene(0, 100);
qreal dScale = qSqrt(QPoint::dotProduct(pt - pt0, pt - pt0));
const QPoint pt0 = scene()->views().at(0)->mapFromScene(0, 0);
const QPoint pt = scene()->views().at(0)->mapFromScene(0, 100);
const QPoint p = pt - pt0;
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
const qreal dScale = qSqrt(QPoint::dotProduct(p, p));
#else
const qreal dScale = qSqrt(p.xp * p.xp + p.yp * p.yp);
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
grainLine->SetScale(100/dScale);
//qDebug() << "SCALE" << dScale << 10/dScale;
}