Important: Please read the Qt Code of Conduct -

Minimum height issues with QCalendarWidget

  • Hello

    I've got a QGridLayout featuring a bunch of different widgets, including a pair of QCalendarWidget items. However I'm having problems with their minimum size. By default PyQt5 is squishing them down so they have barely any height at all. This is what the form looks like when it's opened:

    QCalendarWidget example 1

    As you can see, none of the dates are visible. What I want to see is something like this:

    QCalendarWidget example 2

    However, when I use setMinimumHeight on the two widgets, then instead of giving me that, what I get is this:

    QCalendarWidget example 3

    QCalendarWidget example 4

    So the minimum size seems to have been applied to the individual rows of the calendar grid, rather than to the overall QCalendarWidget object.

    Please can somebody tell me what I'm missing here, and how to go about setting a minimum height on the whole QCalendarWidget and not just on the individual rows?


  • Lifetime Qt Champion


    Which version of PyQt5 are you using ?
    On which platform ?
    Do you have the same issue with PySide2 ?
    Can you provide a minimal running example that shows that behaviour ?

  • Hello. Thanks for the response, and for prompting me for a reproducable example. I've tried and failed to reproduce it minimally so far, suggesting there's something else in my code or nested widgets causing the issue. I'm continuing to look into it and will respond if I get anywhere.

Log in to reply