How to use SVG
-
-
Which version of Qt are you currently using ?
-
Qt version 4.14.2 (That is what it says in the "About")
I don't understand something, I just recently downloaded Qt. When I downloaded Qt I selected the Qt 6 version but now as you told me to look at the version it says 4.14,2. What is going on I am very confused. Did I make a mistake in the download process?
-
No that's the Qt Creator version. There's no Qt 4.14.
You have to take a look at the kit you are using.
-
It was introduced from 4.1.
https://doc.qt.io/qt-5/qsvgwidget.html
QT += core gui widgets svg <=== you need widgets as well for qsvgwidgetIf you simply need a QPixmap from a svg source for other widgets, use QSvgRenderer to paint one.
-
Drop the C++ CONFIG, you do not need that currently.
You should also consider updating to the latest Qt 6.1.
-
-
Hi
Else a sure bet is installing Qt5.15.
While v6 does offer new things
https://wiki.qt.io/New_Features_in_Qt_6.0
Its mostly if you are using QML and it still has lots of features missing planned
for some later releases. -
- Why isn't there a widget for SVG in QT Designer by default?
Too much work I would guess. To allow a Widget to be used in design time, a plugin must be made and maintained across many Designers.
And QSvgWidget doesn't have any properties to set at Design time. (besides the svg file) so I gues sit was
not worth the effort.You can use the Producer Promote feature to allow a Qwidget as a place holder in Designer and then app is run its
the SVG one.