[Kmymoney-devel] Chart on the home page

Alvaro Soliverez asoliverez at gmail.com
Fri Oct 23 12:56:30 CEST 2009


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.

Now, I don't know if there is another way to do it. We have to show a widget
on an khtml_part, if possible, without using a temporary file, which would
be the usual in this case. There are too many security implications to have
a temporary file lying around with financial data.

So, does anyone have a clue how to do this? There were some changes from
KDE3 that prevent a straight port.

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


More information about the KMyMoney-devel mailing list