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:
2021-08-01 22:09:55 +03:00
parent 29e68e6e6b
commit c0ac0002e6
8 changed files with 120 additions and 114 deletions

View File

@@ -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();
}