Browse Source

QImage creations fails causing QPainter to fail

Need to check for QImage failure otherwise it will through a qWarning.
QGC4.4
Don Gagne 11 years ago
parent
commit
22ebc746f0
  1. 2
      libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp

2
libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp

@ -133,6 +133,7 @@ namespace mapcontrol
temp=QImage(size, temp=QImage(size,
QImage::Format_ARGB32_Premultiplied); QImage::Format_ARGB32_Premultiplied);
temp.fill(0); temp.fill(0);
if (!temp.isNull()) {
QPainter imagePainter(&temp); QPainter imagePainter(&temp);
imagePainter.translate(-boundingRect().topLeft()); imagePainter.translate(-boundingRect().topLeft());
imagePainter.scale(2*zoomdiff,2*zoomdiff); imagePainter.scale(2*zoomdiff,2*zoomdiff);
@ -141,6 +142,7 @@ namespace mapcontrol
lastimagepoint=Point(core->GetrenderOffset().X()*2*zoomdiff,core->GetrenderOffset().Y()*2*zoomdiff); lastimagepoint=Point(core->GetrenderOffset().X()*2*zoomdiff,core->GetrenderOffset().Y()*2*zoomdiff);
lastimage=temp; lastimage=temp;
} }
}
void MapGraphicItem::paintImage(QPainter *painter) void MapGraphicItem::paintImage(QPainter *painter)
{ {

Loading…
Cancel
Save