I am trying to embed a QWidget into a QGraphicsScene using addWidget, and it seems to be embedding successfully, but it is not drawing at all, and I am not sure why. Here's the code where I embed the QWidget:

Qt Code:
  1. // JSL
  2. void QWorksheetDoc::addTable(DrawObjData *data, bool front, bool leaveSelected, char *theText)
  3. {
  4. if (worksheetView)
  5. {
  6. worksheetScene->clearSelection();
  7. QDatatable *table = new QDatatable();
  8. table->QDatatable::IDatatable(this);
  9. QGraphicsProxyWidget *theProxy = worksheetView->scene()->addWidget(table);
  10.  
  11. theProxy->setFlag(QGraphicsItem::ItemIsMovable);
  12. theProxy->setFlag(QGraphicsItem::ItemIsSelectable);
  13.  
  14. // JSL - install the common scene Event filter object.
  15. theProxy->installSceneEventFilter(sceneDrawCommon);
  16. theProxy->setSelected(true);
  17.  
  18. if (front)
  19. bringToFront();
  20. if (leaveSelected == false)
  21. worksheetScene->clearSelection();
  22. worksheetView->show();
  23. }
  24. }
To copy to clipboard, switch view to plain text mode 

QDatatable descends from QTableView.

Here's the code where QDatatable paints. I added the frame, and the fill to try to see anything on the screen:

Qt Code:
  1. //
  2. // JSL - paint
  3. //
  4. void QDatatable::paintEvent(QPaintEvent *event)
  5. {
  6. QPainter painter(this);
  7. //QRectF rect = frameRect();
  8.  
  9. QTableView::paintEvent(event);
  10.  
  11. painter.setRenderHint(QPainter::Antialiasing);
  12. painter.setPen(Qt::darkGray);
  13. painter.drawRect(rect());
  14. painter.fillRect(rect(), QColor(224,424,224));
  15. }
To copy to clipboard, switch view to plain text mode 

If anyone has any idea why this is not working I would appreciate hearing about it. What I see is a white rectangle that seems to obey z ordering, but is not selectable, or movable, and doesn't render anything.