Bug 159239

Summary: KIntNumInput handles keyboard input incorrectly when suffixes are enabled
Product: [Frameworks and Libraries] kdelibs Reporter: albert <alberthilbert>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, sven.burmeister
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Quick patch that seems to fix the problem

Description albert 2008-03-13 13:49:15 UTC
Version:            (using KDE 4.0.2)
Installed from:    Ubuntu Packages
OS:                Linux

After you have inserted a new value for opacity, via keyboard, and pressed the "apply" button or the "return" key, the opacity value is reseted to zero. Editing this setting with arrows works properly.
Comment 1 Pino Toscano 2008-03-13 14:02:10 UTC
Nothing fancy in the way we use that standard KDE widget.
Comment 2 Pino Toscano 2008-03-13 14:49:34 UTC
The problem seems related to the usage of a suffix for the spinbox.
Commenting out its usage by the opacity spinbox in Okular makes it working normally.
Comment 3 Thomas McGuire 2008-03-13 16:49:35 UTC
KMail has the same problem, it uses "bytes" as suffix, and keyboard input does not work correctly.
Comment 4 Albert Astals Cid 2008-03-13 22:43:02 UTC
Basically KIntSpinBox::textFromValue and KIntSpinBox::valueFromText ignore the fact that the text can have a suffix so it does not work, using the QSpinBox variants is not possible there because we have the very useful base setting that probably noone uses but breaks the 99% used code :-/
Comment 5 Albert Astals Cid 2008-03-13 22:50:10 UTC
Created attachment 23888 [details]
Quick patch that seems to fix the problem

I was about to commit it, but i'd want some comments first
Comment 6 Albert Astals Cid 2008-03-13 22:58:54 UTC
SVN commit 785377 by aacid:

chop the suffix before doing the int conversion

BUG: 159239


 M  +3 -1      knuminput.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=785377