Important: Please read the Qt Code of Conduct -

Mac, Qt4.8: Unified toolbar, QToolbuttons bottom margin too big

  • Hi all, been adding Qt 4.8 support to my application until Qt5 is mature enough on the Mac. I'm currently annoyed by a bottom margin between the unified toolbar and the QToolbar widget.

    How it should be (from Safari prefs window):


    What my toolbar looks like. Note the extra gap in the bottom (apart from the clearly non-native looking depressed button gradient):


    To make it more clear what's happening, here's the QToolbar widget with a red background:


    Bottom aligning the QToolButtons in the toolbar with Qt::AlignBottom helps with the alignment inside the toolbar, except for the weird behavior of the first button (ALL buttons has 32x32 icons, all has their size explicitly set with QToolButton->setIconSize(QSize(32,32)). Deselecting the button does not help the misalignment compared to the other buttons. Any clues why this might happen?


    As for the gap between the QToolbar and the bottom of the surrounding unified toolbar, I'm sort of out of options. I've tried cheating with stylesheet (negative margins), tried bottom aligning the QToolbar widget in the sorrounding layout, but it just stays put.

    You may also notice the difference in the QToolbutton font weight. I tried to fix this in the stylesheet, but in this context it seems to be immune to font weight manipulations.

    Is this because the unified toolbar in Qt 4.8 is essentially a hack? How does anyone else make a preferences toolbar on the Mac in 4.8 look more native (5.x got it right, I know). The problem seem to stem from both the unified toolbar hack and the way QToolButtons are treated when in that context.

Log in to reply