PDA

View Full Version : Model-View-Delegate



hotdox
11th May 2010, 09:05
I try to use model-view-delegate in table view. QSlider are QCheckBox are used. But I have next problems:


To activate widget on table you need double-click on this, only after you may change the value
When you click on check box - it is become checked, but label doesn't change (Checked and "No" label same time)
When you use slider, you see old position of slider


All problems tested under various versions of Qt (RH54 - Qt 3.x, Fedora 12 - Qt 4.6, Ubuntu 8.10 - Qt 4.4, Ubuntu 9.04 - Qt 4.6 but they are all under GNOME)

Do you have same problems on KDE or windows?
Is this by design or my error?
Are there any ways to fix this?

In attachments minimal qt project reproducing problems

T4ng10r
11th May 2010, 11:14
Ad.1 Try to look on EditTriggers in QAbstractView. Unfortunately - I couldn't find trigger which will allow view to react on every click/selection - first you need to select cell.
Ad.2 and 3. Text and old slider position vanishes when location lost focus, which means data from delegate has been saved and control recreated. It looks like some update/redraw problems.

hotdox
11th May 2010, 11:48
Ad.1 Try to look on EditTriggers in QAbstractView. Unfortunately - I couldn't find trigger which will allow view to react on every click/selection - first you need to select cell.


This helps thanks, set QAbstractItemView::CurrentChanged|QAbstractItemVie w::SelectedClicked in designer

hotdox
11th May 2010, 13:20
# 3 Fixed
using


slider->setAutoFillBackground(true);


# 2 Fixed
using subclassing from QCheckBox and one slot to update text connected with QCheckBox::stateChanged

But It fixes consequences, not reasons