[patch] desktop grid #79932 (was: desktop icon text lines)

Luciano Montanaro mikelima at cirulla.net
Mon Nov 29 11:07:52 GMT 2004


El Domingo 28 Noviembre 2004 20:15, Martin Koller escribió:
> On Saturday 27 November 2004 15:50, Martin Koller wrote:
> > On Sunday 21 November 2004 21:03, David Faure wrote:
> > > Personally I'm for committing the "make it configurable" patch.
> >
> > I did that now, but have seen, that I have to also solve the general
> > problem with #79932
>
> <snip>
>
> Finally I have a solution:
>
> Attached you'll find a patch which solves
> http://bugs.kde.org/show_bug.cgi?id=79932
>
> The approach is based on what I described in my previous mail, but again
> here my idea:
>
> The user can already define the icon size he likes to have. He can also
> select the font he wants to have on the desktop. With my previous patch,
> he now also can select how many lines of text he wants to have.
> But what is missing, is the possibility to select how _wide_ the text can
> be. With this setting, we have all information to calculate a good fixed
> size grid.
>
> The width can be defined in kcontrol in the background/advanced dialog
> (same as the text lines)
>
> This is a better solution than simply define a fixed size for the grid,
> because with my approach you can simply play around with different icon
> sizes and font sizes, and you still get a good grid.
>
> Waiting on your feedback ...

I have done tests on this some time ago, in which I wanted to use the font 
size as an additional parameter to calculate the minimum width of the grid.
I think 'ex'es an 'em's are better choices to use in user interfaces.
Still, I think no configuration would be the better solution.
But nobody seem to agree on what is reasonable in this field, so...

In my experiment, I restrict gridX to be at least fontMetrics().height() * 7
which gives roughly the current spacing with normal/small fonts, and larger 
spacing for proportionately larger fonts.
I have not submitted the change because I have not found (yet) how to 
refresh the view on font-size changes. Without that, ugly artifacts appeear 
when adjusting font size from the control center.

Here is the relevant lines of my change, maybe they could be useful, after 
all.

@@ -776,6 +777,7 @@ int KonqIconViewWidget::gridXValue() con
     bool horizontal = (itemTextPos() == QIconView::Right);
     int newGridX = sz + (!m_bSetGridX ? d->gridXspacing : 50) + 
( horizontal ? 100 : 0);
     newGridX = QMAX( newGridX, (horizontal ? 2 : 1) * previewIconSize( sz ) 
+13 );
+    newGridX = QMAX( newGridX, fontMetrics().height() * 7 );
     //kdDebug(1203) << "gridXValue: " << newGridX << " sz=" << sz << endl;
     return newGridX;
 }



-- 
Luciano Montanaro 

Any sufficiently advanced technology is indistinguishable from a yo-yo
                                                            - Enoch Root




More information about the kde-core-devel mailing list