squawk/ui/widgets/settings/settingslist.cpp

28 lines
554 B
C++
Raw Normal View History

2022-01-16 19:54:57 +00:00
#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);
}