#include "iconhint.h"

#include <QDebug>

IconHint::IconHint(QWidget *parent) :
    QLabel(parent)
{
    setObjectName("hint");
    setStyleSheet("border-image: url(:/assets/common/window/frame.png);\nbackground-color: rgb(0, 0, 0);\ncolor: rgb(255, 255, 255);\nfont: 8pt \"D-determination (RUS BY LYAJKA)\";");
    setIndent(10);
    setWordWrap(true);
    setAlignment(Qt::AlignCenter);
    //setScaledContents(true);
    show();
    raise();
    title_ = "Title";
    text_  = "Text";
}

void IconHint::setHintTitle(const QString &title)
{
    title_ = title;
    updateText();
}

void IconHint::setHintText(const QString &text)
{
    text_ = text;
    updateText();
}

IconHint::~IconHint()
{
}

void IconHint::updateText()
{
    setText("<p style=\"font-size:12pt\">" + title_ + "</p><p>" + text_ + "</p>");
    adjustSize();
    resize(width() + 30, height() + 30);
    setIndent(15);
}
