Style snapshots section

This commit is contained in:
David Rowe 2016-02-26 14:01:57 +13:00
parent d255ad3805
commit a25702535b
3 changed files with 27 additions and 24 deletions

View file

@ -19,12 +19,16 @@ TextField {
property int colorScheme: hifi.colorSchemes.light
property string label: ""
property real controlHeight: height + (textFieldLabel.visible ? textFieldLabel.height : 0)
placeholderText: textField.placeholderText
FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; }
font.family: firaSansSemiBold.name
font.pixelSize: hifi.fontSizes.textFieldInput
height: implicitHeight + 4 // Make surrounding box higher so that highlight is vertically centered.
placeholderText: textField.label // Instead of separate label (see below).
y: textFieldLabel.visible ? textFieldLabel.height : 0
style: TextFieldStyle {
textColor: textField.colorScheme == hifi.colorSchemes.light
@ -44,9 +48,8 @@ TextField {
padding.right: hifi.dimensions.textPadding
}
/*
// Separate label instead of placeholderText.
RalewaySemibold {
id: textFieldLabel
text: textField.label
size: hifi.fontSizes.inputLabel
color: hifi.colors.lightGrayText
@ -55,5 +58,4 @@ TextField {
anchors.bottomMargin: 4
visible: label != ""
}
*/
}

View file

@ -1,16 +1,24 @@
//
// BrowsablePreference.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.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../dialogs"
import "../../controls-uit"
Preference {
id: root
property alias buttonText: button.text
property alias text: dataTextField.text
property alias placeholderText: dataTextField.placeholderText
property real spacing: 8
height: labelText.height + Math.max(dataTextField.height, button.height) + spacing
property real spacing: 0
height: Math.max(dataTextField.controlHeight, button.height) + spacing
Component.onCompleted: {
dataTextField.text = preference.value;
@ -21,24 +29,19 @@ Preference {
preference.save();
}
Text {
id: labelText
color: enabled ? "black" : "gray"
text: root.label
}
TextField {
id: dataTextField
placeholderText: root.placeholderText
text: preference.value
style: TextFieldStyle { renderType: Text.QtRendering }
anchors {
top: labelText.bottom
left: parent.left
right: button.left
topMargin: root.spacing
rightMargin: root.spacing
rightMargin: hifi.dimensions.contentSpacing.x
bottomMargin: spacing
}
label: root.label
placeholderText: root.placeholderText
colorScheme: hifi.colorSchemes.dark
}
Component {
@ -57,6 +60,5 @@ Preference {
dataTextField.text = fileDialogHelper.urlToPath(fileUrl);
});
}
}
}

View file

@ -167,8 +167,7 @@ Window {
anchors.right: parent.right
focus: true
colorScheme: hifi.colorSchemes.dark
//placeholderText: "filter"
label: "Filter"
placeholderText: "filter"
onTextChanged: scriptsModel.filterRegExp = new RegExp("^.*" + text + ".*$", "i")
Component.onCompleted: scriptsModel.filterRegExp = new RegExp("^.*$", "i")
}