QTabWidget: first tab's text not displaying

Maurizio Berti maurizio.berti at gmail.com
Sat May 1 00:02:38 BST 2021


There's something wrong there, and the font doesn't seem to be antialiased.
Does that happen only for the first tab, or for the current tab?
Have you tried with an *actual* completely minimal code (just one or two
tabs with only a QWidget as their pages)?
If you allow moving tabs (btw, movable tabs are disabled by default, so
there's no need for that line), does the title appear in the drag object?
Are you using some generic stylesheet (with the "*" universal selector or
without any selector at all) applied on the application or parent window?

The title is there (if you use very high contrast on very low lightness
you'll see it), but considering the overall look I'm inclined to think
that's a specific platform/style issue (the ugly font might be a hint).
Can you provide more information about Linux distribution, window manager,
PyQt version, etc.?
What is the output of QApplication.style().objectName()?

Il giorno ven 30 apr 2021 alle ore 23:12 Rich Shepard <
rshepard at appl-ecosys.com> ha scritto:

> The attached screenshot shows all 8 tabs, but the identifying text on the
> first one is missing and I don't see why that tab is different.
>
> Here's the relevant code:
>
> from views.locations import SitesWindow
> from views.geochem import GeochemWindow
> from views.biota import BiotaWindow
> from views.physical import PhysicalWindow
> from views.microbes import MicrobesWindow
> from views.wx_data import WxDataWindow
> from views.wx_locations import WxSitesWindow
> from views.wx_params import WxParamsWindow
>
> class MainWindow(qtw.QMainWindow):
>      def __init__(self):
>          """MainWindow constructor"""
>          super().__init__()
>
>          self.setWindowTitle('OpenEDMS')
>          self.statusBar()
>          self.setFixedSize(800, 600)
>
>          # tab contents
>          self.loc = SitesWindow()
>          self.che = GeochemWindow()
>          self.bio = BiotaWindow()
>          self.phy = PhysicalWindow()
>          self.mic = MicrobesWindow()
>          self.wxd = WxDataWindow()
>          self.wxp = WxParamsWindow()
>          self.wxl = WxSitesWindow()
>
>          tabs = qtw.QTabWidget()
>          tabs.setMovable(False)
>          self.setCentralWidget(tabs)
>          # add tab pages here
>          tabs.addTab(self.loc, 'Sites')
>          tabs.addTab(self.che, 'Chemicals')
>          tabs.addTab(self.bio, 'Biota')
>          tabs.addTab(self.phy, 'Physical')
>          tabs.addTab(self.mic, 'Microbes')
>          tabs.addTab(self.wxp, 'WX Data')
>          tabs.addTab(self.wxl, 'WX Params')
>          tabs.addTab(self.wxd, 'WX Sites')
>
>          self.show()
>
> All eight look the same to me, but 'Sites' is not displayed on the first
> tab. What have I missed here?
>
> TIA,
>
> Rich



-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210501/637e6002/attachment.htm>


More information about the PyQt mailing list