Skip to content

Commit

Permalink
[QMS-216] QMapShack does not compile with Qt-5.15
Browse files Browse the repository at this point in the history
Add `#include <QPainterPath>` whereever `QPainterPath` is used.

Additionally ran code beautifier
  • Loading branch information
kiozen committed Jun 25, 2020
1 parent 277626d commit 1563ccb
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
V1.XX.X
[QMS-158] Change Routino Profiles search for [prefix-]profiles.xml
[QMS-216] QMapShack does not compile with Qt-5.15
[QMS-217] Fix crash due to faulty profiles.xml

V1.15.0
Expand Down
2 changes: 1 addition & 1 deletion src/qmapshack/gis/rte/router/CRouterOptimization.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#ifndef CROUTEROPTIMIZATION_H
#define CROUTEROPTIMIZATION_H
#include <gis/IGisLine.h>
#include <QCoreApplication>
#include <QMap>
#include <QPolygonF>
#include <QCoreApplication>

class CRouterOptimization
{
Expand Down
6 changes: 3 additions & 3 deletions src/qmapshack/gis/rte/router/CRouterRoutino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void CRouterRoutino::buildDatabaseList()
int pError = 0;
dmap["profilesPath"] = "";
QStringList profilesPaths = {
dir.filePath(prefix+"-profiles.xml"),
dir.filePath(prefix + "-profiles.xml"),
dir.filePath("profiles.xml"),
setup->routinoPath("profiles.xml").toUtf8()
};
Expand All @@ -283,7 +283,7 @@ void CRouterRoutino::buildDatabaseList()
}
if( dmap["profilesPath"].toString().isEmpty() )
{
QMessageBox::critical(this, "Routino...",tr("Could not find a profiles XML file in expected folders. Routino Routing will not function"), QMessageBox::Ok);
QMessageBox::critical(this, "Routino...", tr("Could not find a profiles XML file in expected folders. Routino Routing will not function"), QMessageBox::Ok);
pError = 1;
}
else
Expand Down Expand Up @@ -319,7 +319,7 @@ void CRouterRoutino::freeDatabaseList()
{
for(int i = 0; i < comboDatabase->count(); i++)
{
QVariantMap map = comboDatabase->itemData(i,Qt::UserRole).toMap();
QVariantMap map = comboDatabase->itemData(i, Qt::UserRole).toMap();
Routino_Database * data = (Routino_Database*)(map["db"].toULongLong());
Routino_UnloadDatabase(data);
}
Expand Down
1 change: 1 addition & 0 deletions src/qmapshack/gis/wpt/CGisItemWpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "mouse/IMouse.h"
#include "units/IUnit.h"

#include <QPainterPath>
#include <QtWidgets>
#include <QtXml>

Expand Down
1 change: 1 addition & 0 deletions src/qmapshack/helpers/CDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <QDebug>
#include <QImage>
#include <QPainterPath>
#include <QPointF>
#include <QtMath>

Expand Down
1 change: 1 addition & 0 deletions src/qmapshack/map/CMapIMG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "map/garmin/CGarminTyp.h"
#include "units/IUnit.h"

#include <QPainterPath>
#include <QtWidgets>

#undef DEBUG_SHOW_SECT_DESC
Expand Down
1 change: 1 addition & 0 deletions src/qmapshack/mouse/IMouseSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "mouse/IMouseSelect.h"
#include "mouse/IScrOpt.h"

#include <QPainterPath>
#include <QtWidgets>

IMouseSelect::IMouseSelect(CGisDraw *gis, CCanvas *canvas, CMouseAdapter *mouse)
Expand Down
1 change: 1 addition & 0 deletions src/qmaptool/helpers/CDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <QImage>
#include <QPointF>
#include <QtMath>
#include <QPainterPath>

QPen CDraw::penBorderBlue(QColor(10,10,150,220),2);
QPen CDraw::penBorderGray(Qt::lightGray,2);
Expand Down
22 changes: 12 additions & 10 deletions src/qmaptool/overlay/COverlayCutMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
#include "overlay/COverlayCutMap.h"

#include <functional>
#include <QPainterPath>
#include <QtWidgets>

using std::bind;

static inline qreal sqr(qreal a)
{
return a*a;
return a * a;
}

static inline qreal sqrlen(const QPointF &a)
Expand Down Expand Up @@ -88,14 +90,14 @@ bool COverlayCutMap::drawFx(QPainter& p, CCanvas::redraw_e needsRedraw)
path.addRect(rectMap);
path.addPolygon(shape);

p.setPen(QPen(Qt::darkBlue,1));
p.setPen(QPen(Qt::darkBlue, 1));

p.setBrush((idxFocus1 == NOIDX) ? Qt::BDiagPattern : Qt::NoBrush);
p.drawPath(path);
}

QRectF dot1(0,0,5,5);
QRectF dot2(0,0,7,7);
QRectF dot1(0, 0, 5, 5);
QRectF dot2(0, 0, 7, 7);
const QPointF& pt1 = idxFocus1 != NOIDX ? shape[idxFocus1] : NOPOINTF;
const QPointF& pt2 = idxFocus2 != NOIDX ? shape[idxFocus2] : NOPOINTF;

Expand Down Expand Up @@ -219,7 +221,7 @@ void COverlayCutMap::slotSetMode(mode_e m, bool on)

void COverlayCutMap::slotResetMask()
{
int res = QMessageBox::question(this, tr("Delete mask..."), tr("Are you sure to delete complete mask?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
int res = QMessageBox::question(this, tr("Delete mask..."), tr("Are you sure to delete complete mask?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(res != QMessageBox::Yes)
{
return;
Expand Down Expand Up @@ -317,7 +319,7 @@ void COverlayCutMap::slotLoadShape()
qreal x, y;
in2 >> x >> y;

QPointF pt(x,y);
QPointF pt(x, y);
context->convertCoord2Map(pt);

region << pt;
Expand Down Expand Up @@ -428,7 +430,7 @@ void COverlayCutMap::isCloseToLine(QPointF pt, QPolygonF line, qint32& idx1, qin

QPointF b = line[0];
QPointF dbq = b - pt;
qreal dist = 30*30;
qreal dist = 30 * 30;

for (qint32 i = 1; i < count; ++i)
{
Expand All @@ -439,16 +441,16 @@ void COverlayCutMap::isCloseToLine(QPointF pt, QPolygonF line, qint32& idx1, qin

const QPointF dab = a - b;

const qreal inv_sqrlen = 1./sqrlen(dab);
const qreal t = (dab.x()*daq.x() + dab.y()*daq.y())*inv_sqrlen;
const qreal inv_sqrlen = 1. / sqrlen(dab);
const qreal t = (dab.x() * daq.x() + dab.y() * daq.y()) * inv_sqrlen;
if (t < 0.)
{
continue;
}
qreal current_dist;
if (t <= 1.)
{
current_dist = sqr(dab.x()*dbq.y() - dab.y()*dbq.x())*inv_sqrlen;
current_dist = sqr(dab.x() * dbq.y() - dab.y() * dbq.x()) * inv_sqrlen;
}
else//t>1.
{
Expand Down

0 comments on commit 1563ccb

Please sign in to comment.