From f2eab7768b031fdf5e11cd1a53998b968f7c56d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20T=C3=A4tzner?= Date: Fri, 10 Aug 2012 19:27:37 +0200 Subject: [PATCH] Calculate implicitWith wide enough so that items don't have to ellide. REVIEW: 105742 --- declarativeimports/plasmacomponents/qml/TabBar.qml | 4 ++-- .../plasmacomponents/qml/private/TabBarLayout.qml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/declarativeimports/plasmacomponents/qml/TabBar.qml b/declarativeimports/plasmacomponents/qml/TabBar.qml index 493d15da4..a11a79564 100644 --- a/declarativeimports/plasmacomponents/qml/TabBar.qml +++ b/declarativeimports/plasmacomponents/qml/TabBar.qml @@ -76,8 +76,8 @@ FocusScope { //Plasma extension property Item currentTab - implicitWidth: tabBarLayout.implicitWidth + backgroundFrame.margins.left + backgroundFrame.margins.right + (buttonFrame.margins.left + buttonFrame.margins.right)*tabBarLayout.children.length - implicitHeight: tabBarLayout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom + buttonFrame.margins.top + buttonFrame.margins.bottom + implicitWidth: layout.implicitWidth + backgroundFrame.margins.left + backgroundFrame.margins.right + implicitHeight: layout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom PlasmaCore.FrameSvgItem { id: backgroundFrame diff --git a/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml b/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml index 2fd70e6bc..bd6141398 100644 --- a/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml +++ b/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml @@ -112,6 +112,7 @@ Item { var visibleChildCount = childCount var contentWidth = 0 var contentHeight = 0 + var maxChildWidth = 0 if (childCount != 0) { //not too much efficient but the loop over children needs to be done two times to get the proper child width for (var i = 0; i < childCount; ++i) { @@ -137,7 +138,8 @@ Item { child.height = root.height if (child.implicitWidth != undefined) { - contentWidth = Math.max(contentWidth + i*10, (child.implicitWidth + buttonFrame.margins.left*2 + buttonFrame.margins.right*2) * childCount) + maxChildWidth = Math.max(maxChildWidth, child.implicitWidth) + contentWidth = Math.max(contentWidth + i*10, (maxChildWidth + buttonFrame.margins.left + buttonFrame.margins.right) * childCount) contentHeight = Math.max(contentHeight, (child.implicitHeight + buttonFrame.margins.top + buttonFrame.margins.bottom)) } }