MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / mapNotesClicked

Method mapNotesClicked

src/gui/map/map_editor.cpp:2244–2277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2242}
2243
2244void MapEditorController::mapNotesClicked()
2245{
2246 QDialog dialog(window, Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
2247 dialog.setWindowTitle(tr("Map notes"));
2248 dialog.setWindowModality(Qt::WindowModal);
2249
2250 auto* text_edit = new QTextEdit();
2251 text_edit->setPlainText(map->getMapNotes());
2252 QPushButton* cancel_button = new QPushButton(tr("Cancel"));
2253 QPushButton* ok_button = new QPushButton(QIcon(QString::fromLatin1(":/images/arrow-right.png")), tr("OK"));
2254 ok_button->setDefault(true);
2255
2256 auto* buttons_layout = new QHBoxLayout();
2257 buttons_layout->addWidget(cancel_button);
2258 buttons_layout->addStretch(1);
2259 buttons_layout->addWidget(ok_button);
2260
2261 auto* layout = new QVBoxLayout();
2262 layout->addWidget(text_edit);
2263 layout->addLayout(buttons_layout);
2264 dialog.setLayout(layout);
2265
2266 connect(cancel_button, &QAbstractButton::clicked, &dialog, &QDialog::reject);
2267 connect(ok_button, &QAbstractButton::clicked, &dialog, &QDialog::accept);
2268
2269 if (dialog.exec() == QDialog::Accepted)
2270 {
2271 if (text_edit->toPlainText() != map->getMapNotes())
2272 {
2273 map->setMapNotes(text_edit->toPlainText());
2274 map->setHasUnsavedChanges(true);
2275 }
2276 }
2277}
2278
2279void MapEditorController::createTemplateWindow()
2280{

Callers

nothing calls this directly

Calls 4

setMapNotesMethod · 0.80
QIconClass · 0.70
execMethod · 0.45
setHasUnsavedChangesMethod · 0.45

Tested by

no test coverage detected