steg90
20th November 2007, 12:03
Hi,
I have the following code :
CSendMessage::CSendMessage(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
this->setMinimumHeight(400);
this->setMinimumWidth(600);
QStandardItemModel model(4, 4);
ui.tableView->setModel(&model);
SliderDelegate delegate;
ui.tableView->setItemDelegate( &delegate );
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 4; ++column) {
QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
model.setItem(row, column, item);
}
}
}
Is there any reason why the above code does not put items into the table view? :confused:
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 :
m_pSendMessage = new CSendMessage( this );
m_pSendMessageWindow = new QMdiSubWindow;
m_pSendMessageWindow->setWidget( m_pSendMessage );
m_pSendMessageWindow->setAttribute( Qt::WA_DeleteOnClose );
QMdiSubWindow* subWindow = m_pworkspace->addSubWindow( m_pSendMessageWindow );
subWindow->setWindowIcon(QIcon(QString::fromUtf8(":/QTCanMonitor/Resources/Envelope.png")));
m_pSendMessageWindow->show();
I'm confused?
Regards,
Steve
I have the following code :
CSendMessage::CSendMessage(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
this->setMinimumHeight(400);
this->setMinimumWidth(600);
QStandardItemModel model(4, 4);
ui.tableView->setModel(&model);
SliderDelegate delegate;
ui.tableView->setItemDelegate( &delegate );
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 4; ++column) {
QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
model.setItem(row, column, item);
}
}
}
Is there any reason why the above code does not put items into the table view? :confused:
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 :
m_pSendMessage = new CSendMessage( this );
m_pSendMessageWindow = new QMdiSubWindow;
m_pSendMessageWindow->setWidget( m_pSendMessage );
m_pSendMessageWindow->setAttribute( Qt::WA_DeleteOnClose );
QMdiSubWindow* subWindow = m_pworkspace->addSubWindow( m_pSendMessageWindow );
subWindow->setWindowIcon(QIcon(QString::fromUtf8(":/QTCanMonitor/Resources/Envelope.png")));
m_pSendMessageWindow->show();
I'm confused?
Regards,
Steve