Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, July 2007
Svg vs. QGraphicsView


Message 1 in thread

Hello,

in my program I need some kind of a diagram widget. After playing around
with svg I ended up with a sufficiently good looking result
(diagram_origin.png in the attachment). The problem is, if i resize my
DiagramWidget (inherits QSvgWidget), the digram is not scaled uniformly
(diagram_scaled.png). Changing/adjusting of the  the svg-viewbox and/or
QSvgRenderer::setViewBox() in the resizeEvent() doesn't help. It seems to
me like the SVG-attribute 'preserveAspectRatio' is ignored by QSvgRenderer.
Has somebody managed to show a scalable svg-file preserving the acpect
ratio?

Today I "discovered" the graphics view framework :-)
It looks very promising. It would also help to produce ToolTipTexts for the
different bars, which is not possible with the tiny-svg at the moment. What
I need I just some kind of a digram shown in the picture in the attachment.
The diagram should bi resizable, say, it should be properly scaled while
filling the available place. Is it doable with this framework?
Also I need to produce a Qimage (or QPixmap) out of this diagram for
printing - according to the documentation, this step is easy.
Can somebody with more experience in QGraphicView comment on this?
Thanks in advance.

Alexander Semke

Attachment: diagram_origin.png
Description: PNG image

Attachment: diagram_scaled.png
Description: PNG image