<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body fPStyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<p>Thanks Joachim. This works absolutely the way I wanted.</p>
<p> </p>
<div style="FONT-FAMILY: Times New Roman; COLOR: #000000; FONT-SIZE: 16px">
<hr tabindex="-1">
<div style="DIRECTION: ltr" id="divRpF486168"><font color="#000000" size="2" face="Tahoma"><b>From:</b> Joachim Pouderoux [joachim.pouderoux@kitware.com]<br>
<b>Sent:</b> Tuesday, December 08, 2015 8:23 PM<br>
<b>To:</b> Prashant V<br>
<b>Cc:</b> paraview-developers@paraview.org<br>
<b>Subject:</b> Re: [Paraview-developers] Disabling a menu item in Paraview GUI<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Prashant,<br>
<br>
Sure. You could listen for object builder events (see signals section of pqObjectBuilder.h):<br>
<br>
<span style="FONT-FAMILY: monospace,monospace">  QObject::connect(pqApplicationCore::instance()->getObjectBuilder(),<br>
    SIGNAL(destroying(pqPipelineSource*)),<br>
    this,<br>
    SLOT(onSourceRemoved(pqPipelineSource*)));<br>
<br>
</span></div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr"><b>Joachim Pouderoux</b><br>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex">
<font size="1"><i>PhD, Technical Expert</i></font><br>
<b><font size="1"><a href="http://www.kitware.fr" target="_blank">Kitware SAS</a></font></b><br>
</blockquote>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2015-12-08 15:48 GMT+01:00 Prashant V <span dir="ltr"><<a href="mailto:prashant.v@quest-global.com" target="_blank">prashant.v@quest-global.com</a>></span>:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div style="FONT-FAMILY: Tahoma; DIRECTION: ltr; COLOR: #000000; FONT-SIZE: 10pt">
Hi Joachim,
<div><br>
</div>
<div>Thanks for sharing this snippet. This is really helpful. I have one more question further.</div>
<div>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. </div>
<div><br>
</div>
<div>Regards,</div>
<div>Prashant </div>
<div>
<div style="FONT-FAMILY: Times New Roman; COLOR: #000000; FONT-SIZE: 16px">
<hr>
<div style="DIRECTION: ltr"><font color="#000000" size="2" face="Tahoma"><b>From:</b> Joachim Pouderoux [<a href="mailto:joachim.pouderoux@kitware.com" target="_blank">joachim.pouderoux@kitware.com</a>]<br>
<b>Sent:</b> Tuesday, December 08, 2015 4:36 PM<br>
<b>To:</b> Prashant V<br>
<b>Cc:</b> <a href="mailto:paraview-developers@paraview.org" target="_blank">paraview-developers@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview-developers] Disabling a menu item in Paraview GUI<br>
</font><br>
</div>
<div>
<div class="h5">
<div></div>
<div>
<div dir="ltr">
<div>Prashant,<br>
<br>
I think you could track the number of objects available in the model, something like :<br>
<span style="FONT-FAMILY: monospace,monospace"><br>
  pqServerManagerModel* model =<br>
    pqApplicationCore::instance()->getServerManagerModel();<br>
  pqServer* server = pqApplicationCore::instance()->getActiveServer();<br>
  QList<pqPipelineSource*> sources = model->findItems<pqPipelineSource*>(server);<br>
  int numberOfPipelineSources = sources.size();<br>
</span></div>
<div><span style="FONT-FAMILY: monospace,monospace">  mymenu->setEnable(numberOfPipelineSources != 0);</span><br>
<br>
</div>
<div>Best,<br>
</div>
<div>Joachim<br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div>
<div dir="ltr"><b>Joachim Pouderoux</b><br>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex">
<font size="1"><i>PhD, Technical Expert</i></font><br>
<b><font size="1"><a href="http://www.kitware.fr" target="_blank">Kitware SAS</a></font></b><br>
</blockquote>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2015-12-08 10:42 GMT+01:00 Prashant V <span dir="ltr"><<a href="mailto:prashant.v@quest-global.com" target="_blank">prashant.v@quest-global.com</a>></span>:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div style="FONT-FAMILY: Tahoma; DIRECTION: ltr; COLOR: #000000; FONT-SIZE: 10pt">
<p>Hello,</p>
<p> </p>
<p>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.</p>
<p> </p>
<p>Regards,</p>
<p>Prashant </p>
</div>
---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. -----------------------------------------------------------------------------------
</div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=Paraview-developers" target="_blank">
http://markmail.org/search/?q=Paraview-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="h5">---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. -----------------------------------------------------------------------------------
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
---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. -----------------------------------------------------------------------------------
</body>
</html>