Skip to content


Qt Jambi – Using QTableWidget

Quick example to show how to use the QTableWidget:

// this line of code gets a list of headers from a array I had in the code
List<String> headers = ais.get(firstKey).getStatsHeaders();
// adds an extra header
headers.add(0, "Device");
// populate all the header labels
ui.tblStats.setHorizontalHeaderLabels(headers);

// insert a new item
QTableWidgetItem item = new QTableWidgetItem(name);
ui.tblStats.insertRow(0);
ui.tblStats.setItem(0, 0, item);

Posted in Java, Qt. Tagged with , , , , .