Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, April 2008
QItemDelegate with multiple checkboxes?


Message 1 in thread

Hello,
I am using QTableViews to display and edit the tables of a simple
database. The relational model works great for relational data, but I
have several columns with data that act as flags, so that a cell can
have one or more (or none) of them set.
Currently these columns are represented by comma separated texts like
'flag1,flag3,flag10'. Since there are not much of these flags, using a
separate table for the flags and an intermediate connecting table
would be overkill.
I figured that I would need to use QItemDelegate and inherit it to
create a custom edit widget for this, with multiple checkboxes or a
list that enables multiple selection. Does anyone has any experience
or advice with this, or, since I think this might be a common problem,
there could be a solution already implemented somewhere.
I thought it would make sense to ask first before jumping into
implementing it. :)
Thanks!


-- 
 [ signature omitted ] 

Message 2 in thread

hi Tamas,

Tamas Marki wrote:
...
> I figured that I would need to use QItemDelegate and inherit it to
> create a custom edit widget for this, with multiple checkboxes or a
> list that enables multiple selection. Does anyone has any experience
> or advice with this, or, since I think this might be a common problem,
> there could be a solution already implemented somewhere.
...

Of course yYou can use you custom widgets in the QItemDelegates. I'm
creating one app with quite complex editor widgets (constaining buttons,
lineedits, etc. in one delegate). I create these widgets in Designer.

I had only one problem with it - you has to handle focus very carefully in
delegate's editor.

petr

--
 [ signature omitted ]