From c2039861112498b5f830b0509b2302fb2a417646 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 23 Oct 2016 19:38:34 +0300 Subject: [PATCH] Fix support Qt 5.0. --HG-- branch : develop --- src/libs/vtools/tools/vtooldetail.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 7694f92cf..495591597 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -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; }