Commit 5bc04047 authored by Michael Winkelmann's avatar Michael Winkelmann

Fix Slide Printing

parent 426b0631
......@@ -9,6 +9,7 @@
#include <QtMath>
#include <QQuickItemGrabResult>
#include <QGuiApplication>
#include <set>
Q_LOGGING_CATEGORY(lc, "qt.qmlprinter")
......@@ -280,16 +281,19 @@ void QmlPrinter::paintQQuickText(QQuickItem *item, QPainter *painter) const {
document.setDefaultTextOption(textOption);
document.setDefaultFont(font);
if (textFormat == Qt::PlainText)
document.setPlainText(text);
else
document.setHtml(text);
QAbstractTextDocumentLayout::PaintContext context;
context.palette.setColor(QPalette::Text, color);
QAbstractTextDocumentLayout *layout = document.documentLayout();
painter->translate(rect.topLeft());
painter->setRenderHint(QPainter::Antialiasing, true);
layout->draw(painter, context);
}
......@@ -398,12 +402,28 @@ bool SubItemStrategy::operator()(QQuickItem *rootItem, ItemList &items, ItemList
"allowDelay",
QVariant(false)); // Disable partial reveals on slide pages
int i = 0;
std::set<QString> excludedClasses {
QStringLiteral("QQuickRepeater"),
QStringLiteral("QQuickMouseArea")
};
for (auto &item : rootItem->childItems()) {
if (item->property("isMaster").toBool()) {
masterItems.push_back({item, QVariantMap()});
qDebug() << "Master:" << item->metaObject()->className();
masterItems.push_back({item, {
{ "visible", true }
}});
} else {
if (item->metaObject()->className() != QStringLiteral("QQuickRepeater"))
items.push_back({item, QVariantMap()});
if (excludedClasses.count(QString(item->metaObject()->className())) == 0) {
++i;
qDebug() << item->metaObject()->className();
items.push_back({item, {
{ "visible", true },
{ "currentSlide", i }
} });
}
}
}
return !items.empty();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment