EqList::EqList(QWidget *parent)
:QWidget(parent),ui(new Ui::EqList())
{
ui->setupUi(this);
}
void EqList::init()
{
ui->statusLabel->setText("hehe");
int row = ui->eqListTableWidget->rowCount();
QTableWidgetItem *item = new QTableWidgetItem(tr("01"));
ui->eqListTableWidget->setItem(row,0,item);
ui->eqListTableWidget->setItem(row,1,new QTableWidgetItem("administrator"));
ui->eqListTableWidget->setItem(row,2,new QTableWidgetItem("fad;fjkajflkajlkdsfjlasjflkas"));
}
void MainWindow::onEqList()
{
m_eqListDlg = new EqList;
m_eqListDlg->init();
m_eqListDlg->show();
}
执行时,eqListTableWidget本该显示的字符串却没有,不知道问题出在哪了
QTableWidget 不显示内容 求助
------解决方案--------------------
ui->eqListTableWidget->setRowCount(1);
ui->eqListTableWidget->setColumnCount(3);
QTableWidgetItem *item = new QTableWidgetItem("01");
ui->eqListTableWidget->setItem(0, 0, item);
ui->eqListTableWidget->setItem(0, 1, new QTableWidgetItem("administrator"));
ui->eqListTableWidget->setItem(0, 2, new QTableWidgetItem("fad;fjkajflkajlkdsfjlasjflkas"));