[PlasmaComponents TextField] Don't bother loading icons for unused buttons

We kept loading the clear button and reveal password icons even when that option was
disabled and the buttons never visible.

REVIEW: 128753
This commit is contained in:
Kai Uwe Broulik 2016-08-25 22:59:46 +02:00
parent 81a314c7a9
commit 3f17e32a92

View File

@ -88,7 +88,7 @@ QtControls.TextField {
PlasmaCore.IconItem {
id: showPasswordButton
source: textField.echoMode === TextInput.Normal ? "hint" : "visibility"
source: revealPasswordButtonShown ? (textField.echoMode === TextInput.Normal ? "hint" : "visibility") : ""
height: Math.max(textField.height * 0.8, units.iconSizes.small)
width: height
opacity: (textField.length > 0 && revealPasswordButtonShown && textField.enabled) ? 1 : 0
@ -111,7 +111,7 @@ QtControls.TextField {
PlasmaCore.IconItem {
id: clearButton
//ltr confusingly refers to the direction of the arrow in the icon, not the text direction which it should be used in
source: LayoutMirroring.enabled ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl"
source: clearButtonShown ? (LayoutMirroring.enabled ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl") : ""
height: Math.max(textField.height * 0.8, units.iconSizes.small)
width: height
opacity: (textField.length > 0 && clearButtonShown && textField.enabled) ? 1 : 0