11/** \ingroup MapComposer
22 * A item that forms part of a map composition.
33 */
4- class QgsComposerItem : QObject , QGraphicsRectItem
4+ class QgsComposerItem : QgsComposerObject , QGraphicsRectItem
55{
66%TypeHeaderCode
77#include <qgscomposeritem.h>
@@ -133,46 +133,6 @@ class QgsComposerItem : QObject, QGraphicsRectItem
133133 LowerRight
134134 };
135135
136- /** Data defined properties for different item types
137- */
138- enum DataDefinedProperty
139- {
140- NoProperty = 0, /*< no property */
141- AllProperties, /*< all properties for item */
142- //composer page properties
143- PresetPaperSize, /*< preset paper size for composition */
144- PaperWidth, /*< paper width */
145- PaperHeight, /*< paper height */
146- NumPages, /*< number of pages in composition */
147- PaperOrientation, /*< paper orientation */
148- //general composer item properties
149- PageNumber, /*< page number for item placement */
150- PositionX, /*< x position on page */
151- PositionY, /*< y position on page */
152- ItemWidth, /*< width of item */
153- ItemHeight, /*< height of item */
154- ItemRotation, /*< rotation of item */
155- Transparency, /*< item transparency */
156- BlendMode, /*< item blend mode */
157- //composer map
158- MapRotation, /*< map rotation */
159- MapScale, /*< map scale */
160- MapXMin, /*< map extent x minimum */
161- MapYMin, /*< map extent y minimum */
162- MapXMax, /*< map extent x maximum */
163- MapYMax /*< map extent y maximum */
164- };
165-
166- /** Specifies whether the value returned by a function should be the original, user
167- * set value, or the current evaluated value for the property. This may differ if
168- * a property has a data defined expression active.
169- */
170- enum PropertyValueType
171- {
172- EvaluatedValue = 0, /*< return the current evaluated value for the property */
173- OriginalValue /*< return the original, user set value */
174- };
175-
176136 /**Constructor
177137 @param composition parent composition
178138 @param manageZValue true if the z-Value of this object should be managed by mComposition*/
@@ -259,21 +219,9 @@ class QgsComposerItem : QObject, QGraphicsRectItem
259219 corresponds to 1 scene size unit*/
260220 virtual void setSceneRect( const QRectF& rectangle );
261221
262- /** stores state in Dom element
263- * @param elem is Dom element corresponding to 'Composer' tag
264- * @param doc is the Dom document
265- */
266- virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const = 0;
267-
268222 /**Writes parameter that are not subclass specific in document. Usually called from writeXML methods of subclasses*/
269223 bool _writeXML( QDomElement& itemElem, QDomDocument& doc ) const;
270224
271- /** sets state from Dom document
272- * @param itemElem is Dom node corresponding to item tag
273- * @param doc is Dom document
274- */
275- virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) = 0;
276-
277225 /**Reads parameter that are not subclass specific in document. Usually called from readXML methods of subclasses*/
278226 bool _readXML( const QDomElement& itemElem, const QDomDocument& doc );
279227
@@ -394,8 +342,6 @@ class QgsComposerItem : QObject, QGraphicsRectItem
394342 virtual void addItem( QgsComposerItem* item );
395343 virtual void removeItems();
396344
397- const QgsComposition* composition() const;
398-
399345 virtual void beginItemCommand( const QString& text );
400346
401347 /**Starts new composer undo command
@@ -466,7 +412,7 @@ class QgsComposerItem : QObject, QGraphicsRectItem
466412 * settings).
467413 * @note this method was added in version 2.1
468414 */
469- double itemRotation( PropertyValueType valueType = EvaluatedValue ) const;
415+ double itemRotation( QgsComposerObject:: PropertyValueType valueType = QgsComposerObject:: EvaluatedValue ) const;
470416
471417 /**Returns the rotation for the composer item
472418 * @deprecated Use itemRotation()
@@ -517,22 +463,6 @@ class QgsComposerItem : QObject, QGraphicsRectItem
517463 */
518464 void setCurrentExportLayer( int layerIdx = -1 );
519465
520- /**Returns a reference to the data defined settings for one of the item's data defined properties.
521- * @param property data defined property to return
522- * @note this method was added in version 2.5
523- */
524- QgsDataDefined* dataDefinedProperty( DataDefinedProperty property );
525-
526- /**Sets parameters for a data defined property for the item
527- * @param property data defined property to set
528- * @param active true if data defined property is active, false if it is disabled
529- * @param useExpression true if the expression should be used
530- * @param expression expression for data defined property
531- * @field field name if the data defined property should take its value from a field
532- * @note this method was added in version 2.5
533- */
534- void setDataDefinedProperty( DataDefinedProperty property, bool active, bool useExpression, const QString &expression, const QString &field );
535-
536466 public slots:
537467 /**Sets the item rotation
538468 * @deprecated Use setItemRotation( double rotation ) instead
@@ -556,7 +486,7 @@ class QgsComposerItem : QObject, QGraphicsRectItem
556486 * refreshed.
557487 * @note this method was added in version 2.5
558488 */
559- virtual void refreshDataDefinedProperty( DataDefinedProperty property = AllProperties );
489+ virtual void refreshDataDefinedProperty( QgsComposerObject:: DataDefinedProperty property = QgsComposerObject:: AllProperties );
560490
561491 protected:
562492
@@ -597,43 +527,52 @@ class QgsComposerItem : QObject, QGraphicsRectItem
597527
598528 //some utility functions
599529
600- /**Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation*/
601- bool imageSizeConsideringRotation( double& width, double& height, double rotation ) const;
530+ /**Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation.
531+ * @deprecated will be removed in QGIS 3.0
532+ */
533+ bool imageSizeConsideringRotation( double& width, double& height, double rotation ) const /Deprecated/;
534+
602535 /**Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation
603- * @deprecated Use bool imageSizeConsideringRotation( double& width, double& height, double rotation )
604- * instead
536+ * @deprecated will be removed in QGIS 3.0
605537 */
606538 bool imageSizeConsideringRotation( double& width, double& height ) const /Deprecated/;
607539
608540 /**Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by
609- * a specified amount
610- @param originalRect QRectF to be rotated and scaled
611- @param boundsRect QRectF specifying the bounds which the rotated and scaled rectangle must fit within
612- @param rotation the rotation in degrees to be applied to the rectangle
613- */
614- QRectF largestRotatedRectWithinBounds( QRectF originalRect, QRectF boundsRect, double rotation ) const;
541+ * a specified amount
542+ * @param originalRect QRectF to be rotated and scaled
543+ * @param boundsRect QRectF specifying the bounds which the rotated and scaled rectangle must fit within
544+ * @param rotation the rotation in degrees to be applied to the rectangle
545+ * @deprecated use QgsComposerUtils::largestRotatedRectWithinBounds instead
546+ */
547+ QRectF largestRotatedRectWithinBounds( QRectF originalRect, QRectF boundsRect, double rotation ) const /Deprecated/;
615548
616- /**Calculates corner point after rotation and scaling*/
617- bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation ) const;
618549 /**Calculates corner point after rotation and scaling
619- * @deprecated Use bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation )
620- * instead
550+ * @deprecated will be removed in QGIS 3.0
551+ */
552+ bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation ) const /Deprecated/;
553+
554+ /**Calculates corner point after rotation and scaling
555+ * @deprecated will be removed in QGIS 3.0
621556 */
622557 bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const /Deprecated/;
623558
624- /**Calculates width / height of the bounding box of a rotated rectangle*/
625- void sizeChangedByRotation( double& width, double& height, double rotation );
559+ /**Calculates corner point after rotation and scaling
560+ * @deprecated will be removed in QGIS 3.0
561+ */
562+ void sizeChangedByRotation( double& width, double& height, double rotation ) /Deprecated/;
563+
626564 /**Calculates width / height of the bounding box of a rotated rectangle
627- * @deprecated Use void sizeChangedByRotation( double& width, double& height, double rotation )
628- * instead
565+ * @deprecated will be removed in QGIS 3.0
629566 */
630567 void sizeChangedByRotation( double& width, double& height ) /Deprecated/;
631-
568+
632569 /**Rotates a point / vector
633- @param angle rotation angle in degrees, counterclockwise
634- @param x in/out: x coordinate before / after the rotation
635- @param y in/out: y cooreinate before / after the rotation*/
636- void rotate( double angle, double& x, double& y ) const;
570+ * @param angle rotation angle in degrees, counterclockwise
571+ * @param x in/out: x coordinate before / after the rotation
572+ * @param y in/out: y cooreinate before / after the rotation
573+ * @deprecated use QgsComposerUtils:rotate instead
574+ */
575+ void rotate( double angle, double& x, double& y ) const /Deprecated/;
637576
638577 /**Return horizontal align snap item. Creates a new graphics line if 0*/
639578 QGraphicsLineItem* hAlignSnapItem();
@@ -643,22 +582,12 @@ class QgsComposerItem : QObject, QGraphicsRectItem
643582 void deleteVAlignSnapItem();
644583 void deleteAlignItems();
645584
646- /**Evaluate a data defined property and return the calculated value
647- * @returns true if data defined property could be successfully evaluated
648- * @param property data defined property to evaluate
649- * @param expressionValue QVariant for storing the evaluated value
650- * @note this method was added in version 2.5
651- */
652- bool dataDefinedEvaluate( QgsComposerItem::DataDefinedProperty property, QVariant &expressionValue );
653-
654585 /**Update an item rect to consider data defined position and size of item*/
655586 QRectF evalItemRect( const QRectF &newRect );
656587
657588 signals:
658589 /**Is emitted on item rotation change*/
659590 void itemRotationChanged( double newRotation );
660- /**Used e.g. by the item widgets to update the gui elements*/
661- void itemChanged();
662591 /**Emitted if the rectangle changes*/
663592 void sizeChanged();
664593 /**Emitted if the item's frame style changes
0 commit comments