Sometimes "Delete" menu item is disabled
There is a non-critical bug in recent versions of ParaView. I've tested positively on 5.9.1 - 5.11.1
After I delete a bunch of sources/filters from Pipeline browser, sometimes "Delete" menu item is disabled in context & main Edit menu.
delete-disabled
I've done some research, and came to conclusion:
pqActiveObjects::portChanged
is not emitted, when object in Pipeline Browser is right clicked, so pqDeleteReaction::updateEnabledState
is not called.
As a fix, I've connected pqActiveObjects::selectionChanged
signal instead of portChanged
to pqDeleteReaction::updateEnabledState
and it seems like fixed the bug.
Why pqActiveObjects::portChanged
is not emitted? My guessing is: during deletion of a bunch, the most object above in pipeline becomes active, cached inside pqActiveObjects
, and when selection changes, "new" active object tests as equal to "cached" one, so signal is not emitted here:
void pqActiveObjects::triggerSignals()
{
...
if (this->ActivePipelineProxy.data() != this->CachedPipelineProxy)
{
this->CachedPipelineProxy = this->ActivePipelineProxy.data();
auto port = getPortFromPipelineProxy(this->ActivePipelineProxy);
auto source = port ? port->getSource() : nullptr;
if (source != this->CachedSource)
{
this->CachedSource = source;
Q_EMIT this->sourceChanged(source);
}
if (port != this->CachedPort)
{
this->CachedPort = port;
Q_EMIT this->portChanged(port);
}
....
Considering this, and the fact, that last pqDeleteReaction::updateEnabledState
returned false
during deletion, we're getting a disabled QAction.