#include "historyitemwidget.h"

HistoryItemWidget::HistoryItemWidget(QWidget *parent) : QWidget(parent)
{
    m_iconLabel = new QLabel("1111");
    btn = new KBorderlessButton("X");
    btn->setFixedSize(12, 12);
    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget(m_iconLabel);
    layout->addWidget(btn);

    connect(btn, &QPushButton::clicked, this, &HistoryItemWidget::deleteBtnClicked);

}

HistoryItemWidget::HistoryItemWidget(const QPixmap &icon, const QString &text, QWidget *parent) : QWidget(parent)
{
    m_iconLabel = new QLabel();
    m_iconLabel->setPixmap(icon);
    m_iconLabel->setFixedSize(16, 16);

    m_textLabel = new QLabel();
    m_textLabel->setText(text);

    btn = new KBorderlessButton("X");
    btn->setFixedSize(12, 12);
    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget(m_iconLabel);
    layout->addWidget(m_textLabel);
    layout->addWidget(btn);

    connect(btn, &QPushButton::clicked, this, &HistoryItemWidget::deleteBtnClicked);

}

void HistoryItemWidget::deleteBtnClicked()
{
    qDebug() << this;
    return;
}
