[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Delegate strangeness
From: "=?UTF-8?Q?Rafael_Fern=C3=A1ndez_L=C3=B3pez?=" <ereslibre () gmail ! com>
Date: 2007-01-05 11:25:41
Message-ID: 93f85fee0701050325j3331a45ehc3581124edd46fef () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (text/plain)]
Hi,
I've located the problem. You can see that in the code I removed if
there were an editor present on some methods it just returned before
was called the update method for the correct rectangle.
Patch attached.
Bye,
Rafael Fernández López.
["qt-4.2-delegate-editor.patch" (application/octet-stream)]
Index: src/gui/itemviews/qabstractitemview.cpp
===================================================================
--- src/gui/itemviews/qabstractitemview.cpp (revisión: 619704)
+++ src/gui/itemviews/qabstractitemview.cpp (copia de trabajo)
@@ -1288,8 +1288,15 @@ void QAbstractItemView::mousePressEvent(
QPoint pos = event->pos();
QPersistentModelIndex index = indexAt(pos);
- if (!d->selectionModel
- || (d->state == EditingState && d->hasEditor(index)))
+ if (index.isValid())
+ {
+ d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
+
+ // signal handlers may change the model
+ emit pressed(index);
+ }
+
+ if (!d->selectionModel)
return;
d->pressedAlreadySelected = d->selectionModel->isSelected(index);
@@ -1303,18 +1310,10 @@ void QAbstractItemView::mousePressEvent(
if (d->pressedPosition == QPoint(-1, -1))
d->pressedPosition = visualRect(currentIndex()).center() + offset;
- if (edit(index, NoEditTriggers, event))
- return;
+ edit(index, NoEditTriggers, event);
QRect rect(d->pressedPosition - offset, pos);
setSelection(rect, command);
-
- if (index.isValid())
- d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
-
- // signal handlers may change the model
- if (index.isValid())
- emit pressed(index);
}
/*!
@@ -1345,9 +1344,13 @@ void QAbstractItemView::mouseMoveEvent(Q
QModelIndex index = indexAt(bottomRight);
QModelIndex buddy = d->model->buddy(d->pressedIndex);
- if (state() == EditingState && d->hasEditor(buddy)
- || edit(index, NoEditTriggers, event))
+
+ if (state() != EditingState || !d->hasEditor(buddy))
+ {
+ edit(index, NoEditTriggers, event);
+
return;
+ }
if (d->selectionMode != SingleSelection)
topLeft = d->pressedPosition - d->offset();
@@ -2528,6 +2531,7 @@ void QAbstractItemView::dataChanged(cons
if (!delegate)
return;
delegate->setEditorData(d->editorForIndex(topLeft), topLeft);
+ d->viewport->update(visualRect(topLeft));
} else if (isVisible() && !d->delayedLayout.isActive()) {
// otherwise the items will be update later anyway
d->viewport->update(visualRect(topLeft));
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic