diff options
author | con <[email protected]> | 2009-06-05 12:49:29 +0200 |
---|---|---|
committer | con <[email protected]> | 2009-06-05 12:50:06 +0200 |
commit | 722b23189eb0144116d940f821e4e5647d73dcd9 (patch) | |
tree | 93d2ff3f7c2aa9703a95b10ca73b07a889e073c5 /src/shared/help/indexwindow.cpp | |
parent | b3284cc13186abdca82e4ffd800e813fb2b153ca (diff) |
More fixes for setting focus correctly.
Reviewed-by: dt
Diffstat (limited to 'src/shared/help/indexwindow.cpp')
-rw-r--r-- | src/shared/help/indexwindow.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/shared/help/indexwindow.cpp b/src/shared/help/indexwindow.cpp index 8ae9f4e0a93..208f2357a91 100644 --- a/src/shared/help/indexwindow.cpp +++ b/src/shared/help/indexwindow.cpp @@ -54,6 +54,7 @@ IndexWindow::IndexWindow(QHelpEngine *helpEngine, QWidget *parent) m_searchLineEdit = new QLineEdit(); l->setBuddy(m_searchLineEdit); + setFocusProxy(m_searchLineEdit); connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterIndices(QString))); m_searchLineEdit->installEventFilter(this); @@ -112,6 +113,11 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) break; default: ; // stop complaining } + } else if (obj == m_searchLineEdit + && e->type() == QEvent::FocusIn + && static_cast<QFocusEvent *>(e)->reason() != Qt::MouseFocusReason) { + m_searchLineEdit->selectAll(); + m_searchLineEdit->setFocus(); } else if (obj == m_indexWidget && e->type() == QEvent::ContextMenu) { QContextMenuEvent *ctxtEvent = static_cast<QContextMenuEvent*>(e); QModelIndex idx = m_indexWidget->indexAt(ctxtEvent->pos()); @@ -147,6 +153,7 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) m_indexWidget->activateCurrentItem(); } #endif + return QWidget::eventFilter(obj, e); } @@ -166,14 +173,6 @@ void IndexWindow::setSearchLineEditText(const QString &text) m_searchLineEdit->setText(text); } -void IndexWindow::focusInEvent(QFocusEvent *e) -{ - if (e->reason() != Qt::MouseFocusReason) { - m_searchLineEdit->selectAll(); - m_searchLineEdit->setFocus(); - } -} - void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index) { QHelpIndexModel *model = qobject_cast<QHelpIndexModel*>(indexWidget->model()); |