#include "logo_icon_title_bar.h"
#include <QDebug>
#include "size_para.h"
LogoIconTitleBar::LogoIconTitleBar(QWidget *parent):
    m_titleIcon(nullptr),
    m_titleLabel(nullptr)
{
    m_titleIcon = new QPushButton(parent);
    m_titleIcon->setIcon(QIcon::fromTheme("kylin-printer"));
    m_titleIcon->setIconSize(TITLE_ICON_SIZE);
    m_titleIcon->setFixedSize(TITLE_BTN_SIZE);
    m_titleIcon->setStyleSheet(BTN_TO_LABEL_STYLE);

    m_titleLabel = new QLabel(parent);

    m_titleLabel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
    m_titleLabel->setMinimumHeight(20);

    m_HLayoutLogoName = new QHBoxLayout(parent);
    m_HLayoutLogoName->setSpacing(0);
    m_HLayoutLogoName->setMargin(0);
    m_HLayoutLogoName->setContentsMargins(8,8,0,0);
    m_HLayoutLogoName->addWidget(m_titleIcon);
    m_HLayoutLogoName->addSpacing(10);
    m_HLayoutLogoName->addWidget(m_titleLabel);
    m_HLayoutLogoName->addStretch();

    this->setLayout(m_HLayoutLogoName);
}

void LogoIconTitleBar::setTitleName(QString titleName)
{
    m_titleLabel->hide();
    m_titleLabel->setText(titleName);
    m_titleLabel->show();
}

void LogoIconTitleBar::setFontSize(QFont ft)
{
    m_titleLabel->setFont(ft);
}
