Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmacomponents3/TextField.qml
Show All 12 Lines | |||||
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 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.6 | 20 | import QtQuick 2.6 | ||
21 | import QtQuick.Window 2.2 | ||||
21 | import QtQuick.Controls @QQC2_VERSION@ | 22 | import QtQuick.Controls @QQC2_VERSION@ | ||
22 | import QtQuick.Templates @QQC2_VERSION@ as T | 23 | import QtQuick.Templates @QQC2_VERSION@ as T | ||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import "private" as Private | 25 | import "private" as Private | ||
25 | 26 | | |||
26 | 27 | | |||
27 | T.TextField { | 28 | T.TextField { | ||
28 | id: control | 29 | id: control | ||
29 | 30 | | |||
30 | implicitWidth: Math.max(units.gridUnit * 8, | 31 | implicitWidth: Math.max(units.gridUnit * 8, | ||
31 | placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) | 32 | placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) | ||
32 | || contentWidth + leftPadding + rightPadding | 33 | || contentWidth + leftPadding + rightPadding | ||
33 | implicitHeight: units.gridUnit * 1.6 | 34 | implicitHeight: units.gridUnit * 1.6 | ||
34 | 35 | | |||
35 | padding: 6 | 36 | padding: 6 | ||
36 | 37 | | |||
37 | color: theme.viewTextColor | 38 | color: theme.viewTextColor | ||
38 | selectionColor: theme.highlightColor | 39 | selectionColor: theme.highlightColor | ||
39 | selectedTextColor: theme.highlightedTextColor | 40 | selectedTextColor: theme.highlightedTextColor | ||
40 | verticalAlignment: TextInput.AlignVCenter | 41 | verticalAlignment: TextInput.AlignVCenter | ||
41 | opacity: control.enabled ? 1 : 0.6 | 42 | opacity: control.enabled ? 1 : 0.6 | ||
42 | renderType: Text.NativeRendering | 43 | | ||
44 | // Work around Qt bug where NativeRendering breaks for non-integer scale factors | ||||
45 | // https://bugreports.qt.io/browse/QTBUG-67007 | ||||
46 | renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering | ||||
43 | 47 | | |||
44 | Label { | 48 | Label { | ||
45 | id: placeholder | 49 | id: placeholder | ||
46 | x: control.leftPadding | 50 | x: control.leftPadding | ||
47 | y: control.topPadding | 51 | y: control.topPadding | ||
48 | width: control.width - (control.leftPadding + control.rightPadding) | 52 | width: control.width - (control.leftPadding + control.rightPadding) | ||
49 | height: control.height - (control.topPadding + control.bottomPadding) | 53 | height: control.height - (control.topPadding + control.bottomPadding) | ||
50 | 54 | | |||
Show All 23 Lines |