Backport fix for titler text gradient

parent 9e04f34b
...@@ -213,10 +213,17 @@ void MyTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option ...@@ -213,10 +213,17 @@ void MyTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
} else { } else {
painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::Antialiasing);
int outline = data(TitleDocument::OutlineWidth).toInt(); int outline = data(TitleDocument::OutlineWidth).toInt();
QString gradientData = data(TitleDocument::Gradient).toString();
QTextCursor cursor(document()); QTextCursor cursor(document());
cursor.select(QTextCursor::Document); cursor.select(QTextCursor::Document);
QColor fontcolor = cursor.charFormat().foreground().color(); QBrush paintBrush;
painter->fillPath(m_path, QBrush(fontcolor)); if (gradientData.isEmpty()) {
paintBrush = QBrush(cursor.charFormat().foreground().color());
} else {
QRectF rect = boundingRect();
paintBrush = QBrush(GradientWidget::gradientFromString(gradientData, rect.width(), rect.height()));
}
painter->fillPath(m_path, paintBrush);
if (outline > 0) { if (outline > 0) {
QVariant variant = data(TitleDocument::OutlineColor); QVariant variant = data(TitleDocument::OutlineColor);
QColor outlineColor = variant.value<QColor>(); QColor outlineColor = variant.value<QColor>();
......
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