| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 8 | |
This is in linux with g++-2.95.4:
Can someone explain to me why this program executes ok:
#include <qapp.h>
#include <qimage.h>
#include <qpixmap.h>
int main( int argc, char **argv )
{
QApplication app( argc, argv, false );
QImage im( 400, 300, 32 );
//QPixmap pix( im );
}
but if you uncomment the QPixmap initialization it segfaults?
I have a routine that involves using drawLine and whatnot in QPainter,
but I'd like to use it to create QImages in a headless (commandline)
fashion.
The ideal solution would be to call the equivalent QPainter functions in
QImage, but that appears to be impossible.
Any suggestions would be much appreciated.
Am Thursday 21 March 2002 03:30 schrieb Eric Ortega:
> This is in linux with g++-2.95.4:
>
>
> Can someone explain to me why this program executes ok:
>
> #include <qapp.h>
> #include <qimage.h>
> #include <qpixmap.h>
>
> int main( int argc, char **argv )
> {
> QApplication app( argc, argv, false );
> QImage im( 400, 300, 32 );
> //QPixmap pix( im );
> }
>
>
> but if you uncomment the QPixmap initialization it segfaults?
QPixmap/X11 needs an X connection since it uses an X pixmap. Maybe it would
work with Qt/embedded?
--
[ signature omitted ]
On Thu, 21 Mar 2002, Malte Starostik wrote: > QPixmap/X11 needs an X connection since it uses an X pixmap. Maybe it would > work with Qt/embedded? Hmm, well, this is very sad. Is there no way to draw lines and such in a QImage without an XServer, then (with the regular QT/X11 Free?)? It would be a drag to require yet another library to compile these apps.
<<< text/html: EXCLUDED >>>
On Thu, 21 Mar 2002, Greger Haga wrote: > I have the exact same experience ( the pixmap constructor segfaults ( linux > and qt.3.0.0.beta6 ) ). I repported it as a bug to trolltech and they > adviced me to upgrade qt ( as they could not reproduce the problem there ). Looking at the code, it appears that QPainter makes a simple call to, say XDrawLine from the xlib. This function (in xlib) requires an xserver since it then calls from the xserver. Since I was running with no connection to an xserver I believe this explains the segfault. Setting up an event loop solved the problem but is not as desirable in my situation.
On Thu, 21 Mar 2002, Greger Haga wrote: > Okey, but still it doesn't explain my experience of the case, I tried to create > a QPixmap of an image on file, and later attempted to put it as the erasepixmap > for a mainwindow, which caused the main window to be constructed, painting ONCE > the pixmap on the background, and then segfaulted. *S*. > > And too, such a class like QPixmap should not do anything in the constructor > that might cause the constructor itself to segfault, so there's a clear bug > someplace... Well, I agree with you that you shouldn't segfault. Segfaults, to me, mean bugs. I haven't heard anything yet. *shrug* For now I'll just use it in the officially approved manner, even if that does mean extra wierdness for a commandline client.