[Qt-interest] Widgets in your own Table?

Ramesh ramesh.bs at robosoftin.com
Fri Mar 12 05:37:31 CET 2010


Create the Qtablel widget,  

set the Qstanderditemmodel 

fill up the qstanderditem 

append the items to new row or column of your choice,,

place the tabelwidget as centrelwidegt of ur main window.

 

 

From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of B.W.H. van Beest
Sent: Friday, March 12, 2010 4:18 AM
To: Peter
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Widgets in your own Table?

 

Hi Peter, 

I can't see how!  Qt::DecorationRole is about painting an icon or pixmap. 
But I need to display a widget.
What am I overlooking?

Peter wrote: 

Hello Bertwim,
have a look at Qt::DecorationRole within the model. This should do the 
job...
 
regards,
Peter
 
Am 11.03.2010 22:36, schrieb B.W.H. van Beest:
  

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.
Bertwim
    

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
 
  

-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100312/84525cd4/attachment.html 


More information about the Qt-interest-old mailing list