Style basic text field

This commit is contained in:
David Rowe 2016-02-27 13:52:21 +13:00
parent 98eb94ecef
commit 1a331fcdac

View file

@ -1,11 +1,22 @@
//
// EditablePreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import "../../dialogs"
import "../../controls-uit"
Preference { Preference {
id: root id: root
property real spacing: 8 property real spacing: 8
height: labelText.height + dataTextField.height + spacing height: dataTextField.controlHeight + spacing
Component.onCompleted: { Component.onCompleted: {
dataTextField.text = preference.value; dataTextField.text = preference.value;
@ -16,22 +27,16 @@ Preference {
preference.save(); preference.save();
} }
Text {
id: labelText
color: enabled ? "black" : "gray"
text: root.label
}
TextField { TextField {
id: dataTextField id: dataTextField
placeholderText: preference.placeholderText placeholderText: preference.placeholderText
style: TextFieldStyle { renderType: Text.QtRendering } label: root.label
colorScheme: hifi.colorSchemes.dark
anchors { anchors {
top: labelText.bottom
left: parent.left left: parent.left
right: parent.right right: parent.right
topMargin: root.spacing bottomMargin: spacing
rightMargin: root.spacing
} }
} }
} }