[Qt-interest] How to write our own "context menu"

Santhosh Y santhosh at softjin.com
Thu Dec 4 08:14:05 CET 2008


Malyushytsky, Alex wrote:
> For QMainWindow subclass you may reimplement QMenu * QMainWindow::createPopupMenu (), it is virtual.
>   
Thanks a lot.
I have over-written this function in my MainWindow class.
It works for me now
> Regards,
>    Alex
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Santhosh Y
> Sent: Wednesday, December 03, 2008 6:01 AM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] How to write our own "context menu"
>
> Hi
>
> How to over-write context menu policy.
>
> I am trying to do in the following way:
>
> MyClass : public QMainWindow
> {
>     setContextMenuPolicy (Qt::CustomContextMenu ) ;
>
>     connect (this, SIGNAL (customContextMenuRequested (const QPoint& )),
>             this , SLOT (myMenu(const QPoint&)) );
> }
>
> Let us say on my tool-bar, there are few icons which user can not
> disable from context menu.
> To do so, I have to write my own menu policy, which will ensure that.
>
> The Qt- default menu policy also shows any dock widgets added to my
> Main-Window.
> I just want to read QMenu what Qt-by default has been providing and I
> want to delete those actions which user
> can not uncheck from the menu, and after modifying it , I want to show
> the same.
>
> Is there any way to access QMenu what Qt- by default is displaying.
>
> Please tell me how to do thatt.
>
>
> --
> ----------------------------------------------------
> Y Santhosh Kumar
> Senior Software Engineer
> SoftJin Technologies Private Limited
> Unit No. 102, Mobius Tower,
> I Floor, SJR I - Park,
> EPIP, White Field,
> Bangalore - 560066, India
> U : www.softjin.com
> E : santhosh at softjin.com
> T : +91-80-41779999
> M : +91-9740535265
> ----------------------------------------------------
>
>
>
>
> Business Disclaimer
> ____________________________________________________________
> This e-mail message and any files transmitted with it are intended solely
> for  the use  of the  individual or entity  to which they  are  addressed. It
> may  contain confidential,  proprietary or legally  privileged  information.
> If  you  are  not  the  intended recipient please be advised that you have
> received  this  message in error and any use is strictly prohibited. Please
> immediately  delete it  and all copies of it from your system, destroy any
> hard  copies  of  it and  notify  the  sender  by return mail. You must not,
> directly or indirectly, use,  disclose,  distribute, print, or copy any part of
> this message if you are not the intended recipient.
> ___________________________________________________________
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
> ---------------------------------------------------------------------------------------------------
> Weidlinger Associates, Inc. made the following annotations.
>
> "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
>
> "Please consider our environment before printing this email."
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   


-- 
----------------------------------------------------
Y Santhosh Kumar
Senior Software Engineer
SoftJin Technologies Private Limited
Unit No. 102, Mobius Tower,
I Floor, SJR I - Park,
EPIP, White Field,
Bangalore - 560066, India
U : www.softjin.com
E : santhosh at softjin.com
T : +91-80-41779999
M : +91-9740535265
----------------------------------------------------




Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for  the use  of the  individual or entity  to which they  are  addressed. It
may  contain confidential,  proprietary or legally  privileged  information.
If  you  are  not  the  intended recipient please be advised that you have
received  this  message in error and any use is strictly prohibited. Please
immediately  delete it  and all copies of it from your system, destroy any
hard  copies  of  it and  notify  the  sender  by return mail. You must not,
directly or indirectly, use,  disclose,  distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________





More information about the Qt-interest-old mailing list