[QGIS-Developer] Problems configuring the statusBar

Johannes Kröger (WhereGroup) johannes.kroeger at wheregroup.com
Tue Dec 13 00:44:53 PST 2022


Hey AF,

oh, looks like the help() for those Qt objects is not as comprehensive 
as I hoped.

 >>> type(iface.mainWindow().statusBar())
<class 'PyQt5.QtWidgets.QStatusBar'>

https://doc.qt.io/qt-5/qstatusbar.html ->
https://doc.qt.io/qt-5/qstatusbar-members.html ->
https://doc.qt.io/qt-5/qwidget.html#styleSheet-prop

 >>> iface.mainWindow().statusBar().setStyleSheet("background-color:red;")

Now my status bar is red.

No idea about fonts...

Have fun!
Hannes

Am 13.12.22 um 03:40 schrieb afernandez:
> Hello Johannes,
> Querying was how I found the method 
> self.iface.mainWindow().statusBar().styleSheet() along with many 
> others. I circled back and tried to use 'help' to figure out what I 
> was missing. However, help for 
> self.iface.mainWindow().statusBar().styleSheet() only tells me that 
> styleSheet is a method of the self.iface.mainWindow.statusBar instance 
> that returns a string. I also explored another method 
> self.iface.mainWindow().statusBar().setFont(), which is supposed to 
> take a QFont, but I still haven't been able to make it work properly 
> either.
> The bottom line is that I can add widgets to the statusBar and style 
> them, but even changing the font type for the whole statusBar remains 
> elusive. At least this route allows me to move on with the project 
> while I figure out all the other details.
> Thanks,
> AF
>
-- 
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/20221213/fe54ab12/attachment-0001.htm>


More information about the QGIS-Developer mailing list