1
0
mirror of git://projects.qi-hardware.com/nanomap.git synced 2024-11-24 06:54:59 +02:00

don't perform action if a modifier is pressed

This commit is contained in:
Niels 2010-09-08 14:29:50 +02:00
parent e25b856e35
commit bf6b56644e
2 changed files with 33 additions and 13 deletions

View File

@ -222,20 +222,24 @@ void MapWidget::keyPressEvent(QKeyEvent *event)
QPoint move; QPoint move;
int width = 10; int width = 10;
if (event->modifiers() & Qt::AltModifier) { if (event->modifiers() == Qt::AltModifier) {
width = 100; width = 100;
} else if (event->modifiers() & Qt::ShiftModifier) { } else if (event->modifiers() == Qt::ShiftModifier) {
width = 1; width = 1;
} }
switch (event->key()) { switch (event->key()) {
case Qt::Key_Tab: case Qt::Key_Tab:
{ {
emit showMarkerList(); if (event->modifiers() == Qt::NoModifier) {
emit showMarkerList();
}
break; break;
} }
case Qt::Key_D: case Qt::Key_D:
{ {
emit downloadArea(m_level, geoRect()); if (event->modifiers() == Qt::NoModifier) {
emit downloadArea(m_level, geoRect());
}
break; break;
} }
case Qt::Key_Up: case Qt::Key_Up:
@ -260,29 +264,39 @@ void MapWidget::keyPressEvent(QKeyEvent *event)
} }
case Qt::Key_O: case Qt::Key_O:
{ {
changeZoomLevel(-1); if (event->modifiers() == Qt::NoModifier) {
reloadPixmaps(); changeZoomLevel(-1);
reloadPixmaps();
}
break; break;
} }
case Qt::Key_I: case Qt::Key_I:
{ {
changeZoomLevel(1); if (event->modifiers() == Qt::NoModifier) {
reloadPixmaps(); changeZoomLevel(1);
reloadPixmaps();
}
break; break;
} }
case Qt::Key_U: case Qt::Key_U:
{ {
m_ui = !m_ui; if (event->modifiers() == Qt::NoModifier) {
m_ui = !m_ui;
}
break; break;
} }
case Qt::Key_H: case Qt::Key_H:
{ {
m_usage = !m_usage; if (event->modifiers() == Qt::NoModifier) {
m_usage = !m_usage;
}
break; break;
} }
case Qt::Key_R: case Qt::Key_R:
{ {
emit route(m_routeStart, m_routeEnd); if (event->modifiers() == Qt::NoModifier) {
emit route(m_routeStart, m_routeEnd);
}
break; break;
} }
case Qt::Key_S: case Qt::Key_S:
@ -296,13 +310,17 @@ void MapWidget::keyPressEvent(QKeyEvent *event)
} }
case Qt::Key_E: case Qt::Key_E:
{ {
m_routeEnd = geoPos(); if (event->modifiers() == Qt::NoModifier) {
m_routeEnd = geoPos();
}
break; break;
} }
case Qt::Key_Q: case Qt::Key_Q:
case Qt::Key_Escape: case Qt::Key_Escape:
{ {
qApp->quit(); if (event->modifiers() == Qt::NoModifier) {
emit close();
}
break; break;
} }
} }
@ -331,6 +349,7 @@ void MapWidget::paintEvent(QPaintEvent *event)
painter.begin(this); painter.begin(this);
} }
painter.setPen(Qt::black);
for (int x = 0; x < m_cols; ++x) { for (int x = 0; x < m_cols; ++x) {
for (int y = 0; y < m_rows; ++y) { for (int y = 0; y < m_rows; ++y) {
QPixmap *pix = m_pix[x][y]; QPixmap *pix = m_pix[x][y];

View File

@ -45,6 +45,7 @@ public slots:
void centerOnGeoPos(qreal lon, qreal lat); void centerOnGeoPos(qreal lon, qreal lat);
signals: signals:
void close();
void showMarkerList(); void showMarkerList();
void downloadArea(int level, const QRectF &rect); void downloadArea(int level, const QRectF &rect);
void route(const QPointF &from, const QPointF &to); void route(const QPointF &from, const QPointF &to);