Don't update when the underlying FrameSvg is repaint-blocked

Summary:
When the component completes `FrameSvg::setRepaintBlocked(false)`
is called, which calls `updateFrameData`, which emits
`repaintNeeded`, which is connected to `doUpdate` anyway.

This saves one `doUpdate` per instanciation. The reason for that
is as follows:
* The concept or repaint blocking is implemented in `FrameSvg`,
  which inherits from `Svg`.
* The `repaintNeeded` signal connected to `doUpdate` is the one
  in `Svg`.
* `Svg` code emits `repaintNeeded` liberally even when repaints
  are blocked, since it doesn't know anything about this.

Hence we check if repaints are blocked in doUpdate and abort,
implementing the QQmlParserStatus interface in the right class.

Reviewers: #plasma, davidedmundson, mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D9138
This commit is contained in:
Eike Hein 2017-12-03 23:57:33 +09:00
parent 15f470fafc
commit a570254e1a

View File

@ -460,6 +460,10 @@ void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
void FrameSvgItem::doUpdate() void FrameSvgItem::doUpdate()
{ {
if (m_frameSvg->isRepaintBlocked()) {
return;
}
CheckMarginsChange checkMargins(m_margins); CheckMarginsChange checkMargins(m_margins);
CheckMarginsChange checkFixedMargins(m_fixedMargins); CheckMarginsChange checkFixedMargins(m_fixedMargins);