C++ (Qt) for(int i = 0; i < 15; i++) for(int j = 0; j < 20; j++) { QTableWidgetItem *item = new QTableWidgetItem(); item->setText("0"); ui->tableWidget->setItem(i, j, item); } QTableWidgetItem *item = new QTableWidgetItem(); item->setText("1"); ui->tableWidget->setItem(1, 1, item); item->setText("2"); ui->tableWidget->setItem(2, 2, item);
C++ (Qt)QObject::connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(MyKlickTable(int, int))); void MyWidget::MyKlickTable(int x, int y) { ui->label->setText(QString::number(x) + " " + QString::number(y)); }