forked from organicmaps/organicmaps
Add hot keys for navigation.
This commit is contained in:
parent
144ce44cb7
commit
65e7099282
4 changed files with 52 additions and 4 deletions
|
@ -113,6 +113,18 @@ namespace qt
|
|||
UpdateScaleControl();
|
||||
}
|
||||
|
||||
void DrawWidget::ScalePlusLight()
|
||||
{
|
||||
m_framework.Scale(1.5);
|
||||
UpdateScaleControl();
|
||||
}
|
||||
|
||||
void DrawWidget::ScaleMinusLight()
|
||||
{
|
||||
m_framework.Scale(2.0/3.0);
|
||||
UpdateScaleControl();
|
||||
}
|
||||
|
||||
void DrawWidget::ShowAll()
|
||||
{
|
||||
m_framework.ShowAll();
|
||||
|
|
|
@ -44,8 +44,12 @@ namespace qt
|
|||
void MoveRight();
|
||||
void MoveUp();
|
||||
void MoveDown();
|
||||
|
||||
void ScalePlus();
|
||||
void ScaleMinus();
|
||||
void ScalePlusLight();
|
||||
void ScaleMinusLight();
|
||||
|
||||
void ShowAll();
|
||||
void Repaint();
|
||||
void ScaleChanged(int action);
|
||||
|
|
|
@ -194,6 +194,12 @@ namespace
|
|||
pBar->addSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
struct hotkey_t
|
||||
{
|
||||
int key;
|
||||
char const * slot;
|
||||
};
|
||||
}
|
||||
|
||||
void MainWindow::CreateNavigationBar()
|
||||
|
@ -202,6 +208,29 @@ void MainWindow::CreateNavigationBar()
|
|||
pBar->setOrientation(Qt::Vertical);
|
||||
pBar->setIconSize(QSize(32, 32));
|
||||
|
||||
{
|
||||
// add navigation hot keys
|
||||
hotkey_t arr[] = {
|
||||
{ Qt::Key_Left, SLOT(MoveLeft()) },
|
||||
{ Qt::Key_Right, SLOT(MoveRight()) },
|
||||
{ Qt::Key_Up, SLOT(MoveUp()) },
|
||||
{ Qt::Key_Down, SLOT(MoveDown()) },
|
||||
{ Qt::Key_Equal, SLOT(ScalePlus()) },
|
||||
{ Qt::Key_Minus, SLOT(ScaleMinus()) },
|
||||
{ Qt::ALT + Qt::Key_Equal, SLOT(ScalePlusLight()) },
|
||||
{ Qt::ALT + Qt::Key_Minus, SLOT(ScaleMinusLight()) },
|
||||
{ Qt::Key_A, SLOT(ShowAll()) }
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
|
||||
{
|
||||
QAction * pAct = new QAction(this);
|
||||
pAct->setShortcut(QKeySequence(arr[i].key));
|
||||
connect(pAct, SIGNAL(triggered()), m_pDrawWidget, arr[i].slot);
|
||||
addAction(pAct);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// add my position button with "checked" behavior
|
||||
m_pMyPosition = pBar->addAction(QIcon(":/navig64/location.png"),
|
||||
|
|
|
@ -16,11 +16,13 @@ namespace qt
|
|||
{
|
||||
QAction * m_pMyPosition;
|
||||
DrawWidget * m_pDrawWidget;
|
||||
|
||||
#ifdef DEBUG // code removed for desktop releases
|
||||
QDockWidget * m_Docks[2];
|
||||
//FindTableWnd * m_pFindTable;
|
||||
#ifdef DEBUG // code removed for desktop releases
|
||||
UpdateDialog * m_updateDialog;
|
||||
#endif // DEBUG
|
||||
|
||||
storage::Storage m_storage;
|
||||
|
||||
Q_OBJECT
|
||||
|
@ -44,13 +46,14 @@ namespace qt
|
|||
|
||||
void CreateClassifPanel();
|
||||
void CreateGuidePanel();
|
||||
#endif
|
||||
#endif // DEBUG
|
||||
void CreateNavigationBar();
|
||||
//void CreateFindTable(QLayout * pLayout);
|
||||
#if defined(Q_WS_WIN)
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
/// to handle menu messages
|
||||
virtual bool winEvent(MSG * msg, long * result);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
protected Q_SLOTS:
|
||||
//void OnFeatureEntered(int row, int col);
|
||||
|
|
Loading…
Add table
Reference in a new issue