QMap always returning a const value

227 Views Asked by At

I have the following piece of code :

  • classA.h
class A : public QAbstractTableModel
{
    Q_OBJECT

    private:
        QMap <QString , QStringList> map_filelist_hash ;
};
  • classA.cpp
map_filelist_hash = { {"dummy"},{"dummylist"}};                 
QStringList& temp (map_filelist_hash["dummy"]);

I get the following error when trying to compile using gcc7.2.0

error: cannot bind non-const lvalue reference of type ‘QStringList&’ to an rvalue of type ‘const QStringList’

How do I get QMap to return a reference of the QStringList inside the QMap?

0

There are 0 best solutions below