Calculate implicitWith wide enough so that items don't have to ellide.

REVIEW: 105742
This commit is contained in:
Gregor Tätzner 2012-08-10 19:27:37 +02:00
parent c71f8f509f
commit f2eab7768b
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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))
}
}