[Paraview-developers] Disabling a menu item in Paraview GUI
Prashant V
prashant.v at quest-global.com
Thu Dec 10 04:10:44 EST 2015
Hi Joachim,
Now I want to do operations with my menu when user clicks on Apply button. Taking cue from this link (https://cmake.org/pipermail/paraview/2015-July/034476.html)
I tried to connect Apply button signal 'applied()' (defined in pqPropertiesPanel.h) with a slot defined in my menu class. My code snippet is:
QList<pqPropertiesPanel*> ppanels = pqCoreUtilities::mainWidget()->findChildren<pqPropertiesPanel*>();
foreach (pqPropertiesPanel* ppanel, ppanels)
{
QObject::connect(ppanel, SIGNAL(applied()), myMenuObject, SLOT(onApplyClicked()));
}
This code doesn't work because QList ppanels remains empty. How should I access pqPropertiesPanel object in my menu class? Thanks.
Regards,
Prashant
________________________________
From: Paraview-developers [paraview-developers-bounces at paraview.org] on behalf of Prashant V
Sent: Wednesday, December 09, 2015 1:34 PM
To: Joachim Pouderoux
Cc: paraview-developers at paraview.org
Subject: Re: [Paraview-developers] Disabling a menu item in Paraview GUI
Thanks Joachim. This works absolutely the way I wanted.
________________________________
From: Joachim Pouderoux [joachim.pouderoux at kitware.com]
Sent: Tuesday, December 08, 2015 8:23 PM
To: Prashant V
Cc: paraview-developers at paraview.org
Subject: Re: [Paraview-developers] Disabling a menu item in Paraview GUI
Prashant,
Sure. You could listen for object builder events (see signals section of pqObjectBuilder.h):
QObject::connect(pqApplicationCore::instance()->getObjectBuilder(),
SIGNAL(destroying(pqPipelineSource*)),
this,
SLOT(onSourceRemoved(pqPipelineSource*)));
Joachim Pouderoux
PhD, Technical Expert
Kitware SAS<http://www.kitware.fr>
2015-12-08 15:48 GMT+01:00 Prashant V <prashant.v at quest-global.com<mailto:prashant.v at quest-global.com>>:
Hi Joachim,
Thanks for sharing this snippet. This is really helpful. I have one more question further.
In my case, how should I access object of my menu when user clicks on 'Delete' button. I don't want to change Paraview source code where 'Delete' callback slot is implemented.
Regards,
Prashant
________________________________
From: Joachim Pouderoux [joachim.pouderoux at kitware.com<mailto:joachim.pouderoux at kitware.com>]
Sent: Tuesday, December 08, 2015 4:36 PM
To: Prashant V
Cc: paraview-developers at paraview.org<mailto:paraview-developers at paraview.org>
Subject: Re: [Paraview-developers] Disabling a menu item in Paraview GUI
Prashant,
I think you could track the number of objects available in the model, something like :
pqServerManagerModel* model =
pqApplicationCore::instance()->getServerManagerModel();
pqServer* server = pqApplicationCore::instance()->getActiveServer();
QList<pqPipelineSource*> sources = model->findItems<pqPipelineSource*>(server);
int numberOfPipelineSources = sources.size();
mymenu->setEnable(numberOfPipelineSources != 0);
Best,
Joachim
Joachim Pouderoux
PhD, Technical Expert
Kitware SAS<http://www.kitware.fr>
2015-12-08 10:42 GMT+01:00 Prashant V <prashant.v at quest-global.com<mailto:prashant.v at quest-global.com>>:
Hello,
I have added a menu item in Paraview GUI. I want to disable this menu item when user deletes all objects from pipeline browser. What I want to achieve is quite similar to enabling/disabling of Filter menu. Can anybody please guide, how this can be done? Thanks.
Regards,
Prashant
---Disclaimer------------------------------ This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Opinions, conclusions and other information in this transmission that do not relate to the official business of QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by it. Any statements made herein that are tantamount to contractual obligations, promises, claims or commitments shall not be binding on the Company unless followed by written confirmation by an authorized signatory of the Company. -----------------------------------------------------------------------------------
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Search the list archives at: http://markmail.org/search/?q=Paraview-developers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview-developers
---Disclaimer------------------------------ This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Opinions, conclusions and other information in this transmission that do not relate to the official business of QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by it. Any statements made herein that are tantamount to contractual obligations, promises, claims or commitments shall not be binding on the Company unless followed by written confirmation by an authorized signatory of the Company. -----------------------------------------------------------------------------------
---Disclaimer------------------------------ This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Opinions, conclusions and other information in this transmission that do not relate to the official business of QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by it. Any statements made herein that are tantamount to contractual obligations, promises, claims or commitments shall not be binding on the Company unless followed by written confirmation by an authorized signatory of the Company. -----------------------------------------------------------------------------------
---Disclaimer------------------------------ This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Opinions, conclusions and other information in this transmission that do not relate to the official business of QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by it. Any statements made herein that are tantamount to contractual obligations, promises, claims or commitments shall not be binding on the Company unless followed by written confirmation by an authorized signatory of the Company. -----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20151210/18a5a9ab/attachment.html>
More information about the Paraview-developers
mailing list