[Qgis-developer] Python: viewing properties for an ComposerItem programmatically?

Luca Manganelli luca76 at gmail.com
Thu Sep 25 02:31:17 PDT 2014


On Wed, Sep 24, 2014 at 4:32 PM, Luca Manganelli <luca76 at gmail.com> wrote:
> [CUT ALL]
> # these commands doesn't show the item properties
> composerView.selectedItemChanged.emit(composerMap) # doesn't work
> composer.showItemOptions ( composerMap ) # doesn't work

I found a way to do this programmatically. The two functions above do
not work, so to fix it I have to do in this way:

# The composer window (you have to find the right composerView object
from iface.activeComposers() )
composer = composerView.composerWindow()

# Find the Command History Dock from ccomposer main Window
commandDock = composer.findChildren ( QDockWidget, "CommandDock" )[0]

# Find the QUndoView widget
undoView = commandDock.findChildren ( QUndoView )[0]

# Select the first element in command history (with text <empty>)
index = undoView.model().index (0, 0)
undoView.setCurrentIndex ( index )

# Select the second (but this may vary) element (the map object)
index = undoView.model().index (1, 0)
undoView.setCurrentIndex ( index )


TA-DAH! Now it shows the item properties of the MAP!!!!


More information about the Qgis-developer mailing list