Use lineedit svg margins in sizeHint calculation
QQC button heights are max(backgroundHeight, label + margins). QQC lineedits are only from the background We need to take the margins into consideration when deciding how high the textbox should be otherwise we're effectively just ignoring what the SVG says. This means button and textbox on the login screen are now the same height. REVIEW: 125240
This commit is contained in:
parent
4b4461d76b
commit
7453beb9ce
@ -42,7 +42,13 @@ QtQuickControlStyle.TextFieldStyle {
|
|||||||
renderType: control.echoMode == TextInput.Normal ? Text.NativeRendering : Text.QtRendering
|
renderType: control.echoMode == TextInput.Normal ? Text.NativeRendering : Text.QtRendering
|
||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
implicitHeight: theme.mSize(theme.defaultFont).height * 1.6
|
//QQC button heights are max(backgroundHeight, label + margins).
|
||||||
|
//QQC lineedits are only from the background (and if background is not set, just an arbirtary value of 25)
|
||||||
|
//Why? I don't know
|
||||||
|
|
||||||
|
//In order to get the same height in both buttons and lineedits we need to apply the same rule here
|
||||||
|
|
||||||
|
implicitHeight: Math.max(theme.mSize(theme.defaultFont).height * 1.6, theme.mSize(theme.defaultFont).height + base.margins.top + base.margins.bottom)
|
||||||
implicitWidth: theme.mSize(theme.defaultFont).width * 12
|
implicitWidth: theme.mSize(theme.defaultFont).width * 12
|
||||||
|
|
||||||
Private.TextFieldFocus {
|
Private.TextFieldFocus {
|
||||||
@ -53,8 +59,6 @@ QtQuickControlStyle.TextFieldStyle {
|
|||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: base
|
id: base
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
// TODO: see what is the correct policy for margins
|
|
||||||
//anchors.fill: parent
|
|
||||||
imagePath: "widgets/lineedit"
|
imagePath: "widgets/lineedit"
|
||||||
prefix: "base"
|
prefix: "base"
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import QtQuick 2.0
|
|||||||
|
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.2
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
@ -93,6 +94,19 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: "button and textfield should have the same height"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
PlasmaComponents.Button {
|
||||||
|
text: "test"
|
||||||
|
}
|
||||||
|
PlasmaComponents.TextField {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user