![]() |
2010-06-14
, 15:51
|
Posts: 402 |
Thanked: 229 times |
Joined on Nov 2009
@ Missouri, USA
|
#2
|
![]() |
2010-06-15
, 07:17
|
Posts: 5 |
Thanked: 10 times |
Joined on Feb 2010
|
#3
|
![]() |
2010-06-15
, 15:49
|
Posts: 402 |
Thanked: 229 times |
Joined on Nov 2009
@ Missouri, USA
|
#4
|
class QMyWebView(QWebView) def keyEvent(self, event): QWebView.keyEvent(type, modifiers | Qt.AltModifier)
I tried with Qt::InputMethodHints. Disabling auto complete and auto uppercase on all input fields displayed inside QWebView works with setting the inputMethodHints property on QWebView.
But, if I try to set it to allow only digits (Qt::ImhDigitsOnly), it does not have any effect. (If it would have an effect, I could then switch from digits mode to other modes with JS focusin and focusout events calling the javascript injected object to change the hints, since inputMethodHints property on QWebView affects all input fields on the displayed page).
There was a suggestion on #maemo to set type="number" on the input field (this is a new HTML5 feature), but that does not help much. Qt 4.6 QWebView treats such input field like normal text field (looks like the number type is not implemented yet).
Another option to consider is manually converting the inserted characters to numbers (q - 1, w - 2, e - 3, etc.), but this is ugly and will cause problems because of localisation differences. One would then have to implement conversions for all possible keyboard layouts - this is insane.
Any suggestions or hints?