added colon emote popup for ffz and bttv
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
#include "widgets/dialogs/switcher/GenericItemDelegate.hpp"
|
||||
|
||||
#include "widgets/dialogs/switcher/AbstractSwitcherItem.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
SwitcherItemDelegate::SwitcherItemDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
SwitcherItemDelegate::~SwitcherItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
void SwitcherItemDelegate::paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
auto *item = AbstractSwitcherItem::fromVariant(index.data());
|
||||
|
||||
if (item)
|
||||
{
|
||||
if (option.state & QStyle::State_Selected)
|
||||
painter->fillRect(option.rect, option.palette.highlight());
|
||||
|
||||
item->paint(painter, option.rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
}
|
||||
|
||||
QSize SwitcherItemDelegate::sizeHint(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
auto *item = AbstractSwitcherItem::fromVariant(index.data());
|
||||
|
||||
if (item)
|
||||
{
|
||||
return item->sizeHint(option.rect);
|
||||
}
|
||||
|
||||
return QStyledItemDelegate::sizeHint(option, index);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
Reference in New Issue
Block a user