diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2016-04-08 16:36:20 +0300 |
---|---|---|
committer | VladiMihaylenko <vxmihaylenko@gmail.com> | 2016-04-11 18:14:32 +0300 |
commit | 9bf220a613d18aa8475a5fff8ade32fffa43994a (patch) | |
tree | bf8f849b1c81e0c57e7c43887e3091fb4727ce58 | |
parent | f1b72d5f734e71f6b6c2feba1d0d0bbc3f6683f6 (diff) |
[qt] Fixed qt build.
-rw-r--r-- | qt/editor_dialog.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/qt/editor_dialog.cpp b/qt/editor_dialog.cpp index 846a85e165..a7e7cac377 100644 --- a/qt/editor_dialog.cpp +++ b/qt/editor_dialog.cpp @@ -81,15 +81,18 @@ EditorDialog::EditorDialog(QWidget * parent, osm::EditableMapObject & emo) if (emo.IsAddressEditable()) { // Address rows. - vector<string> nearbyStreets = emo.GetNearbyStreets(); + auto nearbyStreets = emo.GetNearbyStreets(); // If feature does not have a specified street, display empty combo box. - if (emo.GetStreet().empty()) - nearbyStreets.insert(nearbyStreets.begin(), ""); + if (emo.GetStreet().m_defaultName.empty()) + nearbyStreets.insert(nearbyStreets.begin(), {}); grid->addWidget(new QLabel(kStreetObjectName), row, 0); QComboBox * cmb = new QComboBox(); for (int i = 0; i < nearbyStreets.size(); ++i) { - cmb->addItem(nearbyStreets[i].c_str()); + string street = nearbyStreets[i].m_defaultName; + if (!nearbyStreets[i].m_localizedName.empty()) + street += " / " + nearbyStreets[i].m_localizedName; + cmb->addItem(street.c_str()); if (emo.GetStreet() == nearbyStreets[i]) cmb->setCurrentIndex(i); } @@ -195,7 +198,10 @@ void EditorDialog::OnSave() if (m_feature.IsAddressEditable()) { m_feature.SetHouseNumber(findChild<QLineEdit *>(kHouseNumberObjectName)->text().toStdString()); - m_feature.SetStreet(findChild<QComboBox *>(kStreetObjectName)->currentText().toStdString()); + QString const editedStreet = findChild<QComboBox *>(kStreetObjectName)->currentText(); + QStringList const names = editedStreet.split(" / ", QString::SkipEmptyParts); + QString const localized = names.size() > 1 ? names.at(1) : QString(); + m_feature.SetStreet({names.at(0).toStdString(), localized.toStdString()}); m_feature.SetPostcode(findChild<QLineEdit *>(kPostcodeObjectName)->text().toStdString()); } |