[PyQt] QDoubleSpinBox and decimal separator

David Boddie dboddie at trolltech.com
Fri May 16 12:58:15 BST 2008


On Fri May 16 12:30:11 BST 2008, Aaron Digulla wrote:
> Quoting Henrik Pauli <henrik.pauli at gmail.com>:
> 
> >> In my locale, the decimal separator is ',' and not '.'. If I try to
> >> write a decimal separator in a QDoubleSpinBox via the '.' button in the
> >> numeric pad, the spinbox doesn't accept the value and I have to hit the
> >> ',' button under the 'k' key. This happens also in the QDoubleSpinBox
> >> example in the Qt (C++) Demo.
> > Does your numeric-dot key really emit a period, or does it emit a comma?
> 
> Hint: You can use "xev" on Linux to see what really happens when a key  
> is pressed.
> 
> On Windows, there should be a similar tool but I don't have a name handy.
> 
> As for a solution: Install a filter on the combo box and replace "."  
> with the decimal separator you get back from QLocale. That would allow  
> you to catch any other "dot" key anywhere else on the keyboard, too.

This discussion sounds familiar:

http://lists.trolltech.com/qt-interest/2007-11/thread00454-0.html

It may also be related to the problem described in this task, though the
problem is quite different:

http://trolltech.com/developer/task-tracker/index_html?id=177005&method=entry

It's almost certainly a Qt issue more than a PyQt issue, so Simone may want
to report it through the Task Tracker.

In the meantime, the event filter workaround might be worth doing - I'm sure
someone can post an example that shows how this is done.

David
-- 
David Boddie
Lead Technical Writer, Trolltech ASA


More information about the PyQt mailing list