Hi,
vielleicht liegt es nicht an der Größe, sondern an anderen Umständen, versuch es mal bitte mit einem kleineren Pixmap.
Ich habe mal nachgeschaut, was da so passiert, im QPixmap.cpp:
Code: Alles auswählen
QPixmap::QPixmap(int w, int h)
: QPaintDevice()
{
if (!qt_pixmap_thread_test())
init(0, 0,QPixmapData::PixmapType);
else
init(w, h, QPixmapData::PixmapType);
}
Code: Alles auswählen
static bool qt_pixmap_thread_test()
{
if (!qApp) {
qFatal("QPixmap: Must construct a QApplication before a QPaintDevice");
return false;
}
#ifndef Q_WS_WIN
if (qApp->thread() != QThread::currentThread()) {
qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread");
return false;
}
#endif
return true;
}
Hier ist es zwar interessant zu wissen welches BS zu verwendest, letztendlich deute ich die Fehlermeldungen/Warnungen (bekommst du welche?) so, dass dem Pixmap eine QApplication fehlt in der sie läuft. Wäre es der Speicher würde sowas kommen:
Code: Alles auswählen
QPixmap pixmap(1000000000, 100000000);
qDebug() << "pixmap height: " << pixmap.height() << " pixmap width: " << pixmap.width();
Debugger hat geschrieben:pixmap height: 100000000 pixmap width: 1000000000
X Error: BadAlloc (insufficient resources for operation) 11
Major opcode: 53 (X_CreatePixmap)
Resource id: 0x1a7
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Extension: 152 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x5c00064
X Error: RenderBadPicture (invalid Picture parameter) 171
Extension: 152 (RENDER)
Minor opcode: 7 (RenderFreePicture)
Resource id: 0x5c00065
X Error: BadPixmap (invalid Pixmap parameter) 4
Major opcode: 54 (X_FreePixmap)
Resource id: 0x5c00064
Wenn man sich weiter reinließt, kommen noch andere Möglichkeiten zum Tragen, welche aber scheinbar immer eine Ausgabe produzieren. Eine weitere Möglichkeit ist es, dass das der PixelType nicht stimmt (scheinbar nur unter X11 und Mac und nicht unter Windows). In der qpixmap_x11.cpp und qpixmap_mac.cpp steht:
Code: Alles auswählen
..
bool make_null = w <= 0 || h <= 0; // create null pixmap
d = (pixelType() == BitmapType ? 1 : dd);
if (make_null || d == 0) {
w = 0;
h = 0;
hd = 0;
picture = 0;
d = 0;
if (!make_null)
qWarning("QPixmap: Invalid pixmap parameters");
return;
}
...
Hat aber auch eine Ausgabe und passiert wahrscheinlich bei dir nicht, dafür müsstest du den PixelType als int übergeben...
Was dann weiter hier passiert, weiß ich allerdings nicht:
qpixmap.cpp line 126. Vielleicht versteckt sich da auch noch ein Grund, auch wenn ich das nicht glaube. Auch weiter tiefer gibt es Stellen, wo ich einfach nicht mehr weiß, in welcher Datei die aufgerufenen Funktionen oder Klassen sind. Ich habe keine Stelle gefunden in der explizit Speicher alloziert wird.
Grüße,
NothingSpecial