The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

15

You can use the addToolBar() API call via QgisInterface (i.e. iface) to create a custom toolbar: class MyPlugin: def __init__(self, iface): # Save reference to the QGIS interface self.iface = iface def initGui(self): # Add toolbar self.toolbar = self.iface.addToolBar("My_ToolBar") # Create actions ...


8

Use the findChild method of QGIS mainWindow to know if there is a QToolBar called u'MyProcessing' and get it. If you don't get anything, create it. myToolBar = iface.mainWindow().findChild( QToolBar, u'MyProcessing' ) if not myToolBar: myToolBar = iface.addToolBar( u'MyProcessing' ) myToolBar.setObjectName( u'MyProcessing' ) This needs to be ...


7

In Plugins > Python Console, try typing the following: qgis.utils.iface.layerToolBar().move(5,5) It should move the toolbar shown in your image. Hope this helps!


6

You should initialize the map with no controls. You can do this passing an empty array to the controls like this: map = new OpenLayers.Map('map', {zoomDuration: 1,projection: 'EPSG:3857' controls: []}); You should then add only those controls that you require, like this: map.addControl(new OpenLayers.Control.PanZoomBar()); map.addControl(new ...


5

Toolbars are located outside your screen area. You can use Python console to move them on screen. Here is example of moving Navigation Toolbar: qgis.utils.iface.mapNavToolToolBar().move(10,10) Names of other toolbars can be found by this link.


5

Your problem is with self.ShapeLayerList = QWidgetAction(self.projCombo) That is creating a QWidgetAction with the combo box as its parent widget, not its child widget. Try: self.ShapeLayerList=QWidgetAction(None) self.ShapeLayerList.setDefaultWidget(self.projCombo)


5

This is a quirk of Esri, it used to be the other way around. By default it will save all customization in only the current document, to change this open the menu customize::customize mode.. Turn off the checks indicated by the arrows to make ArcMap save to your Normal.mxt. Please note that any open instances of ArcMap will write to the normal on exit so ...


5

I've coded a simple QgsMessageBar which contains a widget with 3 double-spinbox (and their labels), and a QPushButton for load colors. One for each color (Blue, Orange and Red). Each SpinBox have a default value (0), a minimum (0), a maximum (100) and a step (0.5). These values can be easily edited in the code (in the BarWidget class). The messageBar pop ...


4

I know you can create a new toolbar with Buttons/Tools/etc on it, based on Python using ArcGIS 10.1 Addins. You should be able to take advantage of your current Python code and integrate it in these new tools. Take a look, it is fairly simple to create. http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_a_Python_add_in/014p00000025000000/


4

Maybe too obvious an answer, but it's what I needed when googling for this so... "All editing sessions start by choosing the 'Toggle editing' option" "By default, QGIS loads layers read-only: This is a safeguard to avoid accidentally editing a layer if there is a slip of the mouse. However, you can choose to edit any layer as long as the data provider ...


4

The syntax for combobox (as well as other controls) is different in VB.NET. You should review the help to see the changes. cmbBox.ListCount --> cmbBox.Items.Count cmbBox.List(l) --> cmbBox.Items.Item(l) cmbBox.AddItem(sItem, l) --> cmbBox.Items.Insert(l, sItem) cmbBox.AddItem(sItem) --> cmbBox.Items.Add(sItem)


4

Instead of checking for a selection directly in the button's OnUpdate routine, which runs very frequently, I would write an extension that uses event handlers to respond to selection events and caches the selection state of your layer, and then in the OnUpdate routine check the extension's cached state. Of course this is probably overkill if there is only ...


4

You need a function that returns the selection set count property on your layer. If the count is >0 than you can enable your button. ISelectionSet.Count Property


4

Do you need to remove the big one (blue one?) or the small one behind it? if the big one is the issue, try commenting: map.addControl(new OpenLayers.Control.PanZoomBar()); and you should get only one control like here: var map, layer; function init(){ map = new OpenLayers.Map( 'map'); layer = new OpenLayers.Layer.OSM( "...


4

You can activate the "Select Single Feature" tool using iface.actionSelect().trigger(). If you want to be able to deactivate the tool, you need to activate the tool that was previously active. You can save the active tool using currentTool = iface.mapCanvas().mapTool() Then, when you want to deactivate the "Select Single Feature" tool, you can activate ...


4

I am pretty sure it's a part of the Production Mapping extension. http://resources.arcgis.com/en/help/main/10.1/index.html#//010300000214000000 This is not a free extention. (approx $9000) I don't think there is a free trial for this one ethier altough you might be able to contact your ESRI rep and see what you can do. At least it is not listed as the trial ...


4

In config.esriaddinx, set the tool's onDemand property to false. Similarly, if you have any extensions that need to be initialized at startup, set its autoLoad property to true.


4

Assuming the basic directory structure of the uninstalled plugin is: GraphicGroundwater icon.png icons addBase.png ... resources.qrc ... You will want something like this in resources.qrc (see docs): <qresource prefix="/plugins/GraphicGroundwater" > <file>icon.png</file> <file>icons/getDEM.png</file> ...


4

If your code just finds and executes the Start Editing command item then ArcMap will start an edit session and launch the Editor toolbar. There's probably a whole bunch of code behind that control. To start an edit session without launching the toolbar you'll need to start editing a workspace in the map via IEditor.StartEditing. Here's some retro VBA code ...


4

You can access QGIS toolbar buttons (actions) by using the iface object (docs here). From those actions you can create a QActionGroup and add your custom action making all actions mutually exclusive. The following code snippet shows you how to do it, step by step. I've put the code snippet in the initGui(self) method of my test plugin. # Make sure your ...


4

Based on the answer and comments on this post: Tool Bar visibility in PyQGIS, we can determine the name of these objects and set their visibility to False. If you go to the menubar and select Settings > Customization, you can see the types of objects used. In your case: Menu Toolbar = QMenuBar Browser Panel = QDockWidget Label Toolbar = QToolBar So, we ...


4

You have to add any external resources including the icons in the resources.qrc file. resources.qrc = The .xml document created by Qt Designer. Contains relative paths to resources of the forms. http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/plugins.html resources.qrc format: button/icon.png http://doc.qt.io/qt-4.8/resources.html


4

Processing Toolbox menus & buttons are easy to configure in QGIS 3: Settings Options Tab Processing


4

You want to style your layer based on three values and you want a quick way to change those values. One way to get something close would be to create a layer with no geometry and put the three values into it and then dock its Attribute table window. Create your style expression to get the values from the layer: WHEN "valdco" = attribute(get_feature('...


4

The thing that you are looking for is emphasized in blue. P.S. Just check slightly above the highlighted toolbar.


4

Because you opened it via Project > Snapping options... Close your floating window, right click on some empty toolbar area and under Toolbars activate Snapping Toolbar as shown below: But note that the toolbar and the Snapping options partially show the same options, but the Snapping options (rsp. Project snapping settings) are well needed when turning to ...


4

To dock a floating toolbar Click on the end of the toolbar (see the circled area in the image below) and drag it to any side of the QGIS window until it snaps into place. That toolbar will re-appear in the same place the next time you turn it off and back on again. This allows you to customize the QGIS interface to your personal taste. Personally I like ...


3

I don't know why do you need to add the tool in a toolbar. Because, I have worked with some similar thing and I haven't find any need to add it in the tool bar. In my case, when user clicks on a button in the dockable window, a tool activates. To perform this work, my tool class looks like following: My tool id is:"ArcMap_SelectionTool" My tool class name ...


3

Going into a little more depth than Nathan's answer, the actual changes themselves are stored within QGIS in the following locations (Operating system dependent): Linux it is found in: ~/.config/QuantumGIS/QGIS.conf Windows: the registry HKEY_CURRENT_USER\Software\QuantumGIS\QGIS Mac: ~/Library/Preferences/org.qgis.QGIS.plist That's for 1.7.x, but may ...


3

Sure thing. Using the latest build (soon to be 1.8) you can use the method described here http://linfiniti.com/2011/07/customizing-the-qgis-ui/ You can turn every part of ui on or off using Settings -> Customization...


Only top voted, non community-wiki answers of a minimum length are eligible