linux compilation fix

preferencesAboutTextFull
unknown 14 years ago
parent d515d0e5b5
commit b8928808de
  1. 9
      src/tools/UBAbstractDrawRuler.cpp
  2. 14
      src/tools/UBAbstractDrawRuler.h
  3. 2
      src/tools/UBGraphicsRuler.cpp
  4. 16
      src/tools/UBGraphicsTriangle.cpp
  5. 4
      src/tools/UBGraphicsTriangle.h

@ -18,6 +18,15 @@ const QColor UBAbstractDrawRuler::sDarkBackgroundMiddleFillColor = QColor(0xb5,
const QColor UBAbstractDrawRuler::sDarkBackgroundEdgeFillColor = QColor(0xdd, 0xdd, 0xdd, sFillTransparency);
const QColor UBAbstractDrawRuler::sDarkBackgroundDrawColor = QColor(0xff, 0xff, 0xff, sDrawTransparency);
const int UBAbstractDrawRuler::sLeftEdgeMargin = 10;
const int UBAbstractDrawRuler::sDegreeToQtAngleUnit = 16;
const int UBAbstractDrawRuler::sRotationRadius = 15;
const int UBAbstractDrawRuler::sPixelsPerMillimeter = 5;
const int UBAbstractDrawRuler::sFillTransparency = 127;
const int UBAbstractDrawRuler::sDrawTransparency = 192;
const int UBAbstractDrawRuler::sRoundingRadius = sLeftEdgeMargin / 2;
UBAbstractDrawRuler::UBAbstractDrawRuler()
: mShowButtons(false)
, mAntiScaleRatio(1.0)

@ -56,13 +56,13 @@ protected:
static const QColor sDarkBackgroundMiddleFillColor;
static const QColor sDarkBackgroundDrawColor;
static const int sLeftEdgeMargin = 10;
static const int sDegreeToQtAngleUnit = 16;
static const int sRotationRadius = 15;
static const int sPixelsPerMillimeter = 5;
static const int sFillTransparency = 127;
static const int sDrawTransparency = 192;
static const int sRoundingRadius = sLeftEdgeMargin / 2;
static const int sLeftEdgeMargin;
static const int sDegreeToQtAngleUnit;
static const int sRotationRadius;
static const int sPixelsPerMillimeter;
static const int sFillTransparency;
static const int sDrawTransparency;
static const int sRoundingRadius;
};

@ -17,7 +17,7 @@
#include "core/memcheck.h"
const QRect UBGraphicsRuler::sDefaultRect = QRect(0, 0, 800, 96);
const QRect UBGraphicsRuler::sDefaultRect = QRect(0, 0, 800, 96);
UBGraphicsRuler::UBGraphicsRuler()

@ -20,6 +20,7 @@ UBGraphicsTriangle::UBGraphicsTriangle()
, mResizing1(false)
, mResizing2(false)
, mRotating(false)
, angle(0)
{
setRect(sDefaultRect, sDefaultOrientation);
@ -89,7 +90,9 @@ void UBGraphicsTriangle::setOrientation(UBGraphicsTriangleOrientation orientatio
t.setMatrix(-1, 0, 0, 0, -1, 0, boundingRect().right(), boundingRect().bottom(), 1);
break;
}
setTransform(t, true);
rotateAroundCenter(t);
setTransform(t);
}
UBGraphicsScene* UBGraphicsTriangle::scene() const
@ -203,7 +206,7 @@ void UBGraphicsTriangle::paintGraduations(QPainter *painter)
// Check that grad. line inside triangle
qreal lineY = rect().bottom() - rect().height()/rect().width()*(rect().width() - graduationX);
if (lineY >= rotationCenter().y() + rect().height() - graduationHeight)
if (lineY >= rotationCenter().y() - graduationHeight)
break;
painter->drawLine(QLine(graduationX, rotationCenter().y(), graduationX, rotationCenter().y() - graduationHeight));
@ -233,13 +236,20 @@ void UBGraphicsTriangle::paintGraduations(QPainter *painter)
void UBGraphicsTriangle::rotateAroundCenter(qreal angle)
{
this->angle = angle;
QTransform transform;
rotateAroundCenter(transform);
setTransform(transform, true);
}
void UBGraphicsTriangle::rotateAroundCenter(QTransform& transform)
{
transform.translate(rotationCenter().x(), rotationCenter().y());
transform.rotate(angle);
transform.translate(- rotationCenter().x(), - rotationCenter().y());
setTransform(transform, true);
}
QPointF UBGraphicsTriangle::rotationCenter() const
{
return QPointF(rect().x() + sLeftEdgeMargin , rect().bottom());

@ -92,6 +92,10 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
private:
QTransform calculateRotationTransform();
qreal angle;
void rotateAroundCenter(QTransform& transform);
bool mResizing1;
bool mResizing2;
bool mRotating;

Loading…
Cancel
Save