SHARE
TWEET

Untitled

a guest Aug 20th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void slot_timeOut()
  2. {
  3.     //Iterate over the rows
  4.     //and for each cell do something like
  5.     ui->tw_data->setItem(row, 0, new TableWidgetItem(data[row][0]);
  6.     ui->tw_data->setItem(row, 0, new TableWidgetItem(data[row][1]);
  7.     //...
  8.     ui->tw_data->setItem(row, 0, new TableWidgetItem(data[row][9]);
  9. }
  10.      
  11. int main(int argc, char** argv)
  12. {
  13.     QApplication app(argc, argv);
  14.     QTableWidget widget(2, 1);
  15.     QTableWidgetItem* foo = new QTableWidgetItem("Foo");
  16.     widget.setItem(0, 0, foo);
  17.     qDebug() << foo->text(); //works
  18.     widget.setItem(0, 0, new QTableWidgetItem("Bar")); //replaces foo with bar and deletes foo
  19.     qDebug() << foo->text(); // Undefined (usually, crash)
  20.     widget.show();
  21.     return app.exec();
  22. }
  23.      
  24. for( int row = 0; row < 35; row++)
  25. {
  26.     for(int i = 0; i < 9; i++)
  27.     {
  28.         QTableWidgetItem* item = new QTableWidgetItem();
  29.         item->setText(QString::number(i));
  30.         ui->tableWidget->setItem(row, i, item);
  31.     }
  32. }
  33.      
  34. QLineEdit* tableline = new QLineEdit();
  35.     m_tableWidget->setCellWidget(row, column, tableline);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top