[qt] Deprecate Qt4 and old versions of Qt5

Not enough adoption to keep the platform alive.
This commit is contained in:
Thiago Marcos P. Santos
2018-11-12 16:38:34 +02:00
parent b891a8d6b0
commit cd92a231b3
20 changed files with 181 additions and 387 deletions

View File

@@ -9,13 +9,8 @@
#include <QMouseEvent>
#include <QString>
#if QT_VERSION >= 0x050000
#include <QWindow>
#endif
int kAnimationDuration = 10000;
MapWindow::MapWindow(const QMapboxGLSettings &settings)
: m_settings(settings)
{
@@ -45,13 +40,7 @@ void MapWindow::selfTest()
}
qreal MapWindow::pixelRatio() {
#if QT_VERSION >= 0x050600
return devicePixelRatioF();
#elif QT_VERSION >= 0x050000
return devicePixelRatio();
#else
return 1;
#endif
}
@@ -369,11 +358,7 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
void MapWindow::mousePressEvent(QMouseEvent *ev)
{
#if QT_VERSION < 0x050000
m_lastPos = ev->posF();
#else
m_lastPos = ev->localPos();
#endif
if (ev->type() == QEvent::MouseButtonPress) {
if (ev->buttons() == (Qt::LeftButton | Qt::RightButton)) {
@@ -394,11 +379,7 @@ void MapWindow::mousePressEvent(QMouseEvent *ev)
void MapWindow::mouseMoveEvent(QMouseEvent *ev)
{
#if QT_VERSION < 0x050000
QPointF delta = ev->posF() - m_lastPos;
#else
QPointF delta = ev->localPos() - m_lastPos;
#endif
if (!delta.isNull()) {
if (ev->buttons() == Qt::LeftButton && ev->modifiers() & Qt::ShiftModifier) {
@@ -406,19 +387,11 @@ void MapWindow::mouseMoveEvent(QMouseEvent *ev)
} else if (ev->buttons() == Qt::LeftButton) {
m_map->moveBy(delta);
} else if (ev->buttons() == Qt::RightButton) {
#if QT_VERSION < 0x050000
m_map->rotateBy(m_lastPos, ev->posF());
#else
m_map->rotateBy(m_lastPos, ev->localPos());
#endif
}
}
#if QT_VERSION < 0x050000
m_lastPos = ev->posF();
#else
m_lastPos = ev->localPos();
#endif
ev->accept();
}
@@ -464,8 +437,6 @@ void MapWindow::paintGL()
{
m_frameDraws++;
m_map->resize(size());
#if QT_VERSION >= 0x050400
m_map->setFramebufferObject(defaultFramebufferObject(), size() * pixelRatio());
#endif
m_map->render();
}