Bug 394467

Summary: Inconsistent column alignment in KSysGuard
Product: [Applications] ksysguard Reporter: Karl Ove Hufthammer <karl>
Component: ksysguardAssignee: KSysGuard Developers <ksysguard-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: bugseforuns, groot, kde, nate
Priority: NOR    
Version: 5.14.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.12.6
Attachments: Screenshot showing wrong alignment
ksysguard 5.14.2 on Arch Linux

Description Karl Ove Hufthammer 2018-05-20 11:34:07 UTC
Created attachment 112764 [details]
Screenshot showing wrong alignment

The column alignment in KSysGuard is inconsistent:

1. The column headers don’t all have the same alignment as column data. Many of them are centred (CPU %) or left-aligned (CPU time) even though the corresponding data are right-aligned.

2. The alignment of the column *data* is sometimes *centred* when it should be right-aligned (CPU %) or left-aligned (user name).

The customary rules for column alignment (not just for KDE software, for tables in general) are:

1. The headers should have *same* alignment as the data. If the data is right-aligned, the corresponding header should be right-aligned. Similar for left-aligned and centred data. See Dolphin for an example where this implemented.

2. Text columns should always be left-aligned (for LTR locales, since we read from the left to the right), while number(ish) columns should be right-aligned (since numbers ‘grow’ from the right to the left). So, for example, the CPU %, CPU time, memory usage and PID columns should be right-aligned while the Name and User Name columns should be left-aligned.

I’ll attach a screenshot showing the problem.
Comment 1 Karl Ove Hufthammer 2018-05-20 11:36:49 UTC
Just noticed a small error in my previous comment. In the first example, it’s the ‘PID’ (not the ‘CPU %’) header that’s centred even though the corresponding data is (correctly) right-aligned.
Comment 2 Kai Uwe Broulik 2018-05-22 08:11:39 UTC
Can confirm, the processor time column header is left-aligned for some reason. Doesn't seem to be related to translation.
Comment 3 Kai Uwe Broulik 2018-05-24 10:20:42 UTC
Git commit 7a580e83e1b2d21cd5deacb2cbba86130e1de669 by Kai Uwe Broulik.
Committed on 24/05/2018 at 10:20.
Pushed by broulik into branch 'Plasma/5.12'.

[ProcessModel] Center more column headings

Also horizontally center TTY, Relative Start Time, and CPU Time.
Those are typically narrow columns and so should be horizontally centered like the others.
FIXED-IN: 5.12.6

Differential Revision: https://phabricator.kde.org/D13031

M  +3    -0    processui/ProcessModel.cpp

https://commits.kde.org/libksysguard/7a580e83e1b2d21cd5deacb2cbba86130e1de669
Comment 4 Patrick Silva 2018-10-27 22:21:26 UTC
Created attachment 115929 [details]
ksysguard 5.14.2 on Arch Linux
Comment 5 Patrick Silva 2018-10-27 22:23:17 UTC
As we can see in my screenshot, the issue pointed here persists.
Comment 6 Nate Graham 2018-10-28 03:27:20 UTC
Looks like just the name column isn't centered, right?
Comment 7 Karl Ove Hufthammer 2018-10-28 09:58:45 UTC
(In reply to Nate Graham from comment #6)
> Looks like just the name column isn't centered, right?

No, the problem is that the headers don’t have the same alignment as the data. See https://phabricator.kde.org/D13098 for a fix of a similar (now fixed) problem in Lokalize. Note that one has to use `Qt::AlignRight | Qt::AlignAbsolute` instead of just `Qt::AlignRight` for things to work properly for RTL languages.
Comment 8 groot 2020-06-27 21:33:39 UTC
It's helpful to spell out the issues, possibly drawing big red arrows on screenshots, when dealing with visual bugs. Not everyone sees these things.

- PID header center data right
- Memory header center data right

I don't have a sufficiently working KSysGuard at the moment to check other columns, it would be useful Karl or Patrick if you write up a list.
Comment 9 Bug Janitor Service 2020-06-27 23:29:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libksysguard/-/merge_requests/34
Comment 10 Arjen Hiemstra 2020-07-01 13:16:52 UTC
Git commit bc59d3f6532aaf34d738444a566ab491dd4b5fbc by Arjen Hiemstra, on behalf of Adriaan de Groot.
Committed on 01/07/2020 at 13:16.
Pushed by ahiemstra into branch 'master'.

Align headers and data consistently

As the bug report says, data and columns should generally
have the same alignment. Move all the alignment calculation
to one spot and do it consistently.

M  +28   -41   processui/ProcessModel.cpp

https://invent.kde.org/plasma/libksysguard/commit/bc59d3f6532aaf34d738444a566ab491dd4b5fbc