If I add inputMethodHints: Qt.ImhDigitsOnly in a TextField{}, the numeric key pad opens. But the sign key +/- does not change the sign of the number. It only adds a ‘+’ at the current cursor position or ‘-’ with a double click.
Is this a bug, a feature request, or is there something like EnterKey.onClicked that could be used?
Using onTextChanged for changing the sign of the number does not sound optimal.
Well, i don’t think that’s its intended use, so i can’t imagine there being special handling for it ready to be hooked in. I don’t understand what you mean with suggesting current behavior could be a bug… So, some hack, like what you describe, is probably the only way.
I guess the problem is different semantics of the key(s) used in a numeric keypad: in a traditional calculator keypad, there must be separate keys for addition, subtraction, and “toggle sign of current numeric value”.
But the numeric keyboard in general is not necessarily a “calculator input” keyboard like that.