Warning, /plasma/plasma-workspace/kcms/nightcolor/ui/NumberField.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.1 0008 import QtQuick.Controls 2.5 as QQC2 0009 0010 QQC2.TextField { 0011 property double backend 0012 0013 maximumLength: 10 0014 horizontalAlignment: TextInput.AlignHCenter 0015 0016 inputMethodHints: Qt.ImhFormattedNumbersOnly 0017 0018 text: Math.round(backend * 100)/100; 0019 0020 onBackendChanged: { 0021 text = Math.round(backend * 100)/100; 0022 } 0023 0024 onTextChanged: { 0025 var textFloat = parseFloat(text); 0026 if (textFloat === undefined || isNaN(textFloat)) { 0027 return; 0028 } 0029 backend = textFloat; 0030 } 0031 0032 onFocusChanged: { 0033 var textFloat = parseFloat(text); 0034 if (!focus && (textFloat === undefined || isNaN(textFloat))) { 0035 text = backend; 0036 } 0037 } 0038 }