#include <QVBoxLayout>
#include <QEvent>
#include <QDebug>
#include "poweritemwidget.h"
#include "statusbutton.h"

PowerItemWidget::PowerItemWidget(QWidget *parent)
    : QFrame(parent)
{
    itemFace = new StatusButton(this, POWERBUTTON);
    itemFace->setFixedSize(130, 130);
    textLabel = new QLabel(this);
    textLabel->setAlignment(Qt::AlignCenter);
    textLabel->setStyleSheet("color: white");
    QVBoxLayout *itemlayout = new QVBoxLayout(this);
    itemlayout->addWidget(itemFace);
    itemlayout->addWidget(textLabel);
    itemlayout->setAlignment(Qt::AlignHCenter);
}

PowerItemWidget::~PowerItemWidget()
{

}

bool PowerItemWidget::eventFilter(QObject *obj, QEvent *event)
{
    if (event->type() == QEvent::ToolTip) {

    } else if (event->type() == QEvent::Leave) {

    }
    return QWidget::eventFilter(obj, event);
}



void PowerItemWidget::setText(const QString text)
{
    textLabel->setText(text);
}

void PowerItemWidget::setToolTip(const QString tip)
{
    itemFace->setToolTip(tip);
}

void PowerItemWidget::setIcon(const QIcon &icon)
{
    itemFace->setIcon(icon);
}

void PowerItemWidget::setSelected(int status)
{
    itemFace->setClickedStatus(status);
}
