QTableWidgetItem *itemNull = new QTableWidgetItem();	int rowcount = classTable->rowCount();	classTable->insertRow(rowcount);	classTable->setItem(rowcount, 0, itemNull);	classTable->item(rowcount, 0)->setFlags(classTable->item(rowcount, 0)->flags() | Qt::ItemIsEnabled);	connect(classTable, &QTableWidget::cellChanged, this, [=]() {	int count = classTable->rowCount();	classTable->blockSignals(true);	if (classTable->item(count - 1, 0)->text() != NULL) {	classTable->item(count - 1, 0)->setFlags(Qt::NoItemFlags);	QTableWidgetItem *itemNull = new QTableWidgetItem();	classTable->insertRow(count);	classTable->setItem(count, 0, itemNull);	classTable->item(count, 0)->setFlags(classTable->item(count, 0)->flags() | Qt::ItemIsEnabled);	}	classTable->blockSignals(false);	});
博文原创:https://mp.csdn.net/mdeditor/100153765