【发布时间】:2018-03-11 20:35:05
【问题描述】:
构造函数:
ScrollArea::ScrollArea(...)
{
...
end = myItems.count();
for(int i=0; i<end; i++)
{
scrollItems.append(new ScrollItem(myItems.at(i), 0, width, i, this));
}
scrollArea->setWidget(this); //must be last for auto-scrolling to work
}
会员功能:
void ScrollArea::updateSelection(int selection)
{
foreach(ScrollItem* item, scrollItems)
{
if(item->updateSelection(selection, 0))
{
scrollArea->ensureWidgetVisible(item);
}
}
}
运行ScrollArea::updateSelection后是这样的:
我希望它看起来像这样:
Google 返回一个标题错误的问题(据我所知:Place widget in center of QScrollArea)和一堆垃圾。
【问题讨论】: