aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/help/contentwindow.cpp
diff options
context:
space:
mode:
authorcon <[email protected]>2009-06-05 12:49:29 +0200
committercon <[email protected]>2009-06-05 12:50:06 +0200
commit722b23189eb0144116d940f821e4e5647d73dcd9 (patch)
tree93d2ff3f7c2aa9703a95b10ca73b07a889e073c5 /src/shared/help/contentwindow.cpp
parentb3284cc13186abdca82e4ffd800e813fb2b153ca (diff)
More fixes for setting focus correctly.
Reviewed-by: dt
Diffstat (limited to 'src/shared/help/contentwindow.cpp')
-rw-r--r--src/shared/help/contentwindow.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/shared/help/contentwindow.cpp b/src/shared/help/contentwindow.cpp
index ca722034333..e7dcab7da41 100644
--- a/src/shared/help/contentwindow.cpp
+++ b/src/shared/help/contentwindow.cpp
@@ -43,8 +43,10 @@ ContentWindow::ContentWindow(QHelpEngine *helpEngine)
, m_expandDepth(-2)
{
m_contentWidget = m_helpEngine->contentWidget();
+ m_contentWidget->installEventFilter(this);
m_contentWidget->viewport()->installEventFilter(this);
m_contentWidget->setContextMenuPolicy(Qt::CustomContextMenu);
+ setFocusProxy(m_contentWidget);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(4);
@@ -90,18 +92,6 @@ void ContentWindow::expandToDepth(int depth)
m_contentWidget->expandToDepth(depth);
}
-void ContentWindow::focusInEvent(QFocusEvent *e)
-{
- if (e->reason() != Qt::MouseFocusReason)
- m_contentWidget->setFocus();
-}
-
-void ContentWindow::keyPressEvent(QKeyEvent *e)
-{
- if (e->key() == Qt::Key_Escape)
- emit escapePressed();
-}
-
bool ContentWindow::eventFilter(QObject *o, QEvent *e)
{
if (m_contentWidget && o == m_contentWidget->viewport()
@@ -125,6 +115,9 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
itemClicked(index);
}
}
+ } else if (o == m_contentWidget && e->type() == QEvent::KeyPress) {
+ if (static_cast<QKeyEvent *>(e)->key() == Qt::Key_Escape)
+ emit escapePressed();
}
return QWidget::eventFilter(o, e);
}