Delegate strangeness

Rafael Fernández López ereslibre at gmail.com
Tue Jan 2 01:27:21 GMT 2007


Hi,

I think I found a Qt bug, and for that reason I'm a bit sorry writing
it to these lists. I hope some Trolls read it.

Well, the main problem of the thing I'm going to describe is that this
have never been done before on KDE, and is the first time we have been
capable of using this functionality from Qt. The thing is that I'm
developing at kio_uiserver
(http://websvn.kde.org/branches/work/kio_uiserver).

The problem of this model is that it is not only modified by user
interaction (input), but it is updated through internal job behaviours
and progresses. Their behaviour can be modified through user
interaction too (like clicking on a button "Pause transfer", for
example).

The internal data flow is being handled by the Observer, and it works
pretty nice. For handling the interaction with user (actions support)
I added the editing support for the delegate (and the model). As you
may know, there are some methods we should override to have the wanted
effect:

QWidget *createEditor ( QWidget * parent, const QStyleOptionViewItem &
option, const QModelIndex & index ) const

void updateEditorGeometry ( QWidget * editor, const
QStyleOptionViewItem & option, const QModelIndex & index ) const

void paint ( QPainter * painter, const QStyleOptionViewItem & option,
const QModelIndex & index ) const

on QAbstractItemDelegate. And playing with:

void openPersistentEditor ( const QModelIndex & index )

void closePersistentEditor ( const QModelIndex & index )

on QAbstractItemView for showing available actions (buttons) in all
jobs, and not only in the clicked (or double clicked) one, where the
editor is normally "temporarily" opened.

The problem is the next:

Using updateEditorGeometry I place the editor at the end of the
delegate, and above it you can find the other information, messages
like status, progress bar, size downloaded...

When the editor is showed (just after the job is added to the list) it
seems that the delegate itself freezes. I mean, you can click on the
button without problems and it works, but the progress bar and
messages just freezes. I've noticed that if you resize the window or
you click on the delegate it will redraw and the items on the delegate
will be updated and redrawn.

Since the editor can be placed wherever we want in the delegate (with
updateEditorGeometry), and it might not be the same size of the whole
delegate itself, i think the delegate should be redrawn too as it were
if no editor was opened.

We have to take in count that when we open an editor we are generally
going to edit only a value of the model, but we should have present
that while we have the editor opened, other changes can happen to the
model that the delegate needs to show/update while the editor is
opened, since different attributes were changed.

Thank you,
Rafael Fernández López.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


More information about the kde-core-devel mailing list