From 837e1e7f0946717c54f6b6b2d827ec50ddb4ab71 Mon Sep 17 00:00:00 2001 From: Andre Rummler Date: Wed, 16 Sep 2026 11:39:46 +0200 Subject: [PATCH] Remove caching in titleblocktemplaterenderer which has not been used since Qt4.8. --- sources/bordertitleblock.cpp | 2 -- sources/titleblocktemplaterenderer.cpp | 38 ++------------------------ sources/titleblocktemplaterenderer.h | 3 -- 3 files changed, 3 insertions(+), 40 deletions(-) diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 70808b262..84d32d3d2 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -432,8 +432,6 @@ void BorderTitleBlock::titleBlockTemplateRemoved( } else { setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate()); } - // disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes - m_titleblock_template_renderer -> setUseCache(false); } /** diff --git a/sources/titleblocktemplaterenderer.cpp b/sources/titleblocktemplaterenderer.cpp index fa11fa4d3..9ba7c5e29 100644 --- a/sources/titleblocktemplaterenderer.cpp +++ b/sources/titleblocktemplaterenderer.cpp @@ -9,7 +9,6 @@ TitleBlockTemplateRenderer::TitleBlockTemplateRenderer(QObject *parent) : QObject(parent), m_titleblock_template(nullptr), - m_use_cache(true), m_last_known_titleblock_width(-1) { } @@ -84,21 +83,9 @@ void TitleBlockTemplateRenderer::render(QPainter *provided_painter, int titleblock_width) { if (!m_titleblock_template) return; - if (m_use_cache) { - // Do we really need to calculate all this again? - if (titleblock_width != m_last_known_titleblock_width - || m_rendered_template.isNull()) { - renderToQPicture(titleblock_width); - } - - provided_painter -> save(); - m_rendered_template.play(provided_painter); - provided_painter -> restore(); - } else { - m_titleblock_template -> render(*provided_painter, - m_context, - titleblock_width); - } + m_titleblock_template -> render(*provided_painter, + m_context, + titleblock_width); } /** @@ -146,22 +133,3 @@ void TitleBlockTemplateRenderer::invalidateRenderedTemplate() m_rendered_template = QPicture(); } -/** - @brief TitleBlockTemplateRenderer::setUseCache - @param use_cache : - true for this renderer to use its QPicture-based cache, false otherwise. -*/ -void TitleBlockTemplateRenderer::setUseCache(bool use_cache) { - m_use_cache = use_cache; -} - -/** - @brief TitleBlockTemplateRenderer::useCache - @return true if this renderer uses its QPicture-based cache, - false otherwise. -*/ -bool TitleBlockTemplateRenderer::useCache() const -{ - return(m_use_cache); -} - diff --git a/sources/titleblocktemplaterenderer.h b/sources/titleblocktemplaterenderer.h index e0f73866a..7651f00d0 100644 --- a/sources/titleblocktemplaterenderer.h +++ b/sources/titleblocktemplaterenderer.h @@ -42,15 +42,12 @@ class TitleBlockTemplateRenderer : public QObject void render(QPainter *, int); void renderDxf(QRectF &, int, QString &, int); void invalidateRenderedTemplate(); - void setUseCache(bool); - bool useCache() const; private: void renderToQPicture(int); private: const TitleBlockTemplate *m_titleblock_template; - bool m_use_cache; QPicture m_rendered_template; DiagramContext m_context; int m_last_known_titleblock_width;