summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp44
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap_p.h4
-rw-r--r--src/location/maps/qgeotiledmapscene.cpp2
-rw-r--r--src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp2
-rw-r--r--src/positioning/qgeopositioninfosource.cpp2
-rw-r--r--tests/auto/auto.pro4
7 files changed, 37 insertions, 23 deletions
diff --git a/.qmake.conf b/.qmake.conf
index c7bdc7c5..ad4261de 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -3,7 +3,7 @@ CONFIG += warning_clean
DEFINES += QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
-MODULE_VERSION = 5.14.1
+MODULE_VERSION = 5.15.0
# Adds a way to debug location. The define is needed for multiple subprojects as they
# include the essential headers.
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 7fd5f78a..6a2d82e8 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -2289,17 +2289,31 @@ void QDeclarativeGeoMap::geometryChanged(const QRectF &newGeometry, const QRectF
}
/*!
- \qmlmethod void QtLocation::Map::fitViewportToMapItems()
+ \qmlmethod void QtLocation::Map::fitViewportToMapItems(list<MapItems> items = {})
- Fits the current viewport to the boundary of all map items. The camera is positioned
- in the center of the map items, and at the largest integral zoom level possible which
- allows all map items to be visible on screen.
+ If no argument is provided, fits the current viewport to the boundary of all map items.
+ The camera is positioned in the center of the map items, and at the largest integral zoom level
+ possible which allows all map items to be visible on screen.
+ If \a items is provided, fits the current viewport to the boundary of the specified map items only.
+
+ \note This method gained the optional \a items argument since Qt 5.15.
+ In previous releases, this method fitted the map to all map items.
\sa fitViewportToVisibleMapItems
*/
-void QDeclarativeGeoMap::fitViewportToMapItems()
+void QDeclarativeGeoMap::fitViewportToMapItems(const QVariantList &items)
{
- fitViewportToMapItemsRefine(true, false);
+ if (items.size()) {
+ QList<QPointer<QDeclarativeGeoMapItemBase> > itms;
+ for (const QVariant &i: items) {
+ QDeclarativeGeoMapItemBase *itm = qobject_cast<QDeclarativeGeoMapItemBase *>(i.value<QObject *>());
+ if (itm)
+ itms.append(itm);
+ }
+ fitViewportToMapItemsRefine(itms, true, false);
+ } else {
+ fitViewportToMapItemsRefine(m_mapItems, true, false);
+ }
}
/*!
@@ -2313,18 +2327,20 @@ void QDeclarativeGeoMap::fitViewportToMapItems()
*/
void QDeclarativeGeoMap::fitViewportToVisibleMapItems()
{
- fitViewportToMapItemsRefine(true, true);
+ fitViewportToMapItemsRefine(m_mapItems, true, true);
}
/*!
\internal
*/
-void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine, bool onlyVisible)
+void QDeclarativeGeoMap::fitViewportToMapItemsRefine(const QList<QPointer<QDeclarativeGeoMapItemBase> > &mapItems,
+ bool refine,
+ bool onlyVisible)
{
if (!m_map)
return;
- if (m_mapItems.size() == 0)
+ if (mapItems.size() == 0)
return;
double minX = qInf();
@@ -2339,10 +2355,10 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine, bool onlyVisib
// find bounds of all map items
int itemCount = 0;
- for (int i = 0; i < m_mapItems.count(); ++i) {
- if (!m_mapItems.at(i))
+ for (int i = 0; i < mapItems.count(); ++i) {
+ if (!mapItems.at(i))
continue;
- QDeclarativeGeoMapItemBase *item = m_mapItems.at(i).data();
+ QDeclarativeGeoMapItemBase *item = mapItems.at(i).data();
if (!item || (onlyVisible && (!item->isVisible() || item->mapItemOpacity() <= 0.0)))
continue;
@@ -2393,7 +2409,7 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine, bool onlyVisib
if (itemCount == 0) {
if (haveQuickItem)
- fitViewportToMapItemsRefine(false, onlyVisible);
+ fitViewportToMapItemsRefine(mapItems, false, onlyVisible);
return;
}
double bboxWidth = maxX - minX;
@@ -2423,7 +2439,7 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine, bool onlyVisib
// as map quick items retain the same screen size after the camera zooms in/out
// we refine the viewport again to achieve better results
if (refine)
- fitViewportToMapItemsRefine(false, onlyVisible);
+ fitViewportToMapItemsRefine(mapItems, false, onlyVisible);
}
/*!
diff --git a/src/location/declarativemaps/qdeclarativegeomap_p.h b/src/location/declarativemaps/qdeclarativegeomap_p.h
index c97c3622..ee9f8ec2 100644
--- a/src/location/declarativemaps/qdeclarativegeomap_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomap_p.h
@@ -193,7 +193,7 @@ public:
QQuickGeoMapGestureArea *gesture();
- Q_INVOKABLE void fitViewportToMapItems();
+ Q_INVOKABLE void fitViewportToMapItems(const QVariantList &items = {});
Q_INVOKABLE void fitViewportToVisibleMapItems();
Q_INVOKABLE void pan(int dx, int dy);
Q_INVOKABLE void prefetchData(); // optional hint for prefetch
@@ -280,7 +280,7 @@ private:
void setupMapView(QDeclarativeGeoMapItemView *view);
void populateMap();
void populateParameters();
- void fitViewportToMapItemsRefine(bool refine, bool onlyVisible);
+ void fitViewportToMapItemsRefine(const QList<QPointer<QDeclarativeGeoMapItemBase> > &mapItems, bool refine, bool onlyVisible);
bool isInteractive();
void attachCopyrightNotice(bool initialVisibility);
void detachCopyrightNotice(bool currentVisibility);
diff --git a/src/location/maps/qgeotiledmapscene.cpp b/src/location/maps/qgeotiledmapscene.cpp
index a8bee156..18d92b00 100644
--- a/src/location/maps/qgeotiledmapscene.cpp
+++ b/src/location/maps/qgeotiledmapscene.cpp
@@ -515,7 +515,7 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root,
bool ok = d->buildGeometry(it.key(), node, overzooming)
&& qgeotiledmapscene_isTileInViewport(node->rect(), root->matrix(), straight);
- QSGNode::DirtyState dirtyBits = 0;
+ QSGNode::DirtyState dirtyBits = {};
if (!ok) {
#ifdef QT_LOCATION_DEBUG
diff --git a/src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp b/src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp
index bbc70f0a..414d2f34 100644
--- a/src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp
+++ b/src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp
@@ -437,7 +437,7 @@ QList<QGeoAreaMonitorInfo> QGeoAreaMonitorPolling::activeMonitors(const QGeoShap
QGeoAreaMonitorSource::AreaMonitorFeatures QGeoAreaMonitorPolling::supportedAreaMonitorFeatures() const
{
- return 0;
+ return {};
}
void QGeoAreaMonitorPolling::connectNotify(const QMetaMethod &/*signal*/)
diff --git a/src/positioning/qgeopositioninfosource.cpp b/src/positioning/qgeopositioninfosource.cpp
index 0610bd79..1f9abec1 100644
--- a/src/positioning/qgeopositioninfosource.cpp
+++ b/src/positioning/qgeopositioninfosource.cpp
@@ -206,7 +206,7 @@ QGeoPositionInfoSource::QGeoPositionInfoSource(QObject *parent)
{
qRegisterMetaType<QGeoPositionInfo>();
d->interval = 0;
- d->methods = 0;
+ d->methods = {};
}
/*!
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 2b04d110..390e9135 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -93,9 +93,7 @@ SUBDIRS += \
qgeolocation \
qgeopositioninfo \
qgeosatelliteinfo \
- qgeosatelliteinfosource \
- qgeojson \
- qnmeapositioninfosource
+ qgeojson
!android: SUBDIRS += \
positionplugin \