themolecule
13th September 2007, 05:15
I am trying to do something like this:
QVariantMap payload;
QDir d = "/";
payload["children"] = d.entryInfoList();
but the compiler doesn't seem to have an 'operator=':
fileserverWindow.cpp:50: error: no match for 'operator=' in '(+ payload)->QMap<Key, T>::operator[] [with Key = QString, T = QVariant](((const QString&)(& QString(((const char*)"children"))))) = QDir::entryInfoList(QFlags<QDir::Filter>, QFlags<QDir::SortFlag>) const(QFlags<QDir::Filter>(NoFilter), QFlags<QDir::SortFlag>(NoSort))'
I know that qRegisterMetaType<QFileInfo>("QFileInfo"); goes in there somewhere, plus the Q_DECLARE_METATYPE ( QFileInfo ) but I can't seem to figure out where... no combination works. I think Q_DECLARE_METATYPE ( QFileInfo ) goes at the top, and qRegisterMetaType goes in the function, before the assignment.
How do I assign QFileInfoList to a QVariant?
QVariantMap payload;
QDir d = "/";
payload["children"] = d.entryInfoList();
but the compiler doesn't seem to have an 'operator=':
fileserverWindow.cpp:50: error: no match for 'operator=' in '(+ payload)->QMap<Key, T>::operator[] [with Key = QString, T = QVariant](((const QString&)(& QString(((const char*)"children"))))) = QDir::entryInfoList(QFlags<QDir::Filter>, QFlags<QDir::SortFlag>) const(QFlags<QDir::Filter>(NoFilter), QFlags<QDir::SortFlag>(NoSort))'
I know that qRegisterMetaType<QFileInfo>("QFileInfo"); goes in there somewhere, plus the Q_DECLARE_METATYPE ( QFileInfo ) but I can't seem to figure out where... no combination works. I think Q_DECLARE_METATYPE ( QFileInfo ) goes at the top, and qRegisterMetaType goes in the function, before the assignment.
How do I assign QFileInfoList to a QVariant?