Disclaimer: I am not an investment advisor. When I describe my own trading activities, it is not intended as advice or solicitation of any kind.

06 August 2015

Kubuntu 15.04 Repairs: KCalc + Numeric Keypad

The version of KCalc that ships with Kubuntu 15.04 ignores the numeric keypad, which renders it pretty much unusable unless you like hunt-and-pecking for numbers across the top row of your keyboard, or clicking on the screen like an 80-year-old. This is caused by a bug in the Qt 5.4.1 core libraries that ship with Kubuntu 15.04.

KDE Bug #347459
KDE Bug #344638
Qt proposed patch

This bug was fixed in Qt 5.5.0, but of course Ubuntu won't repackage the newer Qt library until the next version comes out, which is months away. Until then, fuck you.

I'm sure there is a better way to accomplish this that won't cause trouble when I upgrade my Ubuntu revision-level, but I couldn't find it. And this definitely solved the problem. If you know of a better way, feel free to explain it in the comments.

Goal: install Qt 5.5 and make KCalc use it, but don't screw everything else up.

Step 1: Download and install Qt Creator 5.5.

You can do this is a non-root user. Go to the Qt website, and download Qt Creator. You can either step through their question and answer screens to assure them that you're not planning on breaking the LGPL, or simply use this link: Qt Creator Open Source Download Be sure to select the binary that is right for your version of Linux (32-bit or 64-bit). When you run the installer, go ahead and skip the Qt Account creation. This is more for developer users of Qt, which you are not. "Next" your way until it asks what components you want to install. You want these (yes I know my colors are wacky, deal with it):

Note that Tools/Qt Creator will also be selected and you can't unselect it. "Next" along and wait for the download to finish. Now you'll have a folder in your home directory, probably ~/Qt/, that contains the Qt 5.5 product set.

Step 2: Put the libraries somewhere accessible.

As root, copy the libs downloaded from Qt into /usr/local/lib/Qt5.5/. Assuming you stored it in ~/Qt/ during Step 1, the commands would be:

sudo mkdir -p /usr/local/lib/Qt5.5
cd ~/Qt/5.5/gcc_lib64/lib
sudo cp * /usr/local/lib/Qt5.5/

By putting them in /usr/local/lib, we're keeping them out of the upgrade path of apt-get and its brethren. This means you need to disconnect this hack once 15.10 comes out, but security updates shouldn't have any freak-outs in the interim.

Step 3: Have KCalc, and only KCalc, use the new libraries.

As root, edit /usr/share/applications/org.kde.kcalc.desktop. This is the system-wide launcher for KCalc, and is used as a base whenever the user customizes anything using the menu editor. Look for a line that says:
Replace that sucker with:
Exec=LD_LIBRARY_PATH=/usr/local/lib/Qt5.5 kcalc

This causes Linux to set the LD_LIBRARY_PATH variable to point to your Qt 5.5.0 libraries before any other shared-library pathing is done. This is a hack, but it's the best you have unless you want to start recompiling things.

If you have already modified KCalc (changed its icon, etc) in the menu editor, look for a file with the same name in ~/.local/share/applications/ and make the same changes to it as well. If you have multiple users on your system, do them a favor and run a quick find on the /home tree and update any custom files they have, too. Or chuckle when they can't use the keypad. Whatever suits your personality.

Step 4: Bask in the Numeric Glory.

Launch KCalc by clicking on it, and verify that you can use the numeric keypad. If not, leave me a question in the comments and I will either help you, mock you, or ignore you, I promise.


  1. Thanks for this, it works brilliantly! Do you know if it is possible to make the whole system use Qt5.5 safely? There are other important bugs corrected in this version of Qt, especially regarding the use of external monitor. Shame it won't be officially packaged for 15.04, according to this http://blog.qt.io/blog/2015/07/01/qt-5-5-released/ I had hope it would be!

    1. Based on some poking around in Launchpad, it looks like 15.10 will also be 5.4.x, which is nearly criminal, IMHO. And sorry, I don't know the proper way to get the whole system upgraded to Qt 5.5. I started by trying to do this, but pretty quickly ran into dependency problems with core KDE Framework stuff, and aborted my attempt.

    2. Agree with you on this, criminal! 15.10 must have qt5.5, there are some many crucial problems corrected in version (wish it'd be backported to 15.04 tbh)... I have tried to install Qt5.5 libraries and made changes to tell the system to use them instead of Qt5.4 (see http://www.linuxfromscratch.org/blfs/view/svn/x/qt5.html) but when I reboot, I have issues with the login screen and then with Kwin (no window decorator). Gauthier