Stacked dock widgets tab bars not consistent

  • Hello! I am relatively new to Qt, and have been pulling my hair out trying to solve this issue. I am working on a theme for the open source project OBS, which just updated to allow dock widgets for many of the main UI elements.

    However, when stacking two dock widgets together, the QTabBar is near impossible to style correctly with a QSS file, and the overall behavior is extremely inconsistent. For example, the biggest issue I'm having is that the separator line (I'm not even really sure what to call this specific element) is present when two widgets are newly stacked, as shown here:

    New stack

    But when the program is restarted, this line is now gone, and the entire object looks different (presumably because this line is adding 1px of height to the QTabBar itsel:

    Old stack

    So, the question I have is, in the context of a stacked dock widget, what is that line element called and how can I select it/remove/change it with QSS or otherwise? QSS would be preferred as that will be the minimum amount of changes needed. I have searched around and found quite a few people having this same issue with the dock widget tab bar and how it does not behave like a normal QTabBar. Thanks in advance for any advice or help you can provide.

    For reference, here is the QSS I'm working with as it relates to the QTabBar:

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you also provide a minimal sample code that shows the problem once the style sheet is applied ?

  • @SGaist Unfortunately, I don't think I will be able to. As I mentioned, I'm very new to Qt and I don't know how to generate a sample application (I know next to nothing about C/C++, I'm more of a web guy).

    I will see if I can find some simple sample applications, however, and try to replicate it there.

  • Ok, I've managed to create a reduced test case (using the Dock Widgets example app that ships with Qt) to replicate this issue.

    What constitutes "minimal sample code" that you need to see here? Here's what happens in the example:

    Before restart:

    After restart:

    You can see that the line is 1px smaller after relaunching the test app.

  • Lifetime Qt Champion

    If the code is small you can post it here.

  • @SGaist I still don't understand what specifically you're asking for, so here's the entire application:

  • Any updates? Do I need to provide anything further for this to be looked at?

  • Lifetime Qt Champion

    That might be specific to Windows, It doesn't seem to happen on macOS.

    On a side note, your gist is missing a .pro and .qrc file and the Q_INIT_RESOURCE is not needed and done too late.

  • So no other suggestions or ideas? I really just need to understand if this is a Qt problem, or a problem with my .qss file.

    I can provide the missing files when I get time, but I don't think they're relevant to this issue and if I remember correctly, they were pretty much blank anyway.

    As for the code itself, this is the example code that ships with Qt, the only modification I did was to apply my theme, so I'm not sure what you mean by "not needed and done too late" there. I can try removing it and see if it makes a difference, however.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.