Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentview.cpp
Show All 37 Lines | |||||
38 | #include <QPointer> | 38 | #include <QPointer> | ||
39 | #include <QDebug> | 39 | #include <QDebug> | ||
40 | #include <QIcon> | 40 | #include <QIcon> | ||
41 | #include <QUrl> | 41 | #include <QUrl> | ||
42 | #include <QDrag> | 42 | #include <QDrag> | ||
43 | #include <QMimeData> | 43 | #include <QMimeData> | ||
44 | #include <QStyleHints> | 44 | #include <QStyleHints> | ||
45 | #include <QGestureEvent> | 45 | #include <QGestureEvent> | ||
46 | #include <QLibraryInfo> | ||||
46 | 47 | | |||
47 | // KDE | 48 | // KDE | ||
48 | #include <KLocalizedString> | 49 | #include <KLocalizedString> | ||
49 | #include <KFileItem> | 50 | #include <KFileItem> | ||
50 | #include <KUrlMimeData> | 51 | #include <KUrlMimeData> | ||
51 | 52 | | |||
52 | // Local | 53 | // Local | ||
53 | #include <lib/document/document.h> | 54 | #include <lib/document/document.h> | ||
▲ Show 20 Lines • Show All 413 Lines • ▼ Show 20 Line(s) | 443 | { | |||
467 | 468 | | |||
468 | // We use an opacity effect instead of using the opacity property directly, because the latter operates at | 469 | // We use an opacity effect instead of using the opacity property directly, because the latter operates at | ||
469 | // the painter level, which means if you draw multiple layers in paint(), all layers get the specified | 470 | // the painter level, which means if you draw multiple layers in paint(), all layers get the specified | ||
470 | // opacity, resulting in all layers being visible when 0 < opacity < 1. | 471 | // opacity, resulting in all layers being visible when 0 < opacity < 1. | ||
471 | // QGraphicsEffects on the other hand, operate after all painting is done, therefore 'flattening' all layers. | 472 | // QGraphicsEffects on the other hand, operate after all painting is done, therefore 'flattening' all layers. | ||
472 | // This is important for fade effects, where we don't want any background layers visible during the fade. | 473 | // This is important for fade effects, where we don't want any background layers visible during the fade. | ||
473 | d->mOpacityEffect = new QGraphicsOpacityEffect(this); | 474 | d->mOpacityEffect = new QGraphicsOpacityEffect(this); | ||
474 | d->mOpacityEffect->setOpacity(0); | 475 | d->mOpacityEffect->setOpacity(0); | ||
476 | | ||||
477 | // QTBUG-74963. QGraphicsOpacityEffect cause painting an image as non-highdpi. | ||||
ngraham: Can you add a comment explaining this, with a link to the relevant Qt bug report or patch? | |||||
478 | if (qFuzzyCompare(qApp->devicePixelRatio(), 1.0) || QLibraryInfo::version() >= QVersionNumber(5, 12, 4)) | ||||
475 | setGraphicsEffect(d->mOpacityEffect); | 479 | setGraphicsEffect(d->mOpacityEffect); | ||
476 | 480 | | |||
477 | scene->addItem(this); | 481 | scene->addItem(this); | ||
478 | 482 | | |||
479 | d->setupHud(); | 483 | d->setupHud(); | ||
480 | d->setCurrentAdapter(new EmptyAdapter); | 484 | d->setCurrentAdapter(new EmptyAdapter); | ||
481 | 485 | | |||
482 | setAcceptDrops(true); | 486 | setAcceptDrops(true); | ||
▲ Show 20 Lines • Show All 619 Lines • Show Last 20 Lines |
Can you add a comment explaining this, with a link to the relevant Qt bug report or patch?