[Qgis-developer] Help needed in creating Third Level Submenu

Germán Carrillo carrillo.german at gmail.com
Mon Aug 3 10:06:21 EDT 2009


Hi Bishwarup, the addActions method is in QWidget class, and QAction don't
inherited from that. So addActions don't exist for QAction. Maybe you can
use QtDesigner to create the menu level you want and then generate the .py
with pyuirc4, this way you can see how to create it.

Why you don't use the last QGis version?

Germán

2009/8/3 Bishwarup Banerjee <bishwarup.banerjee at gmail.com>

> Dear All,
>
> I am trying to create THIRD LEVEL MENU  through the following code. Like I
> have a menu Called "Boundaries", inside that I have sub menu called
> "Division", inside that I have "Division_name", inside "Division Name" we
> have a separate sub menu called "Division Range", on clicking on the sub
> menu "Division range" some action is done, like opening the range boundary
> shape file. I am able to open the Shape file portion, but I am getting error
> in the Bold Line marked as "AttributeError: addActions"
>
>         self.menu = QMenu()
>         self.menu.setTitle( "Boundaries" )
>
>         self.DM = QMenu( "Division" )
>         self.Div1 = QAction( QIcon( ":/icons/find.png" ), "Division
> Name",self.iface.getMainWindow() )
>         self.DM.addActions( [ self.Div1])
>         self.menu.addMenu( self.DM )
>         menuBar = self.iface.getMainWindow().menuBar()
>         menuBar.addMenu(self.menu)
>
>         self.Div_Range = QAction( QIcon( ":/icons/find.png" ), "Division
> Range",self.iface.getMainWindow() )
>         *self.Div1.addActions( [ self.Div_Range])*
>         self.menu.addMenu( self.Div_Range )
>         menuBar = self.iface.getMainWindow().menuBar()
>         menuBar.addMenu(self.menu)
>
>         QObject.connect( self.Div_Range, SIGNAL("triggered()"),
> self.Div1_Clicked )
>
> It will be of immense help, if anybody can point the error in the code, or
> is it like THIRD LEVEL SUBMENU is not supported in QGIS?
>
> I am using QGIS 0.11, Python 2.5 and QT.
>
> I am posting the same in the QGIS Developer forum
>
> Thanking you in advance,
>
> With Warm Regards
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
-- 
-----------
  |\__
(:>__)(
  |/

Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090803/f275bd66/attachment.html


More information about the Qgis-developer mailing list