[Qgis-developer] QgsProjectionSelector in Plugin?

Florian Hillen fhillen at uni-osnabrueck.de
Fri Mar 6 18:16:27 EST 2009


Hi Tim,

thanks for that, it helps a lot and it saves a lot of work for me ;)

Best regards,
Florian



> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Florian
>
>
>
> Florian Hillen wrote:
>> Hi,
>>
>> is it possible to include the QgsProjectionSelector in my plugin?
>> I define this class in Qt Designer, but if I make the project, I recieve
>> the following error:
>>
>> In file included from
>> C:/dev/cpp/qgis/build/src/plugins/test/ui_gdalguibase.h:26
>> ,
>>                  from C:\dev\cpp\qgis\src\plugins\test\/gdalgui.h:17,
>>                  from C:\dev\cpp\qgis\src\plugins\test\plugin.cpp:27:
>> C:/dev/cpp/qgis/src/plugins/test/../../gui/qgsprojectionselector.h:14:42:
>> ui_qgs
>> projectionselectorbase.h: No such file or directory
>>
>> So the header can't find the ui anymore. Can I fix that or isn't it
>> possible to use qgis-gui-parts in plugins?
>
> Indeed it is possible. You should use QgsGenericProjectionSelector since
> it was designed to be used with your own custom messages etc.
>
>
>  #include <qgsgenericprojectionselector.h>
>
> void CoordinateCapture::setCRS()
> {
>   QgsGenericProjectionSelector mySelector( mQGisIface->mainWindow() );
>    mySelector.setSelectedCrsId( mCrs.srsid() );
>    if ( mySelector.exec() )
>    {
>      mCrs.createFromSrsId( mySelector.selectedCrsId() );
>      mTransform.setDestCRS( mCrs );
>      mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8
> : 3;     //precision depends on CRS units
>   }
> }
>
> See the src/plugins/coordinatecapture.cpp sources for more details.
>
> Hope that helps!
>
> Regards
>
> Tim
>>
>> Best regards,
>> Florian
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
>
> - --
>
> Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
> ==============================================
> Please do not email me off-list with technical
> support questions. Using the lists will gain
> more exposure for your issues and the knowledge
> surrounding your issue will be shared with all.
>
> Visit http://linfiniti.com to find out about:
>  * QGIS programming and support services
>  * Mapserver and PostGIS based hosting plans
>  * FOSS Consulting Services
> Skype: timlinux
> Irc: timlinux on #qgis at freenode.net
> ==============================================
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkmxhb4ACgkQqk07qZdiYje+qgCgpl4glbaJZfnGZ/npMq7oD4mv
> G2sAn0t2SllnicEAQcLAfIJRnmfujsLf
> =uXN/
> -----END PGP SIGNATURE-----
>
>



More information about the Qgis-developer mailing list