PDA

View Full Version : Qwt 5.1 + Qt 4.5 - SVG no clipping



giusepped
10th April 2009, 04:46
I am trying to export a picture in svg format.
With Qwt 5.1 and Qt 4.4 all worked fine.
But now, if I use Qt 4.5.0 I have a plot outside the clipping region, like in the figure.
All clippings are set in the QwtPlotCurve.
Any idea ?
The code is quite standard



void MyPlot::exportSVG()
{
QString fileName;


fileName = QFileDialog::getSaveFileName(this, tr("Nome file da esportare"), recentExportPath,"Graphic files ( *svg)");


if ( !fileName.isEmpty() )
{
fileName = MyMath::checkFormat(fileName,"svg");
QSvgGenerator generator;
generator.setFileName(fileName);
generator.setSize(QSize(1024, 800));
QwtPlotPrintFilter filter;
int options = QwtPlotPrintFilter::PrintAll;
options |= QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales|QwtPlotPr intFilter::PrintMargin;
filter.setOptions(options);


print(generator,filter);
}

I tried also qwt 5.2 + qt4.5, but a segfault error happens.
G

giusepped
10th April 2009, 08:11
...in particuluar the seg fault (Qwt 5.2 + Qt 4.5) is as follows:

#0 0x00b7c3d3 in main_arena () from /lib/libc.so.6
#1 0x00c893f2 in QwtPlotCurve::setRawData () from /usr/lib/libqwt.so.5
#2 0x08058520 in MyPlot::drawMyContents ()

giusepped
10th April 2009, 11:10
NO replies?
I tried any combination for my software and the results are as follows:
(I did not touch the code of my software)

Qt Qwt Problems
--------------------------------------------------
4.5 5.1 Run, but exporting in SVG, clips are not correct
4.5 5.2 Not run: strange segfault when calling setRawData()
4.4 5.1 Run, but exporting in SVG, clips are not correct
4.4 5.2 Run, but strange segfault when calling setRawData()

So, it seems that 5.2 has some problems, hasn't it?

giusepped
10th April 2009, 11:37
I discovered that alos under linuk,
the examples of qwt-5-2 do not run either.:confused:
Same segfault as above!!!

Uwe
10th April 2009, 12:13
The Qt SVG paint engine doesn't support clipping at all. So there is no chance that clippings set for a QPainter will work.

For SVG rendering Qwt 5.2 does some clipping against the borders of the canvas. It should work for the common plot items, but not more.

Uwe

PS: The crashes are a problem on your side

giusepped
11th April 2009, 03:41
I think they do not, because my software worked fine (as I explained in the previous post).
I just downloaded qwt 5.2, installed and compiled. No ticks, no changes.

giusepped
11th April 2009, 03:43
For SVG rendering Qwt 5.2 does some clipping against the borders of the canvas. It should work for the common plot items, but not more.



So, you mean that I can't export an SVG picture of my plot (like in the attachment)?

Uwe
11th April 2009, 11:27
As long as you didn't implement any individual plot item ( that doesn't clip on its own ) you should have no problem with Qwt 5.2.
Fix your Qwt 5.2 build/installation ( or your code, when it is the reason for the crash ) and your SVG document will be o.k.

Uwe

giusepped
13th April 2009, 03:38
Ok, now, strangley, Qwt-5.2 runs with Qt 4.5.0, but
still I cannot obtain my svg picture correct. (see the attach)



void MyPlot::exportSVG()
{
QString fileName;


fileName = QFileDialog::getSaveFileName(this, tr("Nome file da esportare"), recentExportPath,"Graphic files ( *svg)");

QFileInfo fileInfo(fileName);
recentExportPath = fileInfo.absoluteDir().absolutePath();

if ( !fileName.isEmpty() )
{
fileName = MyMath::checkFormat(fileName,"svg");
QSvgGenerator generator;
generator.setFileName(fileName);
generator.setSize(QSize(1024, 800));
QwtPlotPrintFilter filter;
int options = QwtPlotPrintFilter::PrintAll;
options |= ~QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales|QwtPlotPr intFilter::PrintMargin;
filter.setOptions(options);


print(generator,filter);
}


}

On the screen, everything is fine. My plot data are also negative, but I do not understand why the SVG printing catches alsot those negative data, while other exporting like PNG does not.
:confused:

giusepped
13th April 2009, 09:52
Now, again I have the same seg fault.
I did not change anything . The segfault happens only with qwt-5.2.
This is a gdb output



Program received signal SIGSEGV, Segmentation fault.
0x00c84073 in QwtPlot::legendItemChecked () from /usr/lib/libqwt.so.5
Missing separate debuginfos, use: debuginfo-install OpenEXR-libs-1.6.1-4.fc10.i386 bzip2-libs-1.0.5-3.fc10.i386 dbus-libs-1.2.4-2.fc10.i386 e2fsprogs-libs-1.41.4-1.fc10.i386 expat-2.0.1-5.i386 fontconfig-2.6.0-3.fc10.i386 freetype-2.3.7-2.fc10.i386 glib2-2.18.4-1.fc10.i386 glibc-2.9-3.i686 ilmbase-1.0.1-2.fc9.i386 jasper-libs-1.900.1-9.fc10.i386 kdebase-runtime-libs-4.2.1-2.fc10.i386 kdelibs-4.2.1-4.fc10.i386 lcms-libs-1.17-6.fc10.i386 libICE-1.0.4-4.fc10.i386 libSM-1.1.0-2.fc10.i386 libX11-1.1.4-6.fc10.i386 libXau-1.0.4-1.fc10.i386 libXcursor-1.1.9-3.fc10.i386 libXdmcp-1.0.2-6.fc10.i386 libXext-1.0.4-1.fc9.i386 libXfixes-devel-4.0.3-4.fc10.i386 libXft-2.1.13-1.fc10.i386 libXi-devel-1.1.3-4.fc9.i386 libXinerama-1.0.3-2.fc10.i386 libXpm-3.5.7-4.fc9.i386 libXrandr-1.2.3-1.fc10.i386 libXrender-0.9.4-3.fc9.i386 libXtst-1.0.3-3.fc9.i386 libcap-2.10-2.fc10.i386 libgcc-4.3.2-7.i386 libjpeg-6b-43.fc10.i386 libmng-1.0.9-7.i386 libpng-1.2.35-1.fc10.i386 libstdc++-4.3.2-7.i386 libtiff-3.8.2-11.fc10.i386 libxcb-1.1.91-5.fc10.i386 linuxwacom-0.8.0.3-8.fc10.i386 qwt-5.1.1-2.fc10.i386 zlib-1.2.3-18.fc9.i386
(gdb) bt
#0 0x00c84073 in QwtPlot::legendItemChecked () from /usr/lib/libqwt.so.5
#1 0x00c9cb18 in QwtPlotCanvas::drawCanvas () from /usr/lib/libqwt.so.5
#2 0x00c9cdd0 in QwtPlotCanvas::drawContents () from /usr/lib/libqwt.so.5
#3 0x00c9cfdf in QwtPlotCanvas::paintEvent () from /usr/lib/libqwt.so.5
#4 0x010143ce in QWidget::event (this=0x83d02e0, event=0xbfffe114) at kernel/qwidget.cpp:7654
#5 0x013c9383 in QFrame::event (this=0x83d02e0, e=0xbfffe114) at widgets/qframe.cpp:559
#6 0x00fbda7c in QApplicationPrivate::notify_helper (this=0x812ee90, receiver=0x83d02e0, e=0xbfffe114) at kernel/qapplication.cpp:4084
#7 0x00fc5e42 in QApplication::notify (this=0xbffff0d8, receiver=0x83d02e0, e=0xbfffe114) at kernel/qapplication.cpp:4049
#8 0x035e712b in QCoreApplication::notifyInternal (this=0xbffff0d8, receiver=0x83d02e0, event=0xbfffe114) at kernel/qcoreapplication.cpp:602
#9 0x00fc8bae in QCoreApplication::sendSpontaneousEvent (receiver=0x83d02e0, event=0x1) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:216
#10 0x0101c1c9 in QWidgetPrivate::drawWidget (this=0x83d0300, pdev=0x8192ee4, rgn=@0xbfffe3d8, offset=@0xbfffe3a8, flags=68, sharedPainter=0x0, backingStore=0x81931d0)
at kernel/qwidget.cpp:5046

Uwe
13th April 2009, 11:26
There is no call of QwtPlot::legendItemChecked() in QwtPlotCanvas::drawCanvas() -> you have a build problem on your side.

Looking at your stack I can see, that your application was running against a library /usr/lib/libqwt.so.5. Are you sure, that this is the library you have built from the Qwt 5.2 tarball ? What are the Qwt headers you have built your application with ?

Uwe

PS: Do you now ldd, ldconfig, LD_LIBRARY_PATH and friends ?

giusepped
13th April 2009, 12:29
OK, you're right.
But still, also with Qwt-5.2, the problems of the export of SVG plot remains...:crying:

Uwe
13th April 2009, 18:43
Because now you are running against 5.1 ?

Start the bode example, zoom in and press the SVG button ( this is exactly the same situation you have in your application.) When in the exported SVG all curves are clipped against the canvas borders you have the right Qwt version. If not download and build Qwt 5.2 and recompile your application.

Then adjust your LD_LIBRARY_PATH. Check with ldd, that your application really runs against the 5.2 libs.

Uwe