diff options
author | Wang Chuan <ouchuanm@outlook.com> | 2019-08-23 22:28:56 +0800 |
---|---|---|
committer | ouchuan <ouchuanm@outlook.com> | 2019-08-29 07:25:45 +0800 |
commit | 35acc9fc3c41446bacbbfe754f7f494de7f62411 (patch) | |
tree | 48104fb6fb867f635db35e855ea60b5cbe3bcdc0 /src | |
parent | 8577f12bf4dfd9adfe8c5b85a3712bf1cc5ba0c3 (diff) |
QQuickTextNodeEngine: don't create background when its alpha is 0
If the alpha value for the background color of a text element is 0,
we don't need to create a rectangle node to represent it, as the
rectangle will be invisible anyway.
[ChangeLog][QtQuick][QQuickTextNodeEngine] don't create a new
rectangle node as the background of text, when the alpha of it is
0
Fixes: QTBUG-76137
Change-Id: I40c624ee8f61740fd07e7d3751a78b6224882913
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktextnodeengine.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 5a4ef2b686..f407de84cb 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -781,8 +781,8 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, for (int i = 0; i < m_backgrounds.size(); ++i) { const QRectF &rect = m_backgrounds.at(i).first; const QColor &color = m_backgrounds.at(i).second; - - parentNode->addRectangleNode(rect, color); + if (color.alpha() != 0) + parentNode->addRectangleNode(rect, color); } // Add all text with unselected color first |