QTableWidget *table = new QTableWidget; // create a table table->setColumnCount(3); // set number of columns table->setHorizontalHeaderLabels({"A", "B", "C"}); // set column labels table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); // stretch columns table->horizontalHeader()->setSectionSize(0, 100); // set the width of the first column to 100In this example, we create a table with 3 columns and set the horizontal header labels. We then set the section resize mode to "Stretch", meaning each column will stretch to fill the available horizontal space. Finally, we set the width of the first column to 100 pixels using setSectionSize. The Qt library package includes the QHeaderView class.