1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Get rid of QT_NO_DEPRECATED_WARNINGS

This commit is contained in:
Martin Tůma 2024-06-05 10:01:16 +02:00
parent 592b552721
commit d750715bed
10 changed files with 63 additions and 41 deletions

View File

@ -142,6 +142,7 @@ HEADERS += src/common/config.h \
src/map/filter.h \
src/map/gemfmap.h \
src/map/gmifile.h \
src/map/metatype.h \
src/map/oruxmap.h \
src/map/osmdroidmap.h \
src/map/proj/polyconic.h \
@ -474,8 +475,7 @@ SOURCES += src/main.cpp \
src/data/smlparser.cpp \
src/data/geojsonparser.cpp
DEFINES += APP_VERSION=\\\"$$VERSION\\\" \
QT_NO_DEPRECATED_WARNINGS
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_en.ts \

View File

@ -38,9 +38,9 @@ static inline QPoint POS(QMouseEvent *e)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return e->pos();
#else // QT 5.15
#else // QT 6
return e->position().toPoint();
#endif // QT 5.15
#endif // QT 6
}
GraphView::GraphView(QWidget *parent)

View File

@ -20,16 +20,16 @@
#define OPEN_SHORTCUT QKeySequence(QKeySequence::Open)
#define CLOSE_SHORTCUT QKeySequence(QKeySequence::Close)
#define RELOAD_SHORTCUT QKeySequence(QKeySequence::Refresh)
#define PDF_EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_E)
#define PNG_EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_X)
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P)
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M)
#define PDF_EXPORT_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_E)
#define PNG_EXPORT_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_X)
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_P)
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_M)
#define NEXT_MAP_SHORTCUT QKeySequence(QKeySequence::Forward)
#define PREV_MAP_SHORTCUT QKeySequence(QKeySequence::Back)
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G)
#define STATISTICS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_S)
#define DOWNLOAD_DEM_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_D)
#define SHOW_TRACKS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_T)
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_G)
#define STATISTICS_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_S)
#define DOWNLOAD_DEM_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_D)
#define SHOW_TRACKS_SHORTCUT QKeySequence(Qt::CTRL | Qt::Key_T)
#define FULLSCREEN_SHORTCUT (QKeySequence(QKeySequence::FullScreen).isEmpty() \
? QKeySequence(Qt::Key_F11) \
: QKeySequence(QKeySequence::FullScreen))

View File

@ -17,6 +17,14 @@
#include "flowlayout.h"
#include "popup.h"
static inline QPointF mousePos(QEvent *ev)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return static_cast<QMouseEvent*>(ev)->globalPos();
#else // QT 6
return static_cast<QMouseEvent*>(ev)->globalPosition();
#endif // QT 6
}
class PopupFrame : public QFrame
{
@ -163,8 +171,7 @@ bool PopupFrame::eventFilter(QObject *o, QEvent *ev)
break;
case QEvent::MouseMove: {
QRectF r(geometry().adjusted(-5, -20, 5, 20));
QPointF p(static_cast<QMouseEvent*>(ev)->globalPos());
if (!r.contains(p))
if (!r.contains(mousePos(ev)))
deleteAfterTimer();
break;
}

View File

@ -7,10 +7,10 @@
#include <QtConcurrent>
#include "common/util.h"
#include "osm.h"
#include "metatype.h"
#include "mbtilesmap.h"
#define MAX_TILE_SIZE 4096
#define META_TYPE(type) static_cast<QMetaType::Type>(type)
static RectC str2bounds(const QString &str)
{
@ -201,13 +201,13 @@ MBTilesMap::MBTilesMap(const QString &fileName, QObject *parent)
QSqlRecord r = _db.record("tiles");
if (r.isEmpty()
|| r.field(0).name() != "zoom_level"
|| META_TYPE(r.field(0).type()) != QMetaType::Int
|| METATYPE(r.field(0)) != QMetaType::Int
|| r.field(1).name() != "tile_column"
|| META_TYPE(r.field(1).type()) != QMetaType::Int
|| METATYPE(r.field(1)) != QMetaType::Int
|| r.field(2).name() != "tile_row"
|| META_TYPE(r.field(2).type()) != QMetaType::Int
|| METATYPE(r.field(2)) != QMetaType::Int
|| r.field(3).name() != "tile_data"
|| META_TYPE(r.field(3).type()) != QMetaType::QByteArray) {
|| METATYPE(r.field(3)) != QMetaType::QByteArray) {
_errorString = "Invalid table format";
return;
}

15
src/map/metatype.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef METATYPE_H
#define METATYPE_H
#include <QSqlField>
static inline QMetaType::Type METATYPE(const QSqlField &f)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return static_cast<QMetaType::Type>(f.type());
#else // QT 6
return static_cast<QMetaType::Type>(f.metaType().id());
#endif // QT 6
}
#endif // METATYPE_H

View File

@ -9,11 +9,10 @@
#include <QXmlStreamReader>
#include "pcs.h"
#include "utm.h"
#include "metatype.h"
#include "oruxmap.h"
#define META_TYPE(type) static_cast<QMetaType::Type>(type)
static bool intAttr(QXmlStreamReader &reader, const QXmlStreamAttributes &attr,
const QString &name, int &val)
{
@ -431,14 +430,11 @@ OruxMap::OruxMap(const QString &fileName, QObject *parent)
QSqlRecord r = _db.record("tiles");
if (r.isEmpty()
|| r.field(0).name() != "x"
|| META_TYPE(r.field(0).type()) != QMetaType::Int
|| r.field(1).name() != "y"
|| META_TYPE(r.field(1).type()) != QMetaType::Int
|| r.field(2).name() != "z"
|| META_TYPE(r.field(2).type()) != QMetaType::Int
|| r.field(0).name() != "x" || METATYPE(r.field(0)) != QMetaType::Int
|| r.field(1).name() != "y" || METATYPE(r.field(1)) != QMetaType::Int
|| r.field(2).name() != "z" || METATYPE(r.field(2)) != QMetaType::Int
|| r.field(3).name() != "image"
|| META_TYPE(r.field(3).type()) != QMetaType::QByteArray) {
|| METATYPE(r.field(3)) != QMetaType::QByteArray) {
_errorString = "Invalid table format";
return;
}

View File

@ -9,11 +9,10 @@
#include <QtConcurrent>
#include "osm.h"
#include "tile.h"
#include "metatype.h"
#include "osmdroidmap.h"
#define META_TYPE(type) static_cast<QMetaType::Type>(type)
OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent)
: Map(fileName, parent), _mapRatio(1.0), _valid(false)
{
@ -34,11 +33,11 @@ OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent)
QSqlRecord rcrd = _db.record("tiles");
if (rcrd.isEmpty()
|| rcrd.field(0).name() != "key"
|| META_TYPE(rcrd.field(0).type()) != QMetaType::Int
|| METATYPE(rcrd.field(0)) != QMetaType::Int
|| rcrd.field(1).name() != "provider"
|| META_TYPE(rcrd.field(1).type()) != QMetaType::QString
|| METATYPE(rcrd.field(1)) != QMetaType::QString
|| rcrd.field(2).name() != "tile"
|| META_TYPE(rcrd.field(2).type()) != QMetaType::QByteArray) {
|| METATYPE(rcrd.field(2)) != QMetaType::QByteArray) {
_errorString = "Invalid table format";
return;
}

View File

@ -9,11 +9,10 @@
#include <QtConcurrent>
#include "osm.h"
#include "tile.h"
#include "metatype.h"
#include "sqlitemap.h"
#define META_TYPE(type) static_cast<QMetaType::Type>(type)
SqliteMap::SqliteMap(const QString &fileName, QObject *parent)
: Map(fileName, parent), _mapRatio(1.0), _valid(false)
{
@ -32,13 +31,13 @@ SqliteMap::SqliteMap(const QString &fileName, QObject *parent)
QSqlRecord r = _db.record("tiles");
if (r.isEmpty()
|| r.field(0).name() != "x"
|| META_TYPE(r.field(0).type()) != QMetaType::Int
|| METATYPE(r.field(0)) != QMetaType::Int
|| r.field(1).name() != "y"
|| META_TYPE(r.field(1).type()) != QMetaType::Int
|| METATYPE(r.field(1)) != QMetaType::Int
|| r.field(2).name() != "z"
|| META_TYPE(r.field(2).type()) != QMetaType::Int
|| METATYPE(r.field(2)) != QMetaType::Int
|| r.field(4).name() != "image"
|| META_TYPE(r.field(4).type()) != QMetaType::QByteArray) {
|| METATYPE(r.field(4)) != QMetaType::QByteArray) {
_errorString = "Invalid table format";
return;
}

View File

@ -4,9 +4,15 @@
#include "tileloader.h"
#define SUBSTITUTE_CHAR '$'
#define IS_INT(zoom) \
((QMetaType::Type)((zoom).type()) == QMetaType::Int)
static bool inline IS_INT(const QVariant &v)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return (static_cast<QMetaType::Type>(v.type()) == QMetaType::Int);
#else // QT 6
return (static_cast<QMetaType::Type>((v.typeId()) == QMetaType::Int));
#endif // QT 6
}
static QString fsSafeStr(const QString &str)
{