[qet] [2035] Element editor: introduced CustomElementPart::sceneGeometricRect(), which provides a margin-less equivalent to sceneBoundingRect().

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2035
Author:   xavier
Date:     2013-02-11 19:35:13 +0100 (Mon, 11 Feb 2013)
Log Message:
-----------
Element editor: introduced CustomElementPart::sceneGeometricRect(), which provides a margin-less equivalent to sceneBoundingRect().

Modified Paths:
--------------
    trunk/sources/editor/customelementpart.h
    trunk/sources/editor/partarc.cpp
    trunk/sources/editor/partarc.h
    trunk/sources/editor/partcircle.cpp
    trunk/sources/editor/partcircle.h
    trunk/sources/editor/partellipse.cpp
    trunk/sources/editor/partellipse.h
    trunk/sources/editor/partline.cpp
    trunk/sources/editor/partline.h
    trunk/sources/editor/partpolygon.cpp
    trunk/sources/editor/partpolygon.h
    trunk/sources/editor/partrectangle.cpp
    trunk/sources/editor/partrectangle.h
    trunk/sources/editor/partterminal.cpp
    trunk/sources/editor/partterminal.h
    trunk/sources/editor/parttext.cpp
    trunk/sources/editor/parttext.h
    trunk/sources/editor/parttextfield.cpp
    trunk/sources/editor/parttextfield.h

Modified: trunk/sources/editor/customelementpart.h
===================================================================
--- trunk/sources/editor/customelementpart.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/customelementpart.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -73,6 +73,7 @@
 		Typically, useless primitives are discarded when saving the element.
 	*/
 	virtual bool isUseless() const = 0;
+	virtual QRectF sceneGeometricRect() const = 0;
 	/**
 		Inform this part a user-induced transformation is about to begin. This method can be used to save data required by handleUserTransformation().
 	*/

Modified: trunk/sources/editor/partarc.cpp
===================================================================
--- trunk/sources/editor/partarc.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partarc.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -257,6 +257,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartArc::sceneGeometricRect() const {
+	return(mapToScene(rect()).boundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/partarc.h
===================================================================
--- trunk/sources/editor/partarc.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partarc.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -60,6 +60,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	

Modified: trunk/sources/editor/partcircle.cpp
===================================================================
--- trunk/sources/editor/partcircle.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partcircle.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -200,6 +200,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartCircle::sceneGeometricRect() const {
+	return(mapToScene(rect()).boundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/partcircle.h
===================================================================
--- trunk/sources/editor/partcircle.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partcircle.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -52,6 +52,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	

Modified: trunk/sources/editor/partellipse.cpp
===================================================================
--- trunk/sources/editor/partellipse.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partellipse.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -190,6 +190,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartEllipse::sceneGeometricRect() const {
+	return(mapToScene(rect()).boundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/partellipse.h
===================================================================
--- trunk/sources/editor/partellipse.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partellipse.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -51,6 +51,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	

Modified: trunk/sources/editor/partline.cpp
===================================================================
--- trunk/sources/editor/partline.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partline.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -477,6 +477,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartLine::sceneGeometricRect() const {
+	return(QRectF(sceneP1(), sceneP2()));
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/partline.h
===================================================================
--- trunk/sources/editor/partline.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partline.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -68,6 +68,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	virtual void setFirstEndType(const QET::EndType &);

Modified: trunk/sources/editor/partpolygon.cpp
===================================================================
--- trunk/sources/editor/partpolygon.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partpolygon.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -164,6 +164,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartPolygon::sceneGeometricRect() const {
+	return(mapToScene(polygon().boundingRect()).boundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/partpolygon.h
===================================================================
--- trunk/sources/editor/partpolygon.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partpolygon.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -56,6 +56,7 @@
 	void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	

Modified: trunk/sources/editor/partrectangle.cpp
===================================================================
--- trunk/sources/editor/partrectangle.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partrectangle.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -197,6 +197,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartRectangle::sceneGeometricRect() const {
+	return(mapToScene(rect()).boundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/partrectangle.h
===================================================================
--- trunk/sources/editor/partrectangle.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partrectangle.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -51,6 +51,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	

Modified: trunk/sources/editor/partterminal.cpp
===================================================================
--- trunk/sources/editor/partterminal.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partterminal.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -221,6 +221,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartTerminal::sceneGeometricRect() const {
+	return(sceneBoundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/partterminal.h
===================================================================
--- trunk/sources/editor/partterminal.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/partterminal.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -57,6 +57,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	

Modified: trunk/sources/editor/parttext.cpp
===================================================================
--- trunk/sources/editor/parttext.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/parttext.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -304,6 +304,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartText::sceneGeometricRect() const {
+	return(sceneBoundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a rect bounding rectangle.
 */

Modified: trunk/sources/editor/parttext.h
===================================================================
--- trunk/sources/editor/parttext.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/parttext.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -56,6 +56,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0 );

Modified: trunk/sources/editor/parttextfield.cpp
===================================================================
--- trunk/sources/editor/parttextfield.cpp	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/parttextfield.cpp	2013-02-11 18:35:13 UTC (rev 2035)
@@ -347,6 +347,16 @@
 }
 
 /**
+	@return the minimum, margin-less rectangle this part can fit into, in scene
+	coordinates. It is different from boundingRect() because it is not supposed
+	to imply any margin, and it is different from shape because it is a regular
+	rectangle, not a complex shape.
+*/
+QRectF PartTextField::sceneGeometricRect() const {
+	return(sceneBoundingRect());
+}
+
+/**
 	Start the user-induced transformation, provided this primitive is contained
 	within the \a initial_selection_rect bounding rectangle.
 */

Modified: trunk/sources/editor/parttextfield.h
===================================================================
--- trunk/sources/editor/parttextfield.h	2013-02-11 10:53:53 UTC (rev 2034)
+++ trunk/sources/editor/parttextfield.h	2013-02-11 18:35:13 UTC (rev 2035)
@@ -62,6 +62,7 @@
 	virtual void setProperty(const QString &, const QVariant &);
 	virtual QVariant property(const QString &);
 	virtual bool isUseless() const;
+	virtual QRectF sceneGeometricRect() const;
 	virtual void startUserTransformation(const QRectF &);
 	virtual void handleUserTransformation(const QRectF &, const QRectF &);
 	virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0 );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/