#include "settingslist.h" SettingsList::SettingsList(QWidget* parent): QListWidget(parent), lastWidth(0) { } SettingsList::~SettingsList() { } QStyleOptionViewItem SettingsList::viewOptions() const { QStyleOptionViewItem option = QListWidget::viewOptions(); if (!iconSize().isValid()) { option.decorationSize.setWidth(lastWidth); } option.rect.setWidth(lastWidth); return option; } void SettingsList::resizeEvent(QResizeEvent* event) { lastWidth = event->size().width(); QListWidget::resizeEvent(event); }