[Icon Item] Don't animate from previous pixmap when it has been invisible
We have a lot of reusable singletons that are just hidden when not needed, such as the OSD. IconItem, however, will always fade from the previous state, even if the previous action happened minutes ago. This fixes for example changing the volume and then later changing the brightness where you could see the OSD animating from the volume icon. REVIEW: 122859
This commit is contained in:
parent
3b115e6d90
commit
344d04e230
@ -240,8 +240,6 @@ void IconItemTest::animation()
|
||||
|
||||
void IconItemTest::animationAfterHide()
|
||||
{
|
||||
QEXPECT_FAIL("", "Needs 'no animation after hide' patch", Abort);
|
||||
|
||||
QQuickItem *item1 = createIconItem();
|
||||
QQuickItem *item2 = createIconItem();
|
||||
item1->setProperty("source", "user-away");
|
||||
|
@ -441,6 +441,16 @@ void IconItem::loadPixmap()
|
||||
update();
|
||||
}
|
||||
|
||||
void IconItem::itemChange(ItemChange change, const ItemChangeData &value)
|
||||
{
|
||||
if (change == ItemVisibleHasChanged && value.boolValue) {
|
||||
// Clear pixmap to disable animation
|
||||
m_iconPixmap = QPixmap();
|
||||
}
|
||||
|
||||
QQuickItem::itemChange(change, value);
|
||||
}
|
||||
|
||||
void IconItem::geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry)
|
||||
{
|
||||
|
@ -129,6 +129,7 @@ public:
|
||||
void updatePolish() Q_DECL_OVERRIDE;
|
||||
QSGNode* updatePaintNode(QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData) Q_DECL_OVERRIDE;
|
||||
|
||||
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
|
||||
void geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry) Q_DECL_OVERRIDE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user