@@ -46,8 +46,15 @@ class QgsSymbol;
4646 * highlight.show()
4747 * \endcode
4848 */
49- class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
49+ class GUI_EXPORT QgsHighlight: public QObject, public QgsMapCanvasItem
5050{
51+
52+ Q_OBJECT
53+ Q_PROPERTY ( QColor color READ color WRITE setColor )
54+ Q_PROPERTY ( QColor fillColor READ fillColor WRITE setFillColor )
55+ Q_PROPERTY ( int width READ width WRITE setWidth )
56+ Q_PROPERTY ( int buffer READ buffer WRITE setBuffer )
57+
5158 public:
5259
5360 /* *
@@ -68,11 +75,23 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
6875 QgsHighlight ( QgsMapCanvas *mapCanvas, const QgsFeature &feature, QgsVectorLayer *layer );
6976 ~QgsHighlight () override ;
7077
78+ /* *
79+ * Return line/stroke color
80+ * \since QGIS 3.4
81+ */
82+ QColor color ( ) const { return mColor ; }
83+
7184 /* *
7285 * Set line/stroke to color, polygon fill to color with alpha = 63.
7386 * This is legacy function, use setFillColor() after setColor() if different fill color is required. */
7487 void setColor ( const QColor &color );
7588
89+ /* *
90+ * Return fill color
91+ * \since QGIS 3.4
92+ */
93+ QColor fillColor ( ) const { return mFillColor ; }
94+
7695 /* *
7796 * Fill color for the highlight.
7897 * Will be used for polygons and points.
@@ -81,13 +100,25 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
81100 */
82101 void setFillColor ( const QColor &fillColor );
83102
103+ /* *
104+ * Return stroke width
105+ * \since QGIS 3.4
106+ */
107+ int width ( ) const { return mWidth ; }
108+
84109 /* *
85110 * Set stroke width.
86111 *
87112 * \note Ignored in feature mode.
88113 */
89114 void setWidth ( int width );
90115
116+ /* *
117+ * Return buffer
118+ * \since QGIS 3.4
119+ */
120+ double buffer ( ) const { return mBuffer ; }
121+
91122 /* *
92123 * Set line / stroke buffer in millimeters.
93124 *
@@ -125,6 +156,9 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
125156 void paintLine ( QPainter *p, QgsPolylineXY line );
126157 void paintPolygon ( QPainter *p, const QgsPolygonXY &polygon );
127158
159+ int mWidth = 1 ; // line / stroke width property
160+ QColor mColor ; // line / stroke color property
161+ QColor mFillColor ; // line / stroke fillColor property
128162 QBrush mBrush ;
129163 QPen mPen ;
130164 QgsGeometry *mGeometry = nullptr ;
0 commit comments