Creates a 3x3 table : QTableWidget « Qt « C++






Creates a 3x3 table

  

#include <QtGui>

int main(int argc, char* argv[])
{
  QApplication app(argc, argv);
  QTableWidget tableWidget(3,3);
  for(introw=0;row<tableWidget.rowCount(); row++)
    for (int col=0;col<tableWidget.columnCount(); col++)
      tableWidget.setItem(row,col,new QTableWidgetItem(QString::number(row*col)));
  tableWidget.show();
  return app.exec();
}

   
    
  








Related examples in the same category

1.Calculate the average and sum for QTableWidget
2.Resize QTableWidget
3.QTableWidget and QTableWidgetItem