voidFileList::resizeEvent(QResizeEvent* e){ int vScrollbarWidth = 0; if (verticalScrollBar()) vScrollbarWidth = verticalScrollBar()->width();
int w = width(); int cnt = count(); for (int i = 0; i < cnt; i++) { QListWidgetItem* it = item(i); if (it) { CustomWidget* customWidget = dynamic_cast<CustomWidget*>(itemWidget(it)); if (customWidget) { it->setSizeHint(QSize(w - vScrollbarWidth, customWidget->height())); } } } QListWidget::resizeEvent(e); }