Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentviewcontainer.cpp
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Line(s) | 173 | { | |||
---|---|---|---|---|---|
178 | qSort(views.begin(), views.end(), viewLessThan); | 178 | qSort(views.begin(), views.end(), viewLessThan); | ||
179 | 179 | | |||
180 | bool animated = GwenviewConfig::animationMethod() != DocumentView::NoAnimation; | 180 | bool animated = GwenviewConfig::animationMethod() != DocumentView::NoAnimation; | ||
181 | bool crossFade = d->mAddedViews.count() == 1 && d->mRemovedViews.count() == 1; | 181 | bool crossFade = d->mAddedViews.count() == 1 && d->mRemovedViews.count() == 1; | ||
182 | 182 | | |||
183 | if (animated && crossFade) { | 183 | if (animated && crossFade) { | ||
184 | DocumentView* oldView = *d->mRemovedViews.begin(); | 184 | DocumentView* oldView = *d->mRemovedViews.begin(); | ||
185 | DocumentView* newView = *d->mAddedViews.begin(); | 185 | DocumentView* newView = *d->mAddedViews.begin(); | ||
186 | newView->setZValue(oldView->zValue() - 1); | ||||
186 | 187 | | |||
187 | newView->setGeometry(rect()); | 188 | newView->setGeometry(rect()); | ||
188 | newView->setEraseBorders(true); | 189 | newView->setEraseBorders(true); | ||
189 | QPropertyAnimation* anim = newView->fadeIn(); | | |||
190 | 190 | | |||
191 | oldView->setZValue(-1); | 191 | // We animate both views so there are no artifacts when switching between images with/without transparency | ||
192 | connect(anim, &QPropertyAnimation::finished, oldView, &DocumentView::hideAndDeleteLater); | 192 | QPropertyAnimation* newViewAnim = newView->fadeIn(); | ||
193 | QPropertyAnimation* oldViewAnim = oldView->fadeOut(); | ||||
194 | | ||||
195 | connect(newViewAnim, &QPropertyAnimation::finished, oldView, &DocumentView::hideAndDeleteLater); | ||||
196 | connect(oldViewAnim, &QPropertyAnimation::finished, oldView, &DocumentView::hideAndDeleteLater); | ||||
193 | d->mRemovedViews.clear(); | 197 | d->mRemovedViews.clear(); | ||
194 | 198 | | |||
195 | return; | 199 | return; | ||
196 | } | 200 | } | ||
197 | 201 | | |||
198 | if (!views.isEmpty()) { | 202 | if (!views.isEmpty()) { | ||
199 | // Compute column count | 203 | // Compute column count | ||
200 | int colCount; | 204 | int colCount; | ||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |