How to add Horizontal scrollbar in one of the column in QTableView in Qt?

230 Views Asked by At

I have a QTableView with 3 columns. The columns are Name,Type,Show. I want to add Horizontal Scrollbarin Name column as names in that column are lengthy.

How to add Horizontal scrollbar in one of the column in QTableView? 

Here is my code :

void myView :: CreateTable()
{
    myTable = new QTableView();
    myTable ->setAlternatingRowColors(true);
    myTable ->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

    mymodel = new QStandardItemModel(this);
    mymodel ->setColumnCount(3);
    mymodel ->setHeaderData(0, Qt::Horizontal, tr("Name"));
    mymodel ->setHeaderData(1, Qt::Horizontal, tr("Type"));
    mymodel ->setHeaderData(2, Qt::Horizontal, tr("Show"));
}
0

There are 0 best solutions below