Trigger Reload Files from within property widget code

Is there a way how the code of a property widget can trigger a “reload files” (like what the user can do with F5 in ParaView)?

Because I have a button there in a property widget related to a specialized file reader that allows to do changes in the input file - and afterwards it would be nice if the user would not be required to press F5 (and possibly forget!).

For some other widget I already found a way to automatically press “Apply”, but this is a bit “hackish”: First get the property panel object through the means of Qt (findChild - starting with the main window etc. -, then call the “Apply” function). Maybe such kind of approach would be possible as well!?

Anyway, if there is a more elegant way I would prefer it. So any hints are welcome!

I see that with the following code I am getting the desired effect:

QMainWindow* mainWindow = qobject_cast<QMainWindow*>(pqCoreUtilities::mainWidget());
QList<QAction*> aList = mainWindow->findChildren<QAction*>("actionReloadFiles");
if(!aList.isEmpty())
{
    rfa = aList.first();
	rfa->trigger();
}

Maybe I should put my hesitations about “hackish code” aside and just do it :wink:

pqReloadFilesReaction::reload() is a static function, so you can just call it directly instead.

Here is the “right” way to Apply the pipeline, filter by filter.

filter->getProxy()->UpdateVTKObjects();
filter->updatePipeline();
filter->setModifiedState(pqProxy::UNMODIFIED);
1 Like

Thanks for both hints!