[QGIS-trac] [Quantum GIS] #3236: Cannot determine the type of QgsComposerItem

Quantum GIS qgis at qgis.org
Fri Nov 19 05:24:50 EST 2010


#3236: Cannot determine the type of QgsComposerItem
------------------------------------------------+---------------------------
   Reporter:  anitagraser                       |              Owner:  borysiasty   
       Type:  bug                               |             Status:  new          
   Priority:  major: does not work as expected  |          Milestone:  Version 1.7.0
  Component:  Python plugins and bindings       |            Version:  Trunk        
   Keywords:                                    |   Platform_version:               
   Platform:  Debian                            |           Must_fix:  No           
Status_info:  0                                 |  
------------------------------------------------+---------------------------
 In Python console, type(item) will only return <class
 'qgis.core.QgsComposerItem'>

 From IRC:

 [09:49] <anita1> how can i get all QgsComposerLabels from a composer?
 currently, i can just access all QgsComposerItems but don't know how to
 filter only labels from them

 [10:50] <marco> hi anita1

 [10:50] <marco> dynamic cast in (C++) or query the class type (in python)

 [10:51] <anita1> marco: hi. but that returns only QgsComposerItem, not
 label

 [10:51] <anita1> type(items[0]) <class 'qgis.core.QgsComposerItem'>

 [10:52] <marco> in python? Then there is probably missing a
 'convertToSubclass' somewhere in the python bindings...

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/3236>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list