[Qt-interest] Creating QPixmap from QByteArray causes segfault [SOLVED]
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed May 5 13:12:51 CEST 2010
Mandeep Sandhu wrote on Wednesday, May 05, 2010 12:35 PM:
> ...
> Initially I thought adding CONFIG += gui in the pro file would be
> enough. But that wasn't the case.
Correct: only if you really instantiate a QApplication (instead of just QCoreApplication) is the graphics subsystem properly initialised, and only then you can use QPixmap (which uses the same pixel setup as set in the graphic card and such), QWidget and any other GUI-related class. QPixmap (QPainter...) interfaces the native drawing subsystem (DirectDraw etc.), and this must be properly initialised (by instantiating a QApplication object).
QImage on the other hand does not depend on any hardware, and thus can be used within a "QCoreApplication".
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list