From 919ce79845d077f2509d6cc0f8fac50d339175b3 Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 2 Jun 2010 15:54:45 +0200 Subject: Remove leftover. Reviewed-by: ck --- tools/assistant/tools/assistant/contentwindow.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/assistant/tools/assistant/contentwindow.h b/tools/assistant/tools/assistant/contentwindow.h index 62855dd..658e74e 100644 --- a/tools/assistant/tools/assistant/contentwindow.h +++ b/tools/assistant/tools/assistant/contentwindow.h @@ -76,7 +76,6 @@ private: void focusInEvent(QFocusEvent *e); void keyPressEvent(QKeyEvent *e); bool eventFilter(QObject *o, QEvent *e); - bool isPdfFile(QHelpContentItem *item) const; QHelpContentWidget * const m_contentWidget; int m_expandDepth; -- cgit v0.12 From 27c4c963de1a28afa95e7837fa844ae8a3bccd2c Mon Sep 17 00:00:00 2001 From: kh1 Date: Thu, 3 Jun 2010 14:23:52 +0200 Subject: Make the open pages widget act on the up/ down key directly. Reviewed-by: ck --- .../assistant/tools/assistant/openpageswidget.cpp | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tools/assistant/tools/assistant/openpageswidget.cpp b/tools/assistant/tools/assistant/openpageswidget.cpp index a68da23..b7ac33e 100644 --- a/tools/assistant/tools/assistant/openpageswidget.cpp +++ b/tools/assistant/tools/assistant/openpageswidget.cpp @@ -134,10 +134,15 @@ OpenPagesWidget::~OpenPagesWidget() void OpenPagesWidget::selectCurrentPage() { TRACE_OBJ + const QModelIndex ¤t = + model()->index(CentralWidget::instance()->currentIndex(), 0); + QItemSelectionModel * const selModel = selectionModel(); - selModel->clearSelection(); - selModel->select(model()->index(CentralWidget::instance()->currentIndex(), 0), + selModel->select(current, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); + selModel->clearSelection(); + + setCurrentIndex(current); scrollTo(currentIndex()); } @@ -204,18 +209,27 @@ void OpenPagesWidget::handleClicked(const QModelIndex &index) bool OpenPagesWidget::eventFilter(QObject *obj, QEvent *event) { TRACE_OBJ - if (obj == this && event->type() == QEvent::KeyPress) { - if (currentIndex().isValid()) { - QKeyEvent *ke = static_cast(event); + if (obj != this) + return QWidget::eventFilter(obj, event); + + if (event->type() == QEvent::KeyPress) { + QKeyEvent *ke = static_cast(event); + if (currentIndex().isValid() && ke->modifiers() == 0) { const int key = ke->key(); - if ((key == Qt::Key_Return || key == Qt::Key_Enter || key == Qt::Key_Space) - && ke->modifiers() == 0) { + if (key == Qt::Key_Return || key == Qt::Key_Enter + || key == Qt::Key_Space) { emit setCurrentPage(currentIndex()); } else if ((key == Qt::Key_Delete || key == Qt::Key_Backspace) - && ke->modifiers() == 0 && model()->rowCount() > 1) { + && model()->rowCount() > 1) { emit closePage(currentIndex()); } } + } else if (event->type() == QEvent::KeyRelease) { + QKeyEvent *ke = static_cast(event); + if (ke->modifiers() == 0 + && (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down)) { + emit setCurrentPage(currentIndex()); + } } return QWidget::eventFilter(obj, event); } -- cgit v0.12