[Paraview-developers] Hiding programmatically a Toolbar in a pvCustomApplication

Louka Jacques--Chevallier louka.jacques--chevallier at pi.esisar.grenoble-inp.fr
Mon Mar 12 03:59:54 EDT 2018


Yup, tried, and the results were : 

QTollBar* tb = mainWindow->findChild<...>(...); // Finds the tb
mainWindow->removeToolBar(tb);                  // Does absolutly nothing
delete tb;                                      // Deletes the tb (thus hiding it)

But the point is that i want to hide it, or 'uncheck' it, the user must be able to make it spawn again. 

The fix I found was : (It hides and unchecks all the toolbars)

QList<QToolBar*> l = this->findChildren<QToolBar*>();
for (int i = 0; i < l.size(); i++) {
    cout << l.at(i)->objectName().toStdString() << endl;
    /*
     Is false but shown by default, fixed by set
     at true and trigger the toggle, thus updating the toolbras...
    */
    l.at(i)->toggleViewAction()->setChecked(true);
    l.at(i)->toggleViewAction()->trigger();
}


This way the user is still able to check it back. 

~ Have a great day ~ 
Louka

==================================


More information about the Paraview-developers mailing list