Bug 344638

Summary: numeric keypad not working
Product: [Applications] kcalc Reporter: Harald Pollak <harald.pollak>
Component: generalAssignee: Evan Teran <eteran>
Status: RESOLVED UPSTREAM    
Severity: normal CC: a.wiekens, anakin.cs, bugs5.kde.org, chiporo, darose, ddrs, erbengi, fademind, h-trader, h.k.ghost, harald.pollak, jonathan.chiarella, josiah.barber, kdebugs, kimle.michal, luislezcair, maxi, oleg.dydyshko, pelardonable, proteus5, rdieter
Priority: NOR    
Version: 2.13   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Harald Pollak 2015-02-27 19:37:56 UTC
Input from standard keys ( keysym as written by xev: 0x31, 1 ) works fine, the number 1 is displayed in the display, but when i press the number 1 on my numerickey pad ( xev: 0ffb1, KP_1 ) nothing happens in the display.






Reproducible: Always

Steps to Reproduce:
after kcalc started
1. press 1 from standard keyboard
2. press 1 from numeric keypad

Actual Results:  
1. 1 is displayed correctly
2. nothing happens

Expected Results:  
1. 1 is displayed
2. 11 is displayed

It tried to make a quick and dirty test in the code ( inside void KCalculator::keyPressEvent(QKeyEvent *e) ):

I added: 

std::cout << "Key pressed: " << e->key() << std::endl;

if (e->key() == Qt::Key_1) {
            pb1->animateClick();
}

If I press std-key 1 no output on console ( it seems shortcut action as used is cauth before key-pressed event sent ).

After press key 1 from nummeric-keypad: pb1->enimateClick() is called ( no it's allso displayed correctly ) and on console: "Key pressed: 49" displayed.

Maybe its better to work with key-events than shortcuts ( so far i've seen only one shortcut is possible for each Button )
Comment 1 Harald Pollak 2015-02-28 07:34:20 UTC
I thinkthis is a Problem with the QT-Shortcuts: this work-arround works vor me:

in kcalc.cpp at the end of "void KCalculator::keyPressEvent(QKeyEvent *e)":

        switch (e->key()) {
        case Qt::Key_0:
            // 0 is available in all number systems, so the Button will never be deactivated
            pb0->animateClick();
            break;
        case Qt::Key_1:
            // 1 is available in all number systems, so the Button will never be deactivated
            pb1->animateClick();
            break;
        case Qt::Key_2:
            if(pb2->isEnabled())
                pb2->animateClick();
            break;
        case Qt::Key_3:
            if(pb3->isEnabled())
                pb3->animateClick();
            break;
        case Qt::Key_4:
            if(pb4->isEnabled())
                pb4->animateClick();
            break;
        case Qt::Key_5:
            if(pb5->isEnabled())
                pb5->animateClick();
            break;
        case Qt::Key_6:
            if(pb6->isEnabled())
                pb6->animateClick();
            break;
        case Qt::Key_7:
            if(pb7->isEnabled())
                pb7->animateClick();
            break;
        case Qt::Key_8:
            if(pb8->isEnabled())
                pb8->animateClick();
            break;
        case Qt::Key_9:
            if(pb9->isEnabled())
                pb9->animateClick();
            break;
        case Qt::Key_Enter:
            if(pbEqual->isEnabled())
                pbEqual->animateClick();
            break;
        case Qt::Key_Equal:
            if(pbEqual->isEnabled())
                pbEqual->animateClick();
            break;
        case Qt::Key_Plus:
            if(pbPlus->isEnabled())
                pbPlus->animateClick();
            break;
        case Qt::Key_Minus:
            if(pbMinus->isEnabled())
                pbMinus->animateClick();
            break;
        case Qt::Key_Comma:
            if(pbPeriod->isEnabled())
                pbPeriod->animateClick();
            break;
        case Qt::Key_Asterisk:
            if(pbMultiplication->isEnabled())
                pbMultiplication->animateClick();
            break;
        case Qt::Key_Slash:
            if(pbDivision->isEnabled())
                pbDivision->animateClick();
            break;
        default:
            break;
        }
Comment 2 Christoph Feck 2015-02-28 12:47:19 UTC
*** Bug 340846 has been marked as a duplicate of this bug. ***
Comment 3 fademind 2015-04-21 15:58:52 UTC
*** This bug has been confirmed by popular vote. ***
Comment 4 fademind 2015-04-21 16:01:59 UTC
Distro: Arch Linux x64
Package details:
kcalc 15.04.0-1
plasma-desktop 5.2.2-3
plasma-framework 5.9.0-1
plasma-workspace 5.2.2-2
Comment 5 Luis Lezcano Airaldi 2015-04-27 18:24:19 UTC
I'm also facing this issue. The problem is that KConfig (the library that manages keyboard shortcuts) is not reading Qt::Keypad_Modifier which is set when pressing keypad keys.

https://bugs.kde.org/show_bug.cgi?id=346806
Comment 6 Vojtěch Erben 2015-05-05 18:15:18 UTC
Same issue on Kubuntu 15.04 with KDE 5.3 (via kubuntu/backports ppa)
Comment 7 Christoph Feck 2015-05-06 18:50:53 UTC
*** Bug 347325 has been marked as a duplicate of this bug. ***
Comment 8 Christoph Feck 2015-05-06 19:15:06 UTC
This is a regression in Qt5.

See patch and link to bug at https://codereview.qt-project.org/#/c/95219/
Comment 9 Christoph Feck 2015-05-09 09:39:48 UTC
*** Bug 347459 has been marked as a duplicate of this bug. ***
Comment 10 Rex Dieter 2015-05-09 13:41:44 UTC
I can confirm the qt patch referenced in comment #8 seems to work as advertised.
Comment 11 Christoph Feck 2015-05-12 13:40:35 UTC
*** Bug 347609 has been marked as a duplicate of this bug. ***
Comment 12 Christoph Feck 2015-05-13 10:28:57 UTC
*** Bug 347648 has been marked as a duplicate of this bug. ***
Comment 13 Christoph Feck 2015-05-14 15:12:02 UTC
*** Bug 347713 has been marked as a duplicate of this bug. ***
Comment 14 Christoph Feck 2015-06-05 10:29:13 UTC
*** Bug 348695 has been marked as a duplicate of this bug. ***
Comment 15 proteus5 2015-06-05 17:42:54 UTC
So what's the solution of this bug?
Comment 16 Rex Dieter 2015-06-05 17:45:22 UTC
See comment #8
Comment 17 proteus5 2015-06-05 18:19:32 UTC
(In reply to Rex Dieter from comment #16)
> See comment #8

the explanation is a bit superficial, developer has to explain every single step to the common user.
Comment 18 Rex Dieter 2015-06-05 18:20:43 UTC
In short, it's a Qt5 bug/issue, and the link in comment #8 is a proposed fix (but not included in Qt5 sources yet, as of this moment)
Comment 19 proteus5 2015-06-05 18:29:35 UTC
(In reply to Rex Dieter from comment #18)
> In short, it's a Qt5 bug/issue, and the link in comment #8 is a proposed fix
> (but not included in Qt5 sources yet, as of this moment)

Ok thanks I'll wait for an update of kcalc itself which the bug will be fixed.
Comment 20 Rex Dieter 2015-06-05 18:32:32 UTC
It's not a kcalc bug, so no kcalc update will fix this, but rather, hopefully some future version of Qt5 will include a fix.

Feel free to bug/nag your distro into considering including the candidate Qt5 fix (fedora does, for example)
Comment 21 proteus5 2015-06-05 18:56:51 UTC
(In reply to Rex Dieter from comment #20)
> It's not a kcalc bug, so no kcalc update will fix this, but rather,
> hopefully some future version of Qt5 will include a fix.
> 
> Feel free to bug/nag your distro into considering including the candidate
> Qt5 fix (fedora does, for example)

Ok thanks... by the way is chromium  played by qtwebengine planned to be realized in the near future or some other KDE browser? 

note: which=when in the previous comment.
Comment 22 proteus5 2015-06-09 21:45:08 UTC
EDIT: NEWS... I've installed again KUBUNTU 15.04 Before installing it I've tested and kcalculator works by numlock activated it on the keyboard. NOw or the problems concern with keyboard controller I changed it enabling numlock boot activation, or problem concerns with PLASMA upgrade I made before using kcalculator.
Comment 23 Hermann 2015-07-13 09:54:21 UTC
I'm also suffering this bug now and I don't have Qt5 (it worked on openSUSE 13.2 all the time. Must be something with latest KDE updates...).

~  kde4-config --version
Qt: 4.8.6
KDE: 4.14.9
kde4-config: 1.0

I had kcalc v15.04.3-1.2 installed (from KDE:Applications repo)

i | kcalc             | Paket      | 15.04.3-1.2  | x86_64 | KDE:Applications

So I tried downgrading kcalc package to latest version from openSUSE 13.2 OSS Update repo

zypper install --oldpackage kcalc-14.12.3-16.1.x86_64

and with that version the numkeys are working again!
Comment 24 Christoph Feck 2015-07-28 10:30:41 UTC
Hermann, kcalc since version 15.04 uses Qt5, regardless of your Plasma desktop version.
Comment 25 real 2015-09-25 01:52:07 UTC
Please fix num-pad input.
Comment 26 Christoph Feck 2015-09-27 18:30:28 UTC
It is fixed in Qt (at least in the 5.6 branch, not sure if it was backported to Qt 5.5.x).