import QtQuick 2.4
import QtQuick.Layouts 1.1
import Ubuntu.Components 1.2
//Local Imports
//import "QML"
//javascript
import "Calcs.js" as Calc
MainView {
applicationName: "machinistsmate.dubstar04"
anchorToKeyboard: true
//anchors.fill: parent
//anchors.top: parent.top
width: units.gu(100)
height: units.gu(75)
Page {
title: i18n.tr("Machinists Mate")
ColumnLayout {
spacing: units.gu(1)
anchors { margins: units.gu(2); fill: parent}//; top: parent.top}
ListModel {
id: materialList
ListElement { name: "Steel"; description: "Description 1"; SMM: "30" }
ListElement { name: "Stainless Steel"; description: "Description 2"; SMM: "20" }
ListElement { name: "Aluminium"; description: "Description 3"; SMM: "75" }
ListElement { name: "Brass"; description: "Description 4"; SMM: "90" }
ListElement { name: "Cast Iron"; description: "Description 5"; SMM: "20" }
ListElement { name: "Bronze"; description: "Description 6"; SMM: "25" }
}
OptionSelector {
id: materialSelector
//Layout.fillHeight: true
Layout.fillWidth: true
text: i18n.tr("Material:")
expanded: false
model: materialList
delegate: selectorDelegate
onSelectedIndexChanged: Calc.calculateRPM()
}
Component {
id: selectorDelegate
OptionSelectorDelegate { text: name; subText: description; }
}
RowLayout {
spacing: units.gu(1)
width: parent.width
Label {
id: label
objectName: "Tool Diameter"
text: i18n.tr("Tool Diameter:")
}
TextField {
id: toolInput
Layout.fillWidth: true
placeholderText: i18n.tr("Tool Diameter (mm)")
hasClearButton: true
inputMethodHints : Qt.ImhDigitsOnly
onTextChanged: Calc.calculateRPM()
}
}
Label {
id: rpm
property string rpmresult: ""
Layout.fillHeight: true
Layout.fillWidth: true
text: i18n.tr("RPM:" + rpmresult)
fontSize: "x-large"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}