Bug 141238

Summary: Album tree lacks horizontal scroll bar
Product: [Applications] digikam Reporter: Sebastian <sbtm3>
Component: Albums-TreeViewAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, marcel.wiesweg, mgarski
Priority: NOR Flags: caulier.gilles: Junior_Jobs+
Version: 0.9.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.0
Sentry Crash Report:
Attachments: failed attempt to solve the issue ...
Konqueror KDE3 folder view
tree collapsed again

Description Sebastian 2007-02-05 21:06:13 UTC
Version:           0.9.0 (using KDE 3.5.1 Level "a" , SUSE 10.1)
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.16.27-0.6-default

Observed behaviour: When expanding a tree of albums that is several layers deep (or has long album names), the names of the albums extend beyond the visible area of the pane. Seeing the full album names is only possible by increasing the size of the tree pane.

Expected behaviour: Tree pane should show a horizontal scroll bar (at least when album names are clipped.

How to reproduce: Set some directory with deep hierarchies as the album directory and start expanding.
Comment 1 Marcin Garski 2007-04-27 22:42:22 UTC
Steve Hill on Fedora bugzilla reported the same bug on 0.9.1 version.

https://bugzilla.redhat.com/238193
Comment 2 Arnd Baecker 2007-12-05 19:20:18 UTC
Created attachment 22365 [details]
failed attempt to solve the issue ...


The following summarizes an attempt discussed with Gilles on the IRC:

In digikam/folderview.cpp album tree view re-implements Qt class.
Trying to setVScrollBarMode(QScrollView::Always) 
and setHScrollBarMode(QScrollView::Always)
does not work: Then the problem is that the horizontal one appears, 
but one cannot scroll ...
The default is QScrollView::Auto, so it should work.
Gilles suspected that the content size of viewport is not 
properly defined and because of this the scroolbar do not appear:

"""AlbumFolderViewItem class does not set dimenssion somewhere and 
this class is a child of FolderItem and this one re-implemente 
paintCell() where the dimension must re-computed.
Qt doc : http://doc.trolltech.com/3.3/qlistviewitem.html#paintCell
"If you reimplement this function, you should also reimplement width()."
"""

The attached patch provides a reimplementation of width(), currently
just returning 600, for testing purposes.
This value should be large enough to trigger the automatic use of a 
horiztonal scroll-bar.

However, it does not work.

So that's currently the end of the story, ideas are welcome!
Comment 3 caulier.gilles 2007-12-05 19:29:10 UTC
Marcel,

Your viewpoint ???

Gilles
Comment 4 caulier.gilles 2008-12-05 09:18:12 UTC
Marcel, 

No idea about comment #2 from Arnd ?

Gilles
Comment 5 Andi Clemens 2008-12-05 10:54:48 UTC
I disabled paintCell and width() completely, still the scrollbars are not working. Maybe this is a totally different issue?
Comment 6 Andi Clemens 2008-12-05 11:09:54 UTC
The only thing that works here is to use setResizeMode(Q3ListView::NoColumn);

Then scrollbar will always be visible, but it is working. I think this is normal, looking at Eclipse right now it also shows the horizontal scrollbar all the time, even if the contents would fit in the frame.

Right now we use LastColumn, which will resize the columns to fit the width of the folderview. So turning of resizing the columns seems to be the only way.
Comment 7 Andi Clemens 2008-12-05 11:16:28 UTC
Another note: QListView (Qt4) will work better I guess, but we can only use it later on when switching to model-view concept.

Andi
Comment 8 caulier.gilles 2008-12-05 11:23:21 UTC
With QT4, we need to use QTreeWidget, not QListView... i think

Just my experience... to have already tried to port this code to Qt4, but without to re-define Model/View (I have used default class as well)

Gilles
Comment 9 Andi Clemens 2008-12-05 11:37:57 UTC
I just tested this with the ImagesList (QTreeWidget) widget from KIPI: the same issue. When I enter a big value into the EyeCounter column of RemoveRedEyes, the text gets truncated and you can not scroll, because ImagesList resizes its columns.

So this is just the normal behavior. We need to turn off resizing and it is working. Also Kmail will not show me horizontal scrollbars, because Kmail also resizes the columns.

I suggest to just remove all resizing code from the views and it is working.

Arnd,

actually your patch is working fine, if resizing is turned off, the column will be 600px wide. But you can not see the effect when resizing takes place.

Andi
Comment 10 Andi Clemens 2008-12-09 21:23:31 UTC
So what to do here? The only possible solution seems to be to display the horizontal scrollbar all the time...

Any other suggestions?

Andi
Comment 11 Andi Clemens 2009-01-03 21:56:11 UTC
Again: Should we just display the horizontal scrollbar all the time? Seems to be the only way.

Andi
Comment 12 Mikolaj Machowski 2009-01-03 23:17:08 UTC
If this is the only way to fix that bug... +1 for always showing of horizontal scrollbar.
Comment 13 Andi Clemens 2009-01-03 23:21:52 UTC
Looking at many apps I use daily (Eclipse:GTK, amarok1:Qt etc) they all have the hori scrollbar active all the time.
Maybe this is just a normal behavior?
Comment 14 caulier.gilles 2009-01-04 09:45:40 UTC
Andi,

No. it's not the normal behavior. Look konqueror folder view for example.

To have take a look indeep in folderview/folderitem code recently, i'm pretty sure that the problem is in itemRect() method. Investigations still in progress.

Gilles
Comment 15 Andi Clemens 2009-01-04 10:03:59 UTC
But konqueror folderview has more than one column, this is a totally different behavior. It uses columns that are not automatically resized, so when space is missing, folder names will be cut of and "..." is attached.

I have not seen one app that will automatically resize the column when expanding folder items and show the scrollbar if needed, since the column only knows its absolute size (the width containing all nested items).

So when adding heavily nested album trees, the column will be for example 1000px wide, always. To have auto scrollbars, you need to resize the column, which will result in a very big sidepanel that is not resizable by the user.

At least this is what happens here all the time when I try to implement something.

To sum it up: the konqueror folderview doesn't work the same way then the one in digiKam (at least in KDE3).

Andi
Comment 16 Andi Clemens 2009-01-04 10:18:26 UTC
(In reply to comment #15)
> So when adding heavily nested album trees, the column will be for example
> 1000px wide, always. To have auto scrollbars, you need to resize the column,
> which will result in a very big sidepanel that is not resizable by the user.

Now I'm confused by my own words :-)

What I meant was to get rid of the column cutoff (and the "..." chars),  we need to auto-resize the column (Q3ListView::AllColumns / LastColumn). This is all ok in our code.

If you resize the folderview (pull the slider to the left), the column itself will not get smaller (and the scrollbars should appear). This is the behavior we expect, but it seems to be that in this resizemode scrollbars are never shown.

I can see this effect in other apps with other toolkits like GTK, too.
Maybe I'm getting things wrong here, but for me it looks like this is the only way to do: display the hori scrollbar all the time.

Andi
Comment 17 caulier.gilles 2009-01-04 10:22:54 UTC
Created attachment 29881 [details]
Konqueror KDE3 folder view

Andi,

You is wrong here (:=))) Look my screenshot of Konqueror folder view from KDE3...

Gilles Caulier
Comment 18 Andi Clemens 2009-01-04 10:28:38 UTC
But if you collapse the folder structure, the scrollbar will still be visible (the more you expanded, the wider the scrollbar will be).
So it is displayed all the time actually.
Comment 19 Andi Clemens 2009-01-04 10:30:47 UTC
Created attachment 29882 [details]
tree collapsed again

scrollbar still showing (because the column size is resized now and not auto-resized to the current folder view width). This is the behavior I am talking about... :-)
Comment 20 Andi Clemens 2009-01-04 10:33:52 UTC
I have reproduced this behavior, the thing is that the scrollbar will be visible mostly all the time then (if you every expanded your tree and collapse it again).
When using autoresize like we do, no hori scrollbar is ever displayed, because the column size is applied to the current folderview size. So there is no need to display a scrollbar, because the column is not wider than the folderview.
Comment 21 Andi Clemens 2009-09-30 12:01:57 UTC
SVN commit 1029595 by aclemens:

I really think we should set the resizeMode for AlbumFolderView and
TagFolderView to NoColumn, otherwise the column is just re-sized to the width of
the folder view and items that are beyond the size are invisible.
Maybe the Qt4 version behaves better, but since we still use a Qt3Support class
here, there just doesn't seem to be a better solution.

I'd rather have a scrollbar visible all the time than not be able to see nested
albums :-)

CCBUG:141238

 M  +2 -3      albumfolderview.cpp  
 M  +2 -3      tagfolderview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1029595
Comment 22 Andi Clemens 2009-10-01 16:54:37 UTC
I will close this one for now, I guess the Qt4 port will solve the problem in a more elegant way.
Anyway the main problem should be solved now.

Andi
Comment 23 Andi Clemens 2009-11-02 23:30:53 UTC
SVN commit 1044060 by aclemens:

Fix (hopefully at last) the FolderViews.
Qt3 and Qt4 acts strange here, columns are either resized to the list view
width (this is stupid) or it maximizes the column, but doesn't grow the column
when the view is actually wider than the column.

We now calculate the column width our self, and it seems to finally work fine.
A too small view will show scrollbars, a wider view will switch to
LastColumn-ResizeMode.

To see the old "weird" behavior in Qt4, just fire up Kmail and resize the
folder view, the last column will stay where it is.
But this is necessary to have a scrollbar, because otherwise the column is
always resized.

I think this is a bug, because a normal QScrollArea acts not like that, but a
ListView somehow does.

CCBUG:141238

 M  +0 -1      albumfolderview.cpp  
 M  +29 -1     folderview.cpp  
 M  +0 -1      tagfolderview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1044060