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()
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 svgY = mXmlReader.attributes().value("y");
QStringRef svgWidth = mXmlReader.attributes().value("width");
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())
{
triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat()
, svgWidth.toString().toFloat(), svgHeight.toString().toFloat(),
orientation);
triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat(), svgWidth.toString().toFloat(), svgHeight.toString().toFloat(), orientation);
}
triangle->setVisible(true);
......
......@@ -7,69 +7,70 @@ class QGraphicsSvgItem;
class UBAbstractDrawRuler : public QObject
{
Q_OBJECT
Q_OBJECT
public:
UBAbstractDrawRuler();
~UBAbstractDrawRuler();
public:
UBAbstractDrawRuler();
~UBAbstractDrawRuler();
void create(QGraphicsItem& item);
void create(QGraphicsItem& item);
virtual void StartLine(const QPointF& position, qreal width);
virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine();
protected:
virtual void StartLine(const QPointF& position, qreal width);
virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine();
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 QRectF resizeButtonRect() const = 0;
virtual QRectF closeButtonRect() const = 0;
virtual QRectF rotateButtonRect() const = 0;
virtual void rotateAroundTopLeftOrigin(qreal angle) = 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;
bool mRotating;
bool mShowButtons;
QGraphicsSvgItem* mCloseSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
QCursor mResizeCursor;
qreal mAntiScaleRatio;
void updateResizeCursor(QGraphicsItem &item);
QPointF startDrawPosition;
bool mResizing;
bool mRotating;
bool mShowButtons;
QGraphicsSvgItem* mCloseSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
QCursor mResizeCursor;
qreal mAntiScaleRatio;
QCursor moveCursor() const;
QCursor resizeCursor() const;
QCursor rotateCursor() const;
QCursor closeCursor() const;
QCursor drawRulerLineCursor() const;
QPointF startDrawPosition;
QColor drawColor() const;
QColor middleFillColor() const;
QColor edgeFillColor() const;
QFont font() const;
QCursor moveCursor() const;
QCursor resizeCursor() const;
QCursor rotateCursor() const;
QCursor closeCursor() const;
QCursor drawRulerLineCursor() const;
static const QColor sLightBackgroundEdgeFillColor;
static const QColor sLightBackgroundMiddleFillColor;
static const QColor sLightBackgroundDrawColor;
static const QColor sDarkBackgroundEdgeFillColor;
static const QColor sDarkBackgroundMiddleFillColor;
static const QColor sDarkBackgroundDrawColor;
QColor drawColor() const;
QColor middleFillColor() const;
QColor edgeFillColor() const;
QFont font() const;
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;
static const QColor sLightBackgroundEdgeFillColor;
static const QColor sLightBackgroundMiddleFillColor;
static const QColor sLightBackgroundDrawColor;
static const QColor sDarkBackgroundEdgeFillColor;
static const QColor sDarkBackgroundMiddleFillColor;
static const QColor sDarkBackgroundDrawColor;
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
\ No newline at end of file
#endif
This diff is collapsed.
......@@ -58,6 +58,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event);
virtual QPainterPath shape() const;
QRectF boundingRect() const;
private:
// Helpers
void paintGraduations (QPainter *painter);
......@@ -90,10 +91,13 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
QGraphicsSvgItem* mResizeSvgItem;
QGraphicsSvgItem* mMarkerSvgItem;
static const QRectF sDefaultRect;
static const QRectF sDefaultRect;
virtual void rotateAroundTopLeftOrigin(qreal angle);
virtual QPointF topLeftOrigin() const;
virtual void rotateAroundTopLeftOrigin(qreal angle);
virtual QPointF topLeftOrigin() const;
int sFillTransparency;
int sDrawTransparency;
};
#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