Is there any way to add & use a class in the QMap value?
I wanna use QMap<QString, Aclass> map;
in Qt. and when I want to set it's value in a function, some errors appear:
C:\Qt\Qt5.5.0\5.5\mingw492_32\include\QtCore\qglobal.h:1043: error: 'QWidget& QWidget::operator=(const QWidget&)' is private
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
^
ps: my container class is inherited from QWidget & is singleton.
#include "Aclass.h"
#include <QWidget>
class AmainClass : public QWidget
{
Q_OBJECT
public:
static AmainClass &getInstance();
void setApp(QString name, Aclass app);
private:
AmainClass(QWidget *parent = 0);
QMap<QString, Aclass> map;
};
and in .cpp:
void AmainClass::setApp(QString name, Aclass app)
{
map.insert(name, app);
}
edit: Aclass
is another class that is inherited from QWidget
.