Skip to content

Commit

Permalink
chore: temporary limit svg support to Tiny 1.2-only
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Jun 28, 2024
1 parent f858702 commit c636b14
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/graphicsscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <QGraphicsItem>
#include <QUrl>
#include <QGraphicsSvgItem>
#include <QSvgRenderer>
#include <QMovie>
#include <QPainter>

Expand Down Expand Up @@ -116,7 +117,16 @@ void GraphicsScene::showText(const QString &text)
void GraphicsScene::showSvg(const QString &filepath)
{
this->clear();
QGraphicsSvgItem * svgItem = new QGraphicsSvgItem(filepath);
QGraphicsSvgItem * svgItem = new QGraphicsSvgItem();
QSvgRenderer * render = new QSvgRenderer(svgItem);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
// Qt 6.7.0's SVG support is terrible caused by huge memory usage, see QTBUG-124287
// Qt 6.7.1's is somewhat better, memory issue seems fixed, but still laggy when zoom in
// Anyway let's disable it for now.
render->setOptions(QtSvg::Tiny12FeaturesOnly);
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
render->load(filepath);
svgItem->setSharedRenderer(render);
this->addItem(svgItem);
m_theThing = svgItem;
this->setSceneRect(m_theThing->boundingRect());
Expand Down

0 comments on commit c636b14

Please sign in to comment.