Domanda

Come si utilizza l'oggetto QTable. Ho cercato su internet e gli esempi in realtà non sembra avere senso. Non basta creare una nuova riga all'interno della classe estesa. Sembra tutto agitarsi. Come si fa a retreive, modificare e Elimina righe. C'è qualche estensioni che potrebbero essere utilizzati come

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

Come avrebbe alcun implementare questo?

Tutte le informazioni supplementari necessari basta chiedere.

È stato utile?

Soluzione

QTable è piuttosto vecchio. Si potrebbe essere alla ricerca di QTableWidget . Se si desidera entrare in tutta la 'Model-View' cosa arco, sguardo 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());
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top