[Kmymoney-devel] Chart on the home page

Alvaro Soliverez asoliverez at gmail.com
Fri Oct 23 13:43:16 CEST 2009


On Fri, Oct 23, 2009 at 8:15 AM, Thomas Baumgart <thb at net-bembel.de> wrote:

> On Friday 23 October 2009 12:56:30 Alvaro Soliverez wrote:
> > Hello all,
> > I just commited a big refactor of charts which I have been working on for
> > the past weeks.
> >
> > There is still a missing functionality, which is to show the charts on
> the
> > home page.
> >
> > Here is the relevant code, from khomeview.cpp
> >
> > QPixmap pm =
> QPixmap::grabWidget(chartWidget->coordinatePlane()->parent(),
> > QRect(QPoint(0, 0), QPoint(chartWidget->width(),
> chartWidget->height())));
> > QByteArray* ba;
> > QBuffer buffer( ba );
> > buffer.open( QIODevice::WriteOnly );
> > pm.save( &buffer, "PNG" ); // writes pixmap into ba in PNG format
> >
> > m_html += QString("<table width=\"100%\" cellspacing=\"0\"
> > cellpadding=\"2\" class=\"summarytable\" >");
> > m_html += QString("<tr>");
> > //m_html += QString("<td><center><IMG SRC=\"data:image/png;base64,%1\"
> > ALT=\"Networth\"></center></td>").arg(ba->toBase64().data());
> > m_html += QString("</tr>");
> > m_html += QString("</table></div></div>");
> >
> > As you can, the relevant line is commented out for the moment, because
> the
> > conversion from the buffer which has the QPixmax stored, to base64 to
> then
> > show it on the home page, causes a crash.
>
> Straight from the Qt docs:
>
>     QPixmap pixmap;
>     QByteArray bytes;
>     QBuffer buffer(&bytes);
>     buffer.open(QIODevice::WriteOnly);
>     pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format
>
> which is identical to Qt3 (so we have another bug to fix here in the KDE3
> version - I'll take care of it).
>
>
Great. I will try that as soon as I come back home.

Btw, the charts now have tooltips using a native method of KDChart, but they
are not fully identical to the ones in KDE3. I still have to add the
calculations for the percentage.
Also, there are some regressions, like when you have a lot of accounts, the
legend box goes crazy, and the khtml_part not hiding when it should. But
neither is a blocking bug, so we can move on and fix as we go.

Regards,
Alvaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kmymoney-devel/attachments/20091023/a14aea08/attachment.htm 


More information about the KMyMoney-devel mailing list