diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-06-07 12:41:27 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-11 09:52:00 +0200 |
commit | 806a3d491432ebdf0ead05fada7ea6ff9af71701 (patch) | |
tree | 4e7409ec5593abe7c2253239b620200ee480d5da | |
parent | 0e70cedb2248e54b132822d5be925825fed918d3 (diff) | |
download | qtquickcontrols-806a3d491432ebdf0ead05fada7ea6ff9af71701.tar.gz |
CalendarStyle: do not hard code the width of weekNumberDelegate
Task-number: QTBUG-39482
Change-Id: Ia46f79e5969b9d0a1262bca871a7f389d0df9688
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
-rw-r--r-- | src/controls/Styles/Base/CalendarStyle.qml | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/controls/Styles/Base/CalendarStyle.qml b/src/controls/Styles/Base/CalendarStyle.qml index 741c4549..f96d4577 100644 --- a/src/controls/Styles/Base/CalendarStyle.qml +++ b/src/controls/Styles/Base/CalendarStyle.qml @@ -299,8 +299,11 @@ Style { /*! The delegate that styles each week number. + + The width of the week number column is calculated based on the maximum implicit width of the delegates. */ property Component weekNumberDelegate: Rectangle { + implicitWidth: 30 Label { text: styleData.weekNumber anchors.centerIn: parent @@ -403,19 +406,17 @@ Style { height: viewContainer.height anchors.top: topGridLine.bottom - Item { + Column { id: weekNumbersItem visible: control.weekNumbersVisible - width: 30 height: viewContainer.height + spacing: gridVisible ? __gridLineWidth : 0 Repeater { id: weekNumberRepeater model: panelItem.weeksToShow Loader { id: weekNumberDelegateLoader - y: __cellRectAt(index * panelItem.columns).y - width: weekNumbersItem.width height: __cellRectAt(index * panelItem.columns).height sourceComponent: weekNumberDelegate @@ -439,23 +440,23 @@ Style { } } } - Rectangle { - anchors.topMargin: - dayOfWeekHeaderRow.height - 1 - anchors.top: parent.top - anchors.bottom: parent.bottom - - width: __gridLineWidth - anchors.rightMargin: -__gridLineWidth - anchors.right: parent.right - color: gridColor - } + } + Rectangle { + id: separator + anchors.topMargin: - dayOfWeekHeaderRow.height - 1 + anchors.top: weekNumbersItem.top + anchors.bottom: weekNumbersItem.bottom + + width: __gridLineWidth + color: gridColor + visible: control.weekNumbersVisible } // Contains the grid lines and the grid itself. Item { id: viewContainer - width: container.width - (control.weekNumbersVisible ? weekNumbersItem.width : 0) + width: container.width - (control.weekNumbersVisible ? weekNumbersItem.width + separator.width : 0) height: container.height - navigationBarLoader.height - dayOfWeekHeaderRow.height - topGridLine.height Repeater { |