-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
47 lines (40 loc) · 1.14 KB
/
Copy pathmainwindow.cpp
File metadata and controls
47 lines (40 loc) · 1.14 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
m_map = new MapWidget(this);
setCentralWidget(m_map);
m_map->setFocus();
m_zoomLabel = new QLabel(this);
statusBar()->addWidget(m_zoomLabel);
connect(m_map, SIGNAL(zoomChanged(int)), SLOT(setZoomLabel(int)));
setZoomLabel(m_map->zoom());
m_onlineLabel = new QLabel(this);
statusBar()->addWidget(m_onlineLabel);
connect(m_map, SIGNAL(onlineSwitched(bool)), SLOT(setOnlineLabel(bool)));
setOnlineLabel(m_map->online());
m_loadingLabel = new QLabel();
statusBar()->addWidget(m_loadingLabel);
connect(m_map, SIGNAL(tilesLoading(int)), SLOT(setLoadingLabel(int)));
}
void MainWindow::setZoomLabel(int zoom)
{
QString s = "Zoom: %1";
s = s.arg(zoom);
m_zoomLabel->setText(s);
}
void MainWindow::setOnlineLabel(bool online)
{
m_onlineLabel->setText(online ? "Online" : "Offline");
}
void MainWindow::setLoadingLabel(int count)
{
if (count > 0) {
QString s = "Loading: %1";
s = s.arg(count);
m_loadingLabel->setText(s);
}
else {
m_loadingLabel->clear();
}
}