diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-01-05 14:49:49 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-01-10 14:09:35 +0000 |
commit | 24acfcafdf66f9ade03d0f98520a5d6c02bb2a1c (patch) | |
tree | 10b13f4b833d2c56988b279ad71c5419000c7e8f /src/imports/controls/material | |
parent | 463e46245543540652168861b3d6c65980fb7b05 (diff) |
QQuickTabBar: fix implicit size calculation
Before, the implicit size of TabBar was calculated based on the content
size of the ListView that TabBar uses internally. The problem was that
ListView calculates the content size based on the explicit size of the
items. There was a circular dependency, because TabBar resized the tabs
to the size of the view. To avoid the circular dependency, TabBar now
calculates the content size based on the total implicit size of the
tabs. As before, explicit size is respected for tabs that have it set.
[ChangeLog][Controls][TabBar] Added contentWidth and contentHeight
properties that are automatically calculated based on the total size
of the tab items, but can be manually overridden if desired. This fixes
an issue that TabBar was not able to reliably calculate an implicit
size, and could in certain scenarios enter an infinite loop due to a
circular dependency between the items' sizes and the tabbar's size.
Task-number: QTBUG-57858
Change-Id: Ie303cbc54247e87b0affc6bf32c7bf99acea4571
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/material')
-rw-r--r-- | src/imports/controls/material/TabBar.qml | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/imports/controls/material/TabBar.qml b/src/imports/controls/material/TabBar.qml index 39660c92..3d1e2d82 100644 --- a/src/imports/controls/material/TabBar.qml +++ b/src/imports/controls/material/TabBar.qml @@ -43,16 +43,14 @@ T.TabBar { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - contentItem.implicitWidth + leftPadding + rightPadding) + contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - contentItem.implicitHeight + topPadding + bottomPadding) + contentHeight + topPadding + bottomPadding) spacing: 1 + contentHeight: 48 contentItem: ListView { - implicitWidth: contentWidth - implicitHeight: 48 - model: control.contentModel currentIndex: control.currentIndex |