[Bug 161012] New: KRestrictedLine does not work (patch included)
Tomas Mecir
mecirt at gmail.com
Sat Apr 19 15:09:37 CEST 2008
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=161012
Summary: KRestrictedLine does not work (patch included)
Product: kdelibs
Version: unspecified
Platform: Compiled Sources
OS/Version: Linux
Status: NEW
Severity: normal
Priority: NOR
Component: general
AssignedTo: kdelibs-bugs kde org
ReportedBy: mecirt gmail com
Version: (using Devel)
Installed from: Compiled sources
Compiler: gcc (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux)
OS: Linux
I tried to use KRestrictedLine in my application, only to find out that the current version of KRestrictedLine doesn't work at all - setting any set of valid characters has no effect, it's still possible to write anything into the input line.
The attached patch should fix this problem - partially at least, as it's still possible to copy/paste wrong characters.
I don't know if KRestrictedLine is meant to be deprecated or not, either way, I suppose I'm going to use KLineEdit with a validator instead.
The patch:
Index: kdeui/widgets/krestrictedline.cpp
===================================================================
--- kdeui/widgets/krestrictedline.cpp (revision 798773)
+++ kdeui/widgets/krestrictedline.cpp (working copy)
@ -49,7 +49,7 @
{
// let KLineEdit process "special" keys and return/enter
// so that we still can use the default key binding
- if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return || e->key() == Qt::Key_Delete || e->text().length() < 32)
+ if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return || e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace || (e->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::GroupSwitchModifier)))
{
KLineEdit::keyPressEvent(e);
return;
More information about the Kdelibs-bugs
mailing list