[ContainmentView] Show panels when UI becomes ready

The code already had logic in there but since UI ready is usually emitted later
the client (in this case plasmashell) had to manually show the panels and would
usually show them when they're not ready yet leading to visual glitches on startup.

REVIEW: 128708
This commit is contained in:
Kai Uwe Broulik 2016-08-18 13:42:08 +02:00
parent 98cfdf6b45
commit 1d66098e50

View File

@ -105,8 +105,19 @@ void ContainmentViewPrivate::setContainment(Plasma::Containment *cont)
q, &ContainmentView::showConfigurationInterface);
QObject::connect(cont, SIGNAL(destroyedChanged(bool)),
q, SLOT(updateDestroyed(bool)));
// Panels are created invisible and the code below ensures they are only
// shown once their contents have settled to avoid visual glitches on startup
if (cont->containmentType() == Plasma::Types::PanelContainment ||
cont->containmentType() == Plasma::Types::CustomPanelContainment) {
QObject::connect(cont, &Plasma::Containment::uiReadyChanged,
q, [this, cont](bool ready) {
if (ready && !cont->destroyed()) {
q->setVisible(true);
}
}, Qt::QueuedConnection);
q->setVisible(!cont->destroyed() && cont->isUiReady());
}
} else {