I need a color editor

This commit is contained in:
samcake 2017-12-04 17:29:01 -08:00
parent 9fceaad38b
commit de410b6833
4 changed files with 115 additions and 5 deletions

View file

@ -132,8 +132,48 @@ public:
*/
Q_INVOKABLE bool clearSelectedItemsList(const QString& listName);
/**jsdoc
* Enable highlighting for the named selection.
* If the Selection doesn't exist, it will be created.
* All objects in the list will be displayed with the highlight effect as specified from the highlightStyle.
* The function can be called several times with different values in the style to modify it.
*
* @function Selection.enableListHighlight
* @param listName {string} name of the selection
* @param highlightStyle {jsObject} highlight style fields (see Selection.getListHighlightStyle for a detailed description of the highlightStyle).
* @returns {bool} true if the selection was successfully enabled for highlight.
*/
Q_INVOKABLE bool enableListHighlight(const QString& listName, const QVariantMap& highlightStyle);
/**jsdoc
* Disable highlighting for the named selection.
* If the Selection doesn't exist or wasn't enabled for highliting then nothing happens simply returning false.
*
* @function Selection.disableListHighlight
* @param listName {string} name of the selection
* @returns {bool} true if the selection was successfully disabled for highlight, false otherwise.
*/
Q_INVOKABLE bool disableListHighlight(const QString& listName);
/**jsdoc
* Query the highlight style values for the named selection.
* If the Selection doesn't exist or hasn't been highlight enabled yet, it will return an empty object.
* Otherwise, the jsObject describes the highlight style properties:
* - outlineUnoccludedColor: {xColor} Color of the specified highlight region
* - outlineOccludedColor: {xColor} "
* - fillUnoccludedColor: {xColor} "
* - fillOccludedColor: {xColor} "
*
* - outlineUnoccludedOpacity: {float} Opacity value ranging from 0.0 (not visible) to 1.0 (fully opaque) for the specified highlight region
* - outlineOccludedOpacity: {float} "
* - fillUnoccludedOpacity: {float} "
* - fillOccludedOpacity: {float} "
*
* - outlineWidth: {float} width of the outline expressed in pixels
* - isOutlineSmooth: {bool} true to enable oultine smooth falloff
*
* @function Selection.getListHighlightStyle
* @param listName {string} name of the selection
* @returns {jsObject} highlight style as described above
*/
Q_INVOKABLE QVariantMap getListHighlightStyle(const QString& listName) const;
render::HighlightStyle getHighlightStyle(const QString& listName) const;

View file

@ -0,0 +1,59 @@
//
// XColor.qml
//
// Created by Sam Gateau 12/4/2017
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.7
import QtQuick.Controls 1.4 as Original
import QtQuick.Controls.Styles 1.4
import "qrc:///qml/styles-uit"
import "qrc:///qml/controls-uit" as HifiControls
Item {
HifiConstants { id: hifi }
id: root
anchors.left: parent.left
anchors.right: parent.right
height: 24
property var color
property alias label: labelControl.text
function getColor() {
return Qt.rgba(color.red / 255.0, color.green / 255.0, color.blue / 255.0, 1.0 );
}
Rectangle {
id: current
HifiConstants { id: hifi;}
color: root.getColor();
}
Component.onCompleted: {
// Binding favors qml value, so set it first
bindingControl.when = true;
}
HifiControls.Label {
id: labelControl
text: root.label
enabled: true
anchors.left: root.left
anchors.right: root.horizontalCenter
anchors.verticalCenter: root.verticalCenter
}
Binding {
id: bindingControl
target: root.color
property: root.property
when: false
}
}

View file

@ -1 +1,2 @@
PlotPerf 1.0 PlotPerf.qml
PlotPerf 1.0 PlotPerf.qml
XColor 1.0 XColor.qml

View file

@ -15,6 +15,7 @@ import QtQuick.Layouts 1.3
import "qrc:///qml/styles-uit"
import "qrc:///qml/controls-uit" as HifiControls
import "configSlider"
import "../lib/plotperf"
Rectangle {
id: root
@ -22,8 +23,8 @@ Rectangle {
color: hifi.colors.baseGray;
anchors.margins: hifi.dimensions.contentMargin.x
property var debugConfig: Render.getConfig("RenderMainView.HighlightDebug")
property var highlightConfig: Render.getConfig("UpdateScene.HighlightStageSetup")
//property var debugConfig: Render.getConfig("RenderMainView.HighlightDebug")
//property var highlightConfig: Render.getConfig("UpdateScene.HighlightStageSetup")
signal sendToScript(var message);
@ -60,9 +61,17 @@ Rectangle {
onCheckedChanged: {
sendToScript("add "+checked.toString())
}
}
}
}
Separator {}
XColor {
color: { "red": 0, "green": 255, "blue": 0}
}
Separator {}
/*
HifiControls.ComboBox {
id: box
width: 350
@ -112,7 +121,7 @@ Rectangle {
Column {
spacing: 10
anchors.left: parent.left
anchors.right: parent.right
anchors.right: parent.right
HifiControls.CheckBox {
text: "Smooth"
checked: root.highlightConfig["isOutlineSmooth"]
@ -173,5 +182,6 @@ Rectangle {
}
}
}
*/
}
}