ImageView LOD patch
This commit is contained in:
@@ -126,18 +126,22 @@ bool ImageView::eventFilter(QObject * o, QEvent * e) {
|
|||||||
|
|
||||||
void ImageView::adjustView() {
|
void ImageView::adjustView() {
|
||||||
int nw = map.size().boundedTo(size()).width();
|
int nw = map.size().boundedTo(size()).width();
|
||||||
|
item.setScale(1.);
|
||||||
if (nw > 0) {
|
if (nw > 0) {
|
||||||
qreal mp = map.width() / nw;
|
qreal mp = map.width() / nw;
|
||||||
if (mp > 1.)
|
if (mp > 1.) {
|
||||||
|
QSize ss = map.size();
|
||||||
item.setPixmap(map.scaled(map.size() / mp, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
item.setPixmap(map.scaled(map.size() / mp, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
else
|
item.setScale(double(ss.width()) / item.pixmap().width());
|
||||||
|
} else
|
||||||
item.setPixmap(map);
|
item.setPixmap(map);
|
||||||
} else
|
} else
|
||||||
item.setPixmap(map);
|
item.setPixmap(map);
|
||||||
if (!autofit_) return;
|
if (!autofit_) return;
|
||||||
setSceneRect(item.boundingRect());
|
QRectF r = item.mapRectToScene(item.boundingRect());
|
||||||
fitInView(&item, Qt::KeepAspectRatio);
|
setSceneRect(r);
|
||||||
centerOn(&item);
|
fitInView(r, Qt::KeepAspectRatio);
|
||||||
|
centerOn(r.center());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user