我有一个在QTreeView中显示的文件层次结构。但是,当我展开所有可扩展项时,它们会碰到滚动条的边缘。只有垂直的一个有效。
这些代码行没有进行任何更改。
connect(view, SIGNAL(expanded(const QModelIndex&)), this, SLOT(makeVisible(const QModelIndex&)));
void Hierarchy::makeVisible(const QModelIndex& index)
{
view->scrollTo(index, QAbstractItemView::EnsureVisible);
}