[Qgis-developer] ownership of QgsMessageBar(-items)

Nathan Woodrow madmanwoo at gmail.com
Tue May 24 03:17:44 PDT 2016


IMO I don't think this is the right use case for the message bar and could
see the user getting overwhelmed quickly.

Is there another place these.  Even consider adding something to the status
bar if you have to but not into the message bar.

On Tue, May 24, 2016 at 6:48 PM, Richard Duivenvoorde <rdmailings at duif.net>
wrote:

>
> Busy with a plugin which retrieves (in separate threads) a lot of data
> from 2 w*s services.
>
> I thought to use the QgsMessageBar to show progress of the (two) download
> processes, but stumbled on (I think) a problem:
>
> - from api docs: https://qgis.org/api/classQgsMessageBar.html#details
> The message bar will take ownership of the item...
>
> My problem now is that (I think) my progressbars (which were place in a
> QgsMessageBar-item-widget) are sometimes deleted although I still want to
> use them...
>
> For example: an user can click the little 'x' button in the messagebar to
> clean up all messages.
> Or a python dev can call 'clean all widgets'.
>
> BUT at that moment a progressbar part of a messagebaritem is (at least in
> cpp world) apparently deleted.
> Meaning, if (in the python world) I set a progress value on it, I get a
> nice clean segmentation fault....
>
> I managed to work around this by NOT putting the progress bars in the
> messagebar (but put small ones in the plugin toolbar), but as several
> examples flow around on Google, I thought to speak out.
>
> Should we just not let people do this?
>
> Or was I using the messagebar for things I was not supposed to use if for?
>
> Or should we make an option to add a 'special' widget to the messagebar,
> which is NOT removed using clearWidgets() (either via Python or via
> x-button)?
>
> Regards,
>
> Richard
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160524/9f14a8f0/attachment.html>


More information about the Qgis-developer mailing list