[Qgis-developer] deactivating toolbar with plugin

SJWC GIS sjwcgis at gmail.com
Mon Apr 2 17:17:35 EDT 2012


Thanks Larry, this is exactly what I was looking for!

On Mon, Apr 2, 2012 at 2:13 PM, Larry Shaffer <larrys at dakotacarto.com>wrote:

> Hi Aaron,
>
> On Mon, Apr 2, 2012 at 2:16 PM, SJWC GIS <sjwcgis at gmail.com> wrote:
> > Hello all,
> >
> > I'm creating a qgis python plugin.  One of the functions of the plugin
> is to
> > customize the qgis interface by turning off a few toolbars.  For most
> > toolbars, this isn't a problem, but for some reason I can't find a way to
> > shut off the "Label" toolbar.  For most toolbars, the following
> statements
> > are working...
> >
> > self.iface.digitizeToolBar().setVisible(False)
> >
> > But I can't find a labelToolBar() object that I can do this operation
> with.
> >  Does anyone have any guidance on why this is different?  I'm not
> noticing
> > any plugins that might be influencing this...  Thanks!
>
> Seems there is no method in the QgisInterface class for accessing the
> new label toolbar yet.
>
> Try...
>
>    iface.mainWindow().findChild(QToolBar,"mLabelToolBar").setVisible(False)
>
> I found the object name for the label toolbar using:
>
>    toolbars = iface.mainWindow().findChildren(QToolBar)
>
>    for toolbar in toolbars:
>        print toolbar.objectName()
>
> Which returned this on my QGIS setup:
>
>    mFileToolBar mLayerToolBar mDigitizeToolBar
> mAdvancedDigitizeToolBar mMapNavToolBar mAttributesToolBar
> mPluginToolBar mHelpToolBar mRasterToolBar mLabelToolBar OpenStreetMap
>
>
> There's probably a more direct solution than the 'findChild()' method.
>
> Regards,
>
> Larry Shaffer
> Dakota Cartography
> Black Hills, South Dakota
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120402/d1900d7d/attachment.html


More information about the Qgis-developer mailing list