* Let the metadata widget only get the focus by clicking.
* Tried to install a similar filter for the wheel-event code duplication in the view-implementations, but the event filter is invoked _after_ the view implementation gets the wheel event... -> added a note the the 3 implementations as hint.
svn path=/trunk/KDE/kdebase/apps/; revision=777757
void DolphinColumnWidget::keyPressEvent(QKeyEvent* event)
{
QListView::keyPressEvent(event);
- Q_ASSERT(m_view->m_controller->itemView() == this);
+ requestActivation();
m_view->m_controller->handleKeyPressEvent(event);
}
void DolphinColumnWidget::wheelEvent(QWheelEvent* event)
{
// let Ctrl+wheel events propagate to the DolphinView for icon zooming
- if ((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
+ // (installing an event filter does not work, as the wheel event is handled first)
+ if (event->modifiers() & Qt::ControlModifier) {
event->ignore();
return;
}
void DolphinDetailsView::wheelEvent(QWheelEvent* event)
{
// let Ctrl+wheel events propagate to the DolphinView for icon zooming
- if ((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
+ // (installing an event filter does not work, as the wheel event is handled first)
+ if (event->modifiers() & Qt::ControlModifier) {
event->ignore();
- return;
+ return;
}
QTreeView::wheelEvent(event);
}
void DolphinIconsView::wheelEvent(QWheelEvent* event)
{
// let Ctrl+wheel events propagate to the DolphinView for icon zooming
- if ((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
+ // (installing an event filter does not work, as the wheel event is handled first)
+ if (event->modifiers() & Qt::ControlModifier) {
event->ignore();
return;
}
void DolphinView::wheelEvent(QWheelEvent* event)
{
- if ((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
- int d = event->delta();
- if (d > 0 && isZoomInPossible()) {
+ if (event->modifiers() & Qt::ControlModifier) {
+ const int delta = event->delta();
+ if ((delta > 0) && isZoomInPossible()) {
zoomIn();
- } else if (d < 0 && isZoomOutPossible()) {
+ } else if ((delta < 0) && isZoomOutPossible()) {
zoomOut();
}
- event->accept();
+ event->accept();
}
}
+bool DolphinView::eventFilter(QObject* watched, QEvent* event)
+{
+ if ((watched == itemView()) && (event->type() == QEvent::FocusIn)) {
+ m_controller->requestActivation();
+ }
+
+ return QWidget::eventFilter(watched, event);
+}
+
void DolphinView::activate()
{
setActive(true);
}
Q_ASSERT(view != 0);
+ view->installEventFilter(this);
+
m_controller->setItemView(view);
m_fileItemDelegate = new KFileItemDelegate(view);
public:
/**
- * Defines the view mode for a directory. The view mode
- * can be defined when constructing a DolphinView. The
- * view mode is automatically updated if the directory itself
- * defines a view mode (see class ViewProperties for details).
- */
+ * Defines the view mode for a directory. The view mode
+ * can be defined when constructing a DolphinView. The
+ * view mode is automatically updated if the directory itself
+ * defines a view mode (see class ViewProperties for details).
+ */
enum Mode
{
/**
/** @see QWidget::mouseReleaseEvent */
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void wheelEvent(QWheelEvent* event);
+ virtual bool eventFilter(QObject* watched, QEvent* event);
private slots:
/**
#ifdef HAVE_NEPOMUK
d = new Private;
d->editComment = new QTextEdit(this);
+ d->editComment->setFocusPolicy(Qt::ClickFocus);
d->ratingWidget = new KRatingWidget(this);
d->tagWidget = new Nepomuk::TagWidget(this);
connect(d->ratingWidget, SIGNAL(ratingChanged(unsigned int)), this, SLOT(slotRatingChanged(unsigned int)));