From 071051f75643eaf30a77314e4dec61643c83cd6f Mon Sep 17 00:00:00 2001 From: "dev@dev.com" Date: Thu, 28 Apr 2022 21:58:59 +0800 Subject: [PATCH] Qt6 Need extra pre-compile commands to fit differences . --- qtviewer_planetosm/main.cpp | 7 +++++++ qtviewer_planetosm/osmtiles/tilesviewer.cpp | 4 ++++ qtviewer_planetosm/osmtiles/urlDownloader.cpp | 4 ++++ qtvplugin_geomarker/qtvplugin_geomarker.cpp | 14 +++++++++++++- .../qtvplugin_geomarker_uimethods.cpp | 2 +- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/qtviewer_planetosm/main.cpp b/qtviewer_planetosm/main.cpp index 0abfcd8..a63b8ea 100644 --- a/qtviewer_planetosm/main.cpp +++ b/qtviewer_planetosm/main.cpp @@ -20,9 +20,16 @@ int main(int argc, char *argv[]) QTranslator qtTranslator; +#if QT_VERSION>=0x060000 if (qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::path(QLibraryInfo::TranslationsPath))) app.installTranslator(&qtTranslator); +#else + if (qtTranslator.load("qt_" + QLocale::system().name(), + QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + app.installTranslator(&qtTranslator); +#endif + QTranslator appTranslator; QString strTransLocalFile = diff --git a/qtviewer_planetosm/osmtiles/tilesviewer.cpp b/qtviewer_planetosm/osmtiles/tilesviewer.cpp index dc824ef..a05028d 100644 --- a/qtviewer_planetosm/osmtiles/tilesviewer.cpp +++ b/qtviewer_planetosm/osmtiles/tilesviewer.cpp @@ -467,7 +467,11 @@ namespace QTVOSM{ if (needUpdate) this->update(); double lat,lon; +#if QT_VERSION>=0x060000 CV_DP2LLA(event->position().x(),event->position().y(),&lat,&lon); +#else + CV_DP2LLA(event->x(),event->y(),&lat,&lon); +#endif //! 1. source=MAIN_MAP, destin = ALL, msg = MOUSE_MOVE if (this->isEnabled()) diff --git a/qtviewer_planetosm/osmtiles/urlDownloader.cpp b/qtviewer_planetosm/osmtiles/urlDownloader.cpp index 6896be8..32e65d1 100644 --- a/qtviewer_planetosm/osmtiles/urlDownloader.cpp +++ b/qtviewer_planetosm/osmtiles/urlDownloader.cpp @@ -32,7 +32,11 @@ namespace QTVOSM{ { const tag_download_tasks & tk = m_map_pendingTasks[rply]; QVariant vaurl = rply->attribute(QNetworkRequest::RedirectionTargetAttribute); +#if QT_VERSION>=0x060000 if (vaurl.typeId()==QMetaType::QUrl) +#else + if (vaurl.type()==QVariant::Url) +#endif { QUrl urlRd = vaurl.toUrl(); if (urlRd.isRelative()) diff --git a/qtvplugin_geomarker/qtvplugin_geomarker.cpp b/qtvplugin_geomarker/qtvplugin_geomarker.cpp index ea7dea5..eaca54c 100644 --- a/qtvplugin_geomarker/qtvplugin_geomarker.cpp +++ b/qtvplugin_geomarker/qtvplugin_geomarker.cpp @@ -542,7 +542,11 @@ bool qtvplugin_geomarker::cb_mouseDoubleClickEvent(QMouseEvent * e) while (wx > winsz-1) wx -= winsz; QPointF mouse_scene_pt(wx,wy); +#if QT_VERSION>=0x060000 QPoint mouse_screen_pt = e->globalPosition().toPoint(); +#else + QPoint mouse_screen_pt = e->globalPos(); +#endif Qt::MouseButton mouse_button = e->button(); QWidget * pwig = dynamic_cast (m_pVi); if (m_bVisible && pwig && too_many_items()==false) @@ -590,7 +594,11 @@ bool qtvplugin_geomarker::cb_mousePressEvent(QMouseEvent * e) while (wx > winsz-1) wx -= winsz; QPointF mouse_scene_pt(wx,wy); +#if QT_VERSION>=0x060000 QPoint mouse_screen_pt = e->globalPosition().toPoint(); +#else + QPoint mouse_screen_pt = e->globalPos(); +#endif Qt::MouseButton mouse_button = e->button(); QWidget * pwig = dynamic_cast (m_pVi); if (m_bVisible && pwig && too_many_items()==false) @@ -646,7 +654,11 @@ bool qtvplugin_geomarker::cb_mouseMoveEvent ( QMouseEvent * e ) while (wx < 0) wx += winsz; while (wx > winsz-1) wx -= winsz; QPointF mouse_scene_pt(wx,wy); +#if QT_VERSION>=0x060000 QPoint mouse_screen_pt = e->globalPosition().toPoint(); +#else + QPoint mouse_screen_pt = e->globalPos(); +#endif Qt::MouseButton mouse_button = e->button(); QWidget * pwig = dynamic_cast (m_pVi); if (m_bVisible && pwig && too_many_items()==false) @@ -750,7 +762,7 @@ bool qtvplugin_geomarker::cb_mouseReleaseEvent ( QMouseEvent * e ) */ QColor qtvplugin_geomarker::string2color(const QString & s) { -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= 0x050F00 QStringList lst = s.split(",",Qt::SkipEmptyParts); #else QStringList lst = s.split(",",QString::SkipEmptyParts); diff --git a/qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp b/qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp index 01621dd..609f989 100644 --- a/qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp +++ b/qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp @@ -480,7 +480,7 @@ void qtvplugin_geomarker::on_pushButton_QTV_update_clicked() strPlainTexts.remove('\r'); strPlainTexts.remove('\015'); strPlainTexts.remove('\012'); -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= 0x050F00 QStringList lst = strPlainTexts.split(QRegularExpression("[,;]"),Qt::SkipEmptyParts); #else QStringList lst = strPlainTexts.split(QRegularExpression("[,;]"),QString::SkipEmptyParts); -- GitLab