[Qgis-developer] ownership of QgsMessageBar(-items)
Richard Duivenvoorde
rdmailings at duif.net
Tue May 24 01:48:04 PDT 2016
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
More information about the Qgis-developer
mailing list