/** * @RDE_HEADER@ * Item Delegate class to show On/Off switch buttons. * $Id$ * $HeadURL$ * $Author$ * Created by Filip Biedziak, NLE, 2020-08-10 */ #include "efm_switch_item_delegate.h" #include "../logger.h" #include namespace EffectManagement { const QIcon SwitchItemDelegate::s_iconOn = QIcon(QStringLiteral("icon:switch_on.svg")); const QIcon SwitchItemDelegate::s_iconOff = QIcon(QStringLiteral("icon:switch_off.svg")); SwitchItemDelegate::SwitchItemDelegate(QObject *parent) : QStyledItemDelegate(parent) , m_logger(getLogger("Plugins.Gui.SoundArea.SwitchItemDelegate")) { } void SwitchItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { if (index.data().toInt() == 1) s_iconOn.paint(painter, option.rect, Qt::AlignCenter); else if (index.data().toInt() == -1) s_iconOff.paint(painter, option.rect, Qt::AlignCenter); } } // namespace EffectManagement