Search Results

Search found 2 results on 1 pages for 'qmapiterator'.

Page 1/1 | 1 

  • QMap inheritance with QMapIterator

    - by gregseth
    Hi, I made a personnal class which inherits QMap: class CfgMgr : public QMap<QString, CfgSet*> {...} I'm trying to iterate over all its elements like that: CfgMgr* m_pDefaults = new CfgMgr; // .../... QMapIterator<QString, CfgSet*> ics(*m_pDefaults); while (ics.hasNext()) { // doing my stuff } And I get the compile error: Can't convert parameter 1 from 'CfgMgr' to 'const QMap< Key,T &' with [ Key=QString, T=CfgSet * ] I tried with a dynamic_cast: QMapIterator<QString, CfgSet*> ics( *dynamic_cast< QMap<QString,CfgSet*>* >(m_pDefaults) ); it compiles, but always returns NULL. What's wrong? How can I solve this?

    Read the article

  • Data loss when converting from QString to QByteArray

    - by SleepyCod
    I'm using QPlainTextEdit as an HTML editor, saving the data through an HTTP post with QNetworkAccessManager. I experience data loss when using HTML special characters such as & (ampersand) I'm building a POST request with a QByteArray (as mentioned in the docs). QByteArray postData; QMapIterator<QString, QString> i(params); while(i.hasNext()) { i.next(); postData .append(i.key().toUtf8()) .append("=") .append(i.value().toUtf8()) .append("&"); } postData.remove(postData.length()-1, 1); //Do request QNetworkRequest postRequest = QNetworkRequest(res); oManager.post(postRequest, postData);

    Read the article

1