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

View File

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