From bd4a19963e102f4a89fdc1f17349909605324519 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 10 Sep 2014 08:31:35 +0200 Subject: Respect contents margins when calculating the size hint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this part of the calendar widget get cut off when put in a layout and the contentsMargins are non zero. Task-number: QTBUG-40352 Change-Id: I9ce90476c59c270d92e876a5dc81ea8ce325848c Reviewed-by: Lars Knoll Reviewed-by: Shawn Rutledge Reviewed-by: Jan Arve Sæther --- .../widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp index e3e7b13cbe..d0a787d32a 100644 --- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp @@ -67,6 +67,8 @@ private slots: void showPrevNext(); void firstDayOfWeek(); + + void contentsMargins(); }; // Testing get/set functions @@ -391,5 +393,13 @@ void tst_QCalendarWidget::firstDayOfWeek() QCOMPARE(calendar.firstDayOfWeek(), germanLocale.firstDayOfWeek()); } +void tst_QCalendarWidget::contentsMargins() +{ + QCalendarWidget calendar1; + QCalendarWidget calendar2; + calendar2.setContentsMargins(10, 5, 20, 30); + QCOMPARE(calendar1.minimumSizeHint() + QSize(30, 35), calendar2.minimumSizeHint()); +} + QTEST_MAIN(tst_QCalendarWidget) #include "tst_qcalendarwidget.moc" -- cgit v1.2.3