added colon emote popup for ffz and bttv

This commit is contained in:
fourtf
2020-08-15 18:59:17 +02:00
parent 6781482485
commit f7237dccdd
26 changed files with 700 additions and 251 deletions
@@ -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