Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/birdeyeview.cpp
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 132 | { | |||
---|---|---|---|---|---|
133 | delete d; | 133 | delete d; | ||
134 | } | 134 | } | ||
135 | 135 | | |||
136 | void BirdEyeView::adjustGeometry() | 136 | void BirdEyeView::adjustGeometry() | ||
137 | { | 137 | { | ||
138 | if (!d->mDocView->canZoom() || d->mDocView->zoomToFit()) { | 138 | if (!d->mDocView->canZoom() || d->mDocView->zoomToFit()) { | ||
139 | return; | 139 | return; | ||
140 | } | 140 | } | ||
141 | QSizeF size = d->mDocView->document()->size(); | 141 | QSizeF size = d->mDocView->document()->size() / qApp->devicePixelRatio(); | ||
142 | size.scale(MIN_SIZE, MIN_SIZE, Qt::KeepAspectRatioByExpanding); | 142 | size.scale(MIN_SIZE, MIN_SIZE, Qt::KeepAspectRatioByExpanding); | ||
143 | QRectF docViewRect = d->mDocView->boundingRect(); | 143 | QRectF docViewRect = d->mDocView->boundingRect(); | ||
144 | int maxBevHeight = docViewRect.height() - 2 * VIEW_OFFSET; | 144 | int maxBevHeight = docViewRect.height() - 2 * VIEW_OFFSET; | ||
145 | int maxBevWidth = docViewRect.width() - 2 * VIEW_OFFSET; | 145 | int maxBevWidth = docViewRect.width() - 2 * VIEW_OFFSET; | ||
146 | if (size.height() > maxBevHeight) { | 146 | if (size.height() > maxBevHeight) { | ||
147 | size.scale(MIN_SIZE, maxBevHeight, Qt::KeepAspectRatio); | 147 | size.scale(MIN_SIZE, maxBevHeight, Qt::KeepAspectRatio); | ||
148 | } | 148 | } | ||
149 | if (size.width() > maxBevWidth) { | 149 | if (size.width() > maxBevWidth) { | ||
150 | size.scale(maxBevWidth, MIN_SIZE, Qt::KeepAspectRatio); | 150 | size.scale(maxBevWidth, MIN_SIZE, Qt::KeepAspectRatio); | ||
151 | } | 151 | } | ||
152 | QRectF geom = QRectF( | 152 | QRectF geom = QRectF( | ||
153 | QApplication::isRightToLeft() | 153 | QApplication::isRightToLeft() | ||
154 | ? docViewRect.left() + VIEW_OFFSET | 154 | ? docViewRect.left() + VIEW_OFFSET | ||
155 | : docViewRect.right() - VIEW_OFFSET - size.width(), | 155 | : docViewRect.right() - VIEW_OFFSET - size.width(), | ||
156 | docViewRect.bottom() - VIEW_OFFSET - size.height(), | 156 | docViewRect.bottom() - VIEW_OFFSET - size.height(), | ||
157 | size.width(), | 157 | size.width(), | ||
158 | size.height() | 158 | size.height() | ||
159 | ); | 159 | ); | ||
160 | setGeometry(alignedRectF(geom)); | 160 | setGeometry(alignedRectF(geom)); | ||
161 | adjustVisibleRect(); | 161 | adjustVisibleRect(); | ||
162 | } | 162 | } | ||
163 | 163 | | |||
164 | void BirdEyeView::adjustVisibleRect() | 164 | void BirdEyeView::adjustVisibleRect() | ||
165 | { | 165 | { | ||
166 | QSizeF docSize = d->mDocView->document()->size(); | 166 | QSizeF docSize = d->mDocView->document()->size() / qApp->devicePixelRatio(); | ||
167 | qreal viewZoom = d->mDocView->zoom(); | 167 | qreal viewZoom = d->mDocView->zoom(); | ||
168 | qreal bevZoom; | 168 | qreal bevZoom; | ||
169 | if (docSize.height() > docSize.width()) { | 169 | if (docSize.height() > docSize.width()) { | ||
170 | bevZoom = size().height() / docSize.height(); | 170 | bevZoom = size().height() / docSize.height(); | ||
171 | } else { | 171 | } else { | ||
172 | bevZoom = size().width() / docSize.width(); | 172 | bevZoom = size().width() / docSize.width(); | ||
173 | } | 173 | } | ||
174 | 174 | | |||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |