I have the same question.
I've tried QMap<int, QVariable> and QHash. But both .insert() and operator[] do not work. They all crashed at the QHash::operator[] -> QHash::detach
.
Just like this.
qDebug() << value << role;
m_map[role] = new QVariant(value);
The value and role are both conrrect. But the m_map[]
always crashed at function detach.