squawk/ui/widgets/settings/settingslist.cpp
2022-01-16 22:54:57 +03:00

28 lines
554 B
C++

#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);
}