-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmappanel.cpp
More file actions
26 lines (23 loc) · 930 Bytes
/
mappanel.cpp
File metadata and controls
26 lines (23 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "mappanel.h"
MapPanel::MapPanel(QWidget* p): QWidget(p){
auto lay = new QVBoxLayout(this);
web = new QWebEngineView(this);
web->setContextMenuPolicy(Qt::NoContextMenu);
info = new QLabel("Map is locked. Click “Reveal Coordinates” once you confirm authorization.");
info->setWordWrap(true);
info->setAlignment(Qt::AlignCenter);
lay->addWidget(web,1);
lay->addWidget(info);
lock();
}
void MapPanel::lock(){
web->setHtml("<html><body style='background:#120a1f;color:#c9b9ff;display:flex;align-items:center;justify-content:center;height:100%;font-family:Inter,Segoe UI,Arial'>Map locked</body></html>");
info->show();
locked = true;
}
void MapPanel::showOsm(double lat, double lon){
QString url = QString("https://www.openstreetmap.org/?mlat=%1&mlon=%2&zoom=14").arg(lat,0,'f',6).arg(lon,0,'f',6);
web->setUrl(QUrl(url));
info->hide();
locked = false;
}