From 90e9ab3a75fb86ad3a57cec7d867edb619a5d371 Mon Sep 17 00:00:00 2001 From: Ph0non Date: Tue, 22 Aug 2017 13:10:19 +0200 Subject: [PATCH] add color output for overestimation --- src/nvdb-v2.sqlite | Bin 36864 -> 36864 bytes src/qml/Overestimation.qml | 27 ++++++++++++++++++++------- src/qml/main.qml | 8 ++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/nvdb-v2.sqlite b/src/nvdb-v2.sqlite index 2d39facba1cd0e04223766630e7ce47306ba445e..e37a56320f587bf93d2d2485cf10733d131c1c2c 100644 GIT binary patch delta 109 zcmZozz|^pSX@WH4oQX2dtaBLj1b%N!S)|X`#l$4Xn8wJ;(8Zj>G=E}a8Dr(-&xR_D zOp_&yf|D=aJ2m4dNM@ K7#J3r!~g&xTp-E- delta 98 zcmZozz|^pSX@WH4%!xA2tTP$(SRFQ|EYjzj%)s2pbc!jP@e^YN!{mvL^_%A##WOON wPwqBQVPu%R!62A1b~2kGh^=jC$<$~vIRnh;HJrd$J6YZcB;jHdxyU320N>;tO#lD@ diff --git a/src/qml/Overestimation.qml b/src/qml/Overestimation.qml index 5e06710..d0eca5f 100644 --- a/src/qml/Overestimation.qml +++ b/src/qml/Overestimation.qml @@ -3,6 +3,7 @@ import QtQuick.Window 2.2 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.1 import org.julialang 1.0 +// import "lodash.js" as Lodash Window { width: 800 @@ -64,13 +65,15 @@ Window { onModelChanged: view_overestimate1.update_columns() -// itemDelegate: Text { -// anchors.verticalCenter: parent.verticalCenter -// color: -// get(styleData.row).role < 1 ? "red" : "green" -// text: styleData.value -// } - + itemDelegate: Text { + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: styleData.textAlignment + anchors.leftMargin: 12 + property variant value: styleData.value + text: (isInt(styleData.value)) ? styleData.value : styleData.value.toFixed(4) + color: (isInt(styleData.value)) ? "black" : (styleData.value < 1) ? "red" : "green" + } } Component @@ -102,6 +105,16 @@ Window { } onModelChanged: view_overestimate2.update_columns() + + itemDelegate: Text { + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: styleData.textAlignment + anchors.leftMargin: 12 + property variant value: styleData.value + text: (isInt(styleData.value)) ? styleData.value : styleData.value.toFixed(4) + color: (isInt(styleData.value)) ? "black" : (styleData.value < 1) ? "red" : "green" + } } Component diff --git a/src/qml/main.qml b/src/qml/main.qml index ad2c1df..e79068f 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -12,6 +12,14 @@ ApplicationWindow { title: qsTr("Nuklidvektor berechnen") id: mainWindow + function isInt(value) { + if (isNaN(value)) { + return false; + } + var x = parseFloat(value); + return (x | 0) === x; + } + function itemIndex(item) { if (item.parent === null) return -1