Skip to content

Commit

Permalink
add color output for overestimation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph0non committed Aug 22, 2017
1 parent 938821b commit 90e9ab3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
Binary file modified src/nvdb-v2.sqlite
Binary file not shown.
27 changes: 20 additions & 7 deletions src/qml/Overestimation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 90e9ab3

Please sign in to comment.