Check Qt version for Qt5 related features
[quandoparte] / application / stationlistmodel.cpp
index 335e004..a86e090 100644 (file)
@@ -25,11 +25,9 @@ Boston, MA 02110-1301, USA.
 #include <QFileInfo>
 #include <QDebug>
 #include <QStandardItem>
-#ifndef TARGET_PLATFORM_SAILFISH
-#include <QGeoCoordinate>
-#endif
+#include <QtLocation/QGeoCoordinate>
 
-#ifndef TARGET_PLATFORM_SAILFISH
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
 QTM_USE_NAMESPACE
 Q_DECLARE_METATYPE(QGeoCoordinate)
 #endif
@@ -40,13 +38,13 @@ StationListModel::StationListModel(QObject *parent) :
     QStandardItemModel(parent)
 {
     setRowCount(0);
-#ifndef TARGET_PLATFORM_SAILFISH
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
     QHash<int, QByteArray> roles;
 #endif
     roles[Qt::DisplayRole] = "name";
     roles[StationListModel::PositionRole] = "position";
     roles[StationListModel::StationCodeRole] = "code";
-#ifndef TARGET_PLATFORM_SAILFISH
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
     setRoleNames(roles);
 #endif
 }
@@ -143,10 +141,8 @@ void StationListModel::readStationElement()
 void StationListModel::readPosElement(QStandardItem *item)
 {
     QStringList coordinates = m_reader.readElementText().split(",");
-#ifndef TARGET_PLATFORM_SAILFISH
     QGeoCoordinate pos = QGeoCoordinate(coordinates[0].toDouble(), coordinates[1].toDouble());
     item->setData(QVariant::fromValue(pos), PositionRole);
-#endif
     m_reader.readElementText();
     if (m_reader.isEndElement()) {
         m_reader.readNext();