Bug 403750 - cannot reorder columns in main window
Summary: cannot reorder columns in main window
Status: RESOLVED FIXED
Alias: None
Product: KBibTeX
Classification: Applications
Component: User interface (show other bugs)
Version: 0.8.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Thomas Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-30 00:26 UTC by Gandalf Lechner
Modified: 2020-02-11 07:39 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 0.11
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gandalf Lechner 2019-01-30 00:26:04 UTC
SUMMARY

It seems to be impossible to reorder the columns in the main list (such as year, author, title ... ) to the user's preferences. I think this was possible in an earlier kbibtex version, but not in any recent one. I have tested both in 0.8.1 and the latest git checkout (master) with the same result.
Comment 1 Thomas Fischer 2019-02-23 20:28:51 UTC
The list view component from Qt does not support out of the box to have "relative" widths, for example to allow the Title column to have 20% irrespective of the window's size.
KBibTeX tried to mimic the "relative-size" behavior by recalculating the columns' widths at any window resize event (or when columns where shown/hidden, manually resized, or rearranged). The code had known limitations and flaws, causing bugs like setting columns' width to 0 if anything went wrong or suddenly showing *all* possible columns. Despite several attempts to rewrite the code, it never worked sufficiently well.
Thus, the whole "relative-size" code got removed to have a stable and working but minimal-feature list view.
IMHO, this "relative-size" feature should be implemented in Qt directly (I guess it won't happen before Qt6) instead of attempting to do this in KBibTeX.
Maybe I'll open a feature request at Qt directly ...

The commit to remove the flawed relative-size feature is 841be480cc2230bfe7ba095.

> It seems to be impossible to reorder the columns in the main list (such as
> year, author, title ... ) to the user's preferences. I think this was
> possible in an earlier kbibtex version, but not in any recent one. I have
> tested both in 0.8.1 and the latest git checkout (master) with the same
> result.
Comment 2 Thomas Fischer 2019-12-29 22:50:02 UTC
Hello again,

> It seems to be impossible to reorder the columns in the main list (such as
> year, author, title ... ) to the user's preferences. I think this was
> possible in an earlier kbibtex version, but not in any recent one. I have
> tested both in 0.8.1 and the latest git checkout (master) with the same
> result.
I have reviewed this issue I came up with a hopefully more robust solution.
Please see the latest commits for bug 413367: https://commits.kde.org/clones/kbibtex/thomasfischer/kbibtex/9b560f2e9e697d138532d4de4ea1266cd69203a9
As part of the changes necessary to address bug 413367, I have implemented a solution where manual column resizing and reordering can be enabled via a checkbox in the context menu on the header of the main window's bibliography list. Please check and confirm if this fixes your problem.
Comment 3 Gandalf Lechner 2020-01-08 14:29:28 UTC
Many thanks for your continuing work on kbibtex in general and this bug/request in particular. It would be great to be able to reorder/resize columns to ones liking. 

As a non-coder, I have however problems to test this version. I suppose I somehow need to download some files and patch the code in order to check it, but am not familiar with doing this. I regularly do check out the master branch with an automated script, so once the edits end up there I can provide feedback.
Comment 4 Thomas Fischer 2020-01-18 22:12:42 UTC
> As a non-coder, I have however problems to test this version. I suppose I
> somehow need to download some files and patch the code in order to check it,
> but am not familiar with doing this. I regularly do check out the master
> branch with an automated script, so once the edits end up there I can
> provide feedback.

You can test this code without interfering with your default KBibTeX installation by following the "quick start" instructions:
https://userbase.kde.org/KBibTeX/Development#Quick_Start_to_Run_KBibTeX_from_Git

To test the Git version containing the fix for your bug, please run the following command:
bash run-kbibtex.sh https://anongit.kde.org/clones/kbibtex/thomasfischer/kbibtex.git bugs/kde413367
Comment 5 Thomas Fischer 2020-02-11 07:27:37 UTC
Git commit 82fc9f68da138e3caff37323e2f9685f388cfa36 by Thomas Fischer.
Committed on 10/02/2020 at 20:16.
Pushed by thomasfischer into branch 'master'.

Allow manual column resizing and moving

As reported in bug 413367, the ability to move and resize columns in the
main list view got removed in commit 841be480cc2230bfe7ba as the code
was considered error-prone.

This commit re-introduces the ability to move/resize columns. This
feature is disabled by default and must be first activated via the
context menu on the list view's header.
It is also possible to reset any moved or resized columns to the default
setting via another menu item in the same context menu.
Related: bug 413367
FIXED-IN: 0.11

M  +2    -0    ChangeLog
M  +35   -8    src/gui/file/basicfileview.cpp

https://commits.kde.org/kbibtex/82fc9f68da138e3caff37323e2f9685f388cfa36
Comment 6 Thomas Fischer 2020-02-11 07:39:31 UTC
Git commit 844428d41259820a73ab8a5e848e703870882874 by Thomas Fischer.
Committed on 10/02/2020 at 20:16.
Pushed by thomasfischer into branch 'master'.

(Re)storing columns' width and visual index

Storing and restoring columns' with and visual index if manual column
resizing/positioning is enabled in a BasicFileView.

This change included extending struct FieldDescription with two maps for
storing colums' widths and visual indices.
Default unless changed by user is automatic balancing of column widths
with fixed ordering (logical index == visual index).
Related: bug 413367

M  +182  -160  src/config/bibtexfields.cpp
M  +2    -0    src/config/bibtexfields.h
M  +104  -24   src/gui/file/basicfileview.cpp
M  +1    -1    src/gui/file/basicfileview.h

https://commits.kde.org/kbibtex/844428d41259820a73ab8a5e848e703870882874