summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-07 12:30:21 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-11 09:51:49 +0200
commit0e70cedb2248e54b132822d5be925825fed918d3 (patch)
tree9bc587aa0bb24d84cb0284051a3c45480d912c62
parentb69bccacffa24194233e6c08cc0d2ee3626552e1 (diff)
downloadqtquickcontrols-0e70cedb2248e54b132822d5be925825fed918d3.tar.gz
CalendarStyle: do not hard code the height of dayOfWeekDelegate
Task-number: QTBUG-39482 Change-Id: I7b610a098402f5ec684fc0d7f9b47c4b9981e733 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
-rw-r--r--src/controls/Styles/Base/CalendarStyle.qml9
-rw-r--r--tests/auto/controls/data/tst_calendar.qml3
2 files changed, 7 insertions, 5 deletions
diff --git a/src/controls/Styles/Base/CalendarStyle.qml b/src/controls/Styles/Base/CalendarStyle.qml
index e30f8417..741c4549 100644
--- a/src/controls/Styles/Base/CalendarStyle.qml
+++ b/src/controls/Styles/Base/CalendarStyle.qml
@@ -285,9 +285,12 @@ Style {
/*!
The delegate that styles each weekday.
+
+ The height of the weekday row is calculated based on the maximum implicit height of the delegates.
*/
property Component dayOfWeekDelegate: Rectangle {
color: gridVisible ? "#fcfcfc" : "transparent"
+ implicitHeight: 40
Label {
text: control.__locale.dayName(styleData.dayOfWeek, control.dayOfWeekFormat)
anchors.centerIn: parent
@@ -314,7 +317,7 @@ Style {
property alias navigationBarItem: navigationBarLoader.item
- readonly property real dayOfWeekHeaderRowHeight: 40
+ property alias dayOfWeekHeaderRow: dayOfWeekHeaderRow
readonly property int weeksToShow: 6
readonly property int rows: weeksToShow
@@ -364,7 +367,6 @@ Style {
anchors.left: parent.left
anchors.leftMargin: (control.weekNumbersVisible ? weekNumbersItem.width : 0)
anchors.right: parent.right
- height: dayOfWeekHeaderRowHeight
spacing: gridVisible ? __gridLineWidth : 0
Repeater {
@@ -376,7 +378,6 @@ Style {
id: dayOfWeekDelegateLoader
sourceComponent: dayOfWeekDelegate
width: __cellRectAt(index).width
- height: dayOfWeekHeaderRow.height
readonly property var __dayOfWeek: dayOfWeek
@@ -439,7 +440,7 @@ Style {
}
}
Rectangle {
- anchors.topMargin: - navigationBarLoader.height
+ anchors.topMargin: - dayOfWeekHeaderRow.height - 1
anchors.top: parent.top
anchors.bottom: parent.bottom
diff --git a/tests/auto/controls/data/tst_calendar.qml b/tests/auto/controls/data/tst_calendar.qml
index f2002844..870b5552 100644
--- a/tests/auto/controls/data/tst_calendar.qml
+++ b/tests/auto/controls/data/tst_calendar.qml
@@ -52,7 +52,7 @@ Item {
name: "Tests_Calendar"
when: windowShown
readonly property int navigationBarHeight: calendar !== undefined ? calendar.__panel.navigationBarItem.height : 0
- readonly property int dayOfWeekHeaderRowHeight: calendar !== undefined ? calendar.__panel.dayOfWeekHeaderRowHeight : 0
+ readonly property int dayOfWeekHeaderRowHeight: calendar !== undefined ? calendar.__panel.dayOfWeekHeaderRow.height : 0
readonly property int firstDateCellX: 0
readonly property int firstDateCellY: navigationBarHeight + dayOfWeekHeaderRowHeight
readonly property int previousMonthButtonX: navigationBarHeight / 2
@@ -83,6 +83,7 @@ Item {
" Calendar { }", container, "");
calendar.width = 300;
calendar.height = 300;
+ waitForRendering(calendar);
}
function cleanup() {