Akregator patch and treelist question

Andre Eisenbach int2str at gmail.com
Mon Feb 7 23:56:20 GMT 2005


Hello KDE team!

I've posted below patch to the Akregator-dev list, but it seems like
it's no longer active since Akregator moved into KDE(-pim?).

Asides from the patch, I'd like to ask a more general question:

Where does KListViewItem::painCell()'s "width" parameter come from? Is
there any method which can be overwritten to calculate the width?

The patch fixes a problem where a cell is too small when the font is
changed to bold. It seems like the width is calculated based on a
normal font. If I change the width (as done in the patch), the cell
draws fine, but the "focus rectangle" seems to be the original length
and doesn't adapt.

What can I do to resize the focus rectangle as well?

Thanks,
    Andre

--- akregator/src/treenodeitem.cpp      2004-11-26 04:35:45.000000000 -0800
+++ /var/tmp/portage/akregator-1.0_beta8/work/akregator-1.0_beta8/akregator/src/treenodeitem.cpp
       2005-02-04
20:55:07.000000000 -0800
@@ -110,12 +110,10 @@
     QString oldText = text(column);
     setText( column, " " );

-    // draw bg
-    KListViewItem::paintCell(p,cg,column,width,align);
-
     setText( column, oldText);

-    // draw fg
+    // determine complete text width
+
     QFont f = p->font();
     f.setWeight(QFont::Bold);
     p->setFont(f);
@@ -133,9 +131,16 @@
     QString txt = " (" + QString::number(u) + ")";
     int txtW=fm.width( txt );

-    if (fm.width( oldText ) + txtW + x > width)
-        oldText=KStringHandler::rPixelSqueeze(oldText,fm, width - txtW - x);
+//    if (fm.width( oldText ) + txtW + x > width)
+//        oldText=KStringHandler::rPixelSqueeze(oldText,fm, width - txtW - x);
+//
+//
+    width = fm.width( oldText ) + txtW + x + m;

+    // draw bg
+    KListViewItem::paintCell(p,cg,column,width,align);
+
+    // draw fg
     p->drawText( x, 0, width-m-x, height(), align | AlignVCenter,
oldText, -1, &br );

     if ( !isSelected() )




More information about the kde-core-devel mailing list