[Paraview-developers] Disabling a menu item in Paraview GUI

Prashant V prashant.v at quest-global.com
Tue Dec 8 09:48:14 EST 2015


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]
Sent: Tuesday, December 08, 2015 4:36 PM
To: Prashant V
Cc: 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. -----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20151208/504eea84/attachment-0001.html>


More information about the Paraview-developers mailing list