#include "ToggleSwitch.h"
#include <QPainter>

CToggleSwitch::CToggleSwitch(QWidget *parent) :
    QAbstractButton(parent)
{

}

void CToggleSwitch::paintEvent(QPaintEvent *e)
{
    mOnPixmap = QPixmap("./Ico/switch-off-icon.png").scaled(size());
    mOffPixmap = QPixmap("./Ico/switch-on-icon.png").scaled(size());
    QPainter painter(this);

    if(isChecked())
    {
         painter.drawPixmap(0,0,mOnPixmap);
    }
    else
    {
        painter.drawPixmap(0,0,mOffPixmap);
    }

}
