roles[Qt::DisplayRole] = "name";
roles[StationListModel::PositionRole] = "position";
roles[StationListModel::StationCodeRole] = "code";
+ roles[StationListModel::LongitudeRole] = "longitude";
+ roles[StationListModel::LatitudeRole] = "latitude";
return roles;
}
QStringList coordinates = m_reader.readElementText().split(",");
QGeoCoordinate pos = QGeoCoordinate(coordinates[0].toDouble(), coordinates[1].toDouble());
item->setData(QVariant::fromValue(pos), PositionRole);
+ item->setData(QVariant::fromValue(pos.longitude()), LongitudeRole);
+ item->setData(QVariant::fromValue(pos.latitude()), LatitudeRole);
m_reader.readElementText();
if (m_reader.isEndElement()) {
m_reader.readNext();
enum StationListRole {
PositionRole = Qt::UserRole + 1, //< QGeoCoordinate - Station coordinate
StationCodeRole, //< QString - Station Code (Precise name if the Display name is known to fail)
- RecentIndicatorRole //<bool - If the station has been recently looked up
+ RecentIndicatorRole, //<bool - If the station has been recently looked up
+ LongitudeRole, //< double - Longitude of the station
+ LatitudeRole, //< double - Latitude of the station
};
explicit StationListModel(QObject *parent = 0);