1  MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
2  {
3    ui->setupUi(this);
4    ui->treeWidget->setColumnCount(2);
5    resize(500, 500);
6    // Set the headers
7    QStringList headers = {"ABC", "Description"};
8    ui->treeWidget->setHeaderLabels(headers);
9    // Add root node
10   addTreeRoot("A", "Root_first");
11   addTreeRoot("B", "Root_second");
12   addTreeRoot("C", "Root_third");
13 }