1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629
|
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoSnapStrategy.h"
#include "KoSnapProxy.h"
#include "KoSnapGuide.h"
#include <KoPathShape.h>
#include <KoPathPoint.h>
#include <KoCanvasBase.h>
#include <KoViewConverter.h>
#include <KoGuidesData.h>
#include <QPainter>
#include <math.h>
#ifdef _WIN32
#define isfinite(x) _finite((double)(x))
#endif
KoSnapStrategy::KoSnapStrategy(KoSnapGuide::Strategy type)
: m_snapType(type)
{
}
QPointF KoSnapStrategy::snappedPosition() const
{
return m_snappedPosition;
}
void KoSnapStrategy::setSnappedPosition(const QPointF &position)
{
m_snappedPosition = position;
}
KoSnapGuide::Strategy KoSnapStrategy::type() const
{
return m_snapType;
}
qreal KoSnapStrategy::squareDistance(const QPointF &p1, const QPointF &p2)
{
const qreal dx = p1.x() - p2.x();
const qreal dy = p1.y() - p2.y();
return dx*dx + dy*dy;
}
qreal KoSnapStrategy::scalarProduct(const QPointF &p1, const QPointF &p2)
{
return p1.x() * p2.x() + p1.y() * p2.y();
}
OrthogonalSnapStrategy::OrthogonalSnapStrategy()
: KoSnapStrategy(KoSnapGuide::OrthogonalSnapping)
{
}
bool OrthogonalSnapStrategy::snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance)
{
Q_ASSERT(isfinite(maxSnapDistance));
QPointF horzSnap, vertSnap;
qreal minVertDist = HUGE_VAL;
qreal minHorzDist = HUGE_VAL;
QList<KoShape*> shapes = proxy->shapes();
foreach(KoShape * shape, shapes) {
QList<QPointF> points = proxy->pointsFromShape(shape);
foreach (const QPointF &point, points) {
qreal dx = fabs(point.x() - mousePosition.x());
if (dx < minHorzDist && dx < maxSnapDistance) {
minHorzDist = dx;
horzSnap = point;
}
qreal dy = fabs(point.y() - mousePosition.y());
if (dy < minVertDist && dy < maxSnapDistance) {
minVertDist = dy;
vertSnap = point;
}
}
}
QPointF snappedPoint = mousePosition;
if (minHorzDist < HUGE_VAL)
snappedPoint.setX(horzSnap.x());
if (minVertDist < HUGE_VAL)
snappedPoint.setY(vertSnap.y());
if (minHorzDist < HUGE_VAL)
m_hLine = QLineF(horzSnap, snappedPoint);
else
m_hLine = QLineF();
if (minVertDist < HUGE_VAL)
m_vLine = QLineF(vertSnap, snappedPoint);
else
m_vLine = QLineF();
setSnappedPosition(snappedPoint);
return (minHorzDist < HUGE_VAL || minVertDist < HUGE_VAL);
}
QPainterPath OrthogonalSnapStrategy::decoration(const KoViewConverter &/*converter*/) const
{
QPainterPath decoration;
if (! m_hLine.isNull()) {
decoration.moveTo(m_hLine.p1());
decoration.lineTo(m_hLine.p2());
}
if (! m_vLine.isNull()) {
decoration.moveTo(m_vLine.p1());
decoration.lineTo(m_vLine.p2());
}
return decoration;
}
NodeSnapStrategy::NodeSnapStrategy()
: KoSnapStrategy(KoSnapGuide::NodeSnapping)
{
}
bool NodeSnapStrategy::snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance)
{
Q_ASSERT(isfinite(maxSnapDistance));
const qreal maxDistance = maxSnapDistance * maxSnapDistance;
qreal minDistance = HUGE_VAL;
QRectF rect(-maxSnapDistance, -maxSnapDistance, maxSnapDistance, maxSnapDistance);
rect.moveCenter(mousePosition);
QList<QPointF> points = proxy->pointsInRect(rect);
QPointF snappedPoint = mousePosition;
foreach (const QPointF &point, points) {
qreal distance = squareDistance(mousePosition, point);
if (distance < maxDistance && distance < minDistance) {
snappedPoint = point;
minDistance = distance;
}
}
setSnappedPosition(snappedPoint);
return (minDistance < HUGE_VAL);
}
QPainterPath NodeSnapStrategy::decoration(const KoViewConverter &converter) const
{
QRectF unzoomedRect = converter.viewToDocument(QRectF(0, 0, 11, 11));
unzoomedRect.moveCenter(snappedPosition());
QPainterPath decoration;
decoration.addEllipse(unzoomedRect);
return decoration;
}
ExtensionSnapStrategy::ExtensionSnapStrategy()
: KoSnapStrategy(KoSnapGuide::ExtensionSnapping)
{
}
bool ExtensionSnapStrategy::snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance)
{
Q_ASSERT(isfinite(maxSnapDistance));
const qreal maxDistance = maxSnapDistance * maxSnapDistance;
qreal minDistances[2] = { HUGE_VAL, HUGE_VAL };
QPointF snappedPoints[2] = { mousePosition, mousePosition };
QPointF startPoints[2];
QList<KoShape*> shapes = proxy->shapes(true);
foreach(KoShape * shape, shapes) {
KoPathShape * path = dynamic_cast<KoPathShape*>(shape);
if (! path) {
continue;
}
QTransform matrix = path->absoluteTransformation(0);
const int subpathCount = path->subpathCount();
for (int subpathIndex = 0; subpathIndex < subpathCount; ++subpathIndex) {
if (path->isClosedSubpath(subpathIndex))
continue;
int pointCount = path->subpathPointCount(subpathIndex);
// check the extension from the start point
KoPathPoint * first = path->pointByIndex(KoPathPointIndex(subpathIndex, 0));
QPointF firstSnapPosition = mousePosition;
if (snapToExtension(firstSnapPosition, first, matrix)) {
qreal distance = squareDistance(firstSnapPosition, mousePosition);
if (distance < maxDistance) {
if (distance < minDistances[0]) {
minDistances[1] = minDistances[0];
snappedPoints[1] = snappedPoints[0];
startPoints[1] = startPoints[0];
minDistances[0] = distance;
snappedPoints[0] = firstSnapPosition;
startPoints[0] = matrix.map(first->point());
}
else if (distance < minDistances[1]) {
minDistances[1] = distance;
snappedPoints[1] = firstSnapPosition;
startPoints[1] = matrix.map(first->point());
}
}
}
// now check the extension from the last point
KoPathPoint * last = path->pointByIndex(KoPathPointIndex(subpathIndex, pointCount - 1));
QPointF lastSnapPosition = mousePosition;
if (snapToExtension(lastSnapPosition, last, matrix)) {
qreal distance = squareDistance(lastSnapPosition, mousePosition);
if (distance < maxDistance) {
if (distance < minDistances[0]) {
minDistances[1] = minDistances[0];
snappedPoints[1] = snappedPoints[0];
startPoints[1] = startPoints[0];
minDistances[0] = distance;
snappedPoints[0] = lastSnapPosition;
startPoints[0] = matrix.map(last->point());
}
else if (distance < minDistances[1]) {
minDistances[1] = distance;
snappedPoints[1] = lastSnapPosition;
startPoints[1] = matrix.map(last->point());
}
}
}
}
}
m_lines.clear();
// if we have to extension near our mouse position, they might have an intersection
// near our mouse position which we want to use as the snapped position
if (minDistances[0] < HUGE_VAL && minDistances[1] < HUGE_VAL) {
// check if intersection of extension lines is near mouse position
KoPathSegment s1(startPoints[0], snappedPoints[0] + snappedPoints[0]-startPoints[0]);
KoPathSegment s2(startPoints[1], snappedPoints[1] + snappedPoints[1]-startPoints[1]);
QList<QPointF> isects = s1.intersections(s2);
if (isects.count() == 1 && squareDistance(isects[0], mousePosition) < maxDistance) {
// add both extension lines
m_lines.append(QLineF(startPoints[0], isects[0]));
m_lines.append(QLineF(startPoints[1], isects[0]));
setSnappedPosition(isects[0]);
}
else {
// only add nearest extension line of both
uint index = minDistances[0] < minDistances[1] ? 0 : 1;
m_lines.append(QLineF(startPoints[index], snappedPoints[index]));
setSnappedPosition(snappedPoints[index]);
}
}
else if (minDistances[0] < HUGE_VAL) {
m_lines.append(QLineF(startPoints[0], snappedPoints[0]));
setSnappedPosition(snappedPoints[0]);
}
else if (minDistances[1] < HUGE_VAL) {
m_lines.append(QLineF(startPoints[1], snappedPoints[1]));
setSnappedPosition(snappedPoints[1]);
}
else {
// none of the extension lines is near our mouse position
return false;
}
return true;
}
QPainterPath ExtensionSnapStrategy::decoration(const KoViewConverter &/*converter*/) const
{
QPainterPath decoration;
foreach (const QLineF &line, m_lines) {
decoration.moveTo(line.p1());
decoration.lineTo(line.p2());
}
return decoration;
}
bool ExtensionSnapStrategy::snapToExtension(QPointF &position, KoPathPoint * point, const QTransform &matrix)
{
Q_ASSERT(point);
QPointF direction = extensionDirection(point, matrix);
if (direction.isNull())
return false;
QPointF extensionStart = matrix.map(point->point());
QPointF extensionStop = matrix.map(point->point()) + direction;
float posOnExtension = project(extensionStart, extensionStop, position);
if (posOnExtension < 0.0)
return false;
position = extensionStart + posOnExtension * direction;
return true;
}
qreal ExtensionSnapStrategy::project(const QPointF &lineStart, const QPointF &lineEnd, const QPointF &point)
{
// This is how the returned value should be used to get the
// projectionPoint: ProjectionPoint = lineStart(1-resultingReal) + resultingReal*lineEnd;
QPointF diff = lineEnd - lineStart;
QPointF relPoint = point - lineStart;
qreal diffLength = sqrt(diff.x() * diff.x() + diff.y() * diff.y());
if (diffLength == 0.0)
return 0.0;
diff /= diffLength;
// project mouse position relative to stop position on extension line
qreal scalar = relPoint.x() * diff.x() + relPoint.y() * diff.y();
return scalar /= diffLength;
}
QPointF ExtensionSnapStrategy::extensionDirection(KoPathPoint * point, const QTransform &matrix)
{
Q_ASSERT(point);
KoPathShape * path = point->parent();
KoPathPointIndex index = path->pathPointIndex(point);
// check if it is a start point
if (point->properties() & KoPathPoint::StartSubpath) {
if (point->activeControlPoint2()) {
return matrix.map(point->point()) - matrix.map(point->controlPoint2());
} else {
KoPathPoint * next = path->pointByIndex(KoPathPointIndex(index.first, index.second + 1));
if (! next){
return QPointF();
}
else if (next->activeControlPoint1()) {
return matrix.map(point->point()) - matrix.map(next->controlPoint1());
}
else {
return matrix.map(point->point()) - matrix.map(next->point());
}
}
}
else {
if (point->activeControlPoint1()) {
return matrix.map(point->point()) - matrix.map(point->controlPoint1());
}
else {
KoPathPoint * prev = path->pointByIndex(KoPathPointIndex(index.first, index.second - 1));
if (! prev){
return QPointF();
}
else if (prev->activeControlPoint2()) {
return matrix.map(point->point()) - matrix.map(prev->controlPoint2());
}
else {
return matrix.map(point->point()) - matrix.map(prev->point());
}
}
}
}
IntersectionSnapStrategy::IntersectionSnapStrategy()
: KoSnapStrategy(KoSnapGuide::IntersectionSnapping)
{
}
bool IntersectionSnapStrategy::snap(const QPointF &mousePosition, KoSnapProxy *proxy, qreal maxSnapDistance)
{
Q_ASSERT(isfinite(maxSnapDistance));
const qreal maxDistance = maxSnapDistance * maxSnapDistance;
qreal minDistance = HUGE_VAL;
QRectF rect(-maxSnapDistance, -maxSnapDistance, maxSnapDistance, maxSnapDistance);
rect.moveCenter(mousePosition);
QPointF snappedPoint = mousePosition;
QList<KoPathSegment> segments = proxy->segmentsInRect(rect);
int segmentCount = segments.count();
for (int i = 0; i < segmentCount; ++i) {
const KoPathSegment &s1 = segments[i];
for (int j = i + 1; j < segmentCount; ++j) {
QList<QPointF> isects = s1.intersections(segments[j]);
foreach(const QPointF &point, isects) {
if (! rect.contains(point))
continue;
qreal distance = squareDistance(mousePosition, point);
if (distance < maxDistance && distance < minDistance) {
snappedPoint = point;
minDistance = distance;
}
}
}
}
setSnappedPosition(snappedPoint);
return (minDistance < HUGE_VAL);
}
QPainterPath IntersectionSnapStrategy::decoration(const KoViewConverter &converter) const
{
QRectF unzoomedRect = converter.viewToDocument(QRectF(0, 0, 11, 11));
unzoomedRect.moveCenter(snappedPosition());
QPainterPath decoration;
decoration.addRect(unzoomedRect);
return decoration;
}
GridSnapStrategy::GridSnapStrategy()
: KoSnapStrategy(KoSnapGuide::GridSnapping)
{
}
bool GridSnapStrategy::snap(const QPointF &mousePosition, KoSnapProxy *proxy, qreal maxSnapDistance)
{
Q_ASSERT(isfinite(maxSnapDistance));
if (! proxy->canvas()->snapToGrid())
return false;
// The 1e-10 here is a workaround for some weird division problem.
// 360.00062366 / 2.83465058 gives 127 'exactly' when shown as a qreal,
// but when casting into an int, we get 126. In fact it's 127 - 5.64e-15 !
qreal gridX, gridY;
proxy->canvas()->gridSize(&gridX, &gridY);
// we want to snap to the nearest grid point, so calculate
// the grid rows/columns before and after the points position
int col = static_cast<int>(mousePosition.x() / gridX + 1e-10);
int nextCol = col + 1;
int row = static_cast<int>(mousePosition.y() / gridY + 1e-10);
int nextRow = row + 1;
// now check which grid line has less distance to the point
qreal distToCol = qAbs(col * gridX - mousePosition.x());
qreal distToNextCol = qAbs(nextCol * gridX - mousePosition.x());
if (distToCol > distToNextCol) {
col = nextCol;
distToCol = distToNextCol;
}
qreal distToRow = qAbs(row * gridY - mousePosition.y());
qreal distToNextRow = qAbs(nextRow * gridY - mousePosition.y());
if (distToRow > distToNextRow) {
row = nextRow;
distToRow = distToNextRow;
}
QPointF snappedPoint = mousePosition;
const qreal distance = distToCol * distToCol + distToRow * distToRow;
const qreal maxDistance = maxSnapDistance * maxSnapDistance;
// now check if we are inside the snap distance
if (distance < maxDistance) {
snappedPoint = QPointF(col * gridX, row * gridY);
}
setSnappedPosition(snappedPoint);
return (distance < maxDistance);
}
QPainterPath GridSnapStrategy::decoration(const KoViewConverter &converter) const
{
QSizeF unzoomedSize = converter.viewToDocument(QSizeF(5, 5));
QPainterPath decoration;
decoration.moveTo(snappedPosition() - QPointF(unzoomedSize.width(), 0));
decoration.lineTo(snappedPosition() + QPointF(unzoomedSize.width(), 0));
decoration.moveTo(snappedPosition() - QPointF(0, unzoomedSize.height()));
decoration.lineTo(snappedPosition() + QPointF(0, unzoomedSize.height()));
return decoration;
}
BoundingBoxSnapStrategy::BoundingBoxSnapStrategy()
: KoSnapStrategy(KoSnapGuide::BoundingBoxSnapping)
{
}
bool BoundingBoxSnapStrategy::snap(const QPointF &mousePosition, KoSnapProxy *proxy, qreal maxSnapDistance)
{
Q_ASSERT(isfinite(maxSnapDistance));
const qreal maxDistance = maxSnapDistance * maxSnapDistance;
qreal minDistance = HUGE_VAL;
QRectF rect(-maxSnapDistance, -maxSnapDistance, maxSnapDistance, maxSnapDistance);
rect.moveCenter(mousePosition);
QPointF snappedPoint = mousePosition;
KoFlake::Position pointId[5] = {
KoFlake::TopLeftCorner,
KoFlake::TopRightCorner,
KoFlake::BottomRightCorner,
KoFlake::BottomLeftCorner,
KoFlake::CenteredPosition
};
QList<KoShape*> shapes = proxy->shapesInRect(rect, true);
foreach(KoShape * shape, shapes) {
qreal shapeMinDistance = HUGE_VAL;
// first check the corner and center points
for (int i = 0; i < 5; ++i) {
m_boxPoints[i] = shape->absolutePosition(pointId[i]);
qreal d = squareDistance(mousePosition, m_boxPoints[i]);
if (d < minDistance && d < maxDistance) {
shapeMinDistance = d;
minDistance = d;
snappedPoint = m_boxPoints[i];
}
}
// prioritize points over edges
if (shapeMinDistance < maxDistance)
continue;
// now check distances to edges of bounding box
for (int i = 0; i < 4; ++i) {
QPointF pointOnLine;
qreal d = squareDistanceToLine(m_boxPoints[i], m_boxPoints[(i+1)%4], mousePosition, pointOnLine);
if (d < minDistance && d < maxDistance) {
minDistance = d;
snappedPoint = pointOnLine;
}
}
}
setSnappedPosition(snappedPoint);
return (minDistance < maxDistance);
}
qreal BoundingBoxSnapStrategy::squareDistanceToLine(const QPointF &lineA, const QPointF &lineB, const QPointF &point, QPointF &pointOnLine)
{
QPointF diff = lineB - lineA;
if(lineA == lineB)
return HUGE_VAL;
const qreal diffLength = sqrt(diff.x() * diff.x() + diff.y() * diff.y());
// project mouse position relative to start position on line
const qreal scalar = KoSnapStrategy::scalarProduct(point - lineA, diff / diffLength);
if (scalar < 0.0 || scalar > diffLength)
return HUGE_VAL;
// calculate vector between relative mouse position and projected mouse position
pointOnLine = lineA + scalar / diffLength * diff;
QPointF distVec = pointOnLine - point;
return distVec.x()*distVec.x() + distVec.y()*distVec.y();
}
QPainterPath BoundingBoxSnapStrategy::decoration(const KoViewConverter &converter) const
{
QSizeF unzoomedSize = converter.viewToDocument(QSizeF(5, 5));
QPainterPath decoration;
decoration.moveTo(snappedPosition() - QPointF(unzoomedSize.width(), unzoomedSize.height()));
decoration.lineTo(snappedPosition() + QPointF(unzoomedSize.width(), unzoomedSize.height()));
decoration.moveTo(snappedPosition() - QPointF(unzoomedSize.width(), -unzoomedSize.height()));
decoration.lineTo(snappedPosition() + QPointF(unzoomedSize.width(), -unzoomedSize.height()));
return decoration;
}
LineGuideSnapStrategy::LineGuideSnapStrategy()
: KoSnapStrategy(KoSnapGuide::GuideLineSnapping)
{
}
bool LineGuideSnapStrategy::snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance)
{
Q_ASSERT(isfinite(maxSnapDistance));
KoGuidesData * guidesData = proxy->canvas()->guidesData();
if (!guidesData || !guidesData->showGuideLines())
return false;
QPointF snappedPoint = mousePosition;
m_orientation = 0;
qreal minHorzDistance = maxSnapDistance;
foreach(qreal guidePos, guidesData->horizontalGuideLines()) {
qreal distance = qAbs(guidePos - mousePosition.y());
if (distance < minHorzDistance) {
snappedPoint.setY(guidePos);
minHorzDistance = distance;
m_orientation |= Qt::Horizontal;
}
}
qreal minVertSnapDistance = maxSnapDistance;
foreach(qreal guidePos, guidesData->verticalGuideLines()) {
qreal distance = qAbs(guidePos - mousePosition.x());
if (distance < minVertSnapDistance) {
snappedPoint.setX(guidePos);
minVertSnapDistance = distance;
m_orientation |= Qt::Vertical;
}
}
setSnappedPosition(snappedPoint);
return (minHorzDistance < maxSnapDistance || minVertSnapDistance < maxSnapDistance);
}
QPainterPath LineGuideSnapStrategy::decoration(const KoViewConverter &converter) const
{
QSizeF unzoomedSize = converter.viewToDocument(QSizeF(5, 5));
Q_ASSERT(unzoomedSize.isValid());
QPainterPath decoration;
if (m_orientation & Qt::Horizontal) {
decoration.moveTo(snappedPosition() - QPointF(unzoomedSize.width(), 0));
decoration.lineTo(snappedPosition() + QPointF(unzoomedSize.width(), 0));
}
if (m_orientation & Qt::Vertical) {
decoration.moveTo(snappedPosition() - QPointF(0, unzoomedSize.height()));
decoration.lineTo(snappedPosition() + QPointF(0, unzoomedSize.height()));
}
return decoration;
}
|