Using QPainterPath to generate more complex "images"
-
Hi,
What is your use case ?
It looks like you should rather use an painting application like Inkscape or Gimp to create them and then te-use the images in your application.
-
Hi,
I created this images with inkscape, but i have the option to enlarge the diagramscene where i put these items. And when i apply the transfomations to zoom in, the images loose quality
so i wondered if using the QPolygonF my problems would be solved. -
Why not use a SVG image ?
-
Hi
With SVG format and
https://doc.qt.io/qt-5/qgraphicssvgitem.html#details
zooming/enlarging should be possible without any loss of quality. -
Set sourceSize (height and width) or feed it Qt.size(x,y). Make this value as high as dimensions of object to maintain quality. Be careful setting it to the Image{} size as it will cause errors. Use external size to set the width and height.
For instance:
Image { id: logo // prevent binding loop, calc once property int calcHeight: parent.height*0.66 height: calcHeight fillMode: Image.PreserveAspectFit source: "logo.svg" // make it look right smooth: true antialiasing: true // this is needed to make the sampling decent // 1x will work as well sourceSize.height: calcHeight }