Commit b485765e authored by Claudio Valerio's avatar Claudio Valerio

fixed some errors on OS other than win

parent 92b664b3
...@@ -2576,31 +2576,18 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() ...@@ -2576,31 +2576,18 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
graphicsItemFromSvg(triangle); graphicsItemFromSvg(triangle);
//QStringRef angle = mXmlReader.attributes().value(mNamespaceUri, "angle");
//if (!angle.isNull())
//{
// protractor->setAngle(angle.toString().toFloat());
//}
//QStringRef markerAngle = mXmlReader.attributes().value(mNamespaceUri, "marker-angle");
//if (!markerAngle.isNull())
//{
// protractor->setMarkerAngle(markerAngle.toString().toFloat());
//}
QStringRef svgX = mXmlReader.attributes().value("x"); QStringRef svgX = mXmlReader.attributes().value("x");
QStringRef svgY = mXmlReader.attributes().value("y"); QStringRef svgY = mXmlReader.attributes().value("y");
QStringRef svgWidth = mXmlReader.attributes().value("width"); QStringRef svgWidth = mXmlReader.attributes().value("width");
QStringRef svgHeight = mXmlReader.attributes().value("height"); QStringRef svgHeight = mXmlReader.attributes().value("height");
UBGraphicsTriangle::UBGraphicsTriangleOrientation orientation =
UBGraphicsTriangle::orientationFromStr((mXmlReader.attributes().value("orientation"))); QStringRef orientationStringRef = mXmlReader.attributes().value("orientation");
UBGraphicsTriangle::UBGraphicsTriangleOrientation orientation = UBGraphicsTriangle::orientationFromStr(orientationStringRef);
if (!svgX.isNull() && !svgY.isNull() && !svgWidth.isNull() && !svgHeight.isNull()) if (!svgX.isNull() && !svgY.isNull() && !svgWidth.isNull() && !svgHeight.isNull())
{ {
triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat() triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat(), svgWidth.toString().toFloat(), svgHeight.toString().toFloat(), orientation);
, svgWidth.toString().toFloat(), svgHeight.toString().toFloat(),
orientation);
} }
triangle->setVisible(true); triangle->setVisible(true);
......
...@@ -7,69 +7,70 @@ class QGraphicsSvgItem; ...@@ -7,69 +7,70 @@ class QGraphicsSvgItem;
class UBAbstractDrawRuler : public QObject class UBAbstractDrawRuler : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
UBAbstractDrawRuler(); UBAbstractDrawRuler();
~UBAbstractDrawRuler(); ~UBAbstractDrawRuler();
void create(QGraphicsItem& item); void create(QGraphicsItem& item);
virtual void StartLine(const QPointF& position, qreal width); virtual void StartLine(const QPointF& position, qreal width);
virtual void DrawLine(const QPointF& position, qreal width); virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine(); virtual void EndLine();
protected:
void paint(); protected:
virtual UBGraphicsScene* scene() const = 0; void paint();
virtual void rotateAroundTopLeftOrigin(qreal angle) = 0; virtual UBGraphicsScene* scene() const = 0;
virtual QPointF topLeftOrigin() const = 0; virtual void rotateAroundTopLeftOrigin(qreal angle) = 0;
virtual QRectF resizeButtonRect() const = 0;
virtual QRectF closeButtonRect() const = 0;
virtual QRectF rotateButtonRect() const = 0;
void updateResizeCursor(QGraphicsItem &item); virtual QPointF topLeftOrigin() const = 0;
virtual QRectF resizeButtonRect() const = 0;
virtual QRectF closeButtonRect() const = 0;
virtual QRectF rotateButtonRect() const = 0;
bool mResizing; void updateResizeCursor(QGraphicsItem &item);
bool mRotating;
bool mShowButtons;
QGraphicsSvgItem* mCloseSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
QCursor mResizeCursor;
qreal mAntiScaleRatio;
QPointF startDrawPosition; bool mResizing;
bool mRotating;
bool mShowButtons;
QGraphicsSvgItem* mCloseSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
QCursor mResizeCursor;
qreal mAntiScaleRatio;
QCursor moveCursor() const; QPointF startDrawPosition;
QCursor resizeCursor() const;
QCursor rotateCursor() const;
QCursor closeCursor() const;
QCursor drawRulerLineCursor() const;
QColor drawColor() const; QCursor moveCursor() const;
QColor middleFillColor() const; QCursor resizeCursor() const;
QColor edgeFillColor() const; QCursor rotateCursor() const;
QFont font() const; QCursor closeCursor() const;
QCursor drawRulerLineCursor() const;
static const QColor sLightBackgroundEdgeFillColor; QColor drawColor() const;
static const QColor sLightBackgroundMiddleFillColor; QColor middleFillColor() const;
static const QColor sLightBackgroundDrawColor; QColor edgeFillColor() const;
static const QColor sDarkBackgroundEdgeFillColor; QFont font() const;
static const QColor sDarkBackgroundMiddleFillColor;
static const QColor sDarkBackgroundDrawColor;
static const int sLeftEdgeMargin = 10; static const QColor sLightBackgroundEdgeFillColor;
static const int sMinLength = 150; static const QColor sLightBackgroundMiddleFillColor;
static const int sDegreeToQtAngleUnit = 16; static const QColor sLightBackgroundDrawColor;
static const int sRotationRadius = 15; static const QColor sDarkBackgroundEdgeFillColor;
static const int sPixelsPerMillimeter = 5; static const QColor sDarkBackgroundMiddleFillColor;
static const int sFillTransparency = 127; static const QColor sDarkBackgroundDrawColor;
static const int sDrawTransparency = 192;
static const int sRoundingRadius = sLeftEdgeMargin / 2; static const int sLeftEdgeMargin = 10;
static const int sMinLength = 150;
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;
}; };
#endif #endif
\ No newline at end of file
This diff is collapsed.
...@@ -58,6 +58,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse ...@@ -58,6 +58,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event); virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event);
virtual QPainterPath shape() const; virtual QPainterPath shape() const;
QRectF boundingRect() const; QRectF boundingRect() const;
private: private:
// Helpers // Helpers
void paintGraduations (QPainter *painter); void paintGraduations (QPainter *painter);
...@@ -90,10 +91,13 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse ...@@ -90,10 +91,13 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
QGraphicsSvgItem* mResizeSvgItem; QGraphicsSvgItem* mResizeSvgItem;
QGraphicsSvgItem* mMarkerSvgItem; QGraphicsSvgItem* mMarkerSvgItem;
static const QRectF sDefaultRect; static const QRectF sDefaultRect;
virtual void rotateAroundTopLeftOrigin(qreal angle);
virtual QPointF topLeftOrigin() const;
virtual void rotateAroundTopLeftOrigin(qreal angle); int sFillTransparency;
virtual QPointF topLeftOrigin() const; int sDrawTransparency;
}; };
#endif /* UBGRAPHICSPROTRACTOR_H_ */ #endif /* UBGRAPHICSPROTRACTOR_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment