Hello. I'm using Qt 4.8.1 (4.8.1-0ubuntu4.2 to be precise) on Kubuntu Linux.

The attached program demonstrates what seems to be a bug in the
behaviour of QSvgWidget i.e. that it distorts the SVG rendering
according to its (i.e. the widget's) size. This makes QSvgWidget
unusable for general-purpose rendering of SVGs. Is my program supposed
to be able to read the SVG code itself and determine its
size/proportions without depending on Qt to do what is needed? I can't
throw any valid SVG code at QSvgWidget and expect it to render it
without distorting it?

The documentation says: "Since QSvgWidget is a subclass of QWidget,
SVG drawings are rendered using the properties of the display." But I
am not sure how this is supposed to mean that the picture represented
by the SVG is potentially distorted while being displayed...

I am using QSvgWidget in my program to display SVG code output by a
drawing library (as I have mentioned in other threads). But now I find
that the SVG is displayed distorted! :-(

I should note that in my program each time the user presses the
Execute button (to execute the drawing commands the user inputs), the
produced SVG code can change, and I want to reuse the same QSvgWidget.
Can I do this or not?

Thanks.

-- 
Shriramana Sharma
// gcc -Wall -g -I /usr/include/qt4/ -o qsvgwidget-bug qsvgwidget-bug.cpp -L /usr/lib/x86_64-linux-gnu/ -l QtCore -l QtGui -l QtSvg

# include <QtCore/QByteArray>
# include <QtGui/QApplication>
# include <QtSvg/QSvgWidget>

int main ( int argc, char * argv [] )
{
	QApplication app ( argc, argv ) ;
	QByteArray code ( "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"; xmlns:xlink=\"http://www.w3.org/1999/xlink\"; width=\"103.48676\" height=\"92.25047\" viewBox=\"0 0 103.48676 92.25047\"><g transform=\"matrix(0.5547,0.96077,-0.48038,0.27734,0,0)\"><path d=\"M114.6465 -77.53545L26.13483 -77.53554L70.39084 75.77429Z\" style=\"stroke:rgb(0%,0%,0%); stroke-width: 7.21112;stroke-linecap: round;stroke-linejoin: round;stroke-miterlimit: 10;fill: none;\"></path></g></svg>" ) ;
	QSvgWidget svg1, svg2, svg3, svg4 ;

	svg1 . resize ( 100, 100 ) ;
	svg2 . resize ( 200, 200 ) ;
	svg3 . resize ( 100, 200 ) ;
	svg4 . resize ( 200, 100 ) ;
	
	svg1 . load ( code ) ; svg2 . load ( code ) ; svg3 . load ( code ) ; svg4 . load ( code ) ;
	svg1 . show ()       ; svg2 . show ()       ; svg3 . show ()       ; svg4 . show () ;
	
	return app . exec () ;
}
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to