diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-04-18 14:34:25 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2018-04-22 06:34:13 +0000 |
commit | ecb6fbd235a8f23f0844bb2b926b78566c1aaa76 (patch) | |
tree | d26b0fca188570e72b9aaaaf8aabceedef923084 /src/location/declarativemaps/qdeclarativepolylinemapitem_p.h | |
parent | e86a2f2a437a8c0e820e85ae4498a391c76bb823 (diff) | |
download | qtlocation-ecb6fbd235a8f23f0844bb2b926b78566c1aaa76.tar.gz |
Fix QGeoMapObject handling in reference implementation
setVisible was neither changing the visibility nor
triggering repaint.
Pimpls weren't removing themselves in their destructors when
dynamically added/removed via QGeoMapObjectView
add/removeMapObject.
This patch also factors out the duplicated QGeoMapObject support
from QGeoTiledMapLabs and QGeoMapObjectsOverlay and moves it
into an own class, QGeoMapObjectQSGSupport.
To properly flush the scene graph nodes upon object removal,
a pointer to the QSGNode is added to the MapObject struct,
now moved inside QGeoMapObjectQSGSupport.
Change-Id: Ie8c6d54f8f340ba3867717d9620791d3fe8021cc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativepolylinemapitem_p.h')
-rw-r--r-- | src/location/declarativemaps/qdeclarativepolylinemapitem_p.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h index ca01de12..225f21d9 100644 --- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h @@ -181,20 +181,39 @@ private: ////////////////////////////////////////////////////////////////////// -class Q_LOCATION_PRIVATE_EXPORT MapPolylineNode : public QSGGeometryNode +class Q_LOCATION_PRIVATE_EXPORT VisibleNode { +public: + VisibleNode(); + virtual ~VisibleNode(); + + bool subtreeBlocked() const; + void setSubtreeBlocked(bool blocked); + bool visible() const; + void setVisible(bool visible); + + bool m_blocked : 1; + bool m_visible : 1; +}; +class Q_LOCATION_PRIVATE_EXPORT MapItemGeometryNode : public QSGGeometryNode, public VisibleNode +{ +public: + ~MapItemGeometryNode() override; + bool isSubtreeBlocked() const override; +}; + +class Q_LOCATION_PRIVATE_EXPORT MapPolylineNode : public MapItemGeometryNode +{ public: MapPolylineNode(); - ~MapPolylineNode(); + ~MapPolylineNode() override; void update(const QColor &fillColor, const QGeoMapItemGeometry *shape); - bool isSubtreeBlocked() const override; private: QSGFlatColorMaterial fill_material_; QSGGeometry geometry_; - bool blocked_; }; QT_END_NAMESPACE |