Stop redirecting windows when item is disabled or hidden.

Concretely fixes Task Manager tooltips slowing down app rendering even
after the tooltip is hidden.

REVIEW:126475
BUG:356938
This commit is contained in:
Eike Hein 2015-12-22 19:26:15 +01:00
parent 9dcb6e5d52
commit c64a94a265

View File

@ -98,6 +98,20 @@ WindowThumbnail::WindowThumbnail(QQuickItem *parent)
stopRedirecting();
startRedirecting();
});
connect(this, &QQuickItem::enabledChanged, [this]() {
if (!isEnabled()) {
stopRedirecting();
} else {
startRedirecting();
}
});
connect(this, &QQuickItem::visibleChanged, [this]() {
if (!isVisible()) {
stopRedirecting();
} else {
startRedirecting();
}
});
if (QGuiApplication *gui = dynamic_cast<QGuiApplication *>(QCoreApplication::instance())) {
m_xcb = (gui->platformName() == QStringLiteral("xcb"));
if (m_xcb) {
@ -148,7 +162,11 @@ void WindowThumbnail::setWinId(uint32_t winId)
}
stopRedirecting();
m_winId = winId;
startRedirecting();
if (isEnabled() && isVisible()) {
startRedirecting();
}
emit winIdChanged();
}