实现的效果如图:
代码如下比较粗糙
其中n_meetings为列表总个数, livelistwidget为自定义列表类,每行显示5个放到scrollArea中
while (n_meetings)
{
if (n_meetings > 5)
{
QWidget *m_livewidget = new QWidget(ui.scrollAreaWidgetContents);
m_livewidget->setObjectName("livewidget");
QHBoxLayout *layout = new QHBoxLayout;
QSpacerItem *horizontalSpacer = new QSpacerItem(1190, 50, QSizePolicy::Maximum, QSizePolicy::Minimum);
//verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
layout->addItem(horizontalSpac