add keyboard, fix display of negative numbers
This commit is contained in:
parent
8550049335
commit
4734fe5a0e
@ -19,6 +19,7 @@ int main(int argc, char** argv)
|
||||
//fixed-width font for LCD
|
||||
QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
fixedFont.setStyleHint(QFont::TypeWriter);
|
||||
fixedFont.setPointSize(24);
|
||||
engine.rootContext()->setContextProperty("_fixedFont", fixedFont);
|
||||
|
||||
//handle quit
|
||||
|
@ -59,7 +59,7 @@ ApplicationWindow
|
||||
color: "gray"
|
||||
border { width: 1; color: "black" }
|
||||
Text {
|
||||
text: index
|
||||
text: {getText(parent.parent.objectName, index)}
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
@ -71,4 +71,16 @@ ApplicationWindow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getText(row, col) {
|
||||
var keys = [
|
||||
["Shift", "x<->y", "+/-", "C"],
|
||||
["7", "8", "9", "/"],
|
||||
["4", "5", "6", "*"],
|
||||
["1", "2", "3", "-"],
|
||||
["0", ".", "Enter", "+"]
|
||||
]
|
||||
|
||||
return keys[row][col]
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ static int is_valid_character(char letter){
|
||||
return 1;
|
||||
} else if(letter == CGRAM_EXP || letter == CGRAM_EXP_NEG){
|
||||
return 1;
|
||||
} else if(letter == '.' || letter == ' '){
|
||||
} else if(letter == '.' || letter == ' ' || letter == '-'){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user