Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何使用QTable?添加、编辑、删除和检索行_C++_Qt_Qt4_Qtablewidget - Fatal编程技术网

C++ 如何使用QTable?添加、编辑、删除和检索行

C++ 如何使用QTable?添加、编辑、删除和检索行,c++,qt,qt4,qtablewidget,C++,Qt,Qt4,Qtablewidget,如何使用QTable对象。我在网上搜索过,这些例子似乎没有什么意义。您只是在扩展类中创建一个新行吗。这一切似乎都很烦人。如何检索、编辑和删除行。有没有可以像这样使用的扩展 QRowObject *row = table->add("Main Title"); row->addSubColumnText("Second column"); otherRow = table->getRowByIndex(table->selectedIndex); otherRow.remo

如何使用QTable对象。我在网上搜索过,这些例子似乎没有什么意义。您只是在扩展类中创建一个新行吗。这一切似乎都很烦人。如何检索、编辑和删除行。有没有可以像这样使用的扩展

QRowObject *row = table->add("Main Title");
row->addSubColumnText("Second column");
otherRow = table->getRowByIndex(table->selectedIndex);
otherRow.remove;
任何人将如何实施这一点


任何需要的额外信息都可以询问。

QTable已经很旧了。你可能在找。如果您想了解整个“模型视图”拱门的内容,请查看

//例如在qmain窗口中,父项可以是“this”
QTableWidget*widget=新的QTableWidget(父项);
//添加到布局等,然后:
QStringList头标;
headerLabels removeRow(表->当前行());
// inside e.g. a QMainWindow, parent could be 'this'
QTableWidget *widget = new QTableWidget(parent); 
// add to layout etc, then:

QStringList headerLabels;
headerLabels << "First Column" << "Second Column";
widget->setHorizontalHeaderLabels(headerLabels);
// here you would add data, then:
widget->removeRow(table->currentRow());