Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @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 <QDebug>
|
||||
|
||||
|
||||
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
|
||||
Reference in new issue
Block a user