[QGIS-Developer] Problems configuring the statusBar

Johannes Kröger (WhereGroup) johannes.kroeger at wheregroup.com
Mon Dec 12 00:19:36 PST 2022


Hi  AF,

you can always query objects for their type with type(objectname) or 
even access their documentation in an interactive interpreter session 
with help(objectname). Then you know what methods and attributes they 
expose or which Qt documentation page is matching whatever object you 
are handling.

Be aware that pages like https://doc.qt.io/qt-5/qstatusbar.html only 
list the "direct" members and that the objects might have already 
inherited others. For that you can click the "List of all members, 
including inherited members" link.

CaSe matters! Best use an IDE that helps you with autocompletion and 
inspection, this helps a lot when learning. For PyCharm all you need to 
do is select the python-qgis.bat file as interpreter and let it scan the 
Python modules for a while.

When googling for QGIS Python classes, make sure you are reading 
up-to-date documentation matching your QGIS version, e. g. 
https://qgis.org/pyqgis/3.28/gui/QgisInterface.html

Cheers, Hannes

Am 12.12.22 um 01:42 schrieb afernandez via QGIS-Developer:
> Hi Nyall,
> Obviously I'm not an expert in Qt/QGIS (only been using it for a few 
> weeks) and still have many things to learn. Most of the code works 
> fine (by staying away from very complex structures) and styling 
> widgets has been no problem until now when trying to do anything with 
> the statusBar. From your comment, I went back to the 
> PyQGISDeveloperCookbook(v3.22) and snippets like
>     myicon = 
> QIcon("/home/ubuntu/.local/share/QGIS/QGIS3/profiles/default/python/plugins/app/appicon.png")
> iface.mainWindow().setWindowIcon(myicon)
> iface.mainWindow().setWindowTitle("Tailoring QGIS")
> had worked in the past. One problem has been to find specific 
> documentation about iface.mainWindow().statusBar(), let alone examples 
> and those online (e.g. 
> https://gis.stackexchange.com/questions/210327/how-to-display-qgis-processing-bar-from-a-plugin) 
> kind of suggests that my initial snippet could work. I'll continue 
> reading the cookbook tomorrow but, in the meantime, is there any other 
> documentation discussing iface in general or 
> iface.mainWindow().statusBar() that I should also be reading? (Note: I 
> also checked https://doc.qt.io/qt-5/qstatusbar.html)
> Thanks,
> AF
> P.S. Again sorry about the extra messages that shouldn't have been 
> sent to the thread (hopefully it won't happen again)
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Johannes Kröger / GIS-Entwickler/-Berater

---------------------------------------------
Where2B Konferenz 2022
15. Dezember 2022 in Bonn und Online
https://where2b-conference.com/
---------------------------------------------

WhereGroup GmbH
Grevenweg 89
20537 Hamburg
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

johannes.kroeger at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20221212/db5b7080/attachment.htm>


More information about the QGIS-Developer mailing list