[KDirOperator] Don't squeeze Name column when there isn't enough horizontal space
ClosedPublic

Authored by ngraham on Dec 9 2018, 8:28 PM.

Details

Summary

When a KDirOperator view is used in Detailed or Detailed Tree view, when there isn't enough horizontal space, the Name column currently gets squeezed and becomes illegible.

This patch fixes that by making the name column fixed-width so it never gets too small to read the contents; instead the view sprouts a horizontal scrollbar, which is preferable.

BUG: 401506
FIXED-IN: 5.54

Test Plan

In Kate's Filesystem Browser plugin sidebar view:

In the open/save dialog when there's not enough horizontal space:

In the open/save dialog when there is enough horizontal space:

In this case, the other columns no longer stick to the right size of the view when the window is resized, which maybe isn't as nice as current behavior. Open to suggestions.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Dec 9 2018, 8:28 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 9 2018, 8:28 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
ngraham requested review of this revision.Dec 9 2018, 8:28 PM
ngraham edited the test plan for this revision. (Show Details)Dec 9 2018, 8:29 PM

A slightly nicer solution would appear to be to keep column 0 using QHeaderView::Stretch like it already is, but give only that column a minimum size equal to the longest item. That way the name column would dynamically expand as the view was enlarged which keeps the other columns aligned to the right side, but would not compress as the view shrinks. Unfortunately this doesn't appear to be easily possible: https://bugreports.qt.io/browse/QTBUG-1248

cullmann accepted this revision.Dec 9 2018, 9:54 PM
cullmann added a subscriber: cullmann.

I think the proposed change is already an improvement.

This revision is now accepted and ready to land.Dec 9 2018, 9:54 PM

Yeah, I do too. It's certainly more functional. Do you think I should just commit this now?

cfeck accepted this revision.Dec 10 2018, 1:43 AM
cfeck added a subscriber: cfeck.

See also bug 394115 (and I blamed Qt ...)

Cool, landing now. If I can get some assistance, I might try my hand at submitting a Qt patch to add the requested resize mode.

ngraham edited the summary of this revision. (Show Details)Dec 10 2018, 4:47 AM
This revision was automatically updated to reflect the committed changes.
apol added a subscriber: apol.Dec 13 2018, 2:06 PM

Hey, this change makes the file dialog crawl on big directories.
For me, going into /usr/include makes the whole application freeze.

We should consider reverting and trying a different approach.

In D17461#376509, @apol wrote:

Hey, this change makes the file dialog crawl on big directories.
For me, going into /usr/include makes the whole application freeze.

We should consider reverting and trying a different approach.

Weird, but can confirm. :/ I guess the minimum width calculation for the name column is a non-trivial operation.

abetts added a subscriber: abetts.Dec 13 2018, 3:13 PM

+1 for improving visuals

Actually I feel like this regressed the visuals for the file dialog itself in the name of improving the situation for apps that use this view in a sidebar.

Unfortunately, since it also regresses performance, I will be reverting it and and will look for another approach.

Reverted. Will find another way. Sorry for the regression, everyone!