Details
-
Bug
-
Resolution: Won't Do
-
P4: Low
-
None
-
4.8.5, 5.2.0
-
None
Description
I have ported my app from QGraphicsSvgItem to QGraphicsWebView and encountered strange behaviour - my images got margins at left, top and bottom (8 pixels each). I conducted some tests and came to conclusion that WebKit is responsible for this bug.
How to reproduce:
test.pro
QT += core webkitwidgets SOURCES += main.cpp
main.cpp
#include <QApplication> #include <QtWebKitWidgets/QGraphicsWebView> QByteArray svg = "\ <svg\ xmlns=\"http://www.w3.org/2000/svg\"\ width=\"200\"\ height=\"200\">\ <g>\ <rect\ width=\"10\"\ height=\"10\"\ x=\"50\"\ y=\"50\"\ fill=\"#0000ff\"\ />\ </g>\ </svg>"; int main (int argc, char * argv[]) { QApplication a (argc, argv); QGraphicsWebView w; w.setResizesToContents (true); w.setContent (svg); w.page()->setPreferredContentsSize (QSize (1, 1)); QSizeF s = w.boundingRect().size(); qDebug() << s.width() << s.height(); return 0; }
Output: 208 216, but should be 200 200