Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmastyle/TextFieldStyle.qml
Show All 11 Lines | |||||
12 | * GNU Library General Public License for more details | 12 | * GNU Library General Public License for more details | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.0 | 20 | import QtQuick 2.6 | ||
21 | import QtQuick.Window 2.2 | 21 | import QtQuick.Window 2.2 | ||
22 | import QtQuick.Controls 1.0 | 22 | import QtQuick.Controls 1.0 | ||
23 | import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle | 23 | import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle | ||
24 | import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate | 24 | import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate | ||
25 | 25 | | |||
26 | import org.kde.plasma.core 2.0 as PlasmaCore | 26 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
27 | import org.kde.plasma.components 2.0 as PlasmaComponents | 27 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
28 | 28 | | |||
Show All 23 Lines | 31 | QtQuickControlStyle.TextFieldStyle { | |||
52 | 52 | | |||
53 | background: Item { | 53 | background: Item { | ||
54 | //QQC button heights are max(backgroundHeight, label + margins). | 54 | //QQC button heights are max(backgroundHeight, label + margins). | ||
55 | //QQC lineedits are only from the background (and if background is not set, just an arbirtrary value of 25) | 55 | //QQC lineedits are only from the background (and if background is not set, just an arbirtrary value of 25) | ||
56 | //Why? I don't know | 56 | //Why? I don't know | ||
57 | 57 | | |||
58 | //In order to get the same height in both buttons and lineedits we need to apply the same rule here | 58 | //In order to get the same height in both buttons and lineedits we need to apply the same rule here | ||
59 | 59 | | |||
60 | implicitHeight: Math.max(control.cursorRectangle.height * 1.6, control.cursorRectangle.height + base.margins.top + base.margins.bottom) | 60 | implicitHeight: Math.max(metrics.height * 1.6, | ||
61 | metrics.height + base.margins.top + base.margins.bottom) | ||||
sitter: maybe add a linebreak between the two sides so it's easy to spot the metrics.height on both… | |||||
61 | implicitWidth: theme.mSize(theme.defaultFont).width * 12 | 62 | implicitWidth: theme.mSize(theme.defaultFont).width * 12 | ||
62 | opacity: control.enabled ? 1 : 0.6 | 63 | opacity: control.enabled ? 1 : 0.6 | ||
63 | 64 | | |||
65 | TextMetrics { | ||||
66 | id: metrics | ||||
67 | text: "M" | ||||
68 | font: control.font | ||||
69 | } | ||||
70 | | ||||
64 | Private.TextFieldFocus { | 71 | Private.TextFieldFocus { | ||
65 | id: hover | 72 | id: hover | ||
66 | state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "hidden") | 73 | state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "hidden") | ||
67 | anchors.fill: base | 74 | anchors.fill: base | ||
68 | } | 75 | } | ||
69 | PlasmaCore.FrameSvgItem { | 76 | PlasmaCore.FrameSvgItem { | ||
70 | id: base | 77 | id: base | ||
71 | anchors.fill: parent | 78 | anchors.fill: parent | ||
Show All 34 Lines |
maybe add a linebreak between the two sides so it's easy to spot the metrics.height on both sides of the max.