Bug 489790

Summary: Inconsistent behavior of result display and base conversion
Product: [Applications] kcalc Reporter: Zakk <zakk>
Component: generalAssignee: Gabriel Barrantes <gabriel.barrantes.dev>
Status: CONFIRMED ---    
Severity: normal CC: aaronw, gabriel.barrantes.dev, marek.matej, trufanovan
Priority: NOR    
Version First Reported In: 24.05.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Zakk 2024-07-05 15:15:59 UTC
After a recent change it is nearly impossible to use kcalc as a general hex/dec/bin converter, as the input display is now inconsistent.

All of this is with the calculator in 'Numerical System Mode'.

Before: select a base via the radio button, input a number in the base and hit enter. It moves into the result area. Then you could select a new base and the result area would change to the representation of that number in the base. So if you started in Dec and entered '10' and then switched to Hex the result area would show 'A'

Now: you enter a number (in say, Dec 23) and hit equal. If you then switch to Hex, instead of the result converting to hex (17). It stays as 23 and the values under the radio buttons  shift to convert to 'Hex 23' to whatever base. So now the Dec radio button says 35.

This is really not useful; those numbers are shortened for large values (binary being the worst) and now if you enter a hex number and switch to Dec the result display goes blank because that's an invalid input. It was also helpful for the conversion to occur in the result window since you could benefit from digit grouping.
Comment 1 Zakk 2024-07-05 15:45:00 UTC
Hmm, I think this may be covered under 489660
I see there's a commit related to fix this, I will try it and see if this workflow is improved
Comment 2 Gabriel Barrantes 2024-07-06 23:22:49 UTC
(In reply to Zakk from comment #1)
> Hmm, I think this may be covered under 489660
> I see there's a commit related to fix this, I will try it and see if this
> workflow is improved

Is an unintended side effect... I think the best solution would be to do something as proposed in:

https://invent.kde.org/utilities/kcalc/-/merge_requests/21

to keep consistency with all modes... Those fields under the radio buttons are way too small to be useful anyway and now that they are actually doing what they were intended to do the flaw is now really notorious.
Comment 4 Gabriel Barrantes 2024-07-16 15:51:06 UTC
> This is really not useful; those numbers are shortened for large values
> (binary being the worst) and now if you enter a hex number and switch to Dec
> the result display goes blank because that's an invalid input. It was also
> helpful for the conversion to occur in the result window since you could
> benefit from digit grouping.

MR 120 helps with this but still is not a complete fix, numbers that require more than 32 bits are still elided.
Comment 5 Bug Janitor Service 2024-07-17 01:17:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/124
Comment 6 Gabriel Barrantes 2024-07-19 19:47:35 UTC
Git commit 2201b7b60d6df1021afa9da89cc5f99b2e0d6fd3 by Gabriel Barrantes.
Committed on 19/07/2024 at 19:40.
Pushed by gabrielbarrantes into branch 'master'.

Connect bit edit with new input display

M  +7    -2    kcalc.cpp
M  +1    -0    kcalc.h
M  +20   -1    kcalc_bitset.cpp
M  +3    -0    kcalc_bitset.h

https://invent.kde.org/utilities/kcalc/-/commit/2201b7b60d6df1021afa9da89cc5f99b2e0d6fd3
Comment 7 Marky 2025-01-13 17:20:33 UTC
I want to add my comment on recent kcalc behavior. The change that made `kcalc` virtually unusable is very well described by Zakk in the original post. I checked the https://bugs.kde.org/show_bug.cgi?id=489660 , as someone referenced but I think this issue has a better explanation how it should work (or not) , in regards the changing between the base systems.

I tried to mitigate the issue by creating keyboard shortcuts, but it was impossible to get the wanted behavior either. For maintainers to see how it should work it is best to look at how the previous version of the `kcalc` worked.
Comment 8 Alexander Trufanov 2025-05-09 11:35:41 UTC
I stil have this issue in Kubuntu 25.04 and KCalc 24.12.3.
Whoever did this change defenitely turned this app to a piece of useless soft.
The solution is:

   cd /tmp
   wget http://ftp.debian.org/debian/pool/main/k/kcalc/kcalc_22.12.3-1_amd64.deb
   sudo dpkg -i kcalc_22.12.3-1_amd64.deb 
   sudo apt-mark hold kcalc
Comment 9 Aaron Williams 2025-07-31 22:04:52 UTC
I must agree. I recently moved to KDE6, and I have to say, KCalc is almost useless for me. I do a lot of low-level software development where I need to work in decimal, hex, and binary, and the old KCalc was great for this. The new one is just horrid. I could live with the drop-down to change modes, but I much preferred the radio buttons. What is unforgivable is that the displayed numbers do not change as they should. If I put in 1024 in decimal and switch to hex, I expect the value to change to 0x400. This is fundamental functionality. Even worse, if I have, say, the value 0xFEDC and change it to decimal, the value just disappears. While it's fine to see the hex, octal, and binary values in real-time, I can't copy/paste them. I also would be happy to disable octal. In the 40+ years I've written software, I have never used octal. It's either hex, decimal, or sometimes binary (in Python).
Similarly, if nothing is displayed, I should be able to click on various bits and have the value changed. I'm dealing with 64-bit hardware registers constantly. I've also found that copy/paste is inconsistent. I wish I could go back to the KDE 5 calculator because the new number system mode is absolute garbage. I also miss setting the background color of the upper display section other than grey.