// Initializes this landmark from the given landmark void QDeclarativeLandmark::setLandmark(const QLandmark& landmark) { // Elaborate but makes sure appropriate signals are sent // (this function is called when landmark updates). setPlace(landmark); // viewport, address, coordinate etc. setName(landmark.name()); setPhoneNumber(landmark.phoneNumber()); setDescription(landmark.description()); setRadius(landmark.radius()); setIconSource(landmark.iconUrl()); setUrl(landmark.url()); m_landmark = landmark; }
LandmarkAddDialog::LandmarkAddDialog(QWidget *parent, Qt::WindowFlags flags, const QLandmark &landmark) : QDialog(parent, flags) { setupUi(this); if (landmark != QLandmark()) { setWindowTitle("Edit Landmark"); lm = landmark; nameLineEdit->setText(landmark.name()); latitudeLineEdit->setText(QString::number(landmark.coordinate().latitude())); longitudeLineEdit->setText(QString::number(landmark.coordinate().longitude())); streetLineEdit->setText(landmark.address().street()); districtLineEdit->setText(landmark.address().district()); cityLineEdit->setText(landmark.address().city()); countyLineEdit->setText(landmark.address().county()); stateLineEdit->setText(landmark.address().state()); countryLineEdit->setText(landmark.address().country()); descriptionLineEdit->setText(landmark.description()); iconUrlLineEdit->setText(landmark.iconUrl().toString()); urlLineEdit->setText(landmark.url().toString()); phoneLineEdit->setText(landmark.phoneNumber()); radiusLineEdit->setText(QString::number(landmark.radius())); } else { setWindowTitle("Add Landmark"); } QLandmarkManager manager; QList<QLandmarkCategory> categories = manager.categories(); foreach( QLandmarkCategory category, categories) { QListWidgetItem *categoryItem = new QListWidgetItem(categoryList,QListWidgetItem::UserType + 1); categoryItem->setData(Qt::DisplayRole,category.name()); QVariant var; var.setValue(category.categoryId()); categoryItem->setData(Qt::UserRole, var); categoryItem->setFlags(Qt::ItemIsEnabled); if (landmark.categoryIds().contains(category.categoryId())) categoryItem->setCheckState(Qt::Checked); else categoryItem->setCheckState(Qt::Unchecked); }