[Qt-interest] Widgets in your own Table?

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Fri Mar 12 00:41:33 CET 2010


> -----Original Message-----
> Hi,
> 
> This is actually a repost - as a previous attempt did not give me much
> help that I could use. Yet there must be many readers of this list who
> have done precisely what I'm trying to achieve.
> 
> In short: I don't know how to display a table with at each 
> (row,column)
> entry a QWidget. I would be *very* pleased if somebody could 
> give me the
> code essentials how to achieve this. Please read on.
> 
> Indeed very much like a QTableWidget, but not quit!
> I need to set my own (table) model, but as
> QTableWidget::setModel() is unaccessible (private), I cannot use the
> QTableWidget class.
> So I need to create my own version of a TableView (subclassed from
> QTableView),  that is capable to display the entry at each 
> [row,column].
> 
> I have tried many things, but all to no avail. I want to follow the
> model/view approach. Reading the source code of QTableWidget did not
> help me. Reading the documentation of what QItemDelegates 
> are, suggested
> that this might be the way to go, by implementing the "paint" method.
> But that can't be true: that is much too low level (with 
> painters etc.)
> I just want to display a widget!
> 
> Obviously, I'm missing the clue of this model/view approach.
> Is there somebody who could give help me out of this?
> 
> Thanks in advance.


Hi Bertwim, 

I agree that the model/view design seems broken in only supporting paint in
QItemDelegate for display modes - and even that aspect was poorly documented
in earlier 4.x versions!  

What problem do you have with setIndexWidget?  Obviously this will only work
for small data sets.  

When you can't find a feature in assistant, always try the 'list all
members' link.  

Regards 

Tony.





More information about the Qt-interest-old mailing list