<br><br><div><span class="gmail_quote">On 10/29/07, <b class="gmail_sendername">Aaron J. Seigo</b> <<a href="mailto:aseigo@kde.org">aseigo@kde.org</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sunday 28 October 2007, Thomas Braxton wrote:<br>> did you also get QSizeF and QPointF? it seems those got lost as well :(<br><br>heh.. you commited QPointF just before i did (i noticed it was missing only<br>afterwords) ..
<br><br>on that note... for people who have custom data types and wish to store them<br>in a kconfig, do they have to pre-serialize into a QByteArray and the<br>deserialize on their own? (idle curiosity speaks =)</blockquote>
<div><br class="webkit-block-placeholder"></div><div>pretty much. the easiest way would be to write custom versions of readEntry/writeEntry that take care of that for them, then they can just use it like any other type. </div>
something like...</div><div><br class="webkit-block-placeholder"></div><div>template<></div><div>QPointF KConfigGroup::readEntry(const QByteArray& key, const QPointF& defaultValue) const</div><div>{</div><div>
const QByteArray data = readEntry(key, QByteArray());</div><div><br class="webkit-block-placeholder"></div><div> if (data.isNull())</div><div> return defaultValue;</div><div><br class="webkit-block-placeholder">
</div><div> if (data.isEmpty())</div><div> return QPointF();</div><div><br class="webkit-block-placeholder"></div><div> const QList<QByteArray> list = data.split(',');</div><div> return QPointF(
list.at(0).toDouble(), list.at(1).toDouble());</div><div>}</div><div><br class="webkit-block-placeholder"></div><div>template<></div><div>void KConfigGroup::writeEntry(const QByteArray& key, const QPointF& value, KConfigBase::WriteConfigFlags flags)
</div><div>{</div><div> QByteArray data="";</div><div><br class="webkit-block-placeholder"></div><div> if (!value.isNull())</div><div> data += QByteArray::number(value.x()) + ',' + QByteArray::number(
value.y());</div><div> writeEntry(key, data, flags);</div><div>}</div><div><br class="webkit-block-placeholder"></div><div>one of these days I need to finish the API docs ;)</div><div><br> </div>