Button component width

Aleix Pol aleixpol at kde.org
Wed Oct 3 12:19:45 UTC 2012


Hi Plasma!
I've been trying to figure out why buttons had a weirdly big size by default, 
forcing me to set a random width that will be rarely appropriate when 
translating.

I decided to look into the code and that's what I found [1]. There I can see 
that we are getting the max between the size we want and 
theme.defaultFont.mSize.width*12 which looks totally random to me. Maybe we 
can just remove this part? Or at least leave it to 1 m so that it's never 0?

Cheers!
Aleix

[1]    implicitWidth: {
        if (label.paintedWidth == 0) {
            return height
        } else {
            //return Math.max(theme.defaultFont.mSize.width*12, 
label.paintedWidth)
            return Math.max(theme.defaultFont.mSize.width*12, icon.width + 
label.paintedWidth + surfaceNormal.margins.left + surfaceNormal.margins.right) 
+ ((icon.valid) ? surfaceNormal.margins.left : 0)
        }
    }


More information about the Plasma-devel mailing list