Reputation: 2777
I am creating 4 columns in QTreeWidget
used in my GUI :
Code creating the 4 columns, Columns are created correctly by the following code :
void MainWindow::createTreeWidgetView()
{
QTreeWidgetItem* headerItem = new QTreeWidgetItem();
headerItem->setText(0,QString("Test Case"));
headerItem->setText(1,QString("Description"));
headerItem->setText(2,QString("Floor"));
headerItem->setText(3,QString("House"));
ui->treeWidgetLeft->setHeaderItem(headerItem);
}
Problem I am facing is that all the four columns of QTreeWidget
are not visible when the GUI opens.
Only first column "Test case" is visible while rest three are hidden (although I can view all the four column by scrolling horizontally QTreeWidget
).
Please suggest what I have to change in my code that all 4 columns are visible when GUI opens?
Upvotes: 0
Views: 1460
Reputation: 1
See: PySide6, QTreeWidget, showing full column text as tooltip if and only if the column text is truncated (it's python, but... it's all Qt at the bottom anyway).
The crux of it is to include a line of code: treeWidgetLeft->setColumnCount(4)
I see how old this is, but it came up first in my search, so who knows, it might save someone a bit of effort.
Upvotes: 0
Reputation: 1
in QTcreator under header property uncheck headerstrechlastSection
then it shows all columns
Upvotes: 0