#include <QApplication>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QHeaderView>
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QTreeWidget treeWidget;
treeWidget.setColumnCount(3);
treeWidget.setHeaderLabels({"Column 1", "Column 2", "Column 3"});
// Populate the tree widget with sample data
QTreeWidgetItem *item1 = new QTreeWidgetItem(&treeWidget, {"Item 1", "Data 1", "Info 1"});
QTreeWidgetItem *item2 = new QTreeWidgetItem(&treeWidget, {"Item 2", "Data 2", "Info 2"});
QTreeWidgetItem *item3 = new QTreeWidgetItem(&treeWidget, {"Item 3", "Data 3", "Info 3"});
// Set the header view to enable section resizing
QHeaderView *headerView = treeWidget.header();
headerView->setSectionResizeMode(QHeaderView::Interactive);
// Lock the first column by setting the ResizeMode to Fixed for the first section
headerView->setSectionResizeMode(0, QHeaderView::Fixed);
headerView->resizeSection(0, 150); // Set the width of the first column
treeWidget.show();
return a.exec();
}