I've a problem with QTreeView horizontal scrollbar, it doesn't appear. I've set horizontal scrollbar policy to ScrollBarAsNeeded, but it doesn't appear if needed. Have tried to connect expanded and collapsed signals to a slot:
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(update_scroll_area(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(update_scroll_area(QModelIndex)));
The slot consists of one line of code:
update_scroll_area(const QModelIndex& i)
{
resizeColumnToContents(i.column());
}
This makes scrollbar working, but only when I'm expanding/collapsing the tree view items.
I need to have working horizontal scrollbar "every time", from starting the application till its end. How can it be organized?
Thank you.