Hi,

I have the following code :

Qt Code:
  1. CSendMessage::CSendMessage(QWidget *parent)
  2. : QWidget(parent)
  3. {
  4. ui.setupUi(this);
  5.  
  6. this->setMinimumHeight(400);
  7. this->setMinimumWidth(600);
  8.  
  9. QStandardItemModel model(4, 4);
  10. ui.tableView->setModel(&model);
  11.  
  12. SliderDelegate delegate;
  13. ui.tableView->setItemDelegate( &delegate );
  14.  
  15. for (int row = 0; row < 4; ++row) {
  16. for (int column = 0; column < 4; ++column) {
  17. QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
  18. model.setItem(row, column, item);
  19. }
  20. }
  21.  
  22. }
To copy to clipboard, switch view to plain text mode 

Is there any reason why the above code does not put items into the table view?

The class that holds the table view is a standard QT ui one with a table view on the form and is added to a QMdiSubWindow as a widget.

This is added as follows :

Qt Code:
  1. m_pSendMessage = new CSendMessage( this );
  2. m_pSendMessageWindow = new QMdiSubWindow;
  3. m_pSendMessageWindow->setWidget( m_pSendMessage );
  4. m_pSendMessageWindow->setAttribute( Qt::WA_DeleteOnClose );
  5.  
  6. QMdiSubWindow* subWindow = m_pworkspace->addSubWindow( m_pSendMessageWindow );
  7. subWindow->setWindowIcon(QIcon(QString::fromUtf8(":/QTCanMonitor/Resources/Envelope.png")));
  8. m_pSendMessageWindow->show();
To copy to clipboard, switch view to plain text mode 

I'm confused?

Regards,
Steve