36 lines
760 B
C++
36 lines
760 B
C++
#include "textparticlewidget.h"
|
|
#include "../models.h"
|
|
#include <QLabel>
|
|
#include <QVBoxLayout>
|
|
|
|
TextParticleWidget::TextParticleWidget(QWidget *parent)
|
|
: QWidget(parent)
|
|
{
|
|
auto *layout = new QVBoxLayout(this);
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
layout->addStretch();
|
|
|
|
m_label = new QLabel();
|
|
QFont font;
|
|
font.setPointSize(36);
|
|
m_label->setFont(font);
|
|
m_label->setAlignment(Qt::AlignCenter);
|
|
m_label->setWordWrap(true);
|
|
m_label->setScaledContents(true);
|
|
layout->addWidget(m_label);
|
|
|
|
layout->addStretch();
|
|
}
|
|
|
|
void TextParticleWidget::setParticle(const Particle *particle)
|
|
{
|
|
if (!particle) return;
|
|
m_label->setText(particle->data.value("content").toString());
|
|
}
|
|
|
|
void TextParticleWidget::clear()
|
|
{
|
|
m_label->setText("");
|
|
}
|