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