summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase.cpp16
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase_p.h7
2 files changed, 21 insertions, 2 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
index c4d43b45..49438a32 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
@@ -77,11 +77,18 @@ QGeoMapViewportChangeEvent &QGeoMapViewportChangeEvent::operator=(const QGeoMapV
}
QDeclarativeGeoMapItemBase::QDeclarativeGeoMapItemBase(QQuickItem *parent)
-: QQuickItem(parent), map_(0), quickMap_(0), geoGeometryDirty_(true), geoMaterialDirty_(true)
+: QQuickItem(parent), map_(0), quickMap_(0), geoGeometryDirty_(true), geoMaterialDirty_(true), parentGroup_(0)
{
setFiltersChildMouseEvents(true);
connect(this, SIGNAL(childrenChanged()),
this, SLOT(afterChildrenChanged()));
+ // Changing opacity on a mapItemGroup should affect also the opacity on the children.
+ // This must be notified to plugins, if they are to render the item.
+ connect(this, &QQuickItem::opacityChanged, this, &QDeclarativeGeoMapItemBase::mapItemOpacityChanged);
+ parentGroup_ = qobject_cast<QDeclarativeGeoMapItemGroup *>(parent);
+ if (parentGroup_)
+ connect(qobject_cast<QDeclarativeGeoMapItemGroup *>(parent), &QQuickItem::opacityChanged,
+ this, &QDeclarativeGeoMapItemBase::mapItemOpacityChanged);
}
QDeclarativeGeoMapItemBase::~QDeclarativeGeoMapItemBase()
@@ -256,6 +263,13 @@ QSGNode *QDeclarativeGeoMapItemBase::updateMapItemPaintNode(QSGNode *oldNode, Up
return 0;
}
+qreal QDeclarativeGeoMapItemBase::mapItemOpacity() const
+{
+ if (parentGroup_)
+ return parentGroup_->opacity() * opacity();
+ return opacity();
+}
+
bool QDeclarativeGeoMapItemBase::isDirty() const
{
return geoGeometryDirty_ || geoMaterialDirty_;
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
index ff887676..3755cfa1 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
@@ -97,13 +97,16 @@ public:
virtual QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *);
virtual QGeoMap::ItemType itemType() const = 0;
-
+ qreal mapItemOpacity() const;
// Data-related bool. Used by QGeoMaps that render the item directly.
bool isDirty() const;
bool isGeoMaterialDirty() const;
bool isGeoGeometryDirty() const;
void markClean();
+Q_SIGNALS:
+ void mapItemOpacityChanged();
+
protected Q_SLOTS:
virtual void afterChildrenChanged();
virtual void afterViewportChanged(const QGeoMapViewportChangeEvent &event) = 0;
@@ -138,6 +141,8 @@ private:
QSizeF lastSize_;
QGeoCameraData lastCameraData_;
+ QDeclarativeGeoMapItemGroup *parentGroup_;
+
friend class QDeclarativeGeoMap;
};