[Qgis-developer] Help needed for 1st dive into Qgis C++ - Access and modify the Scale List combo box

kimaidou kimaidou at gmail.com
Mon May 7 01:38:38 PDT 2012


Thanks Nathan for your kind and documented help !
I will use your patch as a strong basis.

Regards,
Michael

2012/5/7 Nathan Woodrow <madmanwoo at gmail.com>

> Michael,
>
> This is how I would do it.
>
> https://gist.github.com/2626655
>
> I would create a signal on the project properties dialog that gets emitted
> when the scale change, which you then connect to a slot in the scale edit
> object in qgisapp.cpp.  Once the signal fires you read the new scales from
> where every they are stored into the scale bar widget.
>
> - Nathan
>
> On Mon, May 7, 2012 at 6:03 PM, kimaidou <kimaidou at gmail.com> wrote:
>
>> Hi devs,
>>
>> I would like to learn C++ and understand Qgis code organisation, in order
>> to participate in making a better Qgis. This is why I am trying to propose
>> a simple new feature : in the project properties dialog, let the user
>> choose the scales he vould like to use for the current project. Then, use
>> these scales to replace the predefined scales in the status bar scales
>> list. The next step would be to optionnaly force Qgis to stick to these
>> scales when zooming in/out/extent, etc.
>>
>> I have already coded the "project properties dialog" part : manage a list
>> of scales, with add/delete buttons, and read/save in the project xml file.
>> Now I need to interact with the scale list, wich is normally added by
>> src/app/qgisapp.cpp by the method
>>    QgisApp::createStatusBar()
>>
>> The scale list is creating using the class QgsScaleComboBox :
>> mScaleEdit = new QgsScaleComboBox( statusBar() );
>>
>> Now, I need som help. I tried to access the scale list directly using
>> QgisApp::instance()->statusBar() , but with no success.
>> I think what I should do is to add a method
>> QgsScaleComboBox::update(QStringList)  in qgsscalecombobox.cpp which change
>> the content of the list. But then, how can I access this method from
>> qgsprojectproperties.cpp ?
>>
>> Thanks in advance
>>
>> Michael
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120507/32a677f4/attachment.html


More information about the Qgis-developer mailing list