Question

How do you use the QTable object. I have searched the internet and the examples don't really seem to make sense. Do you just create a new row within the extended class. It all seems fussing. How do you retreive, edit and delete rows. Is there any extensions that could be used like

QRowObject *row = table->add("Main Title");
row->addSubColumnText("Second column");
otherRow = table->getRowByIndex(table->selectedIndex);
otherRow.remove;

How would any implement that?

Any extra information needed just ask.

Was it helpful?

Solution

QTable is pretty old. You might be looking for QTableWidget. If you want to get into the whole 'Model-View' arch thing, look into QTableView.

// 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());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top