1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

ADS-B: Fix map centering and station icon for Qt6.

This commit is contained in:
srcejon 2024-04-16 13:28:50 +01:00
parent 5330b8ef45
commit 002c824dd9
2 changed files with 28 additions and 16 deletions

View File

@ -4802,17 +4802,6 @@ void ADSBDemodGUI::applyMapSettings()
// Restore position of map
if (newMap != nullptr)
{
if (coords.isValid())
{
newMap->setProperty("zoomLevel", QVariant::fromValue(zoom));
newMap->setProperty("center", QVariant::fromValue(coords));
}
}
else
{
qDebug() << "ADSBDemodGUI::applyMapSettings - createMap returned a nullptr";
}
// Move antenna icon to My Position
QObject *stationObject = newMap->findChild<QObject*>("station");
if(stationObject != NULL)
@ -4828,6 +4817,20 @@ void ADSBDemodGUI::applyMapSettings()
{
qDebug() << "ADSBDemodGUI::applyMapSettings - Couldn't find station";
}
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
newMap = newMap->findChild<QObject*>("map");
#endif
if (coords.isValid())
{
newMap->setProperty("zoomLevel", QVariant::fromValue(zoom));
newMap->setProperty("center", QVariant::fromValue(coords));
}
}
else
{
qDebug() << "ADSBDemodGUI::applyMapSettings - createMap returned a nullptr";
}
}
// Called from QML when empty space clicked
@ -6000,7 +6003,11 @@ void ADSBDemodGUI::preferenceChanged(int elementType)
// Update icon position on Map
QQuickItem *item = ui->map->rootObject();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QObject *map = item->findChild<QObject*>("map");
#else
QObject *map = item->findChild<QObject*>("mapView");
#endif
if (map != nullptr)
{
QObject *stationObject = map->findChild<QObject*>("station");
@ -6019,7 +6026,11 @@ void ADSBDemodGUI::preferenceChanged(int elementType)
{
// Update icon label on Map
QQuickItem *item = ui->map->rootObject();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QObject *map = item->findChild<QObject*>("map");
#else
QObject *map = item->findChild<QObject*>("mapView");
#endif
if (map != nullptr)
{
QObject *stationObject = map->findChild<QObject*>("station");

View File

@ -74,6 +74,7 @@ Item {
id: station
objectName: "station"
stationName: "Home"
parent: mapView.map
}
MapItemView {