1
0
mirror of git://projects.qi-hardware.com/nanomap.git synced 2024-11-28 02:10:37 +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:
{ {
if (event->modifiers() == Qt::NoModifier) {
emit showMarkerList(); emit showMarkerList();
}
break; break;
} }
case Qt::Key_D: case Qt::Key_D:
{ {
if (event->modifiers() == Qt::NoModifier) {
emit downloadArea(m_level, geoRect()); 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:
{ {
if (event->modifiers() == Qt::NoModifier) {
changeZoomLevel(-1); changeZoomLevel(-1);
reloadPixmaps(); reloadPixmaps();
}
break; break;
} }
case Qt::Key_I: case Qt::Key_I:
{ {
if (event->modifiers() == Qt::NoModifier) {
changeZoomLevel(1); changeZoomLevel(1);
reloadPixmaps(); reloadPixmaps();
}
break; break;
} }
case Qt::Key_U: case Qt::Key_U:
{ {
if (event->modifiers() == Qt::NoModifier) {
m_ui = !m_ui; m_ui = !m_ui;
}
break; break;
} }
case Qt::Key_H: case Qt::Key_H:
{ {
if (event->modifiers() == Qt::NoModifier) {
m_usage = !m_usage; m_usage = !m_usage;
}
break; break;
} }
case Qt::Key_R: case Qt::Key_R:
{ {
if (event->modifiers() == Qt::NoModifier) {
emit route(m_routeStart, m_routeEnd); 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:
{ {
if (event->modifiers() == Qt::NoModifier) {
m_routeEnd = geoPos(); 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);