[qt] Final search edit focus fix, now works with icon click and cmd+f

This commit is contained in:
Alex Zolotarev 2011-06-04 16:28:05 +02:00 committed by Alex Zolotarev
parent 62679898d2
commit f9b7368151
2 changed files with 9 additions and 20 deletions

View file

@ -237,6 +237,7 @@ void MainWindow::CreateNavigationBar()
SLOT(OnSearchButtonClicked()));
m_pSearchAction->setCheckable(true);
m_pSearchAction->setToolTip(tr("Offline Search"));
m_pSearchAction->setShortcut(QKeySequence::Find);
pToolBar->addSeparator();
@ -326,20 +327,6 @@ void MainWindow::OnSearchButtonClicked()
}
}
void MainWindow::OnSearchShortcutPressed()
{
if (m_Docks[2]->isVisible())
{
m_pSearchAction->setChecked(false);
m_Docks[2]->hide();
}
else
{
m_pSearchAction->setChecked(true);
m_Docks[2]->show();
}
}
void MainWindow::OnPreferences()
{
bool autoUpdatesEnabled = DEFAULT_AUTO_UPDATES_ENABLED;
@ -394,7 +381,7 @@ void MainWindow::CreateGuidePanel()
void MainWindow::CreateSearchBarAndPanel()
{
CreatePanelImpl(2, Qt::RightDockWidgetArea, tr("Search"),
QKeySequence(QKeySequence::Find), SLOT(OnSearchShortcutPressed()));
QKeySequence(), 0);
SearchPanel * panel = new SearchPanel(m_pDrawWidget, m_Docks[2]);
m_Docks[2]->setWidget(panel);
}
@ -410,10 +397,13 @@ void MainWindow::CreatePanelImpl(size_t i, Qt::DockWidgetArea area, QString cons
m_Docks[i]->hide();
// register a hotkey to show classificator panel
QAction * pAct = new QAction(this);
pAct->setShortcut(hotkey);
connect(pAct, SIGNAL(triggered()), this, slot);
addAction(pAct);
if (!hotkey.isEmpty())
{
QAction * pAct = new QAction(this);
pAct->setShortcut(hotkey);
connect(pAct, SIGNAL(triggered()), this, slot);
addAction(pAct);
}
}
}

View file

@ -66,6 +66,5 @@ namespace qt
void OnAbout();
void OnMyPosition();
void OnSearchButtonClicked();
void OnSearchShortcutPressed();
};
}