[Qt-interest] QPainter segmentation fault on Linux

Davide davide83 at gmail.com
Thu Feb 19 16:21:41 CET 2009


Hi everybody,
I'm working on a multiplatform program and I'm using Qt 4.4.3
Opensource on Windows and Linux.
My software works fine in Windows XP and Vista but problems started
few days ago when I tried to port my software in Linux.
It compiles but I get an error (Segmentation Fault) at RunTime when
using a QPainter, in particular when I try to draw something.

    *qImage = QImage((u8*)Image.data, Image.width, Image.height,
QImage::Format_RGB16);
    QPainter p;
    p.begin(qImage);
    p.setPen((Qt::GlobalColor)(Qt::cyan));
    p.drawRect(2, 2, 20, 20);   //  -->   Segmentation Fault
    p.end();

The thing that makes me crazy is that if I take the code (the whole
project without changing anything), copy it on a windows system and
compile it, all works fine.
I have no idea how to solve this problem.
Does anyone find this problem with QPainter?

Thanks

Davide



More information about the Qt-interest-old mailing list