VS 2017 Error C2665 'qHash': none of the 30 overloads could convert all the argument types

1k Views Asked by At

I use QHash for a small program.

CompleterData.h

#include <QMap>
#include <QList>
#include <QHash>
#include <QPair>
#include <QVariant>

class CompleterData
{

public:
  enum class Type
  {
     Header,       
     SecondHeader, 
     Data,         
     LastUsed      
  };

  CompleterData() = default;

  QHash < CompleterData::Type, QList<QPair<QString, QVariant>>> data();
  void setData( QHash < CompleterData::Type, QList<QPair<QString, QVariant>>> &p_data );
  void addData( CompleterData::Type &p_type,  QList<QPair<QString, QVariant>> &p_rowData );

private:
  QHash <CompleterData::Type, QList<QPair<QString, QVariant>>> m_data;
};

CompleterData.cpp

QHash < CompleterData::Type, QList<QPair<QString, QVariant>>> CompleterData::data()
{
  return m_data;
}

void CompleterData::addData( CompleterData::Type &p_type,  QList<QPair<QString, QVariant>> &p_rowData )
{
  m_data.insert( p_type, p_rowData );
}

void CompleterData::setData( QHash < CompleterData::Type, QList<QPair<QString, QVariant>>> &p_data )
{
  m_data = p_data;
}

I get this error by compiling enter image description here

Where do I have error in this case. I know this kind of error is posted here so many times, but each case has it own reason and even for this simple case I still can not find the reason why? I use VS 2017.

0

There are 0 best solutions below