25 #include <QDomElement>
29 #include <QGraphicsProxyWidget>
36 QgsAnnotationItem( canvas ), mWidgetContainer( 0 ), mDesignerWidget( 0 ), mVectorLayer( vlayer ), \
37 mHasAssociatedFeature( hasFeature ), mFeature( feature )
72 QFile file( filePath );
73 if ( !file.open( QFile::ReadOnly ) )
80 loader.setWorkingDirectory( fi.dir() );
81 QWidget* widget = loader.load( &file, 0 );
92 QgsAttributeMap::const_iterator attIt = attMap.constBegin();
93 for ( ; attIt != attMap.constEnd(); ++attIt )
95 QgsFieldMap::const_iterator fieldIt = fieldMap.find( attIt.key() );
96 if ( fieldIt != fieldMap.constEnd() )
98 QWidget* attWidget = widget->findChild<QWidget*>( fieldIt->name() );
153 return QSizeF( 0, 0 );
165 return QSizeF( 0, 0 );
171 QDomElement documentElem = doc.documentElement();
172 if ( documentElem.isNull() )
177 QDomElement formAnnotationElem = doc.createElement(
"FormAnnotationItem" );
180 formAnnotationElem.setAttribute(
"vectorLayer",
mVectorLayer->
id() );
183 formAnnotationElem.setAttribute(
"feature",
mFeature );
184 formAnnotationElem.setAttribute(
"designerForm",
mDesignerForm );
186 documentElem.appendChild( formAnnotationElem );
192 if ( itemElem.hasAttribute(
"vectorLayer" ) )
203 mFeature = itemElem.attribute(
"feature",
"0" ).toInt();
205 QDomElement annotationElem = itemElem.firstChildElement(
"AnnotationItem" );
206 if ( !annotationElem.isNull() )
232 mMapPosition.x() + halfIdentifyWidth,
mMapPosition.
y() + halfIdentifyWidth );
236 int currentFeatureId = 0;
237 bool featureFound =
false;
241 currentFeatureId = currentFeature.
id();
267 setVisible( visible );