nodevalue: begin abstracting qvariant

This commit is contained in:
itsmattkc
2022-05-09 13:07:34 -07:00
parent 839f63d78f
commit 58c4600d04
36 changed files with 235 additions and 229 deletions
+7 -7
View File
@@ -96,7 +96,7 @@ void TextGeneratorV1::Value(const NodeValueRow &value, const NodeGlobals &global
job.InsertValue(value);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
if (!job.GetValue(kTextInput).toString().isEmpty()) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
}
}
@@ -114,15 +114,15 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
// Set default font
QFont default_font;
default_font.setFamily(job.GetValue(kFontInput).data().toString());
default_font.setPointSizeF(job.GetValue(kFontSizeInput).data().toFloat());
default_font.setFamily(job.GetValue(kFontInput).toString());
default_font.setPointSizeF(job.GetValue(kFontSizeInput).toDouble());
text_doc.setDefaultFont(default_font);
// Center by default
text_doc.setDefaultTextOption(QTextOption(Qt::AlignCenter));
QString html = job.GetValue(kTextInput).data().toString();
if (job.GetValue(kHtmlInput).data().toBool()) {
QString html = job.GetValue(kTextInput).toString();
if (job.GetValue(kHtmlInput).toBool()) {
html.replace('\n', QStringLiteral("<br>"));
text_doc.setHtml(html);
} else {
@@ -140,7 +140,7 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
// Push 10% inwards to compensate for title safe area
p.translate(tenth_of_width, 0);
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).data().toInt());
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).toInt());
int doc_height = text_doc.size().height();
switch (valign) {
@@ -163,7 +163,7 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
text_doc.documentLayout()->draw(&p, ctx);
// Transplant alpha channel to frame
Color rgb = job.GetValue(kColorInput).data().value<Color>();
Color rgb = job.GetValue(kColorInput).toColor();
for (int x=0; x<frame->width(); x++) {
for (int y=0; y<frame->height(); y++) {
uchar src_alpha = img.bits()[img.bytesPerLine() * y + x];