Changeset View
Changeset View
Standalone View
Standalone View
lib/crop/croptool.cpp
Show First 20 Lines • Show All 368 Lines • ▼ Show 20 Line(s) | 366 | if (d->mMovingHandle == CH_Top || d->mMovingHandle == CH_Bottom) { | |||
---|---|---|---|---|---|
369 | d->mRect.setWidth(width); | 369 | d->mRect.setWidth(width); | ||
370 | } else if (d->mMovingHandle == CH_Left || d->mMovingHandle == CH_Right) { | 370 | } else if (d->mMovingHandle == CH_Left || d->mMovingHandle == CH_Right) { | ||
371 | // Left or right | 371 | // Left or right | ||
372 | int height = int(d->mRect.width() * ratioToEnforce); | 372 | int height = int(d->mRect.width() * ratioToEnforce); | ||
373 | d->mRect.setHeight(height); | 373 | d->mRect.setHeight(height); | ||
374 | } else if (d->mMovingHandle & CH_Top) { | 374 | } else if (d->mMovingHandle & CH_Top) { | ||
375 | // Top left or top right | 375 | // Top left or top right | ||
376 | int height = int(d->mRect.width() * ratioToEnforce); | 376 | int height = int(d->mRect.width() * ratioToEnforce); | ||
377 | d->mRect.setTop(d->mRect.bottom() - height); | 377 | d->mRect.setTop(d->mRect.y() + d->mRect.height() - height); | ||
anthonyfieroni: So use `y() + height` | |||||
I was initially going to do that as the Qt documentation suggests, but as far as I can tell both accomplish the same thing and I chose to simply add 1 instead for consistency with the rest of the file where the same thing was done a couple of times. alexmi: I was initially going to do that as the Qt documentation suggests, but as far as I can tell… | |||||
Yes, they do same thing, but +1 can be forgotten why's its purpose, but when you see y() + height it does not have to think about. anthonyfieroni: Yes, they do same thing, but +1 can be forgotten why's its purpose, but when you see y() +… | |||||
378 | } else if (d->mMovingHandle & CH_Bottom) { | 378 | } else if (d->mMovingHandle & CH_Bottom) { | ||
379 | // Bottom left or bottom right | 379 | // Bottom left or bottom right | ||
380 | int height = int(d->mRect.width() * ratioToEnforce); | 380 | int height = int(d->mRect.width() * ratioToEnforce); | ||
381 | d->mRect.setHeight(height); | 381 | d->mRect.setHeight(height); | ||
382 | } | 382 | } | ||
383 | } | 383 | } | ||
384 | 384 | | |||
385 | if (d->mMovingHandle == CH_Content) { | 385 | if (d->mMovingHandle == CH_Content) { | ||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |
So use y() + height