summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-12 18:07:55 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-26 22:24:56 +0200
commit64906d7dcba7702e7a36acfb5984410f7d91ac24 (patch)
tree04b93c0f22c07ec8ecfa034ef9f35b0a0d5fba3d /tests
parentfdbbfa4a6723b816478ee011ab4098e5332dc2f5 (diff)
downloadqtlocation-64906d7dcba7702e7a36acfb5984410f7d91ac24.tar.gz
Simplify Q(Declarative)GeoMapParameter
Move the initialPropertyCount to the QGeoMapParameter class, where previously the 2 was hardcoded. Don't make type/setType virtual, as the subclass doesn't override those methods anyway. Remove the unused constructor taking a list of property names and values. In QDeclarativeGeoMapParameter, optimize the dynamic connections between property notification signals and the generic forwarder. Connect between QMetaMethods, which avoids the repeated lookups, and give the SignalMapper instances the QMetaProperty as a data member so that we avoid the lookup of the signal for each signal emission, and only need one connection per property, rather than two. Also, remove the empty destructor and apply const where appropriate. QDeclarativeGeoMapParameter is used only by QDeclarativePolyLineMapItem, where support for the respective parameters, penStyle and penCap, is not implemented in the rendering code. None of the other map items support any such dynamic parameters, their support is not documented, and only used in the mappolyline manual test. So remove all that code. If we want to support more properties, then the QDeclarativeMapLineProperties type gives us that infrastructure already. Change-Id: Iddaac568a7dc09deb0bb5085b5b90c3cca0fa5ca Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/geotestplugin/qgeotiledmap_test.cpp11
-rw-r--r--tests/auto/geotestplugin/qgeotiledmap_test.h2
-rw-r--r--tests/manual/mappolyline_tester/main.qml22
3 files changed, 8 insertions, 27 deletions
diff --git a/tests/auto/geotestplugin/qgeotiledmap_test.cpp b/tests/auto/geotestplugin/qgeotiledmap_test.cpp
index bab66fc1..b4986b08 100644
--- a/tests/auto/geotestplugin/qgeotiledmap_test.cpp
+++ b/tests/auto/geotestplugin/qgeotiledmap_test.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "qgeotiledmap_test.h"
+#include <QtCore/QMetaProperty>
#include <QtPositioning/QGeoCoordinate>
#include <QtLocation/private/qgeotiledmap_p_p.h>
#include <QtLocation/private/qgeomapparameter_p.h>
@@ -60,8 +61,8 @@ public:
cameraData.setCenter(newCenter);
q->setCameraData(cameraData);
// Connect for further changes handling
- q->connect(param, SIGNAL(propertyUpdated(QGeoMapParameter *, const char *)),
- q, SLOT(onCameraCenter_testChanged(QGeoMapParameter*, const char*)));
+ q->connect(param, &QGeoMapParameter::propertyUpdated,
+ q, &QGeoTiledMapTest::onCameraCenter_testChanged);
}
}
@@ -97,12 +98,12 @@ QGeoTiledMapTest::QGeoTiledMapTest(QGeoTiledMappingManagerEngine *engine,
{
}
-void QGeoTiledMapTest::onCameraCenter_testChanged(QGeoMapParameter *param, const char *propertyName)
+void QGeoTiledMapTest::onCameraCenter_testChanged(QGeoMapParameter *param, const QMetaProperty &property)
{
- if (strcmp(propertyName, "center") == 0) {
+ if (strcmp(property.name(), "center") == 0) {
QGeoCameraData cameraData = this->cameraData();
// Not testing for propertyName as this param has only one allowed property
- QGeoCoordinate newCenter = param->property(propertyName).value<QGeoCoordinate>();
+ QGeoCoordinate newCenter = property.read(param).value<QGeoCoordinate>();
cameraData.setCenter(newCenter);
setCameraData(cameraData);
}
diff --git a/tests/auto/geotestplugin/qgeotiledmap_test.h b/tests/auto/geotestplugin/qgeotiledmap_test.h
index 7bb1ea27..7194e3d6 100644
--- a/tests/auto/geotestplugin/qgeotiledmap_test.h
+++ b/tests/auto/geotestplugin/qgeotiledmap_test.h
@@ -51,7 +51,7 @@ public:
QObject *parent = nullptr);
protected slots:
- void onCameraCenter_testChanged(QGeoMapParameter *param, const char *propertyName);
+ void onCameraCenter_testChanged(QGeoMapParameter *param, const QMetaProperty &property);
public:
using QGeoTiledMap::setCameraData;
diff --git a/tests/manual/mappolyline_tester/main.qml b/tests/manual/mappolyline_tester/main.qml
index c4e62942..9a657309 100644
--- a/tests/manual/mappolyline_tester/main.qml
+++ b/tests/manual/mappolyline_tester/main.qml
@@ -190,11 +190,6 @@ Window {
? MapPolygon.Software : MapPolygon.OpenGL
}
- function miterValue()
- {
- return (miterSwitch.checked) ? Qt.RoundCap : Qt.FlatCap
- }
-
MapPolyline {
id: tstPolyLine // to verify the polygon stays where it's supposed to
line.color: 'black'
@@ -236,10 +231,6 @@ Window {
{ latitude: 45, longitude: 174 },
{ latitude: 43, longitude: -168 }
]
- DynamicParameter {
- type: "lineStyle"
- property var lineCap: miterValue()
- }
MouseArea {
anchors.fill: parent
@@ -298,23 +289,12 @@ Window {
}
checked: false
}
- C2.Switch {
- text: qsTr("Miter")
- id: miterSwitch
- anchors {
- top: leftSwitch.bottom
- left: parent.left
- leftMargin: 12
- rightMargin: 12
- }
- checked: false
- }
C2.Slider {
id: sliWidth
orientation: Qt.Vertical
anchors {
left: parent.left
- top: miterSwitch.bottom
+ top: leftSwitch.bottom
bottom: parent.bottom
topMargin: 10
leftMargin: 10