| Summary: | disable autozoom when picture fits in window | ||
|---|---|---|---|
| Product: | [Applications] digikam | Reporter: | Thomas Schildknecht <danakil.kde> |
| Component: | ImageEditor-Canvas | Assignee: | Digikam Developers <digikam-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | 0.9.0 | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | 0.9.2 | |
| Sentry Crash Report: | |||
|
Description
Thomas Schildknecht
2006-11-12 15:15:52 UTC
While solution is not exactly the same, whatever get's done for http://bugs.kde.org/show_bug.cgi?id=106508 will affect this bug report. DanaKil: please compare your solution witht he suggested ones in #106508. Add your opionion there if you disagree (or vote for the other bug report ;) Then we can mark this report as a duplicate of #106508 Thx, Achim SVN commit 644497 by cgilles:
digikam from trunk : with small image, autozoom button will adapt image size to canvas size.
BUG: 137236
M +9 -17 canvas.cpp
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #644496:644497
@@ -351,20 +351,13 @@
void Canvas::updateAutoZoom()
{
- double srcWidth, srcHeight, dstWidth, dstHeight;
+ double srcWidth = d->im->origWidth();
+ double srcHeight = d->im->origHeight();
+ double dstWidth = contentsRect().width();
+ double dstHeight = contentsRect().height();
- srcWidth = d->im->origWidth();
- srcHeight = d->im->origHeight();
- dstWidth = contentsRect().width();
- dstHeight = contentsRect().height();
+ d->zoom = QMIN(dstWidth/srcWidth, dstHeight/srcHeight);
- if (dstWidth > srcWidth &&
- dstHeight > srcHeight)
- d->zoom = 1.0;
- else
- d->zoom = QMIN(dstWidth/srcWidth,
- dstHeight/srcHeight);
-
d->im->zoom(d->zoom);
emit signalZoomChanged(d->zoom);
@@ -401,8 +394,8 @@
int centery = contentsRect().height()/2;
int xoffset = int(centerx - wZ/2);
int yoffset = int(centery - hZ/2);
- xoffset = QMAX(xoffset, 0);
- yoffset = QMAX(yoffset, 0);
+ xoffset = QMAX(xoffset, 0);
+ yoffset = QMAX(yoffset, 0);
d->pixmapRect = QRect(xoffset, yoffset, wZ, hZ);
}
@@ -572,13 +565,12 @@
p.setBrush(NoBrush);
QRect r(d->rubber->normalize());
- r = QRect(contentsToViewport(QPoint(r.x(),r.y())), r.size());
+ r = QRect(contentsToViewport(QPoint(r.x(), r.y())), r.size());
QPoint pnt(r.x(), r.y());
style().drawPrimitive(QStyle::PE_FocusRect, &p,
- QRect( pnt.x(), pnt.y(),
- r.width(), r.height() ),
+ QRect(pnt.x(), pnt.y(), r.width(), r.height()),
colorGroup(), QStyle::Style_Default,
QStyleOption(colorGroup().base()));
p.end();
|