version 2.4.0
ImageView now optionally save QImage when setImage() piqt many stream operatorsand new helpers: * qSerialize * qDeserialize * piqSerialize * piqDeserialize
This commit is contained in:
@@ -40,16 +40,18 @@ void ImageView::setPixmap(QPixmap pixmap) {
|
||||
}
|
||||
|
||||
|
||||
void ImageView::setImage(const QImage & i) {
|
||||
void ImageView::setImage(const QImage & i, bool save) {
|
||||
im_data.clear();
|
||||
if (i.isNull()) {
|
||||
item.setPixmap(QPixmap());
|
||||
map = QPixmap();
|
||||
return;
|
||||
}
|
||||
QBuffer b(&im_data); b.open(QIODevice::ReadWrite);
|
||||
i.save(&b, "png");
|
||||
b.close();
|
||||
if (save) {
|
||||
QBuffer b(&im_data); b.open(QIODevice::ReadWrite);
|
||||
i.save(&b, "png");
|
||||
b.close();
|
||||
}
|
||||
map = QPixmap::fromImage(i);
|
||||
adjustView();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user