25 #include <QDomElement>
29 #include <QGraphicsProxyWidget>
36 :
QgsAnnotationItem( canvas ), mWidgetContainer( 0 ), mDesignerWidget( 0 ), mVectorLayer( vlayer ),
37 mHasAssociatedFeature( hasFeature ), mFeature( feature )
73 QFile
file( filePath );
74 if ( !file.open( QFile::ReadOnly ) )
81 loader.setWorkingDirectory( fi.dir() );
82 QWidget* widget = loader.load( &file, 0 );
93 for (
int i = 0; i < attrs.count(); ++i )
95 if ( i < fields.
count() )
97 QWidget* attWidget = widget->findChild<QWidget*>( fields[i].name() );
154 return QSizeF( 0, 0 );
166 return QSizeF( 0, 0 );
172 QDomElement documentElem = doc.documentElement();
173 if ( documentElem.isNull() )
178 QDomElement formAnnotationElem = doc.createElement(
"FormAnnotationItem" );
181 formAnnotationElem.setAttribute(
"vectorLayer",
mVectorLayer->
id() );
184 formAnnotationElem.setAttribute(
"feature",
mFeature );
185 formAnnotationElem.setAttribute(
"designerForm",
mDesignerForm );
187 documentElem.appendChild( formAnnotationElem );
193 if ( itemElem.hasAttribute(
"vectorLayer" ) )
204 mFeature = itemElem.attribute(
"feature",
"0" ).toInt();
206 QDomElement annotationElem = itemElem.firstChildElement(
"AnnotationItem" );
207 if ( !annotationElem.isNull() )
238 bool featureFound =
false;
240 while ( fit.nextFeature( currentFeature ) )
242 currentFeatureId = currentFeature.
id();
268 setVisible( visible );